How do I use Longview to troubleshoot sudden site slowdown?
I'm using PHP Server Monitor on one Linode VPS to monitor the sites on my main 2GB VPS (running Apache, MySQL, PHP 5.6). It alerts me if any of my sites take longer than 10 seconds to load. The usual page load time for the sites is around 2–3 seconds.
So far around once or twice a day one or more of the sites throw an alert. When the last alert triggered I dived straight into Linode's Longview to see if I could ascertain the cause of the slowdown, but nothing there seemed unusual.
I also SSH'ed in and did $ top
and still, nothing that bad; mysql was on about 8%, apache using 1GB of RAM but nothing else very high.
I'd really like to know how to debug a suddenly (and temporarily) slow site. It only usually lasts a few minutes, but is slow enough to sometimes cause a 500 error, so I'd like to know how to sort it out.
1 Reply
I'm not sure if Longview alone will lead to the answer here, but hopefully these troubleshooting steps might help:
- Check out the disk I/O graph in your Longview's overview tab. If the swap usage spikes, then you might have run into a condition where a process ran high on memory and was killed by Linux's oom-killer. You can review your deployment's system logs to confirm this.
- Turn on MySQL's slow query log. You might have a long-running query when site is slow to respond.
- If you run WordPress, try turning on WordPress's debugging.