[OpenSIPS-Devel] RFC: new opensips design

Dan Pascu dan at ag-projects.com
Mon Nov 10 05:57:06 CET 2008


On Sunday 09 November 2008, Stefan Sayer wrote:
> > You seem to forget that lots of threads/processes incur a significant
> > penalty from context switching, reaching a point where you spend more
> > time with context switching than with the actual processing. How many
> > threads do you figure you will need to fill up the CPU and keep it
> > busy? Because I can easily generate a lot of initial INVITES that
> > will block their processing for 15 seconds waiting on DNS lookups
> > from a hostile DNS server that doesn't respond to any queries. If I
> > generate only 1000 such requests per second, which I can do with
> > ease, you will need to create at least 15000 threads to keep them
> > busy all the time and avoid any I/O wait. At that point (in fact much
> > sooner than that), you will spend over 80% of time with context
> > switching between threads, thus your efficiency
>
> i doubt that.

This is based on a benchmark someone did, not on my assumptions.

> if these threads are in blocked waiting, they are 
> sleeping and do not consume CPU for context switching, right?

Right. However when they are in blocked wait they don't execute 
application code either, so in that state there is no need to share the 
CPU with anything. But when they wake up they have to share CPU between 
application code and context switching and that is where it counts.

-- 
Dan



More information about the Devel mailing list