March 28, 2014 10:48AM
Проблема заключается в периодическом "замирании" передачи статичного
файла, возникает в основном на высокоскоростных соединениях.
С включенным limit_rate 200k я ни разу не поймал проблему.
Включил debug_connection для одного тестового клиента, далее
отфильтрованные записи из лога (могу полный лог отправить если надо):
2014/03/28 16:09:44 [debug] 22512#0: *102725 HTTP/1.1 200 OK
Server: nginx/1.4.7
Date: Fri, 28 Mar 2014 12:09:44 GMT
Content-Type: application/octet-stream
Content-Length: 17775749
Connection: keep-alive
ETag: "532070bd-10f3c85"
Last-Modified: Fri, 2 Jan 1970 00:00:01 GMT
Accept-Ranges: bytes

2014/03/28 16:09:44 [debug] 22512#0: *102725 write new buf t:1 f:0
00000000072252E8, pos 00000000072252E8, size: 260 file: 0, size: 0
...
2014/03/28 16:09:44 [debug] 22512#0: *102725 write old buf t:1 f:0
00000000072252E8, pos 00000000072252E8, size: 260 file: 0, size: 0
2014/03/28 16:09:44 [debug] 22512#0: *102725 write new buf t:0 f:1
0000000000000000, pos 0000000000000000, size: 0 file: 0, size:
17775749
...
2014/03/28 16:09:44 [debug] 22512#0: *102725 writev: 260
2014/03/28 16:09:44 [debug] 22512#0: *102725 sendfile: @0 17775749
2014/03/28 16:09:44 [debug] 22512#0: *102725 sendfile: 3440640, @0
3440640:17775749
...
2014/03/28 16:09:44 [debug] 22512#0: *102725 write old buf t:0 f:1
0000000000000000, pos 0000000000000000, size: 0 file: 3440640, size:
14335109
2014/03/28 16:09:44 [debug] 22512#0: *102725 http write filter: l:1
f:0 s:14335109
2014/03/28 16:09:44 [debug] 22512#0: *102725 http write filter limit 0
2014/03/28 16:09:44 [debug] 22512#0: *102725 sendfile: @3440640 14335109
2014/03/28 16:09:44 [debug] 22512#0: *102725 sendfile() is not ready
(11: Resource temporarily unavailable)
2014/03/28 16:09:44 [debug] 22512#0: *102725 sendfile: -1, @3440640 0:14335109
2014/03/28 16:09:44 [debug] 22512#0: *102725 http write filter 0000000007225478
2014/03/28 16:09:44 [debug] 22512#0: *102725 http copy filter: -2 "/test.bin?"
2014/03/28 16:09:44 [debug] 22512#0: *102725 http writer output
filter: -2, "/test.bin?"
2014/03/28 16:09:44 [debug] 22512#0: *102725 event timer: 154, old:
1396008594706, new: 1396008594706
...
2014/03/28 16:09:54 [debug] 22512#0: *102725 event timer del: 154: 1396008594706
2014/03/28 16:09:54 [debug] 22512#0: *102725 http run request: "/test.bin?"
2014/03/28 16:09:54 [debug] 22512#0: *102725 http writer handler: "/test.bin?"
2014/03/28 16:09:54 [info] 22512#0: *102725 client timed out (110:
Connection timed out) while sending response to client, ...

В общем как мне кажется проблема где-то около "sendfile() is not ready
(11: Resource temporarily unavailable)"
Похожая ситуация возникает с sendfile off, но уже "writev() not ready
(11: Resource temporarily unavailable)"

Сервер используется для раздачи видео с модулями mp4/flv, GeoIP вместе
с if/set, lua подсчитывает попадания по каждому урлу в именованный
location @proxy с помощью lua_shared_dict, но по факту и без
выполнения lua возникают проблемы.
Перекомпилировал nginx с необходимыми модулями:
# nginx -V
nginx version: nginx/1.4.7
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-54)
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx
--conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log
--pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock
--http-client-body-temp-path=/var/cache/nginx/client_temp
--http-proxy-temp-path=/var/cache/nginx/proxy_temp
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp
--http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx
--group=nginx --add-module=../../SOURCES/ngx_devel_kit
--add-module=../../SOURCES/lua-nginx-module --with-select_module
--with-poll_module --with-rtsig_module --with-http_flv_module
--with-http_mp4_module --with-http_geoip_module
--with-http_stub_status_module --with-http_secure_link_module
--with-file-aio --with-cc-opt='-O2 -g -m64 -mtune=generic'

kernel 2.6.18-371.6.1.el5 (CentOS 5.10)

На время тестирования пробовал включать все опции по умолчанию,
тестовый файл отдельно от остального контента:
send_timeout 10s;
location = /test.bin {
root /cache/data3;
sendfile on;
}

В чем может быть проблема, в какую сторону копать?
_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

"Замирает" передача статичного файла

vitux March 28, 2014 10:48AM

Re: "Замирает" передача статичного файла

Валентин Бартенев March 28, 2014 12:06PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 135
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready