acceptex_read

The `acceptex_read` directive enables or disables the use of the AcceptEx socket option for accepting connections.

Syntaxacceptex_read on | off;
Defaultoff
Contextevents
Argumentsflag

Description

The acceptex_read directive in NGINX is used within the events context to control whether NGINX utilizes the AcceptEx socket function when accepting incoming connections. AcceptEx is a Windows-specific API that allows the server to read the incoming connection immediately while reducing context switches and improving performance. When set to 'on', NGINX will attempt to use this feature for connection acceptance, potentially yielding better performance under high load due to its efficiency in handling socket connections. However, this feature is only applicable on Windows platforms where AcceptEx is supported.

The parameter for this directive is a flag that can either be 'on' or 'off'. If you set it to 'on', NGINX will make use of the AcceptEx feature when managing new connections. Conversely, setting it to 'off' means that the regular method of accepting connections will be used. It's important to consider that while leveraging AcceptEx can enhance performance, it may introduce compatibility issues with certain network configurations, which could affect application behavior.

Evaluating the server's load, the types of traffic being handled, and the underlying infrastructure can help in deciding whether to enable this option. It should be noted that this feature is specific to Windows and will not have any effect on non-Windows installations of NGINX. Proper testing should be conducted to ensure that enabling AcceptEx does not yield any unintended side effects in the environment.

Config Example

events {
    acceptex_read on;
}

This directive is only applicable on Windows operating systems, and has no effect on Unix/Linux systems.

Enabling AcceptEx may cause compatibility issues with some network configurations; it is advisable to thoroughly test after enabling.

← Back to all directives