[syslog-ng] time_sleep() and inadvertent admission control

John Morrissey jwm at horde.net
Mon Jan 28 23:31:39 CET 2008


On Sat, Jan 26, 2008 at 03:18:56PM +0100, Balazs Scheidler wrote:
> On Thu, 2008-01-24 at 14:18 -0500, John Morrissey wrote:
> > We noticed recently that time_sleep() exhibits some inadvertent
> > admission control behavior. When poll() indicates that the listener
> > socket has activity (new connections), syslog-ng seems to accept() only
> > once on it, allowing one new connection per poll(). As a result, it only
> > allows:
> > 
> >   1000 / time_sleep()
> > 
> > connections per second. Accordingly, with time_sleep(30), only 33
> > connections would be allowed every second. 
> 
> Thanks for the detailed analysis (and for the original idea too :), I
> think the following solutions exist:
> 
>  * do multiple accepts per poll loop; or
>  * increase the I/O priority for the listeners
> 
> The first one easily increases the incoming connection rate and is
> simple to implement, the second is more complex and might cause further
> unexpected behaviour:
> 
> if the priority of the listeners is increased, that would mean that any
> incoming connection might starve the incoming message stream, e.g. if
> there's a continous stream of incoming connections, then long-living
> connections might be starved.
> 
> So I'd choose the first option, what do you think?

I agree; seems like accept(2)ing a number of times in the loop avoids this
problem with minimal possibility of collateral damage.

john
-- 
John Morrissey          _o            /\         ----  __o
jwm at horde.net        _-< \_          /  \       ----  <  \,
www.horde.net/    __(_)/_(_)________/    \_______(_) /_(_)__


More information about the syslog-ng mailing list