Gossamer Forum
Home : General : Databases and SQL :

MySQL processes on a "database server"

Quote Reply
MySQL processes on a "database server"
Hi,

I'm having some server woes :/

Basically, we have quite a beefy old server;

Memory : 1GB DDR RAM
Hard Drive 1 : 80GB EIDE
Operating System : Red Hat Enterprise Linux ES 3
Processor : Single AMD Athlon XP 3000+ 2.167 GHz

However, some of our MySQL processes just keep running and running, and eventually exausing the system (which causes it to crash, after several days).

Is there anywhere that I can set a timeout on mysql processes? i.e if a process runs for more than 1 hour, then kill it?

TIA

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] MySQL processes on a "database server" In reply to
Try doing a `mysqladmin proc` to see what's taking so long, or turn on mysql's slow query log.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] MySQL processes on a "database server" In reply to
Hi Alex,

Thanks. That at least shows me that there are "sleeping" processes. Maybe a DB connection that doesn't get cut off correctly?

Code:
[root@schopen root]# mysqladmin proc
+-------+-----------+---------------------+----------------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+-------+-----------+---------------------+----------------+---------+------+-------+------------------+
| 29847 | cwidbuser | localhost | cwidb | Sleep | 86 | | |
| 30029 | cwidbuser | localhost | cwidb | Sleep | 11 | | |
| 30030 | cwidbuser | localhost | cwidb | Sleep | 82 | | |
| 30034 | cwidbuser | localhost | cwidb | Sleep | 15 | | |
| 30040 | cwidbuser | localhost | cwidb | Sleep | 27 | | |
| 30042 | cwidbuser | localhost | cwidb | Sleep | 14 | | |
| 30043 | cwidbuser | localhost | cwidb | Sleep | 1 | | |
| 30051 | cwidbuser | localhost | cwidb | Sleep | 26 | | |
| 30058 | cwidbuser | localhost | cwidb | Sleep | 18 | | |
| 30066 | cwidbuser | localhost | cwidb | Sleep | 11 | | |
| 30591 | root | localhost | | Query | 0 | | show processlist |
+-------+-----------+---------------------+----------------+---------+------+-------+------------------+

Thanks again.

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] MySQL processes on a "database server" In reply to
That's normal if you are using mod_perl with Apache::DBI, or PHP's persistent connections. If it's php, make sure you have max_connections set in MySQL to at least the max number of apache children.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] MySQL processes on a "database server" In reply to
Hi,

Thanks for the reply... but should some of these processes be running for days on end? :/

AFAIK, these connections should not be the problem with PHP, as we use very little PHP on this server (its soley for the bigger sites, as a database server). I guess the next step, is to try and work out where these errors are coming from, and try to close the connections.

Fun fun... <G>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] MySQL processes on a "database server" In reply to
Quote:
but should some of these processes be running for days on end? :
Yes, if it's listed as 'sleeping', that's quite normal. For instance, if you are using persistent connections in php, then whenever an apache child connects to the database, it will keep a connection open for as long as it lives (which could well be a couple days).

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] MySQL processes on a "database server" In reply to
Ah, I see Frown

Its only got 1Gb of RAM ... do you think its worth upgrading to 1.5Gb? (thats the most we can have on this kind of machine :'().

TIA

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!