aboutsummaryrefslogtreecommitdiff
path: root/src/core/ngx_connection.h
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2015-05-20 15:51:56 +0300
committerMaxim Dounin <mdounin@mdounin.ru>2015-05-20 15:51:56 +0300
commitf7f1607bf2b8b7c45834b66cb45f6445bee65587 (patch)
tree8a458d848d86e6b0e7f9108fd1b792d709091965 /src/core/ngx_connection.h
parentd5c34785bc55164afb7cfe7de1badcebdb05fb8d (diff)
downloadnginx-f7f1607bf2b8b7c45834b66cb45f6445bee65587.tar.gz
nginx-f7f1607bf2b8b7c45834b66cb45f6445bee65587.zip
The "reuseport" option of the "listen" directive.
When configured, an individual listen socket on a given address is created for each worker process. This allows to reduce in-kernel lock contention on configurations with high accept rates, resulting in better performance. As of now it works on Linux and DragonFly BSD. Note that on Linux incoming connection requests are currently tied up to a specific listen socket, and if some sockets are closed, connection requests will be reset, see https://lwn.net/Articles/542629/. With nginx, this may happen if the number of worker processes is reduced. There is no such problem on DragonFly BSD. Based on previous work by Sepherosa Ziehau and Yingqi Lu.
Diffstat (limited to 'src/core/ngx_connection.h')
-rw-r--r--src/core/ngx_connection.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/ngx_connection.h b/src/core/ngx_connection.h
index 27bb8a99c..a49aa9579 100644
--- a/src/core/ngx_connection.h
+++ b/src/core/ngx_connection.h
@@ -51,6 +51,8 @@ struct ngx_listening_s {
ngx_listening_t *previous;
ngx_connection_t *connection;
+ ngx_uint_t worker;
+
unsigned open:1;
unsigned remain:1;
unsigned ignore:1;
@@ -66,6 +68,10 @@ struct ngx_listening_s {
#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
unsigned ipv6only:1;
#endif
+#if (NGX_HAVE_REUSEPORT)
+ unsigned reuseport:1;
+ unsigned add_reuseport:1;
+#endif
unsigned keepalive:2;
#if (NGX_HAVE_DEFERRED_ACCEPT)
@@ -203,6 +209,7 @@ struct ngx_connection_s {
ngx_listening_t *ngx_create_listening(ngx_conf_t *cf, void *sockaddr,
socklen_t socklen);
+ngx_int_t ngx_clone_listening(ngx_conf_t *cf, ngx_listening_t *ls);
ngx_int_t ngx_set_inherited_sockets(ngx_cycle_t *cycle);
ngx_int_t ngx_open_listening_sockets(ngx_cycle_t *cycle);
void ngx_configure_listening_sockets(ngx_cycle_t *cycle);