Docs / Performance Optimization / Linux Huge Pages Configuration for Databases

Linux Huge Pages Configuration for Databases

By Admin · Feb 22, 2026 · Updated Apr 23, 2026 · 7 views · 2 min read

Linux Huge Pages Configuration for Databases is a common requirement for VPS administrators. This guide provides practical instructions that you can follow on Ubuntu 22.04/24.04 or Debian 12, though most steps apply to other distributions as well.

Prerequisites

  • A registered domain name (for public-facing services)
  • Basic familiarity with the Linux command line
  • Current baseline performance metrics for comparison
  • Access to system monitoring tools (htop, iostat)

Baseline Measurement

Security should be a primary consideration when configuring huge-pages. Always use strong passwords, keep software updated, and restrict network access to only the necessary ports and IP addresses.


# Kernel tuning: /etc/sysctl.d/99-performance.conf
cat << 'EOF' | sudo tee /etc/sysctl.d/99-performance.conf
# Network performance
net.core.somaxconn = 65535
net.core.netdev_max_backlog = 65535
net.ipv4.tcp_max_syn_backlog = 65535
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 15

# Memory management
vm.swappiness = 10
vm.dirty_ratio = 15
vm.dirty_background_ratio = 5

# File descriptors
fs.file-max = 2097152
fs.nr_open = 2097152
EOF

sudo sysctl --system

This configuration provides a good balance between performance and resource usage. For high-traffic scenarios, you may need to increase the limits further.

Kernel and OS Tuning

Before making changes to the configuration, always create a backup of the existing files. This ensures you can quickly roll back if something goes wrong during the setup process.


# Benchmark before and after optimization
# CPU benchmark
sysbench cpu --cpu-max-prime=20000 run

# Memory benchmark
sysbench memory --memory-block-size=1M --memory-total-size=10G run

# Disk I/O benchmark
sysbench fileio --file-total-size=4G --file-test-mode=rndrw prepare
sysbench fileio --file-total-size=4G --file-test-mode=rndrw run
sysbench fileio --file-total-size=4G cleanup

The configuration above sets the recommended values for a VPS with 2-4GB of RAM. Adjust the memory-related settings proportionally if your server has different specifications.

Summary

You've successfully configured huge-pages on your VPS. Remember to monitor performance, keep your software updated, and maintain regular backups. If you run into issues, consult the official documentation or open a support ticket for assistance.

Was this article helpful?