[Xorp-hackers] xorp-ospf performance issues: busy-spins & packet floods.

Pavlin Radoslavov pavlin at icir.org
Fri Oct 19 22:49:16 PDT 2007


> > The eventloop is used to handle different events (I/O, timers,
> > tasks) and in the process it is calling select(2) probably more than
> > necessary. E.g., it needs to find the event with the highest
> > priority and the login for doing that probably could be optimized to
> > reduce some of the system calls.
> > This is probably the reason why you see the FEA calling select(2)
> > several times, but this is just a speculation.
> >   
> I've had good luck in other applications doing something like:
> 
> while (1) {
>     clear_fds, set timeout large, maxdesc to 0
>     //let each module recursively set fds it's interested in
>     MainObjectCollection::instance().setFds(&input_set, &output_set, 
> &exc_set,
>                                      maxdesc, sleep_for, now);
>     call select() on the fds with appropriate 'sleep_for' timeout
>     // when done, we have either hit a timeout (ie, timer fired)
>     // or we have IO ready.  Pass in 'now' so that objects don't have to 
> be doing system calls to get the time so often.
>    now  = getCurTime();
>    MainObjectCollection::instance().tick(&input_set, &output_set, 
> &exc_set, now);
> }

Earlier versions of the eventloop were using similar logic.
Since then the eventloop has been extended to support priority and
tasks and this makes things more complicated.

> Even if you keep to your current architecture, I can't see any reason to 
> call select if you
> are not going to read the descriptors immediately after the select.  If 
> you just want to sleep
> and not read fds, just send in null pointers to select() and it will 
> sleep appropriately (within ~10ms accuracy or so).

See SelectorList::get_ready_priority() inside libxorp/selector.cc
for example.
It is used to find the best priority of a file descriptor that is
ready.

I should make it clear that I understand there is a performance
problem that needs to be addressed, so I am not defending the
current implementation.
Please submit a bugzilla entry about the issue so later we can look
at it more carefully.

Thanks,
Pavlin



More information about the Xorp-hackers mailing list