2

I've been working on a series of automatic load-testing scripts, and I've noticed that when averaged out, there's no difference between running a cluster of 2 processes and 4 processes on a Heroku dyno (in this case, a Hapi.js server which just immediately returns a reply), despite the dyno reporting itself as having four available CPUs. The difference between 1 and 2 processes is huge, nearly a 100% increase in throughput.

My guess is Intel CPUs / hyperthreading reporting twice as many cores as are actually available, and Node doesn't really benefit from the benefits in scheduling, but there seems to be very little information available about the specs on Heroku dynos. Is this accurate, or is there another reason performance caps out at 2 threads on a server with no I/O?

ThreeHams
  • 125
  • 1
  • 7

1 Answers1

2

This is due to several reasons:

  • Heroku dynos are running on a shared EC2 server -- this means the CPU is being split up between you and X amount of other users.
  • Depending on how much CPU is utilized by your neighbors, you might have better / worse performance.
  • Your CPU is going to be your biggest bottleneck on Heroku (and with Node in general).

If you're doing CPU intensive stuff, you'll need to scale horizontally across dynos. If you're doing IO intensive stuff, you should be fine vertically scaling to large dynos over time =)

UPDATE: To add more info here, this is the way virtualization works. EC2 boxes (and any linux servers) will always report the total number of CPUs of the core machine, not the VM. Hope that helps

rdegges
  • 32,786
  • 20
  • 85
  • 109
  • I understand the shared environment (because of it, I have to run load tests 5 times and average the results), but I'm curious about why Heroku dynos will self-report as having 4 available CPUs, despite not seeing any benefit from more than 2 processes. – ThreeHams Nov 21 '14 at 17:28
  • That's just an artifact of the way ubuntu's virtualization works. EC2 boxes (and any linux server) will always report the total number of CPUs on the core machine -- not the VM. That's just the way the kernel works when booted up. – rdegges Nov 21 '14 at 18:37
  • Can you edit your answer to include that information, since it's the question I was asking? I can accept it right after that. – ThreeHams Dec 02 '14 at 05:18