worker cpu balance
Igor Sysoev
is at rambler-co.ru
Sun Apr 13 12:36:43 MSD 2008
On Sun, Apr 13, 2008 at 03:04:20AM +0200, Aleksandar Lazic wrote:
> Hi all,
>
> during the testing with the donated 10GB network cards of Myricom to the
> haproxy project http://haproxy.1wt.eu/ I have asked the author of this
> nice peace of SW if he will be so pleasent to run a test with nginx
> instead of tux. He was ;-))
>
> Here the description of his test with haproxy
> http://haproxy.1wt.eu/10g.html and now what he have send me back from
> his tests with nginx.
>
> ---
> It works fast. Since it uses sendfile, it is as fast as Tux on large
> files (>= 1MB), and saturates 10 Gbps with 10% of CPU with 1MB files.
>
> However, it does not scale on multiple CPUs, whatever the number of
> worker_processes. I've tried 1, 2, 8, ... The processes are quite there,
> but something's preventing them from sharing a resource since the
> machine never goes beyond 50% CPU used (it's a dual core). Sometimes,
> "top" looks like this :
>
> Tasks: 189 total, 3 running, 186 sleeping, 0 stopped, 0 zombie
> Cpu0 : 40.3% user, 55.2% system, 0.0% nice, 4.5% idle, 0.0% IO-wait
> Cpu1 : 2.7% user, 1.3% system, 0.0% nice, 96.0% idle, 0.0% IO-wait
> Mem: 2072968k total, 92576k used, 1980392k free, 11604k buffers
> Swap: 0k total, 0k used, 0k free, 25656k cached
>
> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ Command
> 1984 nobody 20 0 2980 996 492 S 34.7 0.0 0:49.85 nginx.bin
> 1986 nobody 20 0 2980 992 488 S 34.7 0.0 0:51.91 nginx.bin
> 1980 nobody 20 0 2980 996 492 S 25.8 0.0 0:47.29 nginx.bin
> 1983 nobody 20 0 2980 996 492 S 2.0 0.0 0:48.07 nginx.bin
> 1988 nobody 20 0 2980 996 492 R 2.0 0.0 0:45.75 nginx.bin
>
> Sometime it looks like this :
>
> Tasks: 188 total, 2 running, 186 sleeping, 0 stopped, 0 zombie
> Cpu0 : 12.7% user, 12.7% system, 0.0% nice, 74.6% idle, 0.0% IO-wait
> Cpu1 : 32.4% user, 39.4% system, 0.0% nice, 28.2% idle, 0.0% IO-wait
> Mem: 2072968k total, 92820k used, 1980148k free, 11604k buffers
> Swap: 0k total, 0k used, 0k free, 25660k cached
>
> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ Command
> 1985 nobody 20 0 2980 996 492 R 53.7 0.0 0:48.14 nginx.bin
> 1982 nobody 20 0 2980 992 488 S 31.8 0.0 0:39.40 nginx.bin
> 1986 nobody 20 0 2980 992 488 S 8.0 0.0 0:54.71 nginx.bin
> 1988 nobody 20 0 2980 996 492 S 5.0 0.0 0:48.79 nginx.bin
> 1983 nobody 20 0 2980 996 492 S 2.0 0.0 0:52.20 nginx.bin
Try
events {
accept_mutex off;
...
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list