I'm interested in assigning different workloads to each worker of a particular type in Heroku. The workload is continuous rather than discrete so a work queue is not appropriate. I could coordinate work through a database or Zookeeper, but these bring complexity and reliability issues.
I know that Heroku dynos are assigned names like worker.1
but I'm curious how these names are assigned and if I can rely on them to have certain properties. I'm only interested in the behavior for worker dynos since web preboot probably changes the behavior for web dynos.
Specifically,
- Is it possible for two dynos to have the same name/number at the same time (I assume not for worker processes since the previous one should be shutdown or have failed before a new one is started)
- If the
ps:scale
for my worker isn
, can I rely on dyno names beingworker.1
,worker.2
...worker.n
or would I sometimes get numbers outside(1, n)
? If it is possible to get numbers outside(1, n)
under what circumstances might it happen?
I'm hoping to create a configuration that maps worker numbers to work assignments so I would rely on worker numbers to be exactly 1 to n.