When dealing with high-speed backup distribution over 10Gbit networks, traditional disk I/O becomes the bottleneck. Our benchmarking shows RAID0 arrays delivering ~260MB/s versus tmpfs reaching ~1GB/s - a clear indication of memory's performance advantage.
# Current VM settings
vm.swappiness = 20
vm.dirty_ratio = 70
vm.dirty_background_ratio = 30
vm.dirty_writeback_centisecs = 60000
While these settings theoretically reserve ~16GB for caching, they're not delivering expected throughput due to several factors:
For true high-performance caching, we need to adjust additional parameters:
# Enhanced settings for backup servers
vm.vfs_cache_pressure = 50
vm.dirty_expire_centisecs = 360000
vm.dirty_bytes = 2147483648 # 2GB threshold
vm.dirty_background_bytes = 1073741824 # 1GB background threshold
The Linux kernel offers several mechanisms for aggressive caching:
- Enable CONFIG_NR_CPUS matching your core count
- Adjust CONFIG_HIGHMEM for large memory systems
- Consider CONFIG_IOMMU for direct memory access
Here's a complete tuning script for backup servers:
#!/bin/bash
# Disk caching optimization for backup servers
# Set VM parameters
sysctl -w vm.swappiness=10
sysctl -w vm.vfs_cache_pressure=50
sysctl -w vm.dirty_ratio=15
sysctl -w vm.dirty_background_ratio=5
sysctl -w vm.dirty_expire_centisecs=600000
sysctl -w vm.dirty_writeback_centisecs=60000
sysctl -w vm.overcommit_memory=1
sysctl -w vm.overcommit_ratio=100
# Block device tuning
for device in $(ls /sys/block/sd*); do
echo 1024 > /sys/block/$device/queue/nr_requests
echo noop > /sys/block/$device/queue/scheduler
echo 256 > /sys/block/$device/queue/read_ahead_kb
done
# Network tuning for 10Gbit
sysctl -w net.core.rmem_max=16777216
sysctl -w net.core.wmem_max=16777216
sysctl -w net.ipv4.tcp_rmem="4096 87380 16777216"
sysctl -w net.ipv4.tcp_wmem="4096 65536 16777216"
Measure actual improvements using:
# Direct cache testing
dd if=/dev/zero of=/path/to/cached/file bs=1G count=10 oflag=direct
# Memory bandwidth verification
sysbench memory --memory-block-size=1G --memory-total-size=20G run
When maximum throughput is absolutely critical:
- Implement a RAM disk for most recent backups
- Use DAX (Direct Access) filesystems with Optane/NVMe
- Consider kernel bypass techniques like DPDK for network
When dealing with high-performance backup servers, the gap between disk I/O (260-275MB/s) and memory throughput (1GB/s+) becomes a critical bottleneck. The key lies in maximizing memory utilization while minimizing unnecessary disk writes.
Your current configuration shows good intentions but misses critical optimizations:
# Current settings
vm.swappiness = 20 # Still too aggressive for cache purposes
vm.dirty_ratio = 70 # Default behavior triggers flushes too early
vm.dirty_background_ratio = 30 # Background flush threshold
vm.dirty_writeback_centisecs = 60000 # 10-minute interval
For a 24GB RAM system dedicated to backup distribution:
# Optimized settings for cache retention
vm.swappiness = 1 # Avoid swapping unless absolutely necessary
vm.dirty_ratio = 90 # Allow more dirty pages accumulation
vm.dirty_background_ratio = 1 # Minimal background flushing
vm.dirty_expire_centisecs = 8640000 # 24-hour retention (when possible)
vm.dirty_writeback_centisecs = 360000 # 1-hour writeback interval
vm.vfs_cache_pressure = 50 # Favor inode/dentry caching
For extreme performance cases, consider these additional tweaks:
# Add to /etc/sysctl.conf
vm.zone_reclaim_mode = 0 # Disable zone reclaim for NUMA
vm.min_free_kbytes = 65536 # Larger emergency pool (adjust based on RAM)
vm.page-cluster = 0 # Disable readahead for random workloads
Use these commands to verify cache behavior:
# Real-time monitoring
watch -n 1 "grep -E 'Dirty|Writeback' /proc/meminfo"
# Detailed cache analysis
vmtouch -v /path/to/backup/files
# IO pressure measurement
iostat -xmt 1
For automated cache management, consider this Python monitoring script:
#!/usr/bin/env python3
import os, time
def check_cache_pressure():
with open('/proc/meminfo') as f:
mem = {l.split(':')[0]: int(l.split(':')[1].split()[0])
for l in f.readlines()}
dirty_pct = (mem['Dirty'] / mem['MemTotal']) * 100
return dirty_pct > 85 # Alert threshold
while True:
if check_cache_pressure():
os.system('sync &') # Async writeback
time.sleep(60)
For XFS (recommended for large files):
# Mount options for cache optimization
UUID=xxx /backup xfs defaults,noatime,nodiratime,logbsize=256k,allocsize=1g 0 0
# Disable last access time recording
sysctl fs.xfs.xfssyncd_centisecs=60000