[zeromq-dev] Reduce zeromq memory usage?

David Wolfe evadeflow at gmail.com
Fri Oct 15 19:43:19 CEST 2010

Hi, all--

Can anyone offer advice on how to reduce zeromq's memory usage for an
embedded app?  I think zmq_init() uses the default stack size (8192 KB
in Linux), which is a pretty big chunk when you've only got 64MB to work
with(!)  Does zeromq provide an API for controlling this, or is it
better handled through OS mechanisms?

Also, for tcp, the buffers corresponding to SO_SNDBUF and SO_RCVBUF are
probably defaulting to their maximums (128K each, I think).  For my app,
each client has two sockets, so that could mean 2 * 2 * 128K, or half a
meg per client.  This could probably be decreased by an order of
magnitude for my app, so... same question: can this be controlled via
the API, or are there system calls I should make to do this?

My simple pub/sub test client and server currently claim to be using 19%
of available memory in 'top'. I've got to get this down in the range of
5-7% before I show my colleagues.  (This is the reported usage for the
app[s] I'm replacing.)

Any advice much appreciated! And thanks to all who provided feedback on
my 'make zeromq load faster' post.  I've got a green light to go ahead
and give it a try...

More information about the zeromq-dev mailing list