Performance of ASP.NET in Mono(Linux) vs IIS(Window) - asp.net

Is there any performance different between hosting your asp.net in mono on linux and iis on window server?

Of course there is a difference, just like there is a performance difference between Java and .Net. However, it is going to vary widely based on what the application is doing.
There are things where .Net is much faster than Mono. There are things where Mono is much faster than .Net. There are things where they perform roughly equal. The same holds true when comparing applications running on Windows or Linux. The same holds true when comparing applications running on IIS and Apache.
Likely, either can run your application fast enough, and you will find that your performance is going to be driven by your programming techniques. The difference of a few requests per second probably isn't a huge issue unless you have a large server farm, in which case you most likely have the resources to test on both and see which is faster for your particular application.

In regards to the suggestion by lextm that publishing the results of perf comparisons is "not possible", the End-User License Agreement (aka EULA) for Windows Vista Ultimate allows it, with conditions.
MICROSOFT .NET BENCHMARK TESTING. The
software includes one or more
components of the .NET Framework 3.0
(“.NET Components”). You may conduct
internal benchmark testing of those
components. You may disclose the
results of any benchmark test of those
components, provided that you comply
with the conditions set forth at
http://go.microsoft.com/fwlink/?LinkID=66406.
Notwithstanding any other agreement
you may have with Microsoft, if you
disclose such benchmark test results,
Microsoft shall have the right to
disclose the results of benchmark
tests it conducts of your products
that compete with the applicable .NET
Component, provided it complies with
the same conditions set forth at
http://go.microsoft.com/fwlink/?LinkID=66406.
The conditions, as I read them, are reasonable disclosure requirements: the source code you used to do the testing, the versions of software you tested, the date you conducted the tests, the configuration and optimizations you made, etc.
The EULA for Windows Server 2003 includes the same provisions. I couldn't find the EULA for Windows Server 2008 (the latest incarnation) but I assume the benchmarking provisions remain.
Addendum: If you look in the EULA for Windows7, you will probably find a no-benchmarking clause, or more accurately a no-publish clause; this is because Win7 is still in pre-release. When it is officially released, expect the standard benchmark publishing conditions to be present.
In the past Microsoft had a more restrictive policy on this topic. Basically: you need permission from us (Microsoft) to disclose performance comparisons. This policy has been relaxed, even retroactively to .NET v1.0 and v1.1, as per the link in the above EULA.

Mono sucks!
http://art-blog.no-ip.info/cppcms/blog/post/27
http://www.phpvs.net/2008/02/08/benchmarking-mono-aspnet-vs-php-a-slight-problem/
Or more politically correct: Mono is not yet ready for prime time at least for Asp.Net web applications:
No support of caching
Performance is terribly unstable and dropping after application start.
EDIT: Added quotes for my post, answer to latest comment.
However, in order to make fair comparison ... I should enable caching ... adding following line at the header of aspx file should help me.
<%# OutputCache Duration="20" VaryByParam="None" %>
I'd done it — no result! The performance is the same.
Note: after deeper check, the implementation of cache in modo is very limited and poor, after recent checks it still holds in newer versions of mono.
Ok, anyway I did some benchmarks(...)simple clock gives me about 750 pages per second
for cached variant and 650 for non cached one.
The tests were done under IIS 5.0 on Dual Core Pentium D 3G
The same code ... with mod_mono (under Signle Core AMD Athlon 3000)
had given me:
350 pages per second.
Next run had given 300.
next 200
and next 150
So, benchmarking is impossible.
Does referring to post is still not augmentative?
No mono is definitely not ready for prime-time.

Here is a nice benchmark where someone tested the difference of windows/IIS vs Linux/Apache/Mono(mod_mono). Crazy enough mod_mono (apache's mono plugin) was significantly more performant. Granted I am sure that in certain circumstances it would be different, but given how low profile linux and apache are plus the great job the mono guys have done, it stands to reason that Linux/Apache/Mono is a better way to go. Now that being said, hopefully with the new open source ASP, we will see some super performant Linux .Net servers coming soon (primed and ready for the cloud).
graph of the performance comparison

I've run mono apps under mod_mono. From a usability, it functions fine, though I didn't do any benchmarks. Still IIS really is an incredibly convenient environment to work in. Given the choice I'd still hosts my web-server in IIS and use linux mono clients to connect to it.

First, it was said that publishing performance statistics to compare CLR implementations (.NET vs Mono) is not possible.I am not sure what is the source, but Mono team only published comparison among Mono versions (1.x, 2.0, 2.2, and 2.4), so I assume the saying is real. Therefore, you can only test the performance in your own environment.
Second, Mono is evolving much faster lately, which gives you a chance to gain performance boost simply by upgrading Mono runtime.
Third, please use a different attitude to judge an open source product. For closed source products, you can do nothing but begging its vendor to improve performance or providing your support on how to tune your applications. For open source projects, you have access to the code base, and you can tailor it to suit your own needs, and fix the issues for your own applications.
As jpobst mentioned, even if you cannot fix issues yourself, you can contact the Mono guys.

Related

ASP.NET on Mono scalability

Does anyone know of any ASP.NET Mono production websites that get a substantial amount of traffic - 100 million page views per day, 100-300 page views per second, etc. ? I've searched here and on the HighScalability.com website but didn't find any.
To clarify my question - I'm wondering if I deploy my ASP.NET/C# website on the Mono/Apache/Linux stack will it suffer a performance hit over just keeping deployed on the .NET/IIS/Windows Server stack? If I were to deploy the same app on two separate servers with exactly the same hardware config, one server running .NET/IIS/Windows Server and the other running Mono/Apache/Linux, and then do some benchmark testing(load testing, stress testing, etc.), what would the numbers be?
You cannot expect the same performance numbers for ASP.NET on Mono and Linux as you would expect on Windows. However, things will change with vNext, the next version of ASP.NET, where Mono and Linux are touted to be first class citizens.
Here is a tech power benchmark article that has performance numbers for various web frameworks including mono - http://www.techempower.com/benchmarks/
As you can see ASP.NET on Mono is nowhere near the top for any of categories. However, that should not be a showstopper for picking ASP.NET on Mono. It really depends on your set of requirements. i.e. the response times you are trying to meet satisfying a given number of requests per second. ASP.NET on Mono could very well be good enough for your set of requirements. Add to that any productivity gains you and your team will make by using familiar C# and .NET, ASP.NET on Mono may very well work for you.

What about OpenEJB? Is it worth it? Any opinions?

I whould like to know some opinions about OpenEJB: we are considering to use it on a new project, but really didn't found many opinions about it.
So, here is my question: how about it? Does it perform well? Is it stable enough for a production environment?
We switched to OpenEJB (deployed embedded in our app on Tomcat). Performance tests showed better or not worse results processing our transactions compared to JBoss (transactions include data access, JMS, and servlets). We use ActiveMQ within OpenEJB for JMS. There are no stability problems as of yet - we are still in staging (pre-production) environment though. The documentation is definitely lacking, but not as poor as other embedded choices. Overall, we consider this as a good choice if you run on Tomcat. Deploying it on other application servers turned out to be much more difficult (JBoss, Weblogic, Websphere) but there are not many reasons for this usually (we had few but dropped this after several attempts basically failed).
And as in all open source products: expect lack of support (documentation, troubleshooting, bugs, etc.) to be compensated by free access to sources.
We've had experience with Oracle OAS and JBOSS before. We decided to give OpenEJB a try. We've found out that it is not only very fast but it also much easier to setup and configure, and it has much better defaults.
Currently we implement our own failure measures in the client, so we don't know how they compare for clustering, or other advanced features that we don't use.
We we have to go back and deal with JBOSS in the developer side, we see a drop on productivity, because it takes too long to bootstrap.

Java and tomcat vs ASP.NET and IIS

Until recently I'd considered myself to be a pretty good web programmer (coming up for 10yrs commercial experience on a variety of e-commerce, static and enterprise applications). I'm self taught and have always used the Microsoft product stack (ASP, ASP.NET)...
My applications are always functional, relatively bug free, but have never been lightening quick. As a frequent web user I always found this to be the norm... how fast are the websites from the big tech players (eBay, Facebook, Microsoft, IBM, Dell, Telerik etc etc) - in truth none are particularly fast. I always attributed this to "the way things are with web apps"...
...then I cam across a product called Jira from atlasian and this has stopped me in my tracks...
This application is fast, and I mean blindingly fast.. too fast to time the switches between pages, fully live content, lots of images and data and cross references etc etc...
I run this on an intranet, with a large application DB, and this is running on a very normal server (single processor, SATA HDD, 8GB RAM).
Am I missing something?? Are my programming techniques that bad?? I am wondering if this speed gain is down to it being written in Java and running on Tomcat.
Does anyone have any benchmarks to compare JSP / ASP or Tomcat / IIS???
Thanks,
Mark
NOTE: this isn't a blatant plug for Jira. I don't work for them or have any affiliation to them... but I would like to be able to write applications like them :)
YMMV. But one of the longest-lived Things That Aren't True Anymore is the assertion that "Java Is Slow". Excepting floating-point (where most Java implementations aren't at liberty to use the floating-point hardware), Java is generally as fast or faster than compiled code. Some of the best and brightest have spent years of effort ensuring this, including such things as dynamic recompilation/re-optimization of code based on run-time metrics - something that statically-compiled languages like C or assembler cannot boast.
ASP is sort of the opposite extreme, since the original ASP had to recompile each page request each and every time it was made. ASPX addressed this by allowing retention of the compiled page code. That got rid of a lot of useless overhead.
A more compelling reason to prefer Java over ASPanything/IIS is freedom. A Java/Tomcat webapp will run under almost any OS on almost any hardware. IIS runs on Windows. Period. And for the most part, that also means Intel. Not Sparc, Not zSeries. Maybe you don't care. But then again, maybe next week IBM will offer your employer a can't-refuse deal on a mainframe.
I don't have benchmarks, and there are a lot of things that can make one platform preferable. But I permanently gave up on the "Java is slow" idea when I encountered the Poseidon UML tool with its cool real-time graphics UI and the FreeMind mindmapper tool. A small hit to startup the JVM, but after that, you'd never know what language you were working under.
The great debate. Java vs. .Net.
When .Net first came out there was an application written called "The Pet Shop." Which was a .Net port of Sun's J2EE reference application, "The Pet Store". It was announced that Microsoft's implementation was "faster."
As with anything, especially anything to do with marketing, you have to dig deeper to find the truth.
Any technology can be fast with enough hardware and the correct design.
In my experience there are two factors to speed: What type of hardware is used and how you architect your application (this includes database tuning).
Caching at various levels (response, db, etc.) makes a huge different in responsiveness of a web application. There is also a lot of things that are done to reduce time consuming operations like db connection pooling, sql statement caching, etc. As much as I'd like to say Java is better :-), I think in this case the performance is due to the way Jira was written and the fact that it's being run internally (probably with few users as compared to eBay, Facebook, Microsoft). This site, Stackoverflow, uses ASP.NET MVC and IIS and is very responsive and my guess (since code is not open sourced, yet) is that they use many of the same techniques you would find in Jira or any other web application built to scale.
I think that it is not typically the frameworks and languages used that make an application slow. In my experience, some frameworks like JSF or .NET server side controls give developers alot of freedom to make too many database calls and look things up too often, but that's definitely not the fault of the framework used.
Keep your application as light as possible and focus on keeping the data sent to the client as small as possible, and you will have a fast application. It's usually faster to develop fast applications too.
The Jira folks have written a best in class application (and charge for it) - nice work crocodile dundees.
I also suggest to consider also two aspects:
the maintenance activities: logging and deployment. In my opinion under a unix like server is more easier to log, deploy, and maintain new release than doing the same on a Windows server.
if the project require to use some open source application (i.e. Alfresco repository) Java is better solutions
People's opinion is mostly biased. Most people have never really tried the other while claiming the other is slower. I wouldn't trust any answer: it's mere opinion. It's boring to always read the same 4 cents again and again.

When should new .NET projects be designed for .NET 4 Framework

I am preparing to start on a new short-term contract (1-2 months) that involves replacing an Access application by moving it to ASP.NET and SQL Server.
I am only responsible for the ASP part and connecting it to the database.
The only requirement is that whatever technologies I use be relatively well-known in the area, so that if they need to have someone else work on it, it isn't specialized knowledge.
So, I could do this in Rails or ASP.NET, but, when should the development be aiming for .NET 4 Framework, as there are many changes coming out that may be advantageous to use.
Or, even though it may be useful, when is it better to just ignore new features and stay on an older version of .NET?
I am assuming that hardware isn't the limitation, as many computers won't be able to run .NET 4 Framework, but that would be an issue for a hosting company, as they can find a hosting company to support whichever framework the application is designed for. If Rails makes the most sense, as their hope is to have the application written quickly, but have it reliable, then again, the hosting company would need to support it, or they use a different one.
This company hasn't used a hosting company, they need to find one, so there isn't a relationship that could be an issue.
UPDATE: Part of my concern is that initially the application will not require javascript, but phase 2 will be to make it more interactive, as some clients won't be allowed to have javascript on their computers. In order to limit how much javascript must be known by a developer there are frameworks that will adapt to browsers and situations fairly well, which is why I am also thinking about RoR and the fact that there appears to be changes coming out in .NET 4 that may help with this.
As a general rule of thumb, I wait one year before building sites in a new framework unless the client specifically asks for the newest technology. This has worked out very well for me. The advantages are:
The technology is much more stable (hotfixes, service packs, etc.)
Common complaints about missing functionality are usually resolved
Hosting companies, support communities and corporate IT departments have had time to get used to the technology, find out more about it, play around with it and have it mature within their organization
Unless there is specific need for new functionality introduced by .Net 4, there is no point in subjecting your clients to the immediate problems with an initial release, or making it more difficult for them to find hosting. You should either investigate all of this up-front, or use .Net 3.5 in the meantime.
The only requirement is that whatever
technologies I use that it be
relatively well-known in the area, so
that if they need to have someone else
work on it, it isn't specialized
knowledge.
I would have thought that requirement was enough not to develop this project on .NET 4.0 - it takes time for a new framework version to filter down into the market, and it will be a while yet before there are a lot of developers around with .NET 4.0 experience.
Also, you would be essentially developing on top of a BETA product - while I'm sure most of the features will remain unbroken from BETA -> RTM, there is always a risk that something will break or not work like it did in BETA, so why risk this on a commercial project?
I wouldn't target .NET 4.0 yet on a commercial project unless there was a specific reason for doing so, and even then you would have to have buy-in from the client, ie "I can do this much more quickly and with less effort if we use the current beta version X rather than established, stable version Y" - good luck with that.
I worked on a commercial project that used the CTP version of LINQ to SQL - then when we went to VS2008 / 3.5, suddenly everything changed and we had to make a lot of changes just to get LINQ to SQL working again.
Stick with 3.5 - it's easier for hosting and getting developers.
Just a couple of thoughts, I wouldn't even think about creating an application for production use in .NET 4/ASP.NET 4 until:
There is a release candidate. It's
not the first time I've seen
features in beta's not make it to
RC/RTM.
Microsoft have permitted development and deployment
of production applications by way of a 'Go
Live' license.
There are some hosters out in the market such as OrcsWeb who are participating in public beta testing, but they aren't intended for production use.
I'd run with the .NET 3.5/ASP.NET 2.0 or MVC bits for now. Better safe than sorry.
Generally speaking it's going to be easier finding hosting for a Rails app. If you want to run .net 4.0 you're probably going to have to run a VPS or dedicated machine. However if you're bailing after the application is finished and assuming your client is in Knoxville, they're going to have a tougher time finding a Rails developer to maintain the application.
I think the bigger question is your role. They're looking to you to solve this problem for them. Are you productive in both technologies? How about getting a Windows server up and running? A Linux server? How's your SQL Server vs MySql? I'd guess that you're probably stronger on one stack vs the other - for a contract that short I wouldn't want to be doing a lot of experimental development.
i wait until the OS that everyone will be using has it.
Just last month i took a dependancy on GDI+, which first shipped with Windows XP.

FOSS ASP.Net Session Replication Solution?

I've been searching (with little success) for a free/opensource session clustering and replication solution for asp.net. I've run across the usual suspects (indexus sharedcache, memcached), however, each has some limitations.
Indexus - Very immature, stubbed session interface implementation. Its otherwise a great caching solution, though.
Memcached - Little replication/failover support without going to a db backend.
Several SF.Net projects - All aborted in the early stages... nothing that appears to have any traction, and one which seems to have gone all commercial.
Microsoft Velocity - Not OSS, but seems nice. Unfortunately, I didn't see where CTP1 supported failover, and there is no clear roadmap for this one. I fear that this one could fall off into the ether like many other MS dev projects.
I am fairly used to the Java world where it is kind of taken for granted that many solutions to problems such as this will be available from the FOSS world.
Are there any suitable alternatives available on the .Net world?
As far as Velocity is concerned I have heard some great things about that project lately. It's still in the developing stages and probably not primetime ready yet. But I think the project has a solid footing and will become a strong mature product from Microsoft and not fall off into the ether like you predict.
Recently I've heard podcasts from Scott Hanselman and Polymorphic Podcast regarding Velocity.
BTW Windows Server AppFabric is out of beta. That's what i mentioned in my previous post.
here is the link on general availability;- http://blogs.technet.com/b/appfabric/archive/2010/06/07/windows-server-appfabric-now-generally-available.aspx
which specific features do you think one can get on NCache and not on AppFabric?
Just a quick update on this thread for the sake of completion.
Velocity (now known as Windows Server AppFabric) is already out in the production and offers a great distributed caching platform. More details are available on the msdn site
http://msdn.microsoft.com/en-us/windowsserver/ee695849.aspx
Although Velocity has made progress from CTP1 to CTP2, it still leaves much to be desired. It will be some time before they provide all the important features in a distributed cache and even longer before it is tested in the market. I wish them good luck.
In the meantime, NCache already provides all CTP2 & V1, and many more features. NCache is the first, the most mature, and the most feature-rich distributed cache in the .NET space. NCache is an enterprise level in-memory distributed cache for .NET and also provides a distributed ASP.NET Session State. Check it out at Distributed Cache.
NCache Express is a totally free version of NCache. Check it out at Free Distributed Cache.

Resources