The rivalry between proponents of .NET and Java frameworks has always reminded me of rivalry between Red Sox and Yankees. Each framework has its ups and downs, but in the end is a solid framework for designing enterprise-level applications. One major drawback of .NET compared to Java is that it’s not really platform independent and is geared heavily towards the MS Windows Operating system. The Mono project is a cross platform, open source .NET framework implementation. Mono makes it possible to run .NET applications including ASP.NET under Linux using Apache, and not to be bound into any specific technologies with their associated licensing fees.
I’ve always anticipated Apache to be faster than IIS but never tested it. This weekend, I had some spare time on my hands, so I decided to compare the performance of a typical ASP.NET application running on Windows with IIS web server versus its performance under Linux with Apache. What I found out is that on average Apache was serving requests three times faster than IIS.
A word of caution is that this comparison wasn’t scientific, as different background processes may have affected the timing. We’re also comparing ‘apples’ to ‘oranges’ since the Mono framework doesn’t implement the full breadth of features available with Microsoft .NET CLR. However, for simple programs, I am still convinced that using Apache will yield better performance. Below are my notes on the performance evaluation.
I use an Intel Core 2 Duo CPU T6600 @ 2.20 Ghz Mhz, 2 core, 2 logical processors with 4GB RAM at home. It’s partitioned to dual boot into ether Windows Vista or Ubuntu Linux. So I could execute the tests onto two different stacks of technology under identical hardware.
I’ve used a test program from the following CodeProject’s Mono article. It’s effectively a ‘hello world’ program on steroids, which prints your computer’s configuration along with details of the HTTP request.
For benchmarking, I used Apache Benchmark tool, which fired off 8,000 requests to the webpage with a 100 thread concurrency. On average, the Apache with mod_mono module was able to serve requests three times faster than an IIS installation.
1. Apache with mod_mono under Ubuntu
$ ab -n 8000 -c 100 -g out.dat http://localhost/index.aspx
2. IIS under Windows
C:\> ab.exe -n 8000 -c 100
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Server Software: Microsoft-IIS/7.0
Server Hostname: localhost
Document Path: /index.aspx
Document Length: 1964 bytes
Concurrency Level: 100
Time taken for tests: 63.468 seconds
Complete requests: 8000
Failed requests: 0
Write errors: 0
Total transferred: 17632000 bytes
HTML transferred: 15712000 bytes
Requests per second: 126.05 [#/sec] (mean)
Time per request: 793.347 [ms] (mean)
Time per request: 7.933 [ms] (mean, across all concurrent requests)
Transfer rate: 271.30 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 7 5.3 6 132
Processing: 162 780 189.1 710 1665
Waiting: 12 435 255.3 420 1576
Total: 167 787 190.4 716 1683
Percentage of the requests served within a certain time (ms)
100% 1683 (longest request)
3. A picture is worth a thousand words
Here is a comparison plot as the number of requests increase.