-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,19 @@ func sysctlSomaxconn() int { | |
return maxConns | ||
} | ||
|
||
// sysctlFSFileMax returns the value of fs.file-max, i.e. | ||
// maximum number of open file descriptors | ||
func sysctlFSFileMax() int { | ||
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) | ||
// returning 0 means don't render the value | ||
return 0 | ||
} | ||
|
||
return maxConns | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we have some "padding" e.g. maxConns - 1024 ? Also, is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Excellent point. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Actually this process can use just the available FDs in the system.
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. |
||
} | ||
|
||
func diff(b1, b2 []byte) ([]byte, error) { | ||
f1, err := ioutil.TempFile("", "a") | ||
if err != nil { | ||
|
There was a problem hiding this comment.
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 :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done