Mercurial > hg > nginx
comparison src/stream/ngx_stream_core_module.c @ 6153:4f6efabcb09b
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.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Wed, 20 May 2015 15:51:56 +0300 |
parents | 61d7ae76647d |
children | c13091e6292c |
comparison
equal
deleted
inserted
replaced
6152:3c344ea7d88b | 6153:4f6efabcb09b |
---|---|
382 "on this platform"); | 382 "on this platform"); |
383 return NGX_CONF_ERROR; | 383 return NGX_CONF_ERROR; |
384 #endif | 384 #endif |
385 } | 385 } |
386 | 386 |
387 if (ngx_strcmp(value[i].data, "reuseport") == 0) { | |
388 #if (NGX_HAVE_REUSEPORT) | |
389 ls->reuseport = 1; | |
390 ls->bind = 1; | |
391 #else | |
392 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
393 "reuseport is not supported " | |
394 "on this platform, ignored"); | |
395 #endif | |
396 continue; | |
397 } | |
398 | |
387 if (ngx_strcmp(value[i].data, "ssl") == 0) { | 399 if (ngx_strcmp(value[i].data, "ssl") == 0) { |
388 #if (NGX_STREAM_SSL) | 400 #if (NGX_STREAM_SSL) |
389 ls->ssl = 1; | 401 ls->ssl = 1; |
390 continue; | 402 continue; |
391 #else | 403 #else |