Несколько непонятностей по nginx

Александр Ворона voron at amhost.net
Wed Apr 25 20:46:32 MSD 2007


Igor Sysoev пишет:
> On Wed, Apr 25, 2007 at 04:17:51PM +0300, Александр Ворона wrote:
> 
>> Александр Ворона пишет:
>> попробовал сам - нужный эффект достигнут. Скорость других закачек с 
>> этого воркера падает очень значительно при наличии закачки со 127.0.0.1, 
>> sendfile отрабатывает примерно по 1сек при отдаче ~90Мбайт/сек с диска.
> 
> А что показывает ktrace -t cn -p worker_pid ? Какие куски отдаёт sendfile
> за раз ?

kdump -f ktrace.out > trace
grep -c "CALL  sendfile" trace
239

качал 8G файл.
wget -Y off -O /dev/null http://127.0.0.1:81/3.tmp
--10:49:45--  http://127.0.0.1:81/3.tmp
            => `/dev/null'
Connecting to 127.0.0.1:81... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8,589,934,592 (8.0G) [application/octet-stream]

100%[================================================================================>] 
8,589,934,592   86.88M/s    ETA 00:00

10:51:24 (82.49 MB/s) - `/dev/null' saved [8589934592/8589934592]

Итого в среднем 34М на вызов

вот кусок trace
   4181 nginx    RET   kevent 1
   4181 nginx    CALL  gettimeofday(0xbf7fe9e8,0)
   4181 nginx    RET   gettimeofday 0
   4181 nginx    CALL 
sendfile(0x9,0x6,0xf03e7000,0x1,0xfc19000,0xbf7fe650,0xbf7fe248,0)
   4181 nginx    RET   sendfile -1 errno 35 Resource temporarily unavailable
   4181 nginx    CALL  kevent(0x8,0x80a3000,0,0x80b4000,0x200,0xbf7fea90)
   4181 nginx    RET   kevent 1
   4181 nginx    CALL  gettimeofday(0xbf7fe9e8,0)
   4181 nginx    RET   gettimeofday 0
   4181 nginx    CALL 
sendfile(0x9,0x6,0xf0862000,0x1,0xf79e000,0xbf7fe650,0xbf7fe248,0)
   4181 nginx    RET   sendfile -1 errno 35 Resource temporarily unavailable
   4181 nginx    CALL  kevent(0x8,0x80a3000,0,0x80b4000,0x200,0xbf7fea90)
   4181 nginx    RET   kevent 1
   4181 nginx    CALL  gettimeofday(0xbf7fe9e8,0)
   4181 nginx    RET   gettimeofday 0
   4181 nginx    CALL 
sendfile(0x9,0x6,0xf262e000,0x1,0xd9d2000,0xbf7fe650,0xbf7fe248,0)
   4181 nginx    RET   gettimeofday 0
   4181 nginx    CALL 
sendfile(0x9,0x6,0xb6896000,0x1,0x4976a000,0xbf7fe650,0xbf7fe248,0)
   4181 nginx    RET   sendfile -1 errno 35 Resource temporarily unavailable
   4181 nginx    CALL  kevent(0x8,0x80a3000,0,0x80b4000,0x200,0xbf7fea90)
   4181 nginx    RET   kevent 1
   4181 nginx    CALL  gettimeofday(0xbf7fe9e8,0)
   4181 nginx    RET   gettimeofday 0
   4181 nginx    CALL 
sendfile(0x9,0x6,0xb81a4000,0x1,0x47e5c000,0xbf7fe650,0xbf7fe248,0)
   4181 nginx    RET   sendfile -1 errno 35 Resource temporarily unavailable
   4181 nginx    CALL  kevent(0x8,0x80a3000,0,0x80b4000,0x200,0xbf7fea90)
   4181 nginx    RET   kevent 1

ну и для верности кусок strace с таймингами
10:50:03.549899 gettimeofday({0, 0}, NULL) = 0
10:50:03.549945 syscall_393(0x9, 0x6, 0x60ad4000, 0, 0x7ffff000, 
0xbf7fe650, 0xbf7fe248, 0) = -1 (errno 35)
10:50:04.080867 kevent(0x8, 0x80a3000, 0, 0x80b4000, 0x200, 0xbf7fea90) = 1
10:50:04.080937 gettimeofday({0, 0}, NULL) = 0
10:50:04.080991 syscall_393(0x9, 0x6, 0x63975000, 0, 0x7ffff000, 
0xbf7fe650, 0xbf7fe248, 0) = -1 (errno 35)
10:50:04.161813 kevent(0x8, 0x80a3000, 0, 0x80b4000, 0x200, 0xbf7fea90) = 1
10:50:04.161902 gettimeofday({0, 0}, NULL) = 0
10:50:04.161948 syscall_393(0x9, 0x6, 0x640b3000, 0, 0x7ffff000, 
0xbf7fe650, 0xbf7fe248, 0) = -1 (errno 35)
10:50:05.573149 kevent(0x8, 0x80a3000, 0, 0x80b4000, 0x200, 0xbf7fea90) = 1
10:50:05.573204 gettimeofday({0, 0}, NULL) = 0

секунды полторы есть, значит метров 120 за раз
> 
> Похоже, нужно директиву вкючать в дистрибутив, но название sendfile_limit
> мне не нравится. Нужно название, отражающее смысл "за один раз".
> 
sendfile_max_chunk ?





More information about the nginx-ru mailing list