Optimizing buffer allocation

Nginx uses buffers to store request and response data at various stages. Optimal buffer allocation can help you spare memory consumption and reduce CPU usage. The following table lists directives that control buffer allocation and the stages they are applied to:

Directive

Function

client_body_buffer_size <size>

This specifies the size of the buffer that is used to receive the request body from the client.

output_buffers <number> <size>

This specifies the number and the size of buffers that are used to send the response body to the client in case no acceleration is used.

gzip_buffers <number> <size>

This specifies the number and the size of the buffers that are used to compress the response body.

proxy_buffers ...

Get Nginx Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.