Your Heroku App Is Slow to Load Because Of This.
Tags: productivity, programming, database, webdev
Published: 2021-04-17 17:12:02

No doubt that [**Heroku**](https://heroku.com) is a great tool for developers. One particular reason for me is its generosity. I will explain how

## Heroku Dynos  

If you're already using Heroku, then you should be familiar with [**dynos**](https://www.heroku.com/dynos). A dyno is a lightweight, isolated, Linux container. It is basically how Heroku runs your app.

With a free plan, you can get 550 hours of dyno per month with an unverified account and 1000 hours of dyno with a verified account. (Your account gets verified when you submit your card details. [See more details here](https://devcenter.heroku.com/articles/account-verification).)

What this means is, for each month, your app can only run for 1000 hours (verified account) or 550 hours (unverified account).

To preserve your dyno hours from burning out or wasting, Heroku puts your app to sleep after 30 minutes of inactivity. How generous!

This is what makes your app is slow to load. When your app's dyno is asleep, waking it up may take some time. But after the first load, it starts loading pretty fast because the dyno is active.


## How do we solve this?
If you don't want your app to go to sleep no matter the inactivity, then I have solutions for you. There are 744 hours in 31 days, so having a verified account keeps you ahead.

Before we look at the solutions, let's see why you may need your app to always be on:

Let's say you have a portfolio, as a full-stack, you wouldn't want a potential client to wait that long for your dyno to wake up.

The worst part is when you're using a custom domain and not a Heroku subdomain (yourapp.herokuapp.com). With the subdomain, He/She may consider knowing fully well your dyno is waking up. But with a custom domain ... you will have to explain yourself then.

Another scenario for you to keep your app alive is with Discord Bot or Twitter Bot. You'd want these bots to always be active at any time right?

What you need is someone to keep your app active so your dyno won't go to bed. You need someone to always reload your app every 5 minutes or 10 or 20 but not 30 above.

That someone is [Uptime robot](https://uptimerobot.com/). Uptime robot will keep your app active and also looks out for downtime (when your app stops working). I will show you how to monitor and keep your app active with Uptime robot.

Visit www.uptimerobot.com. Register an account. You will be redirected to your dashboard.
1. Click the `+ Monitor` button
2. In the monitor type field select HTTP(s)
3. Fill the other fields with a name for your app, the URL of the app.
4. Set an interval, the minimum is 5 minutes.
5. Select the contact you would want them to notify for any downtime. It's optional.
6. Lastly click the green `Create Monitor` button.

Soon as you are redirected to your dashboard, you will see that app you're monitoring in your dashboard. Click on the name of the app to see more stats of the app.

Another option is to upgrade your Heroku plan from a free tier to a paid plan, here is [Heroku pricing](https://herokuapp.com/pricing).

## Summary

I almost wanted to switch from Heroku because of this issue. I used mine for an API and a discord bot. But this solution solved my problem.

I have a Discord server for web developers to help with their coding journeys. [See Info here](https://dev.to/elijahtrillionz/tools-to-improve-as-a-programmer-a7i).

If you like this post and want to support me you can [buy me a Coffee](https://www.buymeacoffee.com/elijahtrillionz).
Thank you for reading.

<hr>
#### You might be interested in
1. [Tools To Improve as a Programmer](https://dev.to/elijahtrillionz/tools-to-improve-as-a-programmer-a7i)
2. [How I made a NoSQL Database clone with JavaScript Classes](https://dev.to/elijahtrillionz/how-i-made-a-nosql-clone-with-javascript-classes-2go5)
<hr>