Commit Graph

2 Commits

Author SHA1 Message Date
lijunlong 74d747d9b4
tests: 002-reuseport-close-unused-fds.t: the order of the logs generated by multiple processes is uncertain. (#827) 2022-04-12 23:25:45 +08:00
spacewander cf7516fcbc optimize: added an NGINX core patch to ensure unused listening fds are closed when 'reuseport' is used.
When `reuseport` is enabled in the `listen` directive, Nginx will create
a listening fd for each worker process in the master process.

These fds will be inherited by the worker processes, but most of them
are unused. For example, considering we have 32 listening ip:port
configurations and 64 worker processes, each worker process will inherit
2048 (32 * 64) listening fds, but only 32 fds are used. By closing the
unused fds, this change could save up to 2016 (32 * 63) fds in a worker
process.

It doesn't affect the listening socket, since there is only one used fd
which associates to the socket with or without this change.

Co-authored-by: Thibault Charbonnier <thibaultcha@me.com>
2019-08-05 18:54:51 -07:00