[zeromq-dev] Can I prevent zeromq from occupying file descriptors?

Alexander Poddey alexander.poddey at gmx.net
Tue Jul 19 17:49:08 CEST 2016


RESOURCE property seems to solve the issue when havin several 'services' via 
one tcp address; this is interesting, but not really my problem.

My point is, that (at least for me), every zmq_connect to a socket consumes 
one of linux/POSIX file descriptor. 

This however means that if a process spawns >NP< child processes and each 
child connects to one socket, the file discriptor costs is >NP<.

For me the limit is 1024 -> I can not have more than 1023 e.g. sub listening 
to the main processes pub socket.



Andriy Drozdyuk wrote:

> I don't know if RESOURCE property is available in C++ implementation yet
> (it's protocol version ZMTP 3.1):
> http://zmtp.org/page:read-the-docs#toc18
> You can use that... otherwise I've no idea.
> On Tue, 19 Jul 2016 at 09:55 Alexander Poddey <alexander.poddey at gmx.net>
> wrote:
>> Hi,
>> I have a setup in C++ on linux where a master process is setting up a
>> ZMQ_ROUTER and then forks many child processes, which then connect to
>> that router (tcp protocol).
>> Whenever a child zmq_connect's to the master, a file descriptor is
>> occupied (and assigned to the master process). They get free'ed fine when
>> the connection is close.
>> This however limits the number of interacting processes to the number of
>> allowed file descriptors (per process). For me (linux), this currently is
>> 1024, which is way to small for my intended use (multi-agent / swarm
>> simulation).
>> Can I prevent this behaviour?
>> In my mesaging architecture, each agent connects to 6 sockets, so with
>> 100 agents I end up with 600 occupied file descriptors :-(
>> Alexander
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

More information about the zeromq-dev mailing list