Skip to content

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+. 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
@Jamesits Jamesits changed the title Draft: fix exec_* startup delay if nofile is too high fix exec_* startup delay if nofile is too high Oct 24, 2024
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