How many CPU cores does a Heroku Dyno have?
Asked Answered
A

3

29

I'm using Django with Celery 3.0.17 and now trying to figure out how many celery workers are run by default.

From this link I understand that (not having modified this config) the number of workers must be currently equal to the number of CPU cores. And that's why I need the former. I wasn't able to find an official answer by googling or searching Heroku's dev center. I think it's 4 cores as I'm seeing 4 concurrent connections to my AMQP server, but I wanted to confirm that.

Auxiliaries answered 9/4, 2013 at 19:36 Comment(0)
R
40

The number of CPUs is not published and is subject to change, but you can find out at runtime by running grep -c processor /proc/cpuinfo.

Rankin answered 12/6, 2013 at 7:1 Comment(4)
when I run grep -c processor /proc/cpuinfo in my 1x heroku dynos, the result is 4Mush
For me it was 8 on X1 dynoStotinka
As of current date, I get 8 for Standard-1X, 8 for Standard-2X, 2 for Performance-M, and 8 for Performance-L.Hamann
If anyone is not sure with the command, it's heroku run grep -c processor /proc/cpuinfo :)Dayton
G
16

According to https://blog.heroku.com/archives/2014/2/3/heroku-xl

|       | 1X Dyno      | Performance Dyno  |
|-------|--------------|-------------------|
| RAM   | 512 MB       | 6 GB              |
|       | 1x - 4x      | 40x (8 CPU cores) |
| Price | $0.05 / hour | $0.80 / hour      |

The 2X dynos also have 4 cores:

$ heroku run --size=2X grep -c processor /proc/cpuinfo --app app-name
Running grep -c processor /proc/cpuinfo on app-name... up, run.3685
4

But the PX dynos have 8 cores:

$ heroku run --size=PX grep -c processor /proc/cpuinfo --app app-name
Running grep -c processor /proc/cpuinfo on app-name... up, run.4731
8
Garrison answered 6/10, 2015 at 20:51 Comment(1)
This answer is now very outdated. Runing the same cpuinfo test against the 4 current dyno types gives you: Standard-1x: 8 Standard-2x: 8 Performance-M: 2 Performance-L: 8Combes
H
6

The heroku puma documentation suggests that you can find this out by running nproc on a dyno:

So, for example, to see how many are on performance-m, running:

$ heroku run bash --size=performance-l
$ nproc
8

But then dividing by 2, because:

The value returned by nproc includes “hyperthreads” in addition to physical cores, the combination of these two are refered to as the vCPU count. All physical cores used on Heroku have a hyperthread so to gain the “true” number of physical cores divide by two.

Which would mean performance-l has 4 CPUs.

When I do the same on performance-m, I get 2, meaning actually only 1 CPU.

Standard-1x and Standard-2x both have nproc tell me "8", meaning 4 CPUs, but the heroku puma documentation warns that these CPUs are shared with other users since standard dynos are multi-tenant.

The value for nproc from free, hobby, standard-1x, and standard-2x dynos are correct, but these cores are shared between multiple applications running in containers. While nproc for these dynos will all return 8, it is best to assume only one process can execute at a time.

Huldahuldah answered 17/11, 2020 at 17:1 Comment(1)
Im confused why PerformanceM is returning 2...... and if i further divide by 2 that gives me 1??Goahead

© 2022 - 2024 — McMap. All rights reserved.