5

I have a MVC3, .NET4.5 asp.net web application hosted on Azure Websites.

I am experimenting with "Free", "Shared" and "Standard" scaling configurations.

I have noticed that after a period of inactivity the compiled code get dropped from memory, or the app pool gets recycled forcing a JIT recompile.

My main question is what is time period before the compiled code gets dropped forcing a recompile? I assume this is as a result of the application pool recycling? I have come across this on standard shared hosts such as DiscountASP.

My second question is: What is the best approach to minimise this issue as I would not like my users bumping into this recompilation lag? My initial thoughts are precompilation.

Many thanks in advance.

EDIT:

I have a found a related SO post on this here: App pool timeout for azure web sites

However it seems, as like standard Shared hosting, one cannot change App Pool recycling. One has more flexibility with the "Standard" scale option, since it is dedicated. So the likely options at present are:

1) Precompilation

2) Use of "Keep alive" ping sites.

EDIT2:

1) "Keep Alive" approach seems to be working. I have a 10 minute monitor running.

Community
  • 1
  • 1
SamJolly
  • 6,347
  • 13
  • 59
  • 125
  • I'm not sure a pool recycle by itself will cause recompilation - we had a nasty bug because of it http://stackoverflow.com/a/14934046/57428 – sharptooth Dec 31 '13 at 08:24
  • Hi, Thanks for this. Certainly my experience was far less than 29 hours. More like 30 minutes. Certainly with DiscountASP, the app pool recycled, so I am guessing that Azure Shared Websites is implementing something similar. Having run the "Keep Alive" process for a few days, it does seem to be working well, even on the "Free" option. We will ultimately go for the standard option, so this situation can only get better. So it is all looking good, and I have not deployed a precompiled version yet. – SamJolly Dec 31 '13 at 13:10

1 Answers1

2

I believe the inactivity period is 20 minutes by default. I haven't used web sites yet so I'm not famailiar with rescrtictions on changing settings but one quick way to keep your site activie is to use a uptime monitoring service like Pingdom (you can check one site for free at time of writing), this will ping your site regularly and prevent it from becoming idle.

sham
  • 1,346
  • 1
  • 20
  • 28
  • 1
    Yes this is what I am doing, and I use "Uptime Robot". yes I have a feeling it is 20 minutes as well. Thanks. – SamJolly Dec 31 '13 at 01:03
  • 2
    Azure will typically run your site across multiple servers/instances to avoid downtime so that means with two instances (for example) and your 10 min ping interval, one instance will recieve a ping every 20 minutes (on round robin load balancing) which would be the edge of the inactivity window. With more "servers" each one recieves the ping at a greater interval and hence instances may still time out. Sounds like its working fine in your case but just something to stay aware of. – sham Jan 02 '14 at 00:02
  • What a fine point. There is more to Azure than meets the eye. Potentially of great benefit, but your do need to know the ins and outs. – SamJolly Jan 02 '14 at 01:54
  • Just checked my site which is currently idling on Free/1 instance so not likely to time out. However this is excellent info. – SamJolly Jan 02 '14 at 02:00