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

Make worker threads and timeouts configurable. #33

Merged
merged 1 commit into from
Oct 31, 2021
Merged

Conversation

blinsay
Copy link
Collaborator

@blinsay blinsay commented Oct 29, 2021

Allow configuring the number of worker threads and handoff timeout with NSNCD_WORKER_COUNT and NSNCD_HANDOFF_TIMEOUT to tune cpu usage on busy hosts.

This also changes the default number of workers from 256 to 8. We may want to roll that out separately.

Allow configuring the number of worker threads and handoff timeout
with NSNCD_WORKER_COUNT and NSNCD_HANDOFF_TIMEOUT to tune cpu usage
on busy hosts.
@blinsay blinsay merged commit bedb474 into main Oct 31, 2021
@leifwalsh leifwalsh mentioned this pull request Oct 15, 2022
@@ -75,15 +74,24 @@ fn main() -> Result<()> {

let logger = slog::Logger::root(drain, slog::o!());

let worker_count = env_usize("NSNCD_WORKER_COUNT", 8);
let handoff_timeout = Duration::from_secs(env_usize("NSNCD_HANDOFF_TIMEOUT", 3) as u64);

Choose a reason for hiding this comment

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

3 seconds is way too low, at cachix.org we've been experiencing problems due to this. Can we make it 10?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Are you able to tune the timeout with NSNCD_HANDOFF_TIMEOUT?

Choose a reason for hiding this comment

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

Yes, however I'd much prefer a fix upstream.

NixOS/nixpkgs#290355

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can you open an issue where we can discuss this? Tell us more about what kind of load you're putting on nsncd at Cachix, how often you see the timeouts and on which calls, and what your upstream NSS calls are (e.g. are you reaching out to LDAP or some other networked service).

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.

3 participants