How to find reasons of why site goes online/offline
Seems today a website I manage has been going online and offline throughout the entire day. I have no idea what is causing the issue so I am seeking guidance on where to start. It is a WordPress based site.
So here is what I do know:
I use a program that pings the server every minute and when the server is not responding me it emails me, so I can know exactly when the site is online and offline. The site between 8pm to 12pm 12.28, and around the 1a hour early morning 12.29 (New York City timezone, and all times below are in same timezone).
At the time of the ups/downs I see a lot of strain on the memory usage. Look at the load average when the site is going online/offline (http://screencast.com/t/BRlfXkqrbJII). Then I ran this command to restart http (http://screencast.com/t/usVtYWZ2Qi) and the memory usage then goes down to this (http://screencast.com/t/VdTIy3bgZiQB). An hour after I restarted http, the site then went offline/online so restarting the http didn't do much help.
When the site is going offline/online, I ran the top command and get this (http://screencast.com/t/zEw开发者_C百科r7YQj3). Here is a top command when the site is at it's lowest (http://screencast.com/t/eaMfha9lbT - so this would be dubbged "normal").
Here is a bandwidth report (http://screencast.com/t/AS0h2CH1Gypq).
The traffic doesn't seem to be that much (http://screencast.com/t/s7hrWNNic1K), but looking at my times the site is going up/down this may be one of the reasons?
I have the dvp Nitro package at Media Temple (http://mediatemple.net/webhosting/nitro/).
So at this point I would request some help in trying to figure out what the cause of this is, and how I can go about pinpointing this issue. ANY HELP is greatly appreciated.
You are using a virtual server, which is harder to debug - there are more likely possibilities for bottlenecks. It also greatly depends on the hosters configuration.
However, the first thing you should do are:
Set the KeepAlive
direction in apache to Off
In almost every cirtumstances this reduces the server load caused by apache significantly, it however reduces the delay for client requests a bit. (because they have to open a new connection for each resource to be fetched.)
But your mysql server seems to consume the most resources. Have a look at the slow queries log, maby you can spot something.
It is most likely something wrong with your application (it hangs and keeps the mysql connection open, executes strange queries etc.)
But it does not need to be. It could also be some sort of resource deadlock.
Please run this command and post the output:
cat /proc/user_beancounters
It is a file that exactly shows the limits of your virtual machine and if they have been hit.
This will let more light shine on the issue so that we can analyze it further.
Please also post "df -h
" as well as "df -i
".
Pretty standard thing - you have alot of 'slow' clients. The more clients - the slower apache works. Dead loop.
You need to:
1) Switch apache to prefork mode, max number of processes = 10-20
2) Set up frontend - like nginx. Another option - replace apache with lighthttpd. They both use very little memory per connection.
I have seen this same thing happening with a similar setup. In our case it turned out to be a situation where there were several clients that were slow and tied up the database connections which slowed things down for everyone else. If I restarted MySQL the problem would go away.
You can probably improve things by tuning your MySQL settings. However, one of the fastest ways to improve things with Wordpress is to install WP Super Cache. Most of the time this will fix any DB issues by dramatically reducing the number of database calls that occur.
http://wordpress.org/extend/plugins/wp-super-cache/
精彩评论