httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Graham Leggett <minf...@sharp.fm>
Subject Re: C as config
Date Tue, 08 Jun 2010 23:21:46 GMT
On 07 Jun 2010, at 11:46 PM, Akins, Brian wrote:

>> With multi-core architectures, we're finding that humble worker on  
>> our
>> commodity hardware is as fast or faster than our load balancers.
>
> +1
>
> We soon found that the web servers spends more time doing context  
> switches
> than actual work. (Or so it seems, probably a slight exaggeration).   
> Imagine
> httpd with 100k threads!!! Now imagine the same amount of "work"  
> being done
> in 2 threads.  Not terribly hard to do in an asynchronous framework.

One of the php guys sent through this to us not so long ago, which  
goes into the gory technical details of multicore architectures, and  
precisely where you slow down and why:

http://lwn.net/Articles/250967/

It shows just how expensive context switching has become. When you  
have work to do, ideally if you can get away with a simple prefork  
server that shares as little as humanly possible between processes,  
you get a massive increase in speed from your CPU caches, which don't  
have to contend with one another.

If your code can fit completely into a CPU cache it is also a huge  
win, which is is why something plain and simple like C can be so much  
faster than an interpreted language (or faster than you might expect  
it to be). That said, if your server doesn't have work to do, ie  
you're just a bit-shifter, then a simple async loop will win hands down.

Regards,
Graham
--


Mime
View raw message