[zeromq-dev] patch: handle idle connections

Dhammika Pathirana dhammika at gmail.com
Wed Mar 25 09:24:28 CET 2009

On Tue, Mar 24, 2009 at 2:13 AM, Martin Sustrik <sustrik at fastmq.com> wrote:
> Dhammika,
> Wow! You are the first person out there who ever dared to touch 0MQ core
> code :)

Cool, 0MQ is neat :)

> And there's actually a token in the bug tracker to do this kind of thing:
> http://jira.fastmq.org/browse/ZMQ-130
> Your patch goes it the right direction by eliminating the need to browse
> over large number of pipes that are idle anyway, however, on the other hand
> it introduces a new problem of it's own:
> -        typedef std::vector <pipe_t*> pipes_t;
> +        typedef std::list <pipe_t*> pipes_t;
> This means that every time pipe is moved from one list to another one
> deallocation (free) and one allocation (malloc) is done - list stores its
> elements in dynamically allocated slots.
> This may become a problem in scenarios where lot of pipes are swiftly moving
> between active and idle states (mostly reqest/reply or ping-pong style
> scenarios).

Thanks a lot for checking this.
Yes, malloc/free will be pretty bad in req/res case.
My tests were done over loopback on a duel core, guess they weren't
very realistic.
I like linked list concept, but wonder if a bitmap would work better
to index active/idle pipes.


More information about the zeromq-dev mailing list