Content-Length: 323588 | pFad | https://github.com/nghttp2/nghttp2/pull/2377

E7 nghttpx: Listen TCP and UNIX domain sockets on worker thread by tatsuhiro-t · Pull Request #2377 · nghttp2/nghttp2 · GitHub
Skip to content

nghttpx: Listen TCP and UNIX domain sockets on worker thread#2377

Merged
tatsuhiro-t merged 1 commit intomasterfrom
nghttpx-listeners-per-worker
May 16, 2025
Merged

nghttpx: Listen TCP and UNIX domain sockets on worker thread#2377
tatsuhiro-t merged 1 commit intomasterfrom
nghttpx-listeners-per-worker

Conversation

@tatsuhiro-t
Copy link
Member

Previously, nghttpx listens TCP and UNIX domain sockets on a dedicated thread, and then distributes the accepted connection to the one of worker threads. With this commit, nghttpx listens those sockets on each worker thread. For TCP sockets, SO_REUSEPORT is used to load balance the connections. This removes the need for inheriting file descriptors via environment variables. For UNIX domain sockets, because there is no SO_REUSEPORT equivalent for them, they are created as before, but they are handled per worker.

The support for legacy deprecated environment variables has been removed.

ocsp-startup option has been deprecated due to this change. OCSP will be remove very soon.

Previously, nghttpx listens TCP and UNIX domain sockets on a dedicated
thread, and then distributes the accepted connection to the one of
worker threads.  With this commit, nghttpx listens those sockets on
each worker thread.  For TCP sockets, SO_REUSEPORT is used to load
balance the connections.  This removes the need for inheriting file
descriptors via environment variables.  For UNIX domain sockets,
because there is no SO_REUSEPORT equivalent for them, they are created
as before, but they are handled per worker.

The support for legacy deprecated environment variables has been
removed.

ocsp-startup option has been deprecated due to this change.  OCSP will
be remove very soon.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates nghttpx to listen for TCP and UNIX domain socket connections directly on worker threads rather than on a dedicated listener thread. Key changes include moving socket listening logic into worker threads (with SO_REUSEPORT used for TCP) and removing legacy acceptor and environment variable support, as well as adjusting related APIs in the connection handler and accept handler.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/shrpx_worker_process.cc Removed dedicated-thread acceptor calls for graceful shutdown.
src/shrpx_worker.h Added new listener-related methods and refactored API.
src/shrpx_worker.cc Updated event loop, server socket setup, and listener control.
src/shrpx_connection_handler.{h,cc} Removed legacy acceptor methods and ocsp-based acceptor enabling.
src/shrpx_config.cc Logged deprecation warning for the ocsp-startup option.
src/shrpx_accept_handler.{h,cc} Modified to use Worker instead of ConnectionHandler for events.
Comments suppressed due to low confidence (1)

src/shrpx_worker.cc:691

  • [nitpick] Add clarifying comments to explain the API isolation logic that differentiates socket selection based on worker index and alt_mode.
if (api_isolation) { ... }

#endif // IPV6_V6ONLY

#ifdef TCP_DEFER_ACCEPT
val = 3;
Copy link

Copilot AI May 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider replacing the magic number '3' for TCP_DEFER_ACCEPT with a named constant to enhance code clarity.

Suggested change
val = 3;
val = TCP_DEFER_ACCEPT_TIMEOUT;

Copilot uses AI. Check for mistakes.
@tatsuhiro-t tatsuhiro-t merged commit f804e92 into master May 16, 2025
87 checks passed
@tatsuhiro-t tatsuhiro-t deleted the nghttpx-listeners-per-worker branch May 16, 2025 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/nghttp2/nghttp2/pull/2377

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy