[zeromq-dev] State of Erlang SMP with ZeroMQ

Martin Sustrik sustrik at 250bpm.com
Tue Jun 21 08:59:36 CEST 2011

Hi Yusuf,

> A prior thread suggests that issues with running Erlang SMP + ZeroMQ
> have been resolved thanks to socket migration [1].
> This is awesome, but I was wondering what exactly goes on during socket
> migration. Erlang SMP generally has one kernel thread for each CPU, and
> a shared queue from which the threads pull jobs to execute [2].
> Consequently, AFAICS, ZeroMQ sockets will regularly migrate from one
> thread to another. If migration is an expensive process, this would
> likely cause the Erlang implementation to perform poorly with SMP enabled.

Migration happens behind 0MQ's back. Erlang chooses to use the 0MQ 
socket from another thread and does so without notifying 0MQ about the 
fact. Thus, there's zero overhead.

The fix you are referring to ensured that the 0MQ codebase makes no 
assumptions about a socket being tied to a particular thread (such as 
using thread-local storage etc.)


More information about the zeromq-dev mailing list