mysqld runs many hours

thunn

Verified User
Joined
Mar 13, 2012
Messages
166
Dear Supporters,
Do you know why mysqld thread runs many hours without close it?
It use 20% of memory and runs about 120 hours:
Code:
23246 | mysql     | 15   | 0  | 628m | 470m | 4748 | S  | 0.3 | 20.6 | 121:49.46 | mysqld

I attached of the screenshot for reference. Please give me an advise.

work_many_hours.png

Thank you.
 
The server is up, is normal that is up since hours (or days).

No problem on that.

For notice what is currently doing the MySQL Server you should think about use mytop.

Regards
 
The server is up, is normal that is up since hours (or days).

No problem on that.

For notice what is currently doing the MySQL Server you should think about use mytop.

Regards

Yes, is see that the server still running in a good state. but this mysqld process takes resources, that's why I concern.
I've just check the tool you said, mytop but it's not for my mysql + centos:
"mytop is a console-based (non-gui) tool for monitoring the threads and overall performance of MySQL 3.22.x, 3.23.x, and 4.x servers"

Do you have any other tool that can know what's happening inside a mysql process?
 
Maybe a script uses persistent connections (mysql_pconnect())?

Yes, I think that can be. But it is not good, right?
I saw it often sitting at the top position of "top" command, that mean it often takes many % CPU than other processes.
 
Yes, I think that can be. But it is not good, right?
It's ok for dedicated servers with one site/purpose, but it's not advised on shared servers, unless it's a high spec server (like quad or multi-quad cpu, 12+ gb ram, etc)
 
It's ok for dedicated servers with one site/purpose, but it's not advised on shared servers, unless it's a high spec server (like quad or multi-quad cpu, 12+ gb ram, etc)

My server use for many websites :(
How can I avoid this persistence connection?
 
To disable persistent connections, just use mysql_connect() instead.

You can also, very simply, set mysql.allow_persistent = Off in your php.ini file, then restart Apache, may need to restart MySQL too.

However, this could break things. My advice is to see what database is used, then you can reference it to the right account, and see the offending script.
 
To disable persistent connections, just use mysql_connect() instead.

You can also, very simply, set mysql.allow_persistent = Off in your php.ini file, then restart Apache, may need to restart MySQL too.

However, this could break things. My advice is to see what database is used, then you can reference it to the right account, and see the offending script.

It's set to Off already when I check phpinfo();
persistence_connection.png
 


I don't see any process listed here too:
Code:
[root@ns ~]# mysqladmin processlist
+-------+----------+-----------+----+---------+------+-------+------------------+
| Id    | User     | Host      | db | Command | Time | State | Info             |
+-------+----------+-----------+----+---------+------+-------+------------------+
| 48184 | da_admin | localhost |    | Query   | 0    |       | show processlist |
+-------+----------+-----------+----+---------+------+-------+------------------+

Code:
mysql> SHOW FULL PROCESSLIST;
+-------+----------+-----------+------+---------+------+-------+-----------------------+
| Id    | User     | Host      | db   | Command | Time | State | Info                  |
+-------+----------+-----------+------+---------+------+-------+-----------------------+
| 48228 | da_admin | localhost | NULL | Query   |    0 | NULL  | SHOW FULL PROCESSLIST |
+-------+----------+-----------+------+---------+------+-------+-----------------------+
1 row in set (0.00 sec)

mysql>
 
As i did reply on Post #2 that should be normal.

Actually i dont see any problem with that.

And mytop work perfectly with MySQL 5.x and CentOS. All my production server are CentOS 5.8 and 6.2 and all of them have mytop working.

Regards
 
Here what I have on one of the servers I maintain:

Code:
PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
23893 mysql     15   0  757m 413m 6016 S  4.3  5.2   1549:28 mysqld

or from another

Code:
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
27753 mysql     15   0 1165m 538m 4696 S  0.7 13.6   7963:26 mysqld

They do not bother me. If you worry about the amount of RAM your process take, check with script (download it from http://mysqltuner.pl) how much can your MySQL server take RAM. You would see something like this:

Code:
-------- Performance Metrics -------------------------------------------------
[--] Up for: 78d 11h 49m 0s (866M q [127.700 qps], 13M conn, TX: 2920B, RX: 204B)
[--] Reads / Writes: 74% / 26%
[--] Total buffers: 896.0M global + 9.6M per thread (140 max threads)
[OK] Maximum possible memory usage: 2.2G (56% of installed RAM)
 
Back
Top