Scott Hanselman

.NET 4 Web Application Startup Time

March 28, 2010 Comment on this post [15] Posted in ASP.NET | VS2010
Sponsored By

I was chatting with Jonathan Hawkins and some of the folks on the ASP.NET team about performance and Jonathan mentioned the startup time for large ASP.NET applications is improved on .NET 4. There are some improvements in the CLR and in ASP.NET itself that helped. If you have a giant app, you should do some tests.

The word from the ASP.NET team is that you'll see improvements when the .NET framework (CLR) is warm in memory but the Web App is cold on disk. This is for shared hosting scenarios where the web server is loading and unloading web applications while .NET remains in memory.

Web App Name

NETFX3.5 SP1

NETFX4

Change

Change as % of NETFX3.5

blogengine

1.959s

1.702s

(0.256s)

-13.08%

dasblog

3.151s

2.818s

(0.333s)

-10.58%

dotnetnuke

4.026s

3.621s

(0.406s)

-10.07%

screwturnwiki

1.579s

1.500s

(0.080s)

-5.03%

Median Improvement

(0.295s)

-10.32%

Environment: NETFX v4.0, Win7-x86, 7200 RPM, 4GB, 2 Cores

If you're interested in one of the reasons, there's a switch in C:\Windows\Microsoft.NET\Framework\v4.0.xxxx\Aspnet.config called shadowCopyVerifyByTimestamp that ASP.NET uses to startup up the CLR. The CLR optimized in .NET 4 how shadow copy assemblies are loaded by removing an unnecessary file copy if nothing's changed. Hence, part of the improvement in cold web app startup.

What's the biggest ASP.NET application that you've got?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
March 28, 2010 18:39
Wow a 10% gain is amazing. Any documentation on how they achieved this in the framework?

I would be interested in seeing the numbers from a larger .NET project like Umbraco, but this is very good news.
March 28, 2010 19:06
Biggest? About 300 primary ascx controls used ibuyspy-like, with heavy use of Infragistics, Dundas and Telerik controls, as well as about 50 custom server controls, on top of about 1 million lines of middle tier code. It's hard to know if that's considered really big these days, but we figure out a while ago it wasn't small! :-)
March 28, 2010 19:41
Is this dasblog of yours hosted on NET4?
March 28, 2010 20:30
The biggest ASP.Net I have is Astrobix.com. This application is a huge portal on vedic astrology and we deliver free reports of all kinds in PDF format (in 10 Indian languages!). You can imagine we've done a lot of work to create this site, but most of the work is not on the front-end but the part that generates those reports.

But I've made a blog aggregator in ASP.Net MVC (http://blogvani.com) which is pretty big too, and right now I am creating Q&A script.

Oh yeah, and I shifted to .Net 4 on one of my production servers because I am prototyping the Q&A script online, and shifting to the new framework broke all my apps whic were made on 3.5. I had to go and delete some entries from the web.config of all 3.5 sites to make them work.

But it was well worth the effort, because now my new app (in testing) is running on ASP.Net MVC2, Framework 4, and I am using the Task-Parallel library!!
March 28, 2010 22:14
Cryil - There's no reason that putting .NET 4 on your servers should break any applications. Just create another IIS AppPool that's specific to .NET 3.5 (there should actually already be 4 created for you) and keep your 3.5 apps in the one AppPool and the .NET 4 apps in the other.
March 28, 2010 22:16
Kamlesh - No, this site is still working nicely on .NET 2, so no reason to move it.
March 28, 2010 22:33
Scott, I am using Plesk at the server and starting another appdomain would mean re-configuring a lot of permissions and losing the facility to use Plesk on that domain. So I stuck to Plesk managed appdomains (Which have no idea what .Net framework is :) ... Really, removing some configuration entries wasn't all that hard work.
March 28, 2010 22:36
In the comment above I meant 'Which have no idea what .Net framework 4 is... I changed the Plesk managed appdomain in IIS to use .Net framework 4 through IIS.
March 29, 2010 1:56
I'm managing a fairly large banksystem for getting instant instore credit. It weighs in at about 900k kines, features à 7(!!!) layer architecture(from before My time) and just about every integration model known to man(binary/ASCII sockets, raw read/write into other systems db, wcf, asmx, biztalk(to msmq)).. Good times! :)
March 29, 2010 18:45
Too bad the biggest .Net application I have to deal with on a regular basis (Sharepoint) isn't going to 4.0 with this upcoming release. Better startup time would be nice.

Am looking forward to seeing Umbraco on 4.0 though.
March 30, 2010 6:07
Somewhat related to this, I thought I read or heard somewhere that with ASP.Net 4.0 it would be possible to have scheduled background tasks rather than having to write a separate Windows Service to handle this. Is this true? If so, a reference to more info would be appreciated. Thanks!
March 31, 2010 13:36
Hi friend, You have a great post. One question for me, How can we create a program for a web page to measure the counter hit of this page using .NET ?
April 08, 2010 21:57
Any chance we could see a similar comparison between 2.0/3.0, 3.5, and 4.0?
April 13, 2010 0:39
lol... somebody always wants to see the stats a different way ;)
June 14, 2010 18:59
To Cyril or someone else...
I'm using Plesk in my Production Server, and I need to install Framework 4 to make ready two sites.
Because the people of Plesk don't want to hear nothing about Plesk and Framework 4, until they have released then new version with Framework 4 support (¿Anybody knows when?), ¿is there a way to install .Net Framework 4 in a Production Server with Plesk, maintaining the other sites running in FX3.5, and without problems to work with Plesk on them?
- I'm sorry about my english, hope can be read -
;-)

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.