Forums

Webapp not responding until I reload (after few days of inactivity)

My webapp receives text messages from clients and sends automated responses immediately. It is currently fully developed but not published to the general user yet. I've had a 4 days of inactivity and when I tried to test it today, it did not send an automated response until I reloaded the webapp.

Does the server shut down after a few days of inactivity? How can I avoid this? I'm going to publish this project to work with more than 60,000 clients and each message they send and the automated response to it are vital for my project.

Websites can sometimes be shut down temporarily due to system maintenance, but they wake up when they receive their first request. If the request is a GET, then this happens completely transparently -- the website is started, and the request is delivered to it, and the response sent back to the client. If it's a POST, it's not quite as seamless, as the first request will get a 503 ("temporarily unavailable") message, but all future requests should be handled properly. A good trick to work around that is to set up a scheduled task that uses curl to access your site regularly; that will make sure that if it does sleep, it will wake up soon afterwards.

From looking at the access logs for your site, it seems that the the first message to come in when the site was sleeping was a POST request, but the requesting system disconnected after waiting for less than five seconds. After that, it would have been up and running again, but no further requests came in until it was reloaded.

Just a note to say that you don't need a scheduled task any more to work around the thing where the first hit to a sleeping website is a POST request. Websites that are sleeping now start up normally when they receive a request, and return their normal status codes, regardless of the method used for the request.