tickets #101842
closed
mailman3 - nginx memory usage?
Added by pjessen about 3 years ago.
Updated 5 months ago.
Description
I was looking at 'uwsgi' being frequently killed by the oom killer, and I also happened notice that our 6-7 nginx processes take up about 800-900Mb, each.
I'm guessing this is due to mails.redirmap, with its 3million entries ?
I think this could be improved on by using a program redirmap, like on apache - a simple 'grep' for uri takes about 200ms.
- Private changed from Yes to No
if we redirect every access to the old archives, via a simple regex, to a script that just greps mails.redirmap ?
- Category set to Mailing lists
- Related to tickets #113111: lists.opensuse.org - webserver backand timeouts - nginx 504 gateway timeout added
I have spent a couple of days writing a small proxy daemon for rewriting those archive urls.
Pseudo-code:
read in rewritemap (/etc/nginc/mails.rewritemap)
hash every URL, then qsort.
while 1
read proxy requests from nginx
parse and hash url
do binary lookup
return 301 if found else 404
endwhile
This is currently running on mailman3, un-salted. The source code is in /home/pjessen/archive_rewriter
At runtime, it takes up about 300Mb which is less than 1/3 of what nginx uses today. Due to the binary search, I expect it will be also be significantly faster than nginx.
pjessen wrote:
Due to the binary search, I expect it will be also be significantly faster than nginx.
Judging by some rough elapse time measurements, it looks like it'll easily do 10'000 requests/second, single-threaded. That ought to be sufficient 😊
At runtime, it takes up about 300Mb which is less than 1/3 of what nginx uses today
After running for a few hours, the memory footprint shrinks to about 160-170Mb. It does of course depend on actual activity, but it's not bad.
- Assignee set to pjessen
- % Done changed from 0 to 50
after I fixed #102203, the memory situation on mailman3 has improved radically. Last night, one (1!) run-away gunicorn process was oom killed, but that was the first time in more than ten days. Currently, mailman3 has 8Gb free memory.
Tbh, I'm not sure if the huge nginx rewriting maps were a genuine problem, but at least nginx is looking a lot "slimmer" now.
Next step, saltifying ...
- Status changed from New to Resolved
Uwsi seems no longer used. Gunicorn out of memory situations have been worked around using systemd memory capping. Nginx seems to no longer be as loaded now with archrwr.
Also available in: Atom
PDF