Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(conf): enable reuseport on all listeners #12359

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

jschmid1
Copy link
Contributor

@jschmid1 jschmid1 commented Jan 17, 2024

Summary

This explicitly sets reuseport to all available listeners.(more on the option here ).
A use can always opt out of this option. by removing the string from the respective listener

Checklist

  • The Pull Request has tests
  • A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Issue reference

Fix https://konghq.atlassian.net/browse/KAG-3357

@oowl
Copy link
Member

oowl commented Jan 19, 2024

I do not know why we need to add a reuseport option to the Nginx listen command.

Yeah, the reuseport option can make accept connections balancer with all worker processes by TCP/IP 5-tuple, it seems good and solved the Thundering Herd problem very well, but that will bring a potential problem, If one nginx worker was blocked by some reason, regarding as Linux kernel distribute accept the connection by TCP/IP 5-tunple hashes, all connection which distributed to current process will be blocked, that will cause some latency problem.

But Linux introduced EPOLLEXCLUSIVE feature (That was make default flag in our use Nginx version) to solve the problem that was mentioned in the last sentence. this flag means the Linux kernel will balance these accept connections with exclusive waiters, which will avoid the Thundering Herd problem more efficiently.

So from my perspective, we do not need to enable reuseport default, just follow the Nginx default option which is the best choice most of the time.

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