Docs / Performance Optimization / Memory Overcommit and OOM Killer Configuration

Memory Overcommit and OOM Killer Configuration

By Admin · Mar 11, 2026 · Updated Apr 23, 2026 · 5 views · 3 min read

Getting overcommit right from the start saves hours of debugging later. In this comprehensive guide, we'll cover everything from initial setup to production-ready configuration, including oom and memory considerations.

Prerequisites

  • Basic familiarity with the Linux command line
  • A VPS running Ubuntu 22.04 or later (2GB+ RAM recommended)
  • Access to system monitoring tools (htop, iostat)
  • A registered domain name (for public-facing services)

Baseline Measurement

It's recommended to test this configuration in a staging environment before deploying to production. This helps identify potential compatibility issues and allows you to benchmark performance differences.


# 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.

Security Implications

The oom component plays a crucial role in the overall architecture. Understanding how it interacts with overcommit will help you make better configuration decisions.

Kernel and OS Tuning

When scaling this setup, consider vertical scaling (adding more RAM/CPU) first, as it's simpler to implement. Horizontal scaling adds complexity but may be necessary for high-traffic applications.


# 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 output should show the service running without errors. If you see any warning messages, address them before proceeding to the next step.

Application-Level Optimization

The oom component plays a crucial role in the overall architecture. Understanding how it interacts with overcommit will help you make better configuration decisions.


# 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

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.

Security Implications

If you encounter issues during setup, check the system logs first. Most problems can be diagnosed by examining the output of journalctl or the application-specific log files in /var/log/.

  • Start with the minimum required resources
  • Scale vertically before scaling horizontally
  • Use connection pooling for database connections
  • Profile before optimizing - measure first
  • Implement caching at every appropriate layer

Summary

You've successfully configured overcommit 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?