Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages

Help for owners

My Heroku app takes ages to load the first time, then is fine

Short answer

Heroku's Eco dynos put a web app to sleep after 30 minutes without web traffic and wake it when the next visitor arrives, after a short delay. If the monthly pool of Eco hours runs out, all Eco dynos sleep until the month renews. Check which dyno type your app uses first.

  • Written for business owners
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Does this sound like your situation?

  • The first visit after a quiet spell is very slow or times out.
  • Reloading a few seconds later is fast.
  • The site was fine all month and then stayed asleep at the end of the month.
  • A demo to a customer failed because the app was asleep.

Why does this happen?

  1. Eco web dynos sleep after 30 minutes without traffic

    Heroku documents that an Eco web dyno sleeps after 30 minutes with no web traffic, and wakes again after a short delay when a request arrives. That delay is what the first visitor feels.

  2. The shared Eco hours pool can run out

    All Eco dynos in an account draw from one monthly pool of hours. When it is used up, every Eco dyno sleeps for the rest of the month and more hours cannot be bought. Heroku sends email notices at 80 percent and 100 percent of the quota.

  3. Eco is the only common-runtime dyno type that sleeps

    In Heroku's dyno table the Sleeps column is marked only for Eco in the Common Runtime. Basic, Standard and Performance rows are not marked.

  4. A slow start after the wake-up is also the app itself

    Once awake, the app still has to load its code, open the database and warm up. A heavy start-up makes the delay longer and can add to it. That part sits in the code and configuration, not in Heroku.

What can I do about it today?

  1. Find out which dyno type the app usesIn the Heroku dashboard open the app and its Resources tab. The dyno type is shown next to the web process.
  2. Check your Eco hoursThe Billing page of the dashboard shows the remaining hours and refreshes daily. Look for the 80 and 100 percent emails in your inbox too.
  3. Do not set up an endless pinger without understanding itHeroku notes that monitoring services can keep a web dyno awake, but that also uses up your hours pool. Decide first whether a sleeping app is acceptable.
  4. Warn people before a demoOpen the site yourself a few minutes before a customer demo so the app is awake.
  5. Ask what the real need isIf the app serves customers all day, a sleeping dyno type is the wrong tool for it. That is a business choice about cost and reliability, and a developer can lay out the options.

When should I bring someone in?

  • Customers see timeouts after quiet periods.
  • The pool ran out and the app is asleep when you need it.
  • Even after waking the app takes very long to answer.

How do I handle it?

  1. Confirm the causeI check the dyno type, the logs and the hours so it is clear whether it is sleep, an exhausted pool or a slow boot.
  2. Measure start-upI time what the app does from start to the first answer and cut what does not need to happen before serving.
  3. Lay out the options plainlyStaying on a sleeping type, moving to one that does not sleep, or moving off the platform, each with what it changes, so the cost decision is yours.
  4. Add a simple health checkA light status page and monitoring tell you when the site is down, separately from being asleep.

The price depends on what I find, so I quote in writing after a short discovery call. Tell me what is happening and I reply within 24 hours.

What do owners ask about this?

Does a sleeping app lose data?

Sleep stops the web process, it does not delete the database. Anything stored only in the dyno's own disk is not safe either way, so important files belong elsewhere.

Can I just keep it awake with a monitoring service?

Heroku notes that monitoring services can keep a web dyno awake. That also consumes the shared Eco hours pool.

Is Heroku the only platform that does this?

No. Other hosts have their own idle behaviour, so check the host's own documentation.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Found a mistake? Tell me.

For your developer: the technical fixes

Next step

Want this off your desk?

Send me a few lines on where things stand. I reply within 24 hours.