Events module

The events module comes with directives that allow you to configure network mechanisms. Some of the parameters have an important impact on the application's performance.

All of the directives listed in the following table must be placed in the events block, which is located at the root of the configuration file:

user nginx nginx; 
master_process on; 
worker_processes 4; 
events { 
  worker_connections 1024; 
  use epoll; 
} 
[...] 

These directives cannot be placed elsewhere (if you do so, the configuration test will fail):

Directive name

Syntax and description

accept_mutex

  • Accepted values: on or off
  • Syntax: accept_mutex on;
  • Default value: As of version 1.11.3 off; prior to version 1.11.3, was on
  • Enables or disables the use of an accept mutex (mutual exclusion) to open listening sockets

accept_mutex_delay

  • Syntax (numeric (time)): accept_mutex_delay 500ms;.
  • Default value: 500 milliseconds.
  • Defines the amount of time a worker process should wait before trying to acquire the resource again. This value is not used if the accept_mutex directive is set to off.

debug_connection

  • Syntax (IP address or CIDR block):
debug_connection   172.63.155.21;   
debug_connection   172.63.155.0/24;   
  • Default value: None.
  • Writes detailed logs for clients matching this IP address or address block. The debug information is stored in the file specified with the error_log directive, enabled with the debug level.
  • Nginx must be compiled with the --debug switch in order to enable this feature.

multi_accept

  • Syntax (on or off): multi_accept off;
  • Default value: off
  • Defines whether or not Nginx should accept all incoming connections at once from the listening queue

use

  • Accepted values: /dev/poll, epoll, eventport, kqueue, rtsig, or select.
  • Syntax: use kqueue;.
  • Default value: Defined at compile time.
  • Selects the event model among the available ones (the ones that you enabled at compile time). Nginx automatically selects the most appropriate one, so you should not have to modify this value.

The supported models are:

  • select: The default and standard module, it is used if the OS does not support a more efficient one (it's the only available method under Windows). This method is not recommended for servers that expect to be under high load.
  • poll: It is automatically preferred over select, but is not available on all systems.
  • kqueue: An efficient method for FreeBSD 4.1+, OpenBSD 2.9+, NetBSD 2.0, and macOS operating systems.
  • epoll: An efficient method for Linux 2.6+ based operating systems.
  • rtsig: Real-time signals, available as of Linux 2.2.19, but unsuited for high-traffic profiles, as default system settings only allow 1,024 queued signals.
  • /dev/poll: An efficient method for Solaris 7 11/99+, HP/UX 11.22+, IRIX 6.5.15+, and Tru64 UNIX 5.1A+ operating systems.
  • eventport: An efficient method for Solaris 10, though a security patch is required.

worker_connections

  • Syntax (numeric): worker_connections 1024;
  • Default value: None
  • Defines the amount of connections that a worker process may treat simultaneously
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.190.159.164