What is the difference between Process Types and Dynos in Heroku
Asked Answered
S

1

6

I subscribed a Hobby plan in Heroku.

The details of the plan specifies that it allows up to 10 Process Types.

So I developed an app with the following Procfile:

backend-dev: node ./backend-dev/backend.js
backend-prod: node ./backend-prod/backend.js

Which represents 2 Process Types, right ?

But when I run it with:

heroku ps:scale backend-dev=1
heroku ps:scale backend-prod=1

I end up with two Hobby Dynos... As the plan also specifies 7€/month/Dyno I am billed 14€/month.

So my questions are:

  1. What is the difference between Process Types and Dynos?
  2. Can I run 2 Process Types within a single Dyno?
  3. Can I run for instance 1 free Dyno (for backend-dev) and 1 Hobby Dyno (for backend-prod)?
Subaudition answered 3/10, 2017 at 13:51 Comment(0)
E
7
  1. Consider this simple example of web application with background worker, so it has web process and worker process. When such app receives a lot of web traffic, but processes very few background jobs, you can increase the number of dynos for your web process, but have only one dyno for worker process. It is also possible to have different dyno size per process. Instead of using more dynos, you can use performance-l dyno for web process and standard-1x for worker process. In other words, Process Types describe different processes that are working together within one application. They are not supposed to be different applications like in your case.

  2. No. You can run one Process Type on multiple dynos.

  3. Technically you can run one process on free dyno and another on hobby, but it won't work in your case. When you upgrade to professional dynos, then all processes must run on professional dynos.

Your Procfile is all wrong. You must have Process Type name web to receive web traffic. If you start your current setup, you will be running two processes, but they will never receive any web requests. It is described in Heroku docs, only web process can receive web traffic and you can only have one such process. So to run two versions of your app, you need to create two different Heroku applications. And ideally you should allow to configure your app via environmental variables so you can deploy the same code to both apps.

Enterogastrone answered 4/10, 2017 at 22:25 Comment(1)
Thanks, but my apps aren't supposed to receive web requests because they are actually listening changes in a Firebase DB.Subaudition

© 2022 - 2024 — McMap. All rights reserved.