Last post May 28, 2016 06:20 PM by imran_ku07
Jan 20, 2016 10:57 AM|MarkHughes|LINK
I'm finding incredibly slow start up times when booting our ASP.NET 5 / RC1 projects - both from Visual Studio (using Kestrel directly - the "command prompt" window opens for the DNX process and it takes around 30 seconds from then until the web page is
available) and, much more worryingly, from within IIS where it can take up to a minute for the first request after an app pool recycle or code deploy for the web site to be available. It was slow on beta7 and beta8 but since the upgrade to
RC1 it's got much slower still.
I don't think we're doing anything too exotic in our startup.cs code, so I guess my main question is "is this normal"? The VS startup is a pain but I can live with it, however the slow startup when deployed to live IIS after publishing is very problematic.
The only item in ConfigureServices that isn't simple config is services.AddMvc, and the only items in Configure are UseIISPlatformHandler, a UseExceptionHandler call with a simple custom exception handler, UseJwtBearerAuthentication, UseCookieAuthentication,
UseStaticFiles and UseMvc - none of these seem like they should be exotic or slow to boot.
Anyone having similar issues? Any tips for where I should start looking to debug where this slow performance is coming in? It looks like the vast majority of the time is before anything gets logged to the console / log files, but that's as much as I've been
able to discern so far!
Thanks in advance for any tips!
Jan 20, 2016 01:50 PM|bbcompent1|LINK
Hey Mark, I think you may want to post this question in the IIS forums since it seems you are running into IIS performance issues. You can find those forums at
Jan 20, 2016 02:23 PM|MarkHughes|LINK
Hi bbcompent1 - Thanks for moving it into the correct sub-forum, however regarding moving it to the IIS forum, the startup time slowness is the same when self-hosting using Kestrel directly from VS2015 and when using IIS after publishing, so I'm convinced
this is an ASP.NET 5 issue not an IIS issue.
Jan 20, 2016 02:25 PM|MarkHughes|LINK
Actually, this issue is highly specific to ASP.NET 5 - I don't think it should be in the General ASP.NET Configuration and Deployment forum, now I look at it, can you move it back please?
Jan 20, 2016 08:48 PM|bbcompent1|LINK
Ok Mark, I moved it back. You probably know about these fixes already but it is worth trying as a start.
The author recommends fixing these three following issues:
Try the recommended fixes and let me know if that helps the IIS app pool warmup. There is an IIS extension out there (I think?) that will keep your IIS App Pools warm so the startup doesn't take as long.
Jan 21, 2016 04:50 AM|rymling|LINK
It doesn't sound normal. I haven't played much with that version but here are a few things to check so maybe we can narrow it down.
Is the HD working like crazy? Maybe the computer doesn't have enough memory.
If you run Visual Studio as an administrator, do you notice any difference? Maybe a permission problem for a folder.
If you right-click the solution and choose "Manage NuGet packages for solution...", does it take a long time for it to show the installed packages or if you browse for other packages to install? Maybe it can't connect to the servers or a feed is down or
If you temporarily turn off anti-virus, does it help? Or the Windows Search service?
Are the files on a network drive or locally?
Is it only ASP.NET 5 projects that starts slowly or ASP.NET 4 (for example) too?
Jan 21, 2016 09:46 AM|MarkHughes|LINK
Thanks for helping rymling - this happens across our full spec production and pre-production web servers (which serve ASP.NET 4 without any problems) as well as on my development workstation under VS2015, so I don't think it's memory shortage.
Once it is started there's no performance problems whatsoever - it's lightning fast - it's just the start up time that is slow. I'll check the performance monitor and see if I can see what is being hit hard while the startup happens though, that's a great
idea - to see if it's hitting the HDD, network or memory hard.
The Manage NuGet packages step takes a while (but does eventually work), I'm not worried about that though as it doesn't happen when running a published site, only when compiling in VS2015. In VS2015, the "slowness" i'm worried about is the time from when
all the compilation has finished and the Kestrel console windows pop up to when the site is available to use. Which I think is the same slowness I'm seeing when IIS tries to start the Kestrel process through DNX / HttpPlatformHandler.
I'll have a look at the performance monitor and report back.
Jan 21, 2016 02:04 PM|MarkHughes|LINK
I've recycled the app pool and made a request to the site, and can see that the CPU is shooting up to 100% for the dnx.exe process for 20 seconds plus, before the response is sent back to the browser. No memory shortage, no significant HDD activity, no significant
I don't think there's anything in my startup which should be taking anything like that long, so I assume it must be something from the ASP.NET 5 framework code or Kestrel hosting which is causing the slowness.
I'm going to remove everything from our startup.cs then add things back in one at a time to see whether there's a smoking gun there.
If anyone can share what sort of startup times they get when starting an ASP.NET 5 / MVC 6 project using DNX (via IIS or directly from visual studio) I'd appreciate it, so I have a basis for comparison.
Feb 06, 2016 09:11 PM|rymling|LINK
For me I feel the app is snappier. The following is for using the standard ASP.NET 5 Web Application.
Cold start (starting Windows 7 and starting Visual Studio): Opening the solution and doing Clean Solution. Starting the timer and pressing CTRL-F5 (start without debugging): about 10 seconds until the compilation is done and IIS Express is started and Internet
Explorer is shown, and an extra 10 seconds until the page has loaded including the resources that page uses.
Closing Internet Explorer and Visual Studio (also shuts down IIS Express).
Warm start: Starting Visual Studio and doing the same actions as above (clean solution etc): About 5-6 seconds until Internet Explorer is shown, and an extra 4-5 seconds until the page is loaded.
All of this without any Application Insights, debugging, etc.
About your "slowness" - could it be related to database initialization?
Feb 07, 2016 03:03 AM|bruce (sqlwork.com)|LINK
asp.net 5 does not use an IIS app pool. IIS is a reverse proxy to the dnx.exe process. on the first request, IIS will start the dnx.exe process, which in turn will load, compile and jit the website. after load, compile and jit, it will call startup, after
startup it will process the request.
20 seconds sounds like a fast startup.
note: after convert to core 1.0 tools, you will be able to compile to native, and save a lot of startup time.
May 21, 2016 11:16 AM|zfugu|LINK
I have the same issue in Kestrel and I think bruce is correct and it's the compile and jit process.
I'm running the latest stuff (as of 5/21/2016). I use the Publish feature to create a bundle and then run the app self hosted from approot (e.g. web.cmd).
Question: how do you compile to native?
BTW, so far I'm loving the new ASP.NET5 and MVC6.
May 28, 2016 06:20 PM|imran_ku07|LINK
Question: how do you compile to native?
Its coming https://github.com/dotnet/cli/issues/1213 :)