35% response time improvement from switching to uWSGI/nginx
As part of refreshing the Reveal IT website, I have moved it from mod_wsgi running on Apache HTTPD to uWSGI running on nginx, mainly because my previous setup had both Django and Drupal sites running on the same Apache server.
Due to some of the shortcomings of PHP, the only recommended way to
mod_php on Apache is via the prefork MPM, which carries a high
memory usage penalty per process. My Apache processes hover around 100MB
of RAM each after serving a few requests. Thus, it is a bit wasteful to
use those fat PHP-enabled processes for serving Django requests.
Out of curiosity, I decided to move the site to nginx before the upgrade, just to see how that would affect performance. I expected a modest improvement, but in my case, it yielded a ~35% boost in page loading times – here’s the chart from Pingdom:
I am not entirely certain what goes on here, but not only is the uWSGI/nginx combo providing better RAM utilisation, but it is also providing much better response times.
Take note, this is the same hardware, the same OS, the same database,
the same memcache instance.
Only thing thats changed in the period of the graphs is the replacement of Apache. I have upgraded the website yesterday, but that did not change the picture much. If anything, it increased the load time ever so slightly.
In fact, the picture becomes even wilder if I use Pingdoms filters to get load times from their Europe (where my site is hosted):
The average load time is essentially cut in half, from around 500 ms to 250 ms.
Спасибо большое, nginx.