Repository navigation
Make nginx tuning configurable and pass streams through unbuffered - #43
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Clients that hold Docker API streams open, like
events, followedlogs,waitandexec/attach, don't work well behind the proxy as it stands:events,logs, image pulls, builds and exports can reach the client late.client_max_body_sizeof 1 MB makes uploads like build contexts anddocker loadfail with413.proxy_read_timeoutcloses any upstream connection that is quiet for 60 seconds, which ends idleeventssubscriptions and followed logs.worker_connections 1024. Since it runs a single worker, that is the limit for the whole proxy. Once long-lived streams from many clients fill it, nginx refuses new requests withworker_connections are not enough, and there's currently no way to raise the limit.This PR:
WORKER_CONNECTIONSto setworker_connections. It still defaults to1024.PROXY_READ_TIMEOUTto setproxy_read_timeout, for example24hfor long-lived idle streams.TCP_KEEPALIVEto setso_keepaliveon the listening port, so the connections of clients that have disappeared are detected and closed. This is useful together with a longPROXY_READ_TIMEOUT.The new settings are only written to the config when set, so nginx's defaults stay in place otherwise. All of them are documented in a new "nginx Settings" section of the README.
Each commit is self-contained, so I'm happy to split this into separate PRs if you prefer.