application compiles every 15 minutes
Asked Answered
N

3

9

I am using ASP.Net4 MVC2 for my application. The first person using the application usually experiences a long wait before the application responds. After that the application is pretty responsive. If the application is idle for 15 minutes, the same person or the next person using the application will experience long wait again. It looks like the application compiles after being idle for 15 minutes. Can someone tell me where I should look to trouble shoot the problem? Thanks.

Neogothic answered 15/10, 2010 at 0:7 Comment(0)
O
8

It is almost certainly the case that what you are experiencing is app pool recycling. It's true it takes some time to re-initialize after the pool has been recycled, but it shouldn't take all that long. How long is a "long wait"? A second? Several? In IIS you can configure how regularly your app pool recycles. For IIS 7, right-click on your app pool and choose "Advanced Settings" then look at "Idle Time-out". You may consider increasing this value. (Or set to 0 to disable completely.)

Osteoclast answered 15/10, 2010 at 0:41 Comment(2)
I set the app pool recycling at 1am each day, but it's still happening during the business hours after some short idle period. The wait is around 30 seconds to 1 minute.Neogothic
@user266909, but did you adjust the "Idle Time-out"?Osteoclast
K
6

You need to accurately diagnose the problem first before you start implementation solutions. First have to verify if it is, in fact, an app pool recycle. You can start by adding this section to your web.config:

<healthMonitoring>
      <rules>
        <add name="Application Lifetime Events Default"
             eventName="Application Lifetime Events"
             provider="EventLogProvider"
             profile="Default"
             minInstances="1"
             maxLimit="Infinite"
             minInterval="00:01:00"
             custom="" />
      </rules>
</healthMonitoring>

It will log an event to the windows event log anytime asp.net recycles itself. It will also gives a reason for the recycle (e.g., someone poked web.config, etc.). If it is a recycle, then you need to figure out why it is recycling. Is it because IIS is set to do it no matter what? Is it because your app is not handling memory correctly and memory pressure is causing asp.net to want to recycle itself? These questions must be answered first.

First determine if it is a recycle by adding to above configuration and why. Once you get the answer you can check memory, etc.

Kennel answered 15/10, 2010 at 3:27 Comment(2)
Which section in web.config should I put the <healthMonitoring>? Thanks.Neogothic
Put it as a direct child of <system.web> - msdn.microsoft.com/en-us/library/2fwh2ss9.aspxKennel
P
0

Have a look at the IIS7 application warmup extension.

http://www.iis.net/download/ApplicationWarmUp

Pleuro answered 27/10, 2010 at 14:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.