Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent an Azure website from going to sleep?

I deployed an ASP.NET 5, MVC 6 web application to Azure. It seems that if I don't hit the site for 10-15 minutes, it goes to sleep and it takes a good 10-15 seconds for it to wake up.

I am not sure whether its the website that's falling asleep, or the database that it's connecting to.

So 2 questions.

  1. How do I prevent the site from going to sleep so soon.
  2. Is there a way to have visibility into what's going on in Azure with the website and the database. Are they kicked out of memory?
like image 858
AngryHacker Avatar asked Nov 18 '15 20:11

AngryHacker


People also ask

How do I prevent my tabs from going to sleep?

To keep you in your flow, we have built in heuristics to detect tabs doing important activity in the background and prevent these tabs from sleeping. You can also add sites you never want to sleep to a block list in Settings by going to edge://settings/system. What activities prevent a site from going to sleep?

What are sleeping tabs in Microsoft Edge?

What is sleeping tabs? To improve memory and CPU utilization of the browser, we've developed a feature called sleeping tabs. To free up resources for active tabs, new tabs, and other applications on your device, sleeping tabs in Microsoft Edge makes background tabs “go to sleep” after 2 hours of inactivity.

Is it possible to set pinned tabs to sleep-able?

If they do not sleep it would be useful to have an option to set pinned tabs to sleep-able tabs. @Eleanor_Huynh Jan 27 2021 03:55 AM

What are the advantages and disadvantages of sleeping a tab?

The advantage of sleeping a tab is that going back to it again is very fast and imperceptible. A tab can also be discarded. When a tab is discarded, the content of the page is completely thrown away, allowing all of the resources (CPU, memory) to be released.


2 Answers

Azure Web Apps have an 'Always on' option (with basic/standard tiers) which keep your app (and associated web jobs) loaded.

Look under Settings, and you'll see 'Application settings':

Application settings

Then look for the 'Always on' setting (which will be disabled for Free tier):

Always on

like image 107
David Makogon Avatar answered Oct 18 '22 01:10

David Makogon


I know this post is a little old, but the issue is still relevant.

I use a free service called Uptime Robot - https://uptimerobot.com/

Even on the free tier, you can create up to 50 monitors to call your web site, at least every 5 minutes, which is certainly regularly enough to keep your site alive.

As well as keeping the site alive (without any knock-on consequences of using 'Always On') it also serves as a monitor for your site, letting you know if it's down.

You can create monitors that alert you if specific words are in or not in the response, so it's quite easy to check the content is correct. You could even create a 'test' page that just returns 'OK' after checking various functionality on your site.

like image 22
cyberspy Avatar answered Oct 18 '22 00:10

cyberspy