Switching to Nginx

First thing I have to say now that it's over: Wow. Nginx is amazing. It's a little rough at first, but when you get it all done the results speak for themeselves.

Testing a Drupal Site

A little about the server (vps) hardware:

  • 4 vCPU
  • 256MB RAM
  • RAID10 disk
  • No swap
  • OpenVZ on an older node
  • Debian 7 (wheezy) 32-bit on 2.6 Kernel

And A little about the site itself:

  • Drupal 6
  • ~115 modules active
  • little/no custom code optimization
  • strait dump from apache
  • relatively small DB
  • Not that big a deal
On to stats
The server is now under siege...
Lifting the server siege...      done.
Transactions:                785 hits
Availability:             100.00 %
Elapsed time:              59.77 secs
Data transferred:           8.15 MB
Response time:              0.59 secs
Transaction rate:          13.13 trans/sec
Throughput:                 0.14 MB/sec
Concurrency:                7.69
Successful transactions:         785
Failed transactions:               0
Longest transaction:            1.52
Shortest transaction:           0.41

Now, that may not look like much, but it is a low traffic site that was only able to serve a few people at once. Now it can handle much more on the same hardware while taking even less memory than before with mod_php and apache. I could only run a few threads and each one took upwards of 60MB a pop.

When you also need MySQL, that's a little rough since SQL is a bit of a hog itself, even if you skip out on InnoDB to save memory.

I haven't even done any otimization passes and already it's better than anything I got out of apache.

Now the Tricky part: Nginx doesn't like .htaccess files or the usual rewrite rules. This has a few drawbacks for webhosting companies, but great perks for anyone trying to get the most out of a server. Sure, you have to learn the new way of doing it, but the nginx wiki is wonderful if you have the patience to learn. Also, they have a fair chunk of easily editable full examples you can basically take as is.

This is just the start of this nginx adventure, but I think I'm going to enjoy the results if these basic "get it working" tests are any indication.

Category
Tagcloud
life lessons Open Standards linux bash scripts ffmpeg gaming browser OS ubuntu