<div dir="ltr"><div dir="ltr"><pre cols="72"><div><font face="arial"><span style="white-space:normal">Проблема заключается в периодическом "замирании" передачи статичного файла, возникает в основном на высокоскоростных соединениях. </span></font></div>
<div><font face="arial"><span style="white-space:normal">С включенным limit_rate 200k я ни разу не поймал проблему.</span></font></div><div><font face="arial"><span style="white-space:normal">Включил debug_connection для одного тестового клиента, далее отфильтрованные записи из лога (могу полный лог отправить если надо):</span></font></div>
<div><font face="arial"><span style="white-space:normal">2014/03/28 16:09:44 [debug] 22512#0: *102725 HTTP/1.1 200 OK</span></font></div><div><font face="arial"><span style="white-space:normal">Server: nginx/1.4.7</span></font></div>
<div><font face="arial"><span style="white-space:normal">Date: Fri, 28 Mar 2014 12:09:44 GMT</span></font></div><div><font face="arial"><span style="white-space:normal">Content-Type: application/octet-stream</span></font></div>
<div><font face="arial"><span style="white-space:normal">Content-Length: 17775749</span></font></div><div><font face="arial"><span style="white-space:normal">Connection: keep-alive</span></font></div><div><font face="arial"><span style="white-space:normal">ETag: "532070bd-10f3c85"</span></font></div>
<div><font face="arial"><span style="white-space:normal">Last-Modified: Fri, 2 Jan 1970 00:00:01 GMT</span></font></div><div><font face="arial"><span style="white-space:normal">Accept-Ranges: bytes</span></font></div><div>
<font face="arial"><span style="white-space:normal"><br></span></font></div><div><font face="arial"><span style="white-space:normal">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</span></font></div>
<div><font face="arial"><span style="white-space:normal">...</span></font></div><div><font face="arial"><span style="white-space:normal">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</span></font></div>
<div><font face="arial"><span style="white-space:normal">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</span></font></div><div><font face="arial"><span style="white-space:normal">...</span></font></div>
<div><font face="arial"><span style="white-space:normal">2014/03/28 16:09:44 [debug] 22512#0: *102725 writev: 260</span></font></div><div><font face="arial"><span style="white-space:normal">2014/03/28 16:09:44 [debug] 22512#0: *102725 sendfile: @0 17775749</span></font></div>
<div><font face="arial"><span style="white-space:normal">2014/03/28 16:09:44 [debug] 22512#0: *102725 sendfile: 3440640, @0 3440640:17775749</span></font></div><div><font face="arial"><span style="white-space:normal">...</span></font></div>
<div><font face="arial"><span style="white-space:normal">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</span></font></div>
<div><font face="arial"><span style="white-space:normal">2014/03/28 16:09:44 [debug] 22512#0: *102725 http write filter: l:1 f:0 s:14335109</span></font></div><div><font face="arial"><span style="white-space:normal">2014/03/28 16:09:44 [debug] 22512#0: *102725 http write filter limit 0</span></font></div>
<div><font face="arial"><span style="white-space:normal">2014/03/28 16:09:44 [debug] 22512#0: *102725 sendfile: @3440640 14335109</span></font></div><div><font face="arial"><span style="white-space:normal">2014/03/28 16:09:44 [debug] 22512#0: *102725 sendfile() is not ready (11: Resource temporarily unavailable)</span></font></div>
<div><font face="arial"><span style="white-space:normal">2014/03/28 16:09:44 [debug] 22512#0: *102725 sendfile: -1, @3440640 0:14335109</span></font></div><div><font face="arial"><span style="white-space:normal">2014/03/28 16:09:44 [debug] 22512#0: *102725 http write filter 0000000007225478</span></font></div>
<div><font face="arial"><span style="white-space:normal">2014/03/28 16:09:44 [debug] 22512#0: *102725 http copy filter: -2 "/test.bin?"</span></font></div><div><font face="arial"><span style="white-space:normal">2014/03/28 16:09:44 [debug] 22512#0: *102725 http writer output filter: -2, "/test.bin?"</span></font></div>
<div><font face="arial"><span style="white-space:normal">2014/03/28 16:09:44 [debug] 22512#0: *102725 event timer: 154, old: 1396008594706, new: 1396008594706</span></font></div><div><font face="arial"><span style="white-space:normal">...</span></font></div>
<div><font face="arial"><span style="white-space:normal">2014/03/28 16:09:54 [debug] 22512#0: *102725 event timer del: 154: 1396008594706</span></font></div><div><font face="arial"><span style="white-space:normal">2014/03/28 16:09:54 [debug] 22512#0: *102725 http run request: "/test.bin?"</span></font></div>
<div><font face="arial"><span style="white-space:normal">2014/03/28 16:09:54 [debug] 22512#0: *102725 http writer handler: "/test.bin?"</span></font></div><div><font face="arial"><span style="white-space:normal">2014/03/28 16:09:54 [info] 22512#0: *102725 client timed out (110: Connection timed out) while sending response to client, ...</span></font></div>
<div><font face="arial"><span style="white-space:normal"><br></span></font></div><div><font face="arial"><span style="white-space:normal">В общем как мне кажется проблема где-то около "sendfile() is not ready (11: Resource temporarily unavailable)"</span></font></div>
<div><font face="arial"><span style="white-space:normal">Похожая ситуация возникает с sendfile off, но уже "writev() not ready (11: Resource temporarily unavailable)"</span></font></div><div><font face="arial"><span style="white-space:normal"><br>
</span></font></div><div><font face="arial"><span style="white-space:normal">Сервер используется для раздачи видео с модулями mp4/flv, GeoIP вместе с if/set, lua подсчитывает попадания по каждому урлу в именованный location @proxy с помощью lua_shared_dict, но по факту и без выполнения lua возникают проблемы.</span></font></div>
<div><font face="arial"><span style="white-space:normal">Перекомпилировал nginx с необходимыми модулями:</span></font></div><div><font face="arial"><span style="white-space:normal"># nginx -V</span></font></div><div><font face="arial"><span style="white-space:normal">nginx version: nginx/1.4.7</span></font></div>
<div><font face="arial"><span style="white-space:normal">built by gcc 4.1.2 20080704 (Red Hat 4.1.2-54)</span></font></div><div><font face="arial"><span style="white-space:normal">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'</span></font></div>
<div><font face="arial"><span style="white-space:normal"><br></span></font></div><div><font face="arial"><span style="white-space:normal">kernel 2.6.18-371.6.1.el5 (CentOS 5.10)</span></font></div><div><font face="arial"><span style="white-space:normal"><br>
</span></font></div><div><font face="arial"><span style="white-space:normal">На время тестирования пробовал включать все опции по умолчанию, тестовый файл отдельно от остального контента:</span></font></div><div><font face="arial"><span style="white-space:normal">send_timeout 10s;</span></font></div>
<div><font face="arial"><span style="white-space:normal">location = /test.bin {</span></font></div><div><font face="arial"><span style="white-space:normal"> root /cache/data3;</span></font></div><div><font face="arial"><span style="white-space:normal"> sendfile on;</span></font></div>
<div><font face="arial"><span style="white-space:normal">}</span></font></div><div><font face="arial"><span style="white-space:normal"><br></span></font></div><div><font face="arial"><span style="white-space:normal">В чем может быть проблема, в какую сторону копать?</span></font></div>
</pre></div>
</div>