Nginx client_body_buffer_size and client_max_body_size optimizations for large POST requests
<p>I have an API that receives anywhere from 1K to 20MB of data in each transmission. I also have a website that would only ever receive less than 10K in a single transmission. Both the API and the website are behind the same Nginx proxy server.</p>

<p>From the docs for <code>client_body_buffer_size</code></p>

<blockquote>
  <p>If the request body size is more than the buffer size, then the entire (or partial) request body is written into a temporary file."</p>
</blockquote>

<p>This means that any time I receive a request over the default, it will be written to disk.</p>

<p>Given that I can receive large payloads, would it be best to set the <code>client_body_buffer_size</code> equal to <code>client_max_body_size</code>, which for me is 20MB? I assume this would prevent nginx from writing the request to disk every time. </p>

<p>Are there any consequences to setting the <code>client_body_buffer_size</code> so high? Would this affect the website, which never receives such large requests?</p>