Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
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/http/ngx_http.c
parentd5c34785bc55164afb7cfe7de1badcebdb05fb8d (diff)
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/http/ngx_http.c')
-rw-r--r--src/http/ngx_http.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/http/ngx_http.c b/src/http/ngx_http.c
index adb4b6f36..4642559ea 100644
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -1737,6 +1737,10 @@ ngx_http_init_listening(ngx_conf_t *cf, ngx_http_conf_port_t *port)
break;
}
+ if (ngx_clone_listening(cf, ls) != NGX_OK) {
+ return NGX_ERROR;
+ }
+
addr++;
last--;
}
@@ -1815,6 +1819,10 @@ ngx_http_add_listening(ngx_conf_t *cf, ngx_http_conf_addr_t *addr)
ls->fastopen = addr->opt.fastopen;
#endif
+#if (NGX_HAVE_REUSEPORT)
+ ls->reuseport = addr->opt.reuseport;
+#endif
+
return ls;
}