MongoDB startup: WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. We suggest setting it to 'never'
Transparent Huge Pages are enabled, which can hurt MongoDB performance (latency spikes).
WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. We suggest setting it to 'never'transparent_hugepage/enabled is always. We suggest setting it to never** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'Transparent Huge Pages MongoDB warning Meaning
MongoDB recommends disabling THP for mongod: use the official packages (which include a service) or add a systemd unit that sets never for enabled and defrag at boot. Verify with cat /sys/kernel/mm/transparent_hugepage/enabled. A startup warning, not a failure.
Common causes
- OS default THP=always/madvise
- Custom install without tuning
- Cloud images enabling THP
- Container hosts sharing kernel settings
- No boot-time setting persisted
⚡ Quick fix
echo never | sudo tee /sys/kernel/mm/transparent_hugepage/enabled(temporary)- Persist via a systemd unit or
tunedprofile - Verify after reboot
Detailed fix by platform
Linux
cat /sys/kernel/mm/transparent_hugepage/enabled /sys/kernel/mm/transparent_hugepage/defrag
How to diagnose
- Setting — always/never?
- Persist — Reboot-safe?
- Impact — Latency?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- Atlas: bad auth: Authentication failed MongoServerError: bad auth : Authentication failed. (Atlas user / special characters in password)
- BSONObj size is invalid / exceeds maximum document size (16MB) MongoServerError: BSONObj size: 17825792 (0x1100000) is invalid. Size must be between 0 and 16793600(16MB)
- mongod killed by OOM killer MongoDB: Out of memory: Killed process (mongod) — WiredTiger cache + queries exhausted RAM
Most viewed in MongoDB
- MongoParseError MongoDB: MongoParseError: Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://"
- Document failed validation MongoDB: MongoServerError: Document failed validation (code 121)
- bad auth : Authentication failed MongoDB: MongoServerError: bad auth : Authentication failed (code 8000 / 18)
Other ways to find it
Where this error sits
Origin: Data. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026