Heroku free quota per-app or total? - heroku

Is heroku's free 750 hours separate per app, or is it a total of 750 hours shared across all your apps?
From their site:
"Each app you create has free access to 750 dyno-hours per month and a starter-tier database."
However, from another answer on StackOverflow:
"Heroku provides, for free, 1 dyno. A dyno is an instance of your application running and responding to requests. If each instance of your application can serve each request in 100ms, then you get 600 requests/minute with the free account."

Based off of what it says there and my experience it's per app. That's talking about instances of dynos not apps. "If each instance of your application can serve each request in 100ms, then you get 600 requests/minute with the free account."

Each app you create within Heroku gets 750 dyno-hours per month for free. The number of requests your app can receive depend on the configuration of the app. For example, an app running unicorn can handle more requests than an app running something else, as unicorn can run multiple workers per dyno.
I've personally run an app on Heroku with 3 unicorn workers on one dyno, 24 hours a day, all month, and always been free (because that is ~750 dyno-hours).

Related

How many days does a free Heroku app stay up?

According to heroku
Starting today, Heroku accounts have an account-based pool of free dyno hours for use on free apps. This replaces the 18 hours a day limit on free apps, allowing a free app to run 24/7 if needed. New accounts receive 550 free dyno hours and you can verify your identity with a credit card for an additional 450 hours
→ How are dyno hours calculated
If my app is always up, how many days will it stay up for (If I have 550 dyno hours) or does it depend on traffic and usage?
An app consumes hours based on their uptime, no matter the usage or traffic your app receives.
If you do the math, 550 hours is equal to 22.92 days.
If you were to add your payment method, it would give you a thousand hours, enough for a single app to run 24/7.

Is there any way to use autoidle in heroku for free?

I want to save my dyno by putting the heroku into idle during night times but it is paid so is there any way to use autoidle in heroku for free?
If your web application is on the Free tier then it will automatically sleep after 30 min inactivity (i.e. where there are no HTTP requests).
In the case of a worker (background process, it doesn't sleep when deployed standalone) you can use the Platform API to manage the Dyno lifecycle

How can I run Heroku server 24/7

I need to be able to run my Heroku app 24/7 even when no one is currently viewing it. It's primarily a server side application that I need to constantly be running at all times.
What's the cheapest and best way to go about doing this. I don't mind paying as long as I'm not paying unnecessarily.
Thank you.
You have three options:
Hobby subscription
Free Web Dyno
Free Worker Dyno
(1) Go for the Hobby subscription: 7$ per month, the Dyno is 24/7 up and running
(2) Use the Free tier, register a valid credit card which gives you extra free Dyno hours (total of 1000 hours) and make sure the Dyno is always up.
The Free Web Dyno sleeps after 30 min inactivity (ie no incoming requests for 30 minutes): you can prevent this sending a request (from an external tool or script) every 20 min.
(3) Use the Free tier (again register a valid credit card to be eligible to 1000 free hours) with a Worker Dyno only (free worker dyno do not sleep)
More info at Free Dyno Sleeping

Heroku - Can app get recycled while it is being used?

I plan to deploy a mini web app to resize photos to the heroku free tier. I read that the heroku file system is ephemeral - uploaded files get deleted when the dyno restarts. What I want to know is if I upload an image only for a short duration to change its properties and then download it, is there a chance that it will get deleted before I download it? That is, can the app get cycled when it is in use?
Regards,
Debashish
On a free tier a web dyno gets cycled on:
1) Dyno restarting - according to the documentation
Dynos are also restarted (cycled) at least once per day to help maintain the health of applications running on Heroku. Any changes to the local filesystem will be deleted. The cycling happens once every 24 hours (plus up to 216 random minutes, to prevent every dyno for an application from restarting at the same time).
Restart can happen at any time then, when occurring, also in progress web request could be terminated. After the restart is triggered, you have 30 seconds to graceful shutdown before the process gets killed
2) Dyno sleeping - according to the documentation
If an app has a free web dyno, and that dyno receives no web traffic in a 30-minute period, it will sleep
If your web request executes during the same session all the operations to upload/change/download the image, you should be guaranteed the file does not get deleted in the process. However, you can avoid these events using monitoring services such as Pingdom or New Relic that can prevent a web dyno from sleeping

Is it possible to stop a Heroku Daily Dyno Restart for a Hobby Dyno

Is it possible to stop a Heroku Daily Dyno Restart for a Hobby Dyno?
My Goal is to stop the Dyno from restarting.
In short, No (with an aside that the restart shouldn't be seen as a bad thing).
From the Heroku Dynos and Dyno Manager Docs
Dynos are also restarted (cycled) at least once per day to help maintain the health of applications running on Heroku. Any changes to the local filesystem will be deleted. The cycling happens once every 24 hours (plus up to 216 random minutes, to prevent every dyno for an application from restarting at the same time).
Cycling happens for all dynos, including one-off dynos, so dynos will run for a maximum of 24 hours + 216 minutes.
In addition, dynos are restarted as needed for the overall health of the system and your app. For example, the dyno manager occasionally detects a fault in the underlying hardware and needs to move your dyno to a new physical location.
Additionally, Dynos Restart if you:
create a new release by deploying new code
change your config vars
change your add-ons
run heroku restart
With Hobby Dynos, the real issue is that inactivity causes the Dyno to sleep throughout the day. From my personal experience, waking up a sleeping dyno can cause a page to take ~30s to load.
There are many solutions to 'ping' the dyno on regular intervals to keep it 'awake'.
An example solution for a Node Server is heroku-self-ping

Resources