Stefan Gloutnikov Stefan Gloutnikov - 1 year ago 112
Python Question

Heroku free tier for a non-stop web and worker process in one application

I have a Python app that pings an API every minute and records data into a database. I also have a Django web app that is the client for displaying this data (it should also not be idling, as I will explain bellow).

Heroku recently made changes again to their free tier, allowing 1000hrs/month for verified accounts. I have verified my account to take advantage of this. What is not clear to me is how the usage hours will be counted in my situation. Will my Heroku application accumulate ~750 hours per month, or 2x750 hours after non-stop running? Are the two lines inside the Procfile considered separate dynos, thus each will be accumulating 750 hours per month?


worker: python
web: gunicorn api_data_client.wsgi --log-file -

I found out that if the web process begins to idle after 30 minutes of inactivity, it will also bring down the worker process with it. This is not a desired outcome for me, as I need the worker process to be running non-stop. After some reading I found that the 'New Relic' monitoring addon can help keep the web process from idling, which is good, unless I will run out of the 1000 monthly hours.

Answer Source

Each line in the procfile will create a separate dyno, so if you can't let either process idle, 1000 hours is not enough. However, if you are ok with your web dyno idling after 30 minutes of inactivity, and presuming you don't have too much web traffic, you should be able to keep your worker process up 24/7, and your web process might consume less than approx. 250 dyno hours per month, so you could fit everything into the 1000 hour free tier.

Heroku should not be idling your worker process when your web process idles. Not sure why you wrote that you think it does.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download