My virtual machines usually have nothing to do between 7pm until midnight when they reschedule a lot of work for the rest of the day. The scheduling starts with fetching a list of tasks and times from a MySQL database. Is it possible for the Virtual Machine to go cold and then struggle to connect to the database at midnight? I seem to have a problem with connecting to the database at midnight consistently, but it usually works fine during the day when the Virtual machine has steady tasks to execute.

Should I have a "warm up" procedure every 10 minutes to do a simple database call to keep the Virtual Machine and database "warm"?

Anyone else find anything similar? I know that Azure WebSites have a similar concept and can go "cold/warm" depending on usage, so first user usually get's bad loading times as the website is powering on.


Are you using standard storage for the VHDs? I wonder if this is storage warm up after long inactivity. Premium storage wouldn't have the same characteristics.

This whitepaper says of standard storage:

Effects of warm-up on data disks With Azure disks, we have observed a “warm-up effect” that can result in a reduced rate of throughput and bandwidth for a short period of time. In situations where a data disk is not accessed for a period of time (approximately 20 minutes), adaptive partitioning and load balancing mechanisms kick in. If the disk is accessed while these algorithms are active, you may notice some degradation in throughput and bandwidth for a short period of time (approximately 10 minutes), after which they return to their normal levels. This warm-up effect happens because of the adaptive partitioning and load balancing mechanism of Azure, which dynamically adjusts to workload changes in a multi-tenant storage environment. You may observe similar effects in other widely known cloud storage systems as well. For more information, see Azure Storage: A Highly Available Cloud Storage Service with Strong Consistency. This warm-up effect is unlikely to be noticed for systems that are in continuous use. But we recommend you consider it during performance testing or when accessing systems that have been inactive for a while.

  • Thanks, that was my issue. From yesterday I had no connection problems or timeouts. I set up a library which does a simple select with 1 row from the database every 10 minutes. That keeps the process hosting machine live and it keeps the database machine live and allocated as requests are coming in at least every 10 minutes so it doesn't get partitioned etc. Thanks a lot for this! Dec 11 '15 at 8:59

One of the things that come to my mind is using endpoint monitoring to warm up your website/db. You can use a simple code to test the database or even create a number of queries to re-cache the primary content and then return http status 200 if everything goes as expected. You can setup monitoring to run from different locations. Works for VMs and Web Apps (classic portal).

enter image description here

Said that, a warm-up is not typically something that is a relevant to databases unless for some reason you restart the server. Bear in mind that dumps can also cool down the server since the data that is mostly used by your workload is not necessarily what's being cached/buffering for the backup process to complete.

Finally, adjusting your scheduled tasks timeout value should fix your connection problems during midnight maintenance (MySQL timeout variables could also drop long running processes).

  • Are my assumptions correct about VMs going cold, it's a Cloud Service hosting worker roles which then struggle to connect to the database after long period of not doing any networking. Or are my assumptions wrong and the issue is somewhere else? Everytime I restart the cloud service it never has an issue connecting following a restart. Dec 10 '15 at 11:16
  • I don't think VMs goes cold. The service running on the VM probably will. Ever tried to execute something simple before starting your maintenance code just to see how it goes? Dec 10 '15 at 11:24
  • Okay, I will run a warm up code every 10 minutes and see how it goes for next few days and leave you an update. Yes when I'm hosting something directly on the VM without a service it is fine all the time, but when hosted inside a Cloud Service it has issues that behave like the "cold/warm" scenario I described but it could well be something else. Dec 10 '15 at 11:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.