<div dir="ltr">
<p class="gmail-MsoPlainText" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">> Mix of different times in logs suggests that workers are blocked for a long time doing something</p><p class="gmail-MsoPlainText" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">> (and hence the time in some worker process are not updated for a long time).<span></span></p>
<p class="gmail-MsoPlainText" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span> </span></p>
<p class="gmail-MsoPlainText" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">> Reasons can be different, and more information/logs are needed to say anything for sure.<span> </span>In this particular case my best guess is that your backend server is much faster than the disk you use for proxy_temp_path,</p><p class="gmail-MsoPlainText" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">> and so nginx loops buffering a <span style="font-size:11pt"> response to disk for a long time.</span><span style="font-size:11pt"> </span><span style="font-size:11pt">For example, the response in *189 already buffered about 600M, and there is no indication in the log lines quoted that it stopped reading from the upstream somewhere.</span><span style="font-size:11pt"> </span></p><p class="gmail-MsoPlainText" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">> At the same time the process thinks current time is 13:53:32, which is 21 seconds behind 13:53:53 as logged by pid 18729 at the same time.<span></span></p>
<p class="gmail-MsoPlainText" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span>></span></p><p class="gmail-MsoPlainText" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:11pt">> An obvious workaround would be to disable or limit disk buffering, "proxy_max_temp_file_size 0;".</span><span style="font-size:11pt"> </span><span style="font-size:11pt">Additionally, using larger memory buffers (proxy_buffer_size, proxy_buffers) might help to avoid such monopolization of a worker process.</span></p><p class="gmail-MsoPlainText" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span></span></p>
<p class="gmail-MsoPlainText" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span>> </span></p>
<p class="gmail-MsoPlainText" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">> See also <a href="https://trac.nginx.org/nginx/ticket/1431" style="color:rgb(5,99,193);text-decoration:underline">https://trac.nginx.org/nginx/ticket/1431</a> for a detailed explanation of a similar problem as observed with websocket proxying.<span></span></p><p class="gmail-MsoPlainText" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">></p><p class="gmail-MsoPlainText" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">> <span style="font-size:11pt">Maxim Dounin</span></p><p class="gmail-MsoPlainText" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span></span></p>
<p></p><p class="gmail-MsoPlainText" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><br></p><p class="gmail-MsoPlainText" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">This seemed to be the problem. The upstream was delivering data too fast compared to writing the temp file. I tried to increase the buffer but that didn't help. I disabled the temp file completely at the problem disappeared. I no longer see this monopolization of the worker process.</p><p class="gmail-MsoPlainText" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><br></p><p class="gmail-MsoPlainText" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">Thanks for the help Maxim.</p><p class="gmail-MsoPlainText" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><br></p><p class="gmail-MsoPlainText" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">Best regards</p><p class="gmail-MsoPlainText" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> Lars</p>
</div>