5

I'm developing an ASP.NET application that will be run under Linux/Mono for various reasons (mostly to stay away from IIS, quite frankly). Of course the first web server I had in mind was Apache. But Apache, for all its advantages, adds a lot of overhead. Also, the application I'm building needs to be highly scalable and performance is one of the main concern.

Apache has, obviously, a very good reputation and its record speaks for itself, but I don't need things like Reverse Proxy or Load Balancing because dedicated network devices would be used for that. So those modules from Apache will never be used.

So basically my question is: since Nginx seems to fit exactly needs, is there any caveat I should be aware of? For instance, is Nginx renowned to be particularity safe? When security flaws are detected, how fast are they patched?

Any insight on the pros and cons of using either of those servers in conjunction with Mono is welcome.

9
  • 2
    If you know you are developing for Linux, why are you choosing ASP.NET? Just seems like a very odd choice. Mono is going to cause WAAAAAYYYYYY more overhead than Apache or Nginx will. Dec 16, 2009 at 19:36
  • 2
    That may be. But ASP.NET is also much faster than PHP because it's compiled, and it's an amazing framework. I hate Microsoft as much as anyone, but in the case of web development, it's the technology with the fastest execution time, period. :-) If Mono causes too much performance degradation (I will load test the Web App under Linux/Mono and under Windows/IIS), I will calculate if buying Windows licenses will require less hardware than a free Linux license but with more hardware.
    – Astaar
    Dec 17, 2009 at 11:19
  • 2
    I would respectfully disagree with all of your statements above, and the architecture choices made by some of the largest sites on the Internet (Google [Python], Facebook [PHP]) support my disagreement. Also, there is Java, opcode compilers for PHP such as eAccelerator, caching engines, etc, etc...Proper web architecture (caching layers, etc) are the right answers to performance and scalability, not hacks. If you are looking for performance, IIS or Mono are poor choices. Plus, you are just asking for trouble going with a Windows-based technology on Linux. Dec 17, 2009 at 15:37
  • 4
    And yet, some equally large websites (including the one you are browsing right now, whose owners stated they went for ASP.NET because of its speed) still use ASP.NET. I would ask you to provide links to factual, neutral benchmarks comparing those various technologies because right now you are just a post on Internet with no argument backing up what he's saying - no offense. My question is about the merits of Nginx over Apache, though.
    – Astaar
    Dec 18, 2009 at 11:46
  • 1
    What you don't get is that it's NOT about the language, or the front end - it's about architecture. All of the prominent web languages out there can perform if you plan your architecture well by using caching technologies (memcached, couchdb) on top. I'm just telling you that you are asking for a world of pain if you want to make ASP.NET work well on Linux. And no offense, but serverfault and it's cousins are not anywhere near the size of Facebook or google, which uses a traditional LAMP stack with memcached layers. Their existence and success proves my point that it's not the language. Dec 18, 2009 at 17:29

4 Answers 4

4

ask yourself WHAT the application will be doing

lots of file I/O? well then apache's threading model is just fine, file I/O is blocking

long-running connections with clients? then nginx's event model is more appropriate, network I/O can be nonblocking

the most honest answer is that its unlikely you will be hitting the architectural limits of ANY webserver. just use whatever you are most comfortable with. the "overhead" arguments directed against apache's thread model are only meaningful in high-traffic scenarios.

1

Sergey Sysoev -- the author of nginx -- releases patches quite often. The webserver is very nice, and is capable of effectively running anything with the help of FCGI, either PHP or Mono or whatever. Nginx is also exteremely efficient in serving static content, and uses very little memory for all these keep-alives and slow ones. Additionally, it has nice features&modules available to resist DDoS attacks.

But look, every scripting language is slow. If performance is the main concern, maybe you'll better try to create a FCGI app in C?

Cheers! :)

9
  • Thanks for the response. ASP.NET does not a scripting language though. It uses VB or C# (the app will use C#), which is compiled, and pretty much as fast as C.
    – Astaar
    Dec 17, 2009 at 11:20
  • 1
    C# and VB are compiled in the same sense that Java is "compiled" They are not, and never will be "pretty much as fast as C." They are compiled to byte code (not machine code) and interpreted by the CLR. It appears that you are making a lot of assumptions based on flawed information. Dec 17, 2009 at 15:40
  • 3
    ASP.NET will compile C# twice. First from the IDE it will build "Assemblies", which are indeed Byte Code. Then when these assemblies are executed for the first time, they will be compiled again as JIT (Just In Time), and converted from Byte Code to machine code. Theoraticaly, C# is as fast as C, although with C you can make a bit more tweaking since you have direct access to the memory pointers.
    – Astaar
    Dec 18, 2009 at 12:45
  • Yes, but the JIT part occurs on execution, which slows things down considerably. It works basically like Java. C# will never and can never be as fast as C. The library overhead alone guarantees that. Anyhow, the point being is that your premise is flawed and ASP.NET is not the fastest, nor the best supported, nor does it have the best tools. Perhaps you are comfortable with it, but it's a lousy choice to run on Linux. Dec 18, 2009 at 17:25
  • A nice proof: cppblog.com/images/cppblog_com/chipset/…
    – kolypto
    Dec 18, 2009 at 18:26
1

I personally replaced my Nginx setup with Cherokee

So far everything is running just as fast and I have a web interface on top of that. It also support Mono.

2
  • cherokee is fast but the config interface is infuriating. and no one uses it. and the webserver is hardly ever the bottleneck. Dec 9, 2010 at 4:46
  • 1
    The webserver is hardly ever the bottleneck unless the server is apache.
    – tylerl
    Dec 9, 2010 at 5:00
1

@ABrown: You're wrong on the point that ASP.Net is interpreted.

Applications/websites can be written in C# for example which are then compiled to an intermediate bytecode (IL). That's phase 1.

When a user initially visits the website, the byte code is then compiled to machine code.

Subsequent visits to the website invoke the machine code (it is not parsed or interpreted, it is executed natively).

2
  • 100% correct Andrew. Nov 17, 2011 at 23:45
  • Exactly! But ignore him ... he's against C#/Mono/IIS like it's a religion or something! Jan 30, 2012 at 18:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .