When optimizing a high-traffic dedicated Linux server, disk I/O bottlenecks are often the primary cause of sluggish response times and elevated load averages. Here are several practical server-tuning techniques I applied to a heavily loaded production server, resulting in a dramatic reduction in disk I/O and much faster throughput.
/tmp mount • Dedicated SSD for MySQL data • FastCGI process management with Nginx + PHP-FPM
1. Mount /tmp as a Ramdisk (tmpfs)
Many web stacks heavily utilize /tmp for transient disk writes:
- PHP Sessions: Default PHP configurations store active session files in
/tmp(session.save_path). - MySQL Temporary Tables: Heavy queries with extensive
JOINorGROUP BYclauses frequently write temporary on-disk tables to/tmp(verify your path usingmysqladmin variables | grep tmpdir).
Mounting /tmp directly into RAM eliminates spinning disk access for these operations. Add the following entry to your /etc/fstab:
none /tmp tmpfs nr_inodes=200k,mode=01777,nosuid,nodev 0 0
Remount or apply without rebooting:
mount -o remount /tmp
2. Isolate MySQL Datadir to High-Performance Storage (SSD)
Moving the MySQL database directory (/var/lib/mysql) to dedicated high-speed SSD storage removes the database write bottleneck and dramatically lowers IO wait times (%iowait) during peak traffic.
3. Adopt Nginx with PHP-FPM
Switching from Apache's traditional prefork MPM / mod_php handler to Nginx + PHP-FPM significantly cuts memory footprint per connection, handles concurrency gracefully, and frees up system resources for database caching.