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

Draft: fix exec_* startup delay if nofile is too high #1750

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Jamesits
Copy link

@Jamesits Jamesits commented Dec 27, 2023

Currently we rely on a for loop to close all possible file descriptors, and when nofile is set to a large number (a very common case in Nginx deployments), the worker process might eat up a single core for a few minutes(!) after fork and before exec. This results in unexpected server performance impacts, and causes exec_push and exec_pull to be delayed a lot (e.g. you can't do low-latency realtime transcode anymore). Others have pointed out this problem but lowering nofiles is not a long term solution.

This patch resolves the performance issue, and have been steadily runnning in my environment for a while. But it requires Linux 5.9 + glibc 2.34, or FreeBSD 8.0+, so I'm marking this as a draft for now. I'm not sure if we can detect the existence of close_range in configure as I'm not really familiar of Nginx's build system conventions. I'd like to refine its compatibility if possible.

@Jamesits Jamesits marked this pull request as draft December 27, 2023 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant