-
Notifications
You must be signed in to change notification settings - Fork 455
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
[dbnode] Add process limits validation (and docs) #1118
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1118 +/- ##
========================================
+ Coverage 71.1% 71.1% +<.1%
========================================
Files 734 737 +3
Lines 61781 61855 +74
========================================
+ Hits 43928 43997 +69
+ Misses 15010 15006 -4
- Partials 2843 2852 +9
Continue to review full report at Codecov.
|
src/dbnode/server/limits.go
Outdated
return nil | ||
} | ||
|
||
return fmt.Errorf(`invalid configuration found [%v]. refer to https://m3db.github.io/m3/operational_guide/kernel_tuning/ for more information`, multiErr.FinalError()) |
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.
Interesting, should we perhaps add like a meta doc package so that we can replace all the links at a later time?
e.g.
docs.Path("operational_guide/kernel_tuning")
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.
Perhaps also a log field for the doc link?
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.
sure thing
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
src/x/os/limits_linux.go
Outdated
return 0, err | ||
} | ||
|
||
return int64(num), 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.
Shouldn’t this be ‘int64(num), 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.
aye
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
docs/how_to/cluster_hard_way.md
Outdated
Alternatively, if you wish to have `m3dbnode` run under `systemd` you can use our [service example](https://github.com/m3db/m3/tree/master/integrations/systemd/m3dbnode.service) which will set sane defaults. | ||
|
||
Before running the process make sure the limits are set, if running manually you can raise the limit for the current user with `ulimit -n 500000`. | ||
[Recommended kernel configuration](../operational_guide/kernel_tuning.md). |
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.
Can you make this a complete sentence that explains why its important that people follow this link. I.E something like: Make sure to review our recommended kernel configuration before running M3DB in production as M3DB may exceed the default limits for some default kernel values
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.
Also its called Kernel Configuration here and Kernel Tuning below. Lets pick one (configuration seems more consistent to me)
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.
sounds good
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
Kernel Tuning | ||
============= | ||
|
||
This document lists the Kernel tweaks `m3dbnode` needs to run well. |
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.
is that what we actually call the binary? I always refer to it as m3db
or M3DB
when I'm writing documentation. We should probably be consistent about that
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.
yeah i'm onboard with being consistent. I'll change to M3DB
for now.
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
## vm.swappiness | ||
`vm.swappiness` controls how much the virtual memory subsystem will try to swap to disk. By default, the kernel configures this value to `60`, and will try to swap out items in memory even when there is plenty of RAM available to the system. | ||
|
||
For performance, we recommend sizing clusters such that `m3dbnode` is running on a substrate such that no-swapping is necessary. And therefore recommend setting the value of `vm.swappiness` to `1`. This tells the kernel to swap as little as possible, without altogether disabling swapping. |
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 leave out For performance
here
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.
"We recommend provisioning m3db clusters such that they use significantly less memory than the maximum on each host. As a result, we recommend setting the value of vm.swappiness
to 1
to prevent the O.S from prematurely swapping pages to disk unless it is absolutely necessary."
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.
sure, tweaked to be a little clearer
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
|
||
|
||
## rlimits | ||
`m3dbnode` also can use a high number of files and we suggest setting a high max open number of files due to per partition fileset volumes. |
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.
The explanations of why seem a little out of place. I understand the desire to include them but it really breaks the flow. If you want to keep them in could we add like a ### Rationale
subheading to each of these? That way you can just scan through and it just lists variables and what our recommended value is and if you care you can read the rationale
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.
the vm.max_map_count
section does the same thing - explain why we need to tweak a value and then what the value should be tweaked to.
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
maxSwappiness = 1 | ||
) | ||
|
||
func validateProcessLimits() error { |
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.
I thought we were gonna emit these log messages at regular intervals as well if they were misconfigured? Seems like a long-lived struct with an internal goroutine that might be useful
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.
sure
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
src/x/os/limits_linux.go
Outdated
} | ||
|
||
func sysctl(key string) (string, error) { | ||
path := sysctlDir + strings.Replace(name, ".", "/", -1) |
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.
I assume "name" is a typo here?
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.
aye
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.
fixed
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.
LGTM other than minor comments
sysctl -w vm.max_map_count=262144 | ||
``` | ||
|
||
To set this value permanently, update the `vm.max_map_count` setting in `/etc/sysctl.conf`. |
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.
references this file:
https://github.com/m3db/m3/blob/master/integrations/systemd/m3dbnode.service
Do we need to add any of these other configs in there?
your_m3db_user soft nofile 500000 | ||
``` | ||
|
||
Alternatively, if you wish to have M3DB run under `systemd` you can use our [service example](https://github.com/m3db/m3/tree/master/integrations/systemd/m3dbnode.service) which will set sane defaults. |
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.
Oh ok I see it is here. Can any of the other values go in there?
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.
naw the rest of it is specific to systemd
) | ||
|
||
// Path returns the url to the | ||
func Path(section string) string { |
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.
lol nice
@@ -630,6 +633,21 @@ func interrupt() <-chan os.Signal { | |||
return c | |||
} | |||
|
|||
func bgValidateProcessLimits(logger xlog.Logger) { |
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.
This is annoying, but should we add a signal to stop this goroutine at some point?
Just because if we start using this more in integration tests having a dangling goroutine may become annoying to deal with.
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.
talked offline: added max monitor duration to control this
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.
LGTM other than minor comment
996be0e
to
8b9be43
Compare
I rebased on master for you, hopefully CI passes. |
No description provided.