saltstack-formulas / redis-formula

Redis state
http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
40 stars 184 forks source link

fix(noise): only change hugepage state if needed #90

Closed noelmcloughlin closed 3 years ago

noelmcloughlin commented 3 years ago

PR progress checklist (to be filled in by reviewers)


What type of PR is this?

Primary type

Secondary type

Does this PR introduce a BREAKING CHANGE?

No.

Related issues and/or pull requests

89

Describe the changes you're proposing

Enable hugepages only when needed, not everytime

Pillar / config required to test the proposed changes

Debug log showing how the proposed changes work

Documentation checklist

Testing checklist

Additional context

iaingeorgeson commented 3 years ago

Thanks for taking a look at this.

Unfortunately, I don't think this commit solves the problem. This file is on sysfs, The command changes the state rather than creating it, and the current state is marked in its contents with square brackets:

always madvise [never]

So the test would be something like:

- unless: grep -q '[never]' /sys/kernel/mm/transparent_hugepage/enabled
noelmcloughlin commented 3 years ago

i checked https://redis.io/topics/latency and you are correct. We can assume Redis formula should enforce never. I'll update the commit.

The ideal solution is probably to create a service file (https://docs.mongodb.com/manual/tutorial/transparent-huge-pages) but you could open separate issue for that and someone will get around to it sometime.

noelmcloughlin commented 3 years ago
$ echo never >/tmp/dave
$ grep -ir '^never' /tmp/dave
never
$ echo $?
0
$ echo always >/tmp/dave
$ grep -ir '^never' /tmp/dave
$ echo $?
1
iaingeorgeson commented 3 years ago
# echo never >/sys/kernel/mm/transparent_hugepage/enabled
# grep -ir '^never' /sys/kernel/mm/transparent_hugepage/enabled
# echo $?
1
# echo always >/sys/kernel/mm/transparent_hugepage/enabled
# grep -ir '^never' /sys/kernel/mm/transparent_hugepage/enabled
# echo $?
1
saltstack-formulas-travis commented 3 years ago

:tada: This PR is included in version 0.27.1 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: