Introduction: The Hidden Kernel Defaults Killing Database Speed
When installing Linux (Oracle Linux, RHEL, Ubuntu) on a server host, the operating system defaults to general-purpose desktop/web server kernel settings:
vm.swappiness = 60transparent_hugepage = always
While suitable for lightweight web servers, these default parameters cause severe latency spikes in memory-intensive databases like Oracle, SQL Server, and Postgres.
Why Default Kernel Settings Destroy Database Performance
1. The Swap Thrashing Penalty (vm.swappiness = 60)
- The Problem: At
swappiness=60, the Linux kernel aggressively reclaims memory by swapping inactive SGA memory pages to disk space—even when 30% of physical RAM is free. - The Result: High database wait events on
latch: free listand severe disk read I/O delays.
2. Transparent Huge Pages (THP) Memory Freezes
- The Problem: THP dynamically allocates 2MB memory pages at runtime. Under heavy transaction volumes, the kernel
khugepagedthread locks memory spaces to defragment memory. - The Result: Random 5-to-30 second complete freezes of the database instance.
🔍 Check Your Environment Now (Diagnostic CTA)
Run the following shell commands on your database or OLVM hypervisor host nodes right now to inspect your kernel settings:
# Diagnostic 1: Check Current Swappiness
sysctl vm.swappiness
# Diagnostic 2: Check Transparent Huge Pages (THP) Status
cat /sys/kernel/mm/transparent_hugepage/enabled
# Diagnostic 3: Check Swap Space Utilization
free -m
What to Look For:
- ❌
vm.swappiness = 60: Incorrect. Host is actively swapping SGA memory blocks. - ❌
[always] madvise never: Incorrect. THP is enabled and causing allocation freezes.
The Correct Production Kernel Configuration
Apply the following production parameters to /etc/sysctl.conf:
# 1. Reduce swappiness to 10
sysctl -w vm.swappiness=10
echo "vm.swappiness=10" >> /etc/sysctl.conf
# 2. Disable Transparent Huge Pages (THP)
echo "never" > /sys/kernel/mm/transparent_hugepage/enabled
echo "never" > /sys/kernel/mm/transparent_hugepage/defrag
# Add grub kernel boot parameter to persist THP disable across reboot
# In /etc/default/grub: transparent_hugepage=never
Download our free Log Collector & Sanitizer Script or Schedule a Virtualization & OS Audit to audit host kernel parameters.