Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Process Types and Dynos in Heroku

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)?
like image 455
Manuel RODRIGUEZ Avatar asked Oct 03 '17 13:10

Manuel RODRIGUEZ


People also ask

What are process types in Heroku?

There are three primary process types: Web dynos: receive HTTP traffic from routers and typically run web servers. Worker dynos: execute anything else, such as background jobs, queuing systems, and timed jobs. One-off dynos: are temporary and not part of an ongoing dyno formation.

What is dynos in Heroku?

As explained in Heroku's docs, Dynos are simply lightweight Linux containers dedicated to running your application processes. At the most basic level, a newly deployed app to Heroku will be supported by one Dyno for running web processes.

What are dyno types?

Dyno's type is related with the capability of processing and the amount of memory that your dyno will have. The existing types are: free, hobby, standard-1x, standard-2x, performance-m, and performance-l. Each type has different features.

How many dynos can you have on Heroku?

Default Scaling Limits By default, applications are limited to 100 total dynos across all process types. Apps running on eco , free , or hobby dynos can have only one dyno running per process type. Apps running on eco or free dynos are limited to a maximum of two concurrently running dynos.


1 Answers

  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.

like image 71
Michał Młoźniak Avatar answered Sep 29 '22 06:09

Michał Młoźniak