I wrote the following script as a test and it appears it’s only being server to two clients at a time:
<?php
$time = time();
$timediff = 0;
do
{
$timediff = time() - $time;
usleep(1);
}while($timediff <= 1);
echo date('G:i:s', $time)." - ".date('G:i:s', time());
?>
Result for a LAMP server:

Each thread seems to be correctly started at the same time, confirmed by the result (what php echo’d back) and every 2 new threads to indeed take an extra 2 seconds (time) to finish.
Each script seems to be taking 2 seconds to finish, after which the following 2 are served. This is just stupid, because now I have a quad core 3.2 GHz server with 12GB RAM queueing people for no good reason. It may be worth to mention that according to htop (a system monitor) only two CPU cores are being used by apache2.
I tried the script again on a debian-squeeze server running lighttpd and php5-fpm, which is a completely different setup, but it gave the same results. I’m not sure if it’s bad coding or something else..
I already tried commenting out the usleep() but that nets the exact same results, except for the fact that htop then shows CPU usage at 100% on all (both) cores. With usleep on 1 it shows a usage of 15% on each core, and with usleep on 500 it’s barely reaching 6% each, confirming that the server should be able to serve way more pages than 2 at a time.
Can anyone tell me why this happens?
How exactly are you running those tests? If your benchmarking-software only does 2 requests simultaneously, it makes sense you only get 2 at a time.
You could try out ab also known as apache benchmark. You can set the amount of simultaneous request using a parameter.