> > 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...
[...@chuck Remes] > ... the "ulimit" command can be used to modify the default stack size > from a shell prior to launching your application. That worked really well, thanks. Writing a little wrapper that says: #!/bin/sh ulimit -s 32 ./usr/bin/testServer & decreased the %MEM reported by top from 19% to 5% (of 64MB total). This is comparable to the app I'm replacing. > > Also, for tcp, the buffers corresponding to SO_SNDBUF and SO_RCVBUF > > are probably defaulting to their maximums (128K each, I think). [...@chuck Remes] > Take a look at the man page for setsockopt(). There are accessors for > both send and receive buffers that you can use to tune the sizes. I set the snd/rcv buf sizes to 32K and this shaved off another 384KB. Not as dramatic a difference as changing the stack size, but it'll definitely help---particularly in the 'real' server when I'm servicing 4 or 5 clients. [...@martin Sustrik] > Also, have a look at src/config.hpp. in_batch_size and out_batch_size > define size of the internal 0MQ's buffers that it uses for batching > inbound/outbound data. Thanks for pointing this out. It's nice to know where the 'knobs' are if I need to reduce memory usage further. Things are looking pretty good now... _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
