Full CPU use is on "waiting" and dunnot know wich proccess to blame and why

Asked by Alvaro Gonzalez

I set up a LAMP server with a Plesk control panel, and from time to time its getting stuck with the CPU use 100% in WAIT state.

MySQL queries take ages to finish, and the http queries don't ever finish to stuck in the queue, so finally I'm getting like 100 or 200 http processes, and a stuck MySQL.

With a lot of difficulty I log on to the server, restart the apache and the mysql server, and it begins to be responsive again.

I've been checking the slowqueries on mysql, and I see some, but are very simple ones, so I think they're going slow because the server is stuck on "WAIT", and I think I don't see any unusual quantity of queries on the server.

How can I check what are my proccesses WAITing for? Is my hard disk doing something weird, maybe it's dying and when reading or writing on some position it gets stuck?

Thanks

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
shrini (shrini) said :
#1

How much RAM you have?

Try to increase RAM.

google and read the articles on optimization for apache and mysql.

Revision history for this message
Alvaro Gonzalez (andor) said :
#2

I have 512MB of RAM, but it shouldn't need more because it's a very low traffic server.

The real question is around why proccesses are stuck on "waiting", I think.

Thanks.

Revision history for this message
shrini (shrini) said :
#3

Hi Alvaro Gonzalez,

For Slow LAMP setup, The following may be the reasons.

1. Low RAM
2. Faulty harddisk
3. Un optimised Apache and MySQL
4. Bugs in PHP coding. i.e Programmer opens the MySQL Connection and forgets to close the connections. So on running, tons of mysql connections will be running unwanted.
5. Other unwanted huge services running on the system.

Do the following things.

Check the hard disk.
Stop all unwanted services.
Check the MySQL connections in PHP are closed on every php page. consult with progreammer.
Optimise apache and MySQL.

Wishes.

Can you help with this problem?

Provide an answer of your own, or ask Alvaro Gonzalez for more information if necessary.

To post a message you must log in.