[zeromq-dev] [PATCH] Scalability improvements for large amounts of connections

Martin Lucina mato at kotelna.sk
Thu Oct 14 18:19:23 CEST 2010


Hi Dhammika,

dhammika at gmail.com said:
> >
> > +int zmq::zmq_connecter_t::get_reconnect_period ()
> > +{
> > +#if defined ZMQ_HAVE_WINDOWS
> > +    return (reconnect_period + (((int)GetCurrentProcessId () * 13)
> > +        % reconnect_period));
> > +#else
> > +    return (reconnect_period + (((int)getpid () * 13) % reconnect_period));
> > +#endif
> > +}
> > +
> 
> 
> This could throw a SIGFPE (floating point exception).
> Do we check for reconnect_period > 0?

No, but if you set reconnect_period to 0 then any number of things will
break. I'd not worry about that too much; changing stuff in config.hpp is
something 90% or more people will never touch.

Incidentally if you can think of a better distribution function than the
getpid() based one I wrote, go for it. That was just a quick hack to get
300 nodes all reconnecting at the same time to not hammer the server.

-mato



More information about the zeromq-dev mailing list