Reducing select() usage under load
Erik Rozendaal
erik at deler.org
Fri May 12 19:41:11 UTC 2006
Aaron Hopkins wrote:
> It is hard and expensive if you want to ensure perfect fairness and
> interleave responses from every socket. But I think there a compromise
> available between perfect fairness and only answering requests from one
> socket when it is flooded.
>
> Changing that while(1) I added to something that would only loop up to a
> fixed number of times (e.g. 100) would be trivial. You'd still amortize
> the
> cost of the select() over many UDP packets, without being able to starve
> other sockets for more than a few milliseconds. You'd concentrate on work
> from one socket, then switch to the next one and do everything pending
> up to
> the same limit. And the performance gains would be approximately the same.
Yes, that could certainly work. And like you measured, saving on
select() makes a huge difference for NSD since it spends a lot of its
time in system calls :)
Regards,
Erik
More information about the nsd-users
mailing list