Quick answer
Most "slow server" tickets are not slow hardware — they are a missing index, a misconfigured cache, or a log disk that filled up.
Most “slow server” tickets are not slow hardware — they are a missing index, a misconfigured cache, or a log disk that filled up. Work through the cheap wins first.
What you need: SSH access and baseline metrics from before any change.
Find the bottleneck first
Check load average, memory, and I/O wait. A box at 0.20 load with 98% iowait is disk-bound; a box at 30 load with free memory is CPU-bound.
Size PHP and the database
Give PHP-FPM enough children to handle peak traffic, and cap MySQL’s buffers so it fits in RAM without swapping.
Cache aggressively
Enable opcache, add a page cache if you run a CMS, and check that static assets carry long cache headers.
uptime
free -h
iostat -x 1 3
htop
# opcache in php.ini:
opcache.enable=1
opcache.memory_consumption=128
How it works, in detail
Performance work is measurement first and configuration second, because the fix for a disk-bound box is nothing like the fix for a CPU-bound one. Load average without I/O wait is misleading: a server at 0.2 load with 98% iowait is slow because of the disk, not the CPU. PHP-FPM should have enough children for peak traffic but not so many that the box swaps, and MySQL’s buffers must fit in RAM. Caching is the highest-leverage change, since a page served from cache never touches PHP or the database at all.
Common pitfalls
- Adding RAM to a disk-bound server and changing nothing.
- Tuning blind without iostat, vmstat and a before/after comparison.
Pro tip
Capture a baseline (uptime, free, iostat, slow query log) before you change anything, so you can prove what actually helped.
Measure before you tune. Adding more RAM to a disk-bound server is just an expensive way to do nothing.



0 Comments