http2_max_requests
The http2_max_requests directive configures the maximum number of concurrent HTTP/2 requests that can be handled per connection.
Description
The http2_max_requests directive is used in NGINX to impose a limit on the number of concurrent HTTP/2 requests that can be processed on a single connection. This is particularly useful in high-traffic environments where HTTP/2 multiplexing is utilized, allowing multiple requests and responses to be sent over a single connection. By defining this directive, administrators can control resource usage and avoid overwhelming the server with too many simultaneous requests, potentially preventing resource exhaustion or other performance issues.
The directive operates in the context of the http or server section of the NGINX configuration, allowing fine-tuning at multiple levels. The value set for http2_max_requests must be a positive integer, specifying the concurrent request limit. If this limit is reached, further requests will be queued until the number of active requests falls below the specified threshold, at which point processing can continue.
It is important to choose this value carefully; setting it too low may under-utilize server capabilities, while a value that is too high could lead to server strain. The behavior of the directive aligns with NGINX’s architecture aimed at high performance and low resource consumption, allowing seamless HTTP/2 operations while preserving server stability.
Config Example
http {
http2_max_requests 50;
}
server {
http2_max_requests 200;
}Setting a very high value may lead to excessive resource consumption which can degrade performance.
Not specifying this directive will default to the server’s internal limits, which may not suit every use case.