If our application on Heroku doesn’t called for a period of time, it switches to sleeping mode. It takes 7-8 seconds to wake up on first call. That effects visitors negative. Pinging applications periodically can be a solution.
For pinging we can use Pingdom or New Relic services but it is possible to do this with a script running on Heroku.
As shown below, we have 3 files and the commands are explained. Create the Heroku application and deploy it. That’s all. This sample is taken from Heroku’s documents.