title: What happens when nginx proxy_buffer_size is exceeded?
body: <p>I am running a node server in AWS Elastic Beanstalk with Docker, which also uses nginx. One of my endpoints is responsible for image manipulation such as resizing etc. 
  My logs show a lot of <code>ESOCKETTIMEDOUT</code> errors, which indicate it could be caused by an invalid url. </p>
  
  <p>This is not the case as it is fairly basic to handle that scenario, and when I open the apparent invalid url, it loads an image just fine.</p>
  
  <p>My research has so far led me to make the following changes:</p>
  
  <ol>
  <li>Increase the timeout of the request module to 2000</li>
  <li>Set the container uv_threadpool_size env variable to the max 128</li>
  </ol>
  
  <p>While 1 has helped in improving response times somewhat, I don't see any improvements from 2. I have now come across the following warning in my server logs:</p>
  
  <p><code>an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/0/12/1234567890 while reading upstream,</code>.</p>
  
  <p>This makes me think that the <code>ESOCKETTIMEDOUT</code> errors could be due to the proxy_buffer_size being exceeded. But, I am not sure and I'd like some opinion on this before I continue making changes based on a hunch.</p>
  
  <p>So I have 2 questions:</p>
  
  <ol>
  <li>Would the nginx proxy_buffer_size result in an error if a) the size is exceeded in cases of manipulating a large image or b) the volume of requests maxes out the buffer size?</li>
  <li>What are the cost impacts, if any, of updating the size. AWS memory, instance size etc?</li>
  </ol>
  
  <p>I have come across <a href="https://serverfault.com/questions/587386/an-upstream-response-is-buffered-to-a-temporary-file">this</a> helpful article but wanted some more opinion on if this would even help in my scenario.</p>