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

Use system fs.max-files as limits instead of hard-coded value #142

Merged
merged 1 commit into from
Jan 19, 2017

Conversation

aledbf
Copy link
Member

@aledbf aledbf commented Jan 19, 2017

@aledbf aledbf self-assigned this Jan 19, 2017
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 19, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@aledbf aledbf assigned justinsb and unassigned aledbf Jan 19, 2017
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.07%) to 42.493% when pulling 6aecc55 on aledbf:file-max into 28c6725 on kubernetes:master.

Copy link
Member

@justinsb justinsb left a comment

Choose a reason for hiding this comment

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

Generally looks great, but I have a question about whether we should use all of fs/file-max

maxConns, err := sysctl.New().GetSysctl("fs/file-max")
if err != nil {
glog.Errorf("unexpected error reading system maximum number of open file descriptors (fs.file-max): %v", err)
return 0
Copy link
Member

Choose a reason for hiding this comment

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

Maybe a comment here that this means "don't render", not that the max will be 0 :-)

Copy link
Member Author

Choose a reason for hiding this comment

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

done

return 0
}

return maxConns
Copy link
Member

Choose a reason for hiding this comment

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

Should we have some "padding" e.g. maxConns - 1024 ? Also, is worker_rlimit_nofile per worker process . I honestly just don't know - I'm happy to follow your lead here if you say "this is correct", just not sure I follow the logic of letting a single nginx process use up all the FDs available to the whole system?

Copy link
Member Author

Choose a reason for hiding this comment

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

Excellent point.

Copy link
Member Author

Choose a reason for hiding this comment

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

I honestly just don't know - I'm happy to follow your lead here if you say "this is correct", just not sure I follow the logic of letting a single nginx process use up all the FDs available to the whole system?

Actually this process can use just the available FDs in the system.
If nginx tries to use more than the available the log just will show "Too many open files" which means:

  • the current fs.file-max value is low
  • the node is small
  • there is a process using/leaking descriptors

This setting tries to use the available resources (if needed) and not require scale the pod just because we are using the default values and we cannot get more than a couple of thousand connections.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 42.425% when pulling 9ce52c5 on aledbf:file-max into ac5b84c on kubernetes:master.

@aledbf
Copy link
Member Author

aledbf commented Jan 19, 2017

@justinsb I think this is an improvement. We can review this after a release.

@justinsb
Copy link
Member

OK, SGTM!

@justinsb justinsb merged commit f1520a1 into kubernetes:master Jan 19, 2017
@aledbf aledbf deleted the file-max branch January 20, 2017 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. nginx
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Nginx ingress controller] file open limit
5 participants