Working through it rather than guessing.
ESTABLISH WHERE THE TIME GOES
Load a static file directly. Fast means the server and network are fine, and the problem is the application or database.
CHECK RESOURCES
- Memory: is the system swapping, or killing processes?
- CPU: which process is consuming it?
- Disk: is iowait high, indicating storage contention?
- Disk space: is it nearly full?
Each points somewhere different.
CHECK THE DATABASE
Enable and read the slow query log. A single unindexed query on a growing table is the most common cause of a site becoming gradually slower over months.
CHECK TRAFFIC
Is request volume unusual? Analyse the access log for top addresses and top URLs. Bot traffic frequently explains a sudden change.
CHECK RECENT CHANGES
What was deployed, updated or configured around when it started?
THE MOST COMMON ANSWERS
Insufficient memory causing swapping A missing database index No caching Bot traffic
In that order.