blog - tech - photos - portfolio

Drupal Performance on IIS7 vs Apache

I’ve been doing a bunch of performance testing for one of my Drupal sites and decided to compare IIS7 vs Apache 2.4. I host several Drupal websites on Windows Web Server 2008 with IIS7 and love it. I’ve read more and more articles that show IIS outperforms Apache and other web servers in many situations. But I wanted to make sure I wasn’t loosing possible performance by hosting my site with IIS compared to Apache.

I created a local copy of my site and database on my desktop which is an Intel Core i7 920 OC@ 3.3Ghz with 6GB ram and an SSD. I installed the following software: IIS7, MySQL 5.5, PHP 5.3.13 & Apache 2.4. For IIS I also installed Microsofts URL Rewrite plugin. Besides that the IIS7 configuration is default. PHP settings are default besides upping the memory_limit to 256MB. For my first tests I also left Apache with its default config.

I used Microsoft’s cool testing tool called WCAT. My tests were to see how many pages each server could load in a 20 second period, with a 5 second warmup. The following is my wcat .ubr settings

WarmupTime 5s
NumClientMachines 1
MaxRecvBuffer 64K
CooldownTime 5s
ThinkTime 0s
NumClientThreads 80
Duration 20s
Comment Test Server

SET KeepAlive = TRUE

classId = 1
weight = 100
server = “localhost”
URL = “http://trailforks.local/”

For the Drupal side, I tested my Trailforks site which contains over 100 modules & a custom theme. I created a blank page with a blank template using a custom module, so its the most basic drupal page. I disabled drupals cache and the Boost module cache. These are the initial results.

  1. IIS – 192
  2. Apache – 53

I was rather surprised with the results, IIS blew Apache out of the water. The next test was to enable boost and test serving basically just a simple html file.

  1. IIS – 207,677
  2. Apache – 84,436
Again IIS more than doubles Apache’s numbers. I also tried with IIS’s built-in “Output Caching” and the result was prety close to Boost at 219,374. Now another advantage to IIS is that the default configuation of IIS7 and of PHP 5.3 when using the PHP Installer is pretty good, I wouldn’t change much. Its been several years since I had used Apache, but I knew that the default Apache config is not great. So I did a bit of looking around and added a couple things to the httpd.conf along with disabling all but the minimum Apache modules needed to run Drupal.

KeepAlive On
MaxKeepAliveRequests 150
KeepAliveTimeout 5

<IfModule mpm_winnt.c>
ThreadsPerChild 250
MaxRequestsPerChild 0

This increased the Apache number only slightly from 53 to 62.
I also wanted to test each platforms most popular PHP Opcode cache extension, Wincache & APC. I installed the newest version for each and gave both lots of memory (same amount for both).
  1. IIS – 683
  2. Apache – 544

So once again IIS with Wincache beats out Apache with APC. Also nice to see that the opcode more than triples the performance!

Another quick test was to enable a “web garden” on the IIS application pool for the site. Changed the max worker process to 10. this increased the IIS number even further to 936.

Doing these tests has defiantly reaffirmed my choice to use Windows & IIS for hosting my sites. Not only does it outperform Apache in these specific tests but I find it MUCH easier to manage with the excellent UI’s and tools. Ever since Microsoft moved the HTTP.sys into the Windows kernal and rewrote IIS from 6 to 7, its been a solid competitive option. With Windows you also don’t have to worry about tweaking TCP like you have to on most Linus distros for optimal web hosting performance. Microsoft has also invested a lot into PHP & FastCGI on Windows over the past several years and PHP on Windows/IIS is just as good as LAMP now. One of my favourite things about IIS is “application pools” and how each site is isolated from everything else, so if it crashes, or is running slow, it doesn’t effect the others. This also helps for security and application pools can be configured to recycle when it detects problems. Another huge bonus is most config changes you make with the IIS Admin GUI or by hand editing a web.config file take effect instantly! No restarting Apache every time you change a setting.

I know doing any kind of benchmarks is never perfect and I want to do more tests. I’m planning on running more tests with a higher concurrent to see if that changes the comparative results at all. Additionaly if anyone has any suggestions on how Apache might be better tweaked please let me know!

Easy WCAT setup I created with simple .BAT files to run creating the server & client for testing:


Torrented Movie renaming tool

When I download torrented movies I like to rename them so the folder and file names are all neat. I need all my movies in a sub folders because this is the way the “Media Browser” Media center plugin in the post below requires. The AVI file needs to be named the same as the folder as well. This can be rather tedious, so I wrote a PHP script to automate renaming downloaded movies. I then used a tool called “bamcompile” to compile the php script into an executable that can be dropped into any folder and ran.

The script will scan through all the folders in the loation the exe is places, it will rename the folder all nice, format the data in the title and delete anything after the date. It will then rename all the files inside the folder to match, along with deleting any nfo and txt files.

For example a folder named “Tropic.Thunder[2008]DvDrip-aXXo” would be renamed to “Tropic Thunder (2008)“.

Most torrents you download the movie is already in a sub-folder, but if they are not, or if you have a ton of old movies all in one folder, you can use this simple DOS batch script my friend made for me to move each file into a sub-folder. movie_folder_tool

I also see someone recently made a batch file that does the same thing available here.