码迷,mamicode.com
首页 > 其他好文 > 详细

Nginx - Events Module

时间:2016-08-01 21:05:51      阅读:293      评论:0      收藏:0      [点我收藏+]

标签:

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).


accept_mutex

Enables or disables the use of an accept mutex (mutual exclusion) to open listening sockets.

Accepted values: on or off
Example: accept_mutex on;
Default value: on


accept_mutex_delay

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.

Syntax: Numeric (time)
Example: accept_mutex_delay 500ms;
Default value: 500 milliseconds


connections

Replaced by worker_connections. This directive is now deprecated.


debug_connection

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.
Note: Nginx must be compiled with the --debug switch in order to enable this feature.

Syntax: IP address or CIDR block.
Example: debug_connection 172.63.155.21;
Example: debug_connection 172.63.155.0/24;
Default value: None.


multi_accept

Defines whether or not Nginx should accept all incoming connections at once from the listening queue.

Syntax: on or off
Example: multi_accept off;
Default value: off


use

Selects the event model among the available ones (the ones that you enabled at compile time), though Nginx automatically selects the most appropriate one.
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 X 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.

Accepted values: /dev/poll, epoll, eventport, kqueue, rtsig, or select
Example: use kqueue;
Default value: Defined at compile time


worker_connections

Defines the amount of connections that a worker process may treat simultaneously.

Syntax: Numeric
Example: worker_connections 1024;
Default value: None


worker_connections

Defines the amount of connections that a worker process may treat simultaneously.

Syntax: Numeric
Example: worker_connections 1024;
Default value: None


 

Nginx - Events Module

标签:

原文地址:http://www.cnblogs.com/huey/p/5727109.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!