Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ksalman/5ce905d216c73215b1870ccc0a571953 to your computer and use it in GitHub Desktop.
Save ksalman/5ce905d216c73215b1870ccc0a571953 to your computer and use it in GitHub Desktop.
systemd service for disabling Transparent Huge Pages (THP) for dbs like mongodb and redis
[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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment