Nginx-ru mailing list archive (nginx-ru@sysoev.ru)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
accept_mutex и epoll
Здравствуйте.
Заметил интересную особенность, что с выключенным параметром
accept_mutex off и при использовании epoll, - nginx неравномерно
распределяет задачи между воркерами, независимо от общего
количества воркеров.
При новом соединении fastcgi, прикрученный к nginx, решает отдавать
ли файл клиенту путём X-Accel-Redirect или средиректить подальше.
Стоит ограничение на 3 коннекта до файла с ip-адреса.
Для наглядности использование 16ти воркеров.
Active connections: 470
server accepts handled requests
194410 194410 196069
Reading: 15 Writing: 425 Waiting: 30
root 4986 0.0 0.0 105000 488 ? Ss 09:30 0:00 nginx:
master process /usr/local/nginx/sbin/nginx
nobody 4987 0.0 0.0 105160 1128 ? S 09:30 0:00 nginx:
worker process
nobody 4988 0.1 0.0 105160 1200 ? S 09:30 0:00 nginx:
worker process
nobody 4989 0.1 0.0 105160 1176 ? S 09:30 0:00 nginx:
worker process
nobody 4990 0.1 0.0 105160 1192 ? S 09:30 0:00 nginx:
worker process
nobody 4991 0.1 0.0 105160 1172 ? S 09:30 0:00 nginx:
worker process
nobody 4992 0.2 0.0 105288 1248 ? S 09:30 0:00 nginx:
worker process
nobody 4993 0.1 0.0 105160 1172 ? S 09:30 0:00 nginx:
worker process
nobody 4994 0.2 0.0 105160 1240 ? S 09:30 0:00 nginx:
worker process
nobody 4995 0.4 0.0 105420 1480 ? S 09:30 0:00 nginx:
worker process
nobody 4996 0.2 0.0 105160 1208 ? S 09:30 0:00 nginx:
worker process
nobody 4997 0.4 0.0 105292 1304 ? S 09:30 0:00 nginx:
worker process
nobody 4998 0.5 0.0 105420 1408 ? S 09:30 0:00 nginx:
worker process
nobody 4999 1.4 0.0 106048 2048 ? S 09:30 0:00 nginx:
worker process
nobody 5000 1.7 0.0 106292 2368 ? S 09:30 0:00 nginx:
worker process
nobody 5001 3.2 0.0 107328 3400 ? S 09:30 0:01 nginx:
worker process
nobody 5002 0.3 0.0 105288 1328 ? S 09:30 0:00 nginx:
worker process
strace -rp 5001
0.003729 sendfile64(80, 144, [214611750], 518723802) = 63888
0.000099 sendfile64(153, 161, [579022769], 154292303) = 71298
0.000110 sendfile64(36, 50, [259638363], 473676709) = 95832
0.000139 sendfile64(130, 138, [817406163], 418968116) = 93600
0.000059 sendfile64(106, 113, [379293086], 316409910) = 518400
0.061436 sendfile64(131, 133, [1185271275], 376758805) = 127776
0.000118 sendfile64(176, 180, [471314155], 1091547413) = 283140
0.002180 sendfile64(243, 256, [448979514], 1019177666) = 64800
0.000065 sendfile64(240, 241, [40881853], 1427919171) = 241032
0.001439 sendfile64(16, 18, [624171750], 844283162) = 191664
0.000100 sendfile64(207, 233, [299333088], 470728787) = 255552
0.000129 sendfile64(77, 291, [312522764], 447597074) = 75504
0.000122 sendfile64(186, 189, [880238754], 587669342) = 139680
0.000106 sendfile64(224, 234, [471687747], 262315453) = 174240
0.000095 close(331) = 0
0.000071 recv(248, 0x8302010, 1024, 0) = -1 EAGAIN (Resource temporarily
unavailable)
0.000055 epoll_wait(43, {{EPOLLOUT, {u32=135077552, u64=135077552}},
{EPOLLOUT, {u32=135084353, u64=135084353}},
{EPOLLOUT, {u32=135083233, u64=135083233}}, {EPOLLOUT, {u32=135081392,
u64=135081392}},
{EPOLLOUT, {u32=135089552, u64=135089552}}, {EPOLLOUT, {u32=135083552,
u64=135083552}},
{EPOLLOUT, {u32=135079873, u64=135079873}}, {EPOLLOUT, {u32=135082032,
u64=135082032}},
{EPOLLOUT, {u32=135076833, u64=135076833}}, {EPOLLOUT, {u32=135085392,
u64=135085392}},
{EPOLLOUT, {u32=135078913, u64=135078913}}, {EPOLLOUT, {u32=135088833,
u64=135088833}},
{EPOLLOUT, {u32=135080513, u64=135080513}}, {EPOLLOUT, {u32=135084752,
u64=135084752}},
{EPOLLOUT, {u32=135088192, u64=135088192}}, {EPOLLOUT, {u32=135077312,
u64=135077312}},
{EPOLLOUT, {u32=135078432, u64=135078432}}, {EPOLLOUT, {u32=135090272,
u64=135090272}},
{EPOLLOUT, {u32=135087712, u64=135087712}}, {EPOLLOUT, {u32=135087153,
u64=135087153}},
{EPOLLOUT, {u32=135085073, u64=135085073}}, {EPOLLOUT, {u32=135081952,
u64=135081952}},
{EPOLLOUT, {u32=135087792, u64=135087792}}, {EPOLLOUT, {u32=135087873,
u64=135087873}},
{EPOLLOUT, {u32=135083713, u64=135083713}}, {EPOLLOUT, {u32=135088112,
u64=135088112}},
{EPOLLOUT, {u32=135080593, u64=135080593}}, {EPOLLOUT, {u32=135085472,
u64=135085472}},
{EPOLLOUT, {u32=135086193, u64=135086193}}, {EPOLLOUT, {u32=135094032,
u64=135094032}},
{EPOLLOUT, {u32=135076672, u64=135076672}}, {EPOLLOUT, {u32=135078752,
u64=135078752}},
{EPOLLOUT, {u32=135084913, u64=135084913}}, {EPOLLOUT, {u32=135085872,
u64=135085872}},
{EPOLLOUT, {u32=135079152, u64=135079152}}, {EPOLLOUT, {u32=135080272,
u64=135080272}},
{EPOLLOUT, {u32=135077233, u64=135077233}}, {EPOLLOUT, {u32=135079792,
u64=135079792}},
{EPOLLOUT, {u32=135079393, u64=135079393}}, {EPOLLOUT, {u32=135082272,
u64=135082272}},
{EPOLLOUT, {u32=135085632, u64=135085632}}, {EPOLLOUT, {u32=135082513,
u64=135082513}},
{EPOLLOUT, {u32=135078672, u64=135078672}}, {EPOLLOUT, {u32=135086832,
u64=135086832}},
{EPOLLOUT, {u32=135080992, u64=135080992}}, {EPOLLOUT, {u32=135084592,
u64=135084592}},
{EPOLLOUT, {u32=135085313, u64=135085313}}, {EPOLLOUT, {u32=135083392,
u64=135083392}},
{EPOLLOUT, {u32=135090672, u64=135090672}}, {EPOLLOUT, {u32=135082752,
u64=135082752}},
{EPOLLOUT, {u32=135087073, u64=135087073}}, {EPOLLOUT, {u32=135083953,
u64=135083953}},
{EPOLLOUT, {u32=135077952, u64=135077952}}, {EPOLLOUT, {u32=135088752,
u64=135088752}},
{EPOLLOUT, {u32=135079232, u64=135079232}}, {EPOLLOUT, {u32=135090112,
u64=135090112}},
{EPOLLOUT, {u32=135084993, u64=135084993}}}, 512, 6) = 57
При использовании poll, select - клиенты раскидываются равномерно.
nginx version: nginx/0.7.5
configure arguments: --with-http_stub_status_module --with-select_module
--with-poll_module
|