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
---
## 📚 Official Documentation & Technical References
- **MOS Doc ID 401749.1:** *HugePages on Linux: What It Is and What It Is Not* — Technical reference for static HugePages architecture vs dynamic kernel memory allocation.
- **Oracle Linux Documentation:** [Oracle Linux Administrator's Guide: Memory Management](https://docs.oracle.com/en/operating-systems/oracle-linux/) — Official documentation on kernel parameters, HugePages configuration, and swap tuning.
- **Oracle Database Installation Guide:** [Configuring Kernel Parameters for Linux](https://docs.oracle.com/en/database/oracle/oracle-database/19/ladbi/configuring-kernel-parameters-for-linux.html) — Memory management guidelines and kernel parameter recommendations for database hosts.
- **ORACLE-BASE:** [Configuring HugePages for Oracle Database on Linux](https://oracle-base.com/articles/linux/configuring-huge-pages-for-oracle-on-linux-64) — Tim Hall's guide to configuring static HugePages and kernel swappiness.
---
Download our free [Log Collector & Sanitizer Script](/tools/sanitizer) or [Schedule a Virtualization & OS Audit](/audits) to audit host kernel parameters.