I am trying to increase the performance of my lighttpd system by using SMP workers for multiple cores.It turns out that instead of improving the performance it is degrading it. I dont seem to understand why this is the case.
The documentation CLAIMS that it should scale linearly with the number of cores/processors when roughly twice the number of SMP workers are configured as the number of cores. I did the testing for core:worker ratios of 1:1
and 1:2
.
I am benchmarking this with ab
. My setup has 4 virtual cores.
Here are the test results done with a small document size
ab -n 10000 -c 50 http://localhost/index.html
1. Default(no smp workers)
Requests per second: 3581.99 [#/sec] (mean)
Time per request: 13.959 [ms] (mean)
Time per request: 0.279 [ms] (mean, across all concurrent requests)
Transfer rate: 1518.15 [Kbytes/sec] received
2. 8 SMP workers
Requests per second: 2292.12 [#/sec] (mean)
Time per request: 21.814 [ms] (mean)
Time per request: 0.436 [ms] (mean, across all concurrent requests)
Transfer rate: 971.46 [Kbytes/sec] received
3. 4 SMP workers
Requests per second: 2510.13 [#/sec] (mean)
Time per request: 19.919 [ms] (mean)
Time per request: 0.398 [ms] (mean, across all concurrent requests)
Transfer rate: 1063.86 [Kbytes/sec] received
These results make to sense to me. The results are easily repeatable also on any other machine. Infact as the machine becomes more powerful the degrading effect becomes more prominent. Any explanation?