Linux Server Performance Optimization
Linux server performance optimization
The site is slow even though resources appear sufficient. Or the opposite — the server keeps hitting its ceiling, processes die and pages return errors under load. Optimization starts with measurement, not with editing configuration files at random.
What I check first
- what the actual bottleneck is — CPU, memory, disk or database;
- the PHP-FPM worker count: too few means queuing and timeouts, too many means memory exhaustion and crashes;
- database settings: buffer pool size, slow queries, missing indexes;
- the PHP opcode cache — frequently disabled or sized too small;
- swap and out-of-memory behaviour: why specific processes are being killed;
- static file serving and compression at web server level.
The typical finding
The most common cause of errors under load is not a "weak server" but a worker count left at its default and never recalculated against actual memory. Second most common is a database running a 128 MB buffer pool on a store whose database is several gigabytes.
What is included
Measurements under real traffic, Nginx and PHP-FPM tuned to your memory budget, MariaDB tuning, opcode cache, kernel and swap parameters, and Redis where it fits. A control measurement after every change, so the effect is observed rather than assumed.
What you receive
A server that carries your traffic without errors, with a description of what changed and why. Plus a marker for the traffic level at which the current configuration will stop being enough — so that scaling up is not a surprise.
Tags: linux, optimization, vps, sysctl, performance