Not signed in (Sign In)
    • CommentAuthorThomas
    • CommentTimeFeb 8th 2008
     permalink
    Hi everybody,

    I'm currently working an a setup to maximize the performance of Wordpress on my slice. After reading a couple of comments and articles on this topic, I'm really would like to create a bullet proof setup for this trio: Nginx, Wordpress and NGinx. Does anybody has experiences with the setup?

    - http://blog.kovyrin.net/2006/08/22/high-performance-rails-nginx-lighttpd-mongrel/
    - http://www.ruby-forum.com/topic/132052
    - http://wordpress.org/support/topic/143891
    - http://wiki.codemongers.com/NginxConfiguration

    After reading a couple of benchmarks, I'm thinking also about Apache as webserver. Any thoughts on this?

    Thomas
    • CommentAuthordavedash
    • CommentTimeFeb 13th 2008
     permalink

    Wait, what is the trio? You mention Nginx twice?

    Or did you mean WP Super Cache? I can only imagine WP Super Cache is static pages of wordpress?

    You could prolly store those in memcache and try this trick.

    •  
      CommentAuthorkneath
    • CommentTimeFeb 13th 2008
     permalink
    Honestly, just moving to nginx+php-(fast)cgi over Apache+mod_php is a huge performance increase (in CPU, Memory, and Response time) -- and very easy.

    A while ago I moved http://totalspore.com (blog+content is wordpress, forums are punbb) to nginx from Apache and was able to disable WP-Cache, lower memory usage, improve response times, and keep the site up during heavier loads. I would be careful about throwing yourself straight into file caching or memcache without good reason (it's going to be painful). For example, without any caching I'm doing around 500k dynamic pageviews a month with no problem on a 512 slice with lots of room to spare. Most of the reason people look into caching for WP so early is that Apache+mod_php is slow as hell.

    If I were you, I'd look at four tiers of performance improvements and only hit them when you see your server is starting to sweat:

    1. Move to nginx + php-(fast)cgi
    2. Look into file caching (WP-Cache, WP-SuperCache, roll your own, etc)
    3. Get faster hardware and/or split up the application/database servers to two machines. Add more app servers as needed.
    4. Look into memcache once your DB server gets maxed out

    As for where to look, it's really very easy. Just make sure you've got php with fastcgi support, add a quick spinner script to /etc/init.d for your php-cgi, install nginx and you're good to go. I've used this tutorial a few times with ease: http://blog.kovyrin.net/2006/05/30/nginx-php-fastcgi-howto/ I think slicehost may have some docs on the articles section too..
    • CommentAuthorartagesw
    • CommentTimeFeb 14th 2008
     permalink
    Kneath,

    500K requests per month is not a very meaningful statistic. On average (which I admit is not super meaningful), that comes to about 0.2 requests per second - nothing to write home about. I'd be much more interested to hear what you're achieving in terms of dynamic requests per second during peak loads.

    BTW, I have a well-tuned apache + mod-php setup that does 2,500 dynamic requests per **second** on decent hardware.
    • CommentAuthorkr0n
    • CommentTimeFeb 14th 2008
     permalink

    Kneath,

    may you try to do some stress measurements with httperf for example, and give more detailed info?

    •  
      CommentAuthorkneath
    • CommentTimeFeb 14th 2008
     permalink
    artagesw: Of course not, but as any web developer knows traffic is *not* linear. Averages are useless. Also remember that if you're talking about "decent hardware" 512MB of ram is a joke ;) VPS hosting is a lot different than dedicated since you're most often limited by memory, which really shows how spectacularly bloated Apache is. Give Apache 2-4GB of ram to breathe in + several years experience tuning apache and the situation is a lot different.

    I threw in my number to just give relative scale. I find most people going all-out in caching are doing around 20-50k dynamic pages a month -- which shouldn't require much hardware (and doesn't with nginx).
    • CommentAuthorartagesw
    • CommentTimeFeb 14th 2008
     permalink
    kneath: I just thought it would be helpful to see some real numbers comparing your site under load with nginx vs. apache (to support your argument of a "huge performance increase"). In my post I said that the average was not meaningful (because, as you said, traffic is not linear). That is why I suggested sharing performance data of your site under load.

    Cheers.
    •  
      CommentAuthorkneath
    • CommentTimeFeb 14th 2008
     permalink
    artagesw: As for real numbers, that's easy. Under Apache my server locked up swapping like mad to an unusable point past a constant 10 req/s. Admittedly Apache was untuned: I only spent 3 days researching; at which point I realized how ridiculous it was I was spending 3 days researching. Under nginx I haven't seen the site crash once, or even get visibly slow. It's been dugg once since then (I'd classify it as low-medium range), so I'd assume around 50-100 req/s.

    But seriously -- swapping out apache for nginx is a [b]visible[/b] improvement in responsiveness (assuming consistent gzipping behavior between the two setups). The memory footprint is again visible once your site is under any kind of load. I am confident anyone who just tries it out will see the improvements.

    I am definite that with enough apache config experience and hardware you could achieve similar results; but the point of using nginx over apache is an easy, cheap (time+money) way to get better performance.
    • CommentAuthorartagesw
    • CommentTimeFeb 15th 2008
     permalink
    Fair enough. FWIW, I'm a big fan of nginx, apache and litespeed as well. They are all fantastic software and each has its use. I'm running litespeed on a 256 slice here with great results. I run nginx on another vps with similarly great results. And I use apache in several production scenarios, where it runs like a champ and has never let me down. Of course, it's all about choosing the best tool for each particular job.
    •  
      CommentAuthorelasticdog
    • CommentTimeFeb 27th 2008
     permalink
    If you're still working on it, I installed WordPress on my Slice running Nginx and documented how I did everything: HOWTO: Install WordPress on Nginx, it runs very quickly and I'm quite pleased with the results. Sometime today or tomorrow, I'll post instructions on how to give WordPress it's own directory and still run the blog out of your domain's root folder like you can on Apache.
    Thankful People: pburleson