Last active
January 22, 2024 21:32
-
-
Save nicksherron/a3cf93920f74b24aca37f935730fc029 to your computer and use it in GitHub Desktop.
systemd service for disabling Transparent Huge Pages (THP) for dbs like mongodb and redis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Disable Transparent Huge Pages (THP) | |
DefaultDependencies=no | |
After=sysinit.target local-fs.target | |
Before=mongod.service | |
[Service] | |
Type=oneshot | |
ExecStart=/bin/sh -c 'echo never | tee /sys/kernel/mm/transparent_hugepage/enabled > /dev/null' | |
[Install] | |
WantedBy=basic.target |
yeah you can checkout this stack overflow discussion for the reasoning https://stackoverflow.com/a/550808
@oscarcarlsson
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there any reason you echo into tee and then ignore the output? It seems backward, compared to just echoing (which returns no output).