PDA

View Full Version : MySQL Processes


W3S
05-14-2005, 04:49 AM
Hi,

I ran the command :

mysqladmin processlist

and found that one user had 5 connections to MySQL
the command column for all processes Was 'SLEEP' and Time Column showed a max time of '25807'

Does this mean that the connections that have been opened to MySQL have not closed in his code?

Other 2 process i found where
1) Root (command = Query) (time = 0)- i think this is to show the proceess list.
2) Eximstats (command = Sleep)(time = 279) - i think this is normal too.



I am not sure about the 5 processes of the user. Can anyone guide me?

W3S
05-14-2005, 08:55 AM
Here is a more specific view of the MySQL Processes after a while:

+-------+----------------+-----------+---------------+---------+-------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+-------+----------------+-----------+---------------+---------+-------+-------+------------------+
| 2 | eximstats | localhost | eximstats | Sleep | 460 | | |
| 9064 | koolpk_EsaDmin | localhost | koolpk_iskool | Sleep | 18540 | | |
| 9363 | koolpk_EsaDmin | localhost | koolpk_iskool | Sleep | 1776 | | |
| 9368 | koolpk_EsaDmin | localhost | koolpk_iskool | Sleep | 17178 | | |
| 9884 | koolpk_EsaDmin | localhost | koolpk_iskool | Sleep | 463 | | |
| 10016 | root | localhost | | Query | 0 | | show processlist |
+-------+----------------+-----------+---------------+---------+-------+-------+------------------+


Can anyone tell why these processes are still stuck ? What can i do about them ?

fus1on
05-17-2005, 07:56 AM
Don't worry about them.
If you're using persistant connections in PHP, whenever a connection is made to the database it will be kept open for as long as the apache child lives.

Martin
03-28-2006, 04:19 PM
Don't worry about them.
If you're using persistant connections in PHP, whenever a connection is made to the database it will be kept open for as long as the apache child lives.

Hi. we have a big forum and we don't user persistent connections to mysql.
but we have lot of sleeping process eating our ram.

do you know some way to kill sleeping process automatically after X seconds ?
there is no config parameter on mysql for that like a timeout ? (I think the timeout on my.cfg is related to tcp/it connections only not local sockets.)

thanks for some info :) !!

vps-vince
03-29-2006, 06:56 PM
Have you got this setting in your my.cnf


wait_timeout 300

Take a look here:

http://bugs.mysql.com/bug.php?id=11897

- Vince