Memory usage with nginx+gevent

In response to a query about how my memory usage changed, here's some info from my VPSs.

Note, that I've done a few tweaks to try to prevent Apache/mod_wsgi using lots of RAM, but as yet none for nginx+gevent.

Apache

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                               
28825 www-data  21   0  290m  67m 4824 S    0 13.1   0:02.52 wsgi              -k start             
 1046 www-data  19   0  208m  25m 4292 S    0  5.0   0:00.52 wsgi-debug        -k start             
  555 www-data  20   0  235m  22m 4204 S    0  4.3   0:00.37 wsgi              -k start             
 2792 www-data  24   0  381m 4384  920 S    0  0.8   0:06.37 /usr/sbin/apache2 -k start             
 2810 www-data  23   0  445m 3692  852 S    0  0.7   0:06.68 /usr/sbin/apache2 -k start

Nginx+gevent

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                               
32185 root      16   0 76696  27m 4208 S    0  2.7   0:06.98 site
24557 root      15   0  118m  25m 4688 S    0  2.5   8:47.73 site
18415 root      15   0 87048  25m 4420 S    0  2.4   0:02.55 site
15735 root      15   0  102m  23m 4388 S    0  2.3   0:00.87 site
25603 root      15   0  101m  21m 4364 S    0  2.1   0:00.28 site
18412 www-data  15   0 30940 2316  928 S    0  0.2   0:35.25 nginx: worker process

Explanation

Now, the Apache/mod_wsgi site is running a total of over 25 sites, split between a "main" group with 2 tasks, and a "debug" group with 1.

The nginx+gevent setup is running only 5 sites.

When the number of sites ramps up, Apache seems to be winning on the memory efficiency. However, the nginx+gevent approach gives me one light, fast front end server, and individually controllable, per-site daemons. Also, the VIRT size is well down, which may indicate some minor housekeeping overhead savings in OS page tables, etc.

I'll update these figures soon once I've confirmed all the nginx+gevent sites have been set to DEBUG=False and exercised.

comments powered by Disqus