rwalter
rwalter

Reputation: 891

Improve first request time after DLL change in IIS .NET MVC site

As you may know, updating an IIS (v8) site's bin folder causes a delay in serving the next request. On a smallish app of mine hosted on one server this lasts about 20 seconds.

On a live site with requests coming in every second or so, auto-warmup doesn't make a difference.

What is the bottleneck that causes this delay and what strategies are there to minimise it? My thoughts so far:

  1. Increase CPU power of the server or the speed of RAM / SSD etc. But which?
  2. Split the project into a number of smaller DLLs so the amount to reload is smaller - would this work?
  3. Have two physical versions on the server in different folders. Have the application point to the old version, update the DLL in the other, do a first request, then switch the application to point to the updated folder. But maybe switching physical locations will also cause this delay?

Thoughts appreciated.

Upvotes: 2

Views: 1202

Answers (1)

Jamie Rees
Jamie Rees

Reputation: 8183

When you publish the application (or changing a bin item) it will create a new instance of the w3wp.exe process. This is the web process where the application memory is stored (keeping it simple). If you publish you are creating a new instance and the old is getting destroyed.

All sessions will be lost.

For example, every time you publish the website, it will make a change to web.config. This will cause the application to unload and IIS to recycle.

Causes:

  • Web.config Changes
  • bin folder content change
  • Manual IIS applicaiton pool recycle

Your points 1 & 2 will make no difference to your problem what-so ever. Your 3rd point will again cause an App pool recycle, this will cause a delay.

A solution to this would be to possibly use a load balanced server environment. You can then update one server while pointing to load to the other, perform a few requests on the updated version so it JIT's then swap the users to that server and do the same on the second.

Upvotes: 3

Related Questions