Tuning Suggestions for Common Scenarios
Recommended Settings for Common Scenarios
Enable the madvise mode so that huge pages can be used only when necessary.
echo madvise > /sys/kernel/mm/transparent_hugepage/enabled
Use defer+madvise for memory defragmentation in the background only for explicit requests.
echo defer+madvise > /sys/kernel/mm/transparent_hugepage/defrag
Database or Latency-Sensitive Services
Databases such as MySQL, PostgreSQL, and Redis are sensitive to performance jitter. You are advised to disable THP.
echo never > /sys/kernel/mm/transparent_hugepage/enabled
To permanently disable THP, add the following information to startup parameters:
sudo grubby --args="transparent_hugepage=never" --update-kernel="/boot/vmlinuz-$(uname -r)" sudo reboot
Controlling the Activity of khugepaged
If the CPU usage of the khugepaged daemon is high, you can use the following settings to reduce the activity of khugepaged.
Reduce the scanning frequency of khugepaged.
echo 30000 > /sys/kernel/mm/transparent_hugepage/khugepaged/scan_sleep_millisecs
Increase the retry interval between two allocation attempts.
echo 120000 > /sys/kernel/mm/transparent_hugepage/khugepaged/alloc_sleep_millisecs
Reduce the number of pages scanned each time.
echo 2048 > /sys/kernel/mm/transparent_hugepage/khugepaged/pages_to_scan
Disable automatic defragmentation of khugepaged (if necessary).
echo 0 > /sys/kernel/mm/transparent_hugepage/khugepaged/defrag
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot