Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
linux_wiki:kernel_tuning [2015/04/28 20:11] billdozor |
linux_wiki:kernel_tuning [2019/05/25 23:50] (current) |
||
---|---|---|---|
Line 6: | Line 6: | ||
**Checklist** | **Checklist** | ||
- | * Any distro, but many examples are done via Red Hat based systems | + | * Distro(s): |
---- | ---- | ||
- | ===== Hugepages ===== | + | ====== Hugepages |
Problem: Unable to access a VM's console, and it shows out of memory errors on boot. | Problem: Unable to access a VM's console, and it shows out of memory errors on boot. | ||
Line 28: | Line 28: | ||
---- | ---- | ||
- | ===== Swappiness ===== | + | ==== HugePage Bug ==== |
- | TODO: VM Swappiness | + | On some kernels, khugepaged can start running at 100% CPU utilization. This is typically seen on systems that have process/ |
+ | |||
+ | Other symptoms include: | ||
+ | * Normal commands hang (w, uptime, ps) | ||
+ | * Processes showing above 100% CPU (ie sometimes up to 1,300%) | ||
+ | |||
+ | Details | ||
+ | * Known Affected kernels | ||
+ | * CentOS 6: 2.6.32-431.el6.x86_64 | ||
+ | * Reference bug report: https:// | ||
+ | |||
+ | === Workaround Fix === | ||
+ | |||
+ | Disable hugepage defragmenting: | ||
+ | <code bash> | ||
+ | echo never > / | ||
+ | </ | ||
+ | |||
+ | Add new cron entry | ||
+ | <code bash> | ||
+ | vim / | ||
+ | |||
+ | # Disable kernel huge page defrag due to bugzilla bug: 879801 | ||
+ | @reboot root /bin/echo never > / | ||
+ | </ | ||
+ | |||
+ | === Permanent Fix === | ||
+ | |||
+ | Ultimately, the permanent fix is to update the kernel to a newer version. | ||
+ | |||
+ | TODO: Will add confirmed kernel versions that this bug is fixed in. | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ====== | ||
+ | |||
+ | Swappiness controls how likely the kernel is to move processes out of memory and onto swap disk space. | ||
+ | |||
+ | The setting is from 0 to 100. | ||
+ | * 0 = Very aggressively avoid swapping for as long as possible | ||
+ | * High risk of OOM killing from memory and I/O pressure | ||
+ | * 10 = Red Hat recommended for Oracle databases | ||
+ | * **60 = Linux default** | ||
+ | * 100 = Aggressively swap from memory to disk | ||
+ | |||
+ | Check the setting: | ||
+ | <code bash> | ||
+ | cat / | ||
+ | 60 | ||
+ | </ | ||
+ | |||
+ | To change the setting: edit sysctl.conf, | ||
+ | <code bash> | ||
+ | vim / | ||
+ | vm.swappiness=10 | ||
+ | :wq | ||
+ | sysctl -p | ||
+ | </ | ||
+ | |||
+ | More details about OOM: https:// | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ====== Page Cache ====== | ||
+ | |||
+ | Tuning how often cached pages in memory are flushed to disk. | ||
+ | |||
+ | Check current settings: | ||
+ | <code bash> | ||
+ | sysctl -a | grep dirty | ||
+ | </ | ||
+ | |||
+ | Background (async) pagecache flushing: | ||
+ | <code bash> | ||
+ | vm.dirty_background_ratio = 3 | ||
+ | </ | ||
+ | * Explanation: | ||
+ | * Default value = 10 | ||
+ | |||
+ | Foreground (sync) pagecache flushing: | ||
+ | <code bash> | ||
+ | vm.dirty_ratio = 15 | ||
+ | </ | ||
+ | * Explanation: | ||
+ | * Default value = 20 | ||
---- | ---- | ||
- | ===== File Descriptors ===== | + | ====== File Descriptors |
Viewing and setting the system wide file descriptors. | Viewing and setting the system wide file descriptors. | ||
Line 57: | Line 141: | ||
</ | </ | ||
Example above increases system wide max by 1,000. | Example above increases system wide max by 1,000. | ||
+ | |||
+ | More details, including per user settings: https:// | ||
---- | ---- | ||
+ | |||
+ | ====== Kernel Panic ====== | ||
+ | |||
+ | Reboot a system after a 10 seconds of kernel panic | ||
+ | <code bash> | ||
+ | kernel.panic = 10 | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ |