Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon what are the implications of setting multi_accept to on or off


what are the implications of setting multi_accept to on or off


Setting `multi_accept` to `on` or `off` in NGINX has significant implications for the way worker processes handle new connections. Here are the key differences:

`multi_accept off` (Default)

- Worker Process Accepts One New Connection at a Time: Each worker process accepts one new connection and handles it before returning to the kernel for the next event to process.
- Efficient Use of System Resources: This approach ensures that each worker process is utilized efficiently, as they do not waste system resources by handling multiple connections simultaneously.
- Recommended for Most Use Cases: This is the default setting and is suitable for most use cases, as it balances the need for efficient resource utilization with the need for handling new connections.

`multi_accept on`

- Worker Process Accepts All New Connections at Once: Each worker process accepts all new connections simultaneously, which can lead to efficient handling of high volumes of connections.
- Potential for Resource Waste: If the volume of new connections is low, some worker processes may waste system resources by handling multiple connections simultaneously.
- Not Recommended for Most Use Cases: This setting is not recommended for most use cases, as it can lead to inefficient use of system resources if the volume of new connections is low.

In summary, setting `multi_accept` to `on` can be beneficial for high-traffic websites where the volume of new connections is high, but it can lead to resource waste if the volume of new connections is low. Setting `multi_accept` to `off` (the default) ensures efficient use of system resources and is suitable for most use cases.

Citations:
[1] https://serverfault.com/questions/763597/why-is-multi-accept-off-as-default-in-nginx
[2] https://hub.packtpub.com/fine-tune-nginx-configufine-tune-nginx-configurationfine-tune-nginx-configurationratio/
[3] https://blog.nginx.org/blog/performance-tuning-tips-tricks
[4] https://nginx.org/en/docs/ngx_core_module.html
[5] https://webdock.io/en/docs/webdock-control-panel/optimizing-performance/optimizing-nginx-high-traffic-websites