comparison src/http/ngx_http_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 2911b7e5491b
children 8b6fa4842133
comparison
equal deleted inserted replaced
6152:3c344ea7d88b 6153:4f6efabcb09b
4164 "on this platform"); 4164 "on this platform");
4165 return NGX_CONF_ERROR; 4165 return NGX_CONF_ERROR;
4166 #endif 4166 #endif
4167 } 4167 }
4168 4168
4169 if (ngx_strcmp(value[n].data, "reuseport") == 0) {
4170 #if (NGX_HAVE_REUSEPORT)
4171 lsopt.reuseport = 1;
4172 lsopt.set = 1;
4173 lsopt.bind = 1;
4174 #else
4175 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
4176 "reuseport is not supported "
4177 "on this platform, ignored");
4178 #endif
4179 continue;
4180 }
4181
4169 if (ngx_strcmp(value[n].data, "ssl") == 0) { 4182 if (ngx_strcmp(value[n].data, "ssl") == 0) {
4170 #if (NGX_HTTP_SSL) 4183 #if (NGX_HTTP_SSL)
4171 lsopt.ssl = 1; 4184 lsopt.ssl = 1;
4172 continue; 4185 continue;
4173 #else 4186 #else