Performance of IIS+ASP.NET vs (NGINX + FastCGI + Mono or XSP)?

32,270

Solution 1

About a year ago, Microsoft published a benchmark of IIS + WCF called StockTrader. Not exactly a webpage-oriented benchmark. Anyway it showed some very good performance using IIS, worker processes, and .NET code.

7 or 8 years ago the benchmarking on web loads was more active. But at some point it seemed like the performance was so good, that on a single standard high-volume intel server, whether you were using Linux+??? or Windows+.NET, you were going to get really good perf. (Assuming reasonable application design).

I can't really comment though, on PHP and FastCGI.

And I don't know anyone who has benchmarked Linux+Mono+XSP versus Windows+.NET+ASPNET on the same hardware.

Solution 2

I am actively developing in both PHP & ASP.Net. I can't claim deep knowledge of IIS, or NGINX but I am VERY familiar with Apache and Lighttpd.

ASP.Net uses a threaded architecture that is very much a part of the web server it's self. Static variables retain their value between requests and in between users. This is where ASP.Net get's most of it's speed advantage from. The shared memory is stored inside each individual process, and between threads. Separate processes do not share memory. So when you scale beyond one server, much of this advantage is lost.

PHP is built in the old fashion CGI style, where each request is a blank slate. This means that any common information either has to be fetched from a common store or entirely regenerated. PHP is NOT slow, it is different. Most major operations in PHP are calling modules written in C, so they are lightning fast. PHP executing on it's own is not as fast as a compiled language, but is by no means slow. There are (very common) modules for PHP which cache compiled (in memory) versions of the code, and can increase performance between 4 and 10 times.

PHP has been around for a while, and many solutions to it's CGI style exist. xcache offers a value store very similar to ASP.Net's static variables. Memcache offers a slightly slower but better scaling (between physical servers) solution to persistent shared variables.

ASP.Net offers much more formalism and structure. But bad programmers can make a mess in any language. If you choose ASP.Net you should investigate some of the excellent NON-Microsoft libraries for development. (eg NHIbernate & http://www.castleproject.org/)

My personal preference (when i'm not paid to do otherwise) is PHP. Even though it takes a speed penalty, it is easier to develop in and less complex to scale up (even if it would require more PHP servers than .Net). Servers are much cheaper than programmers.

In either case any Web > 2.0 application will be data bound, and the database configuration will have a much more profound impact on performance than the language choice.

Solution 3

I did some simple benchmarking of an asp.net mvc3 website running in IIS7 on windows 7 and the same site running on centos 6.2 with mod_mono and mono 2.11.2. They are both virtual machines on the same hardware running in virtual box. The actual machine is a Core i5.

using apache bench from a different linux machine on the same network (ab -n 1000 -c 100)

Centos 6.2 (default settings, no other sites running on 8088)
Server Software:        Apache/2.2.15
Server Hostname:        192.168.1.208
Server Port:            8088

Document Path:          /
Document Length:        24 bytes

Concurrency Level:      100
Time taken for tests:   3.401 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      354000 bytes
HTML transferred:       24000 bytes
Requests per second:    294.01 [#/sec] (mean)
Time per request:       340.124 [ms] (mean)
Time per request:       3.401 [ms] (mean, across all concurrent requests)
Transfer rate:          101.64 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    3   6.4      0      25
Processing:    14  321  71.1    325     483
Waiting:       14  321  71.1    325     483
Total:         39  324  67.8    326     483

Percentage of the requests served within a certain time (ms)
  50%    326
  66%    344
  75%    358
  80%    370
  90%    408
  95%    426
  98%    441
  99%    445
 100%    483 (longest request)



(Again default settings, Windows 7 x64)
Server Software:        Microsoft-IIS/7.5
Server Hostname:        192.168.1.115
Server Port:            8088

Document Path:          /
Document Length:        27 bytes

Concurrency Level:      100
Time taken for tests:   0.469 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      294783 bytes
HTML transferred:       27351 bytes
Requests per second:    2131.09 [#/sec] (mean)
Time per request:       46.924 [ms] (mean)
Time per request:       0.469 [ms] (mean, across all concurrent requests)
Transfer rate:          613.48 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        4   17   4.6     17      27
Processing:    12   28   6.9     28      61
Waiting:        9   22   6.9     22      55
Total:         24   45   7.0     45      67

Percentage of the requests served within a certain time (ms)
  50%     45
  66%     48
  75%     49
  80%     50
  90%     52
  95%     55
  98%     59
  99%     62
 100%     67 (longest request)

I'm sure you can tweak settings, etc. But unless there's something easy I'm missing, IIS seems to be many times faster running asp.net mvc.

The view itself was basically empty, just had a single word in it.

It's not a great benchmark, certainly not something I'd give to my boss. I suspect mono would get a better showing with nginx or lighttpd but I don't have them set up right now.

Solution 4

There are great benchmarks here for IIS and nginx: (and Apache, Cherokee, G-WAN, Lighttpd, Ulib, etc.)

On Linux:

http://gwan.ch/en_linux.html

On Windows:

http://gwan.ch/en_windows.html

Using PHP, Java and C#:

http://gwan.ch/

I have never seen so clear comparisons done anywhere else. The test source code (in PHP, Java, C#) is also available here:

http://gwan.ch/source/

Hope it helps.

Solution 5

We run an asp.net MVC application in both IIS and XSP, and IIS beats XSP in in both performance and reliability.

You can do the performance tests pretty easily, but XSP isn't really designed for production environments. We filed a bug that resulted in the XSP process to crashing every now and then, which they are not going to fix (it involved some deep architecture changes apparently). In the end we just wrapped and restarted the process when it died, but you should be aware that the two (XSP and IIS) are very different beasts.

If you are on windows, use IIS. IIS7 isn't that bad at all.

Share:
32,270

Related videos on Youtube

Tom
Author by

Tom

Updated on September 17, 2022

Comments

  • Tom
    Tom almost 2 years

    How much requests each can handle? How many RAM needed?

    As I remember FastCGI are opened initialized processes, each can handle one request.

    What about multithreading?

  • Quandary
    Quandary over 14 years
    1 year ago - 7 to 8 years ago? I can only tell you that Linux today outperforms Windows 2000 - Vista + Server 2008 in any area, except desktop market share (and thus number of available commercial software packages).
  • user1227502
    user1227502 over 14 years
    Smells like a rant. You say that IIS misses "a lot of VERY VERY important features", then cite one interesting one which is normally carried out by routers. None further. Then you call out the changes in IIS5,6,7, which have occurred over the course of 10 years. 10! You claim IIS perf is not good, with no citation. You also claim memory segmentation, again, no basis for the claim. You suggest that a site will need to be restarted every 20 minutes. And that it requires 2GB to run Windows Server. Seriously? Everyone is entitled to his opinion. Yours seems to be completely unfounded.
  • Quandary
    Quandary about 14 years
    2 GB: Windows 7 minimum requirement 20 min. restart : www.rentacoder.com IIS 5,6,7 are all still in use (because some apps don't support iis 7 because the changes have been so massive [even when that wasn't necessarely necessary]) different configuration interface for iis 5,6,7 (Fact: had to rewrite installation instructions for a iis5 client, because I used iis 7) [linux config is textfiles, so np]. DOS_Evasive is not a router feature and for the instability just take my system: after the last graphics driver update, it started to bluescreen every 5 to 10 minutes (needed to remove the update)
  • Quandary
    Quandary about 13 years
    I agree 100%. If there is a performance bottleneck, it's gonna be the database, not the webserver. And actually, PHP requries less servers than .NET, at least on Linux. To add one statement to yours, nginx is a multithreading based server, so it consumes a lot less memory (under heavy load gigabytes, not just megabytes) than process based servers, such as Apache. On the other hand, if one user encounters a bug that makes the server crash, it crashes for all currently connected users. On apache, only the process of the current user crashes, and all others remain unaffected.
  • Quandary
    Quandary about 13 years
    Quote: "As the U.S. dept. of Justice ruled that it is no longer illegal to benchmark Microsoft IIS and .Net" - holy crap, comparing was illegal...
  • Quandary
    Quandary about 13 years
    Before I am called a troll again: gwan.ch/en_doj.html
  • DeepSpace101
    DeepSpace101 over 12 years
    Quandary: Data?
  • Jarrod Mosen
    Jarrod Mosen almost 12 years
    "I have never seen so clear comparisons done anywhere else." Really? I have the feeling that this is just the owner of G-WAN... pretending to be someone else... again. "Using PHP, Java and C#: ( link to irrelevant home page )"
  • Jarrod Mosen
    Jarrod Mosen almost 12 years
    "If you are a small developer the minimum hardware requirements for an MS system are a lot lower than those of a Linux machine." Did I read this wrong, or shouldn't this be around the other way?
  • Gabriel
    Gabriel almost 12 years
    Well I'm not sure if i should go in this discussion, Linux hosting price is peanuts, Linux VM is much cheaper. While each windows server licence costs a lot, I'm not Microsoft Fobic or something but my experience the last 3 years showed me that paying for all that licenses can be painful and we took the decition on 01-01-2013 to have everything with Linux and proxmox virtualization Simply its cheaper less resources needed.
  • David
    David about 8 years
    The OP's question is not asking about PHP. It's asking about the better environment in which to run ASP.NET: IIS vs (nginx+fastcgi+mono) vs XSP.