#1 (permalink)  
Old 11-17-2004, 10:44 PM
Registered User
 
Join Date: Oct 2001
Posts: 30
kiat
BEWARE! mysql_pconnect could harm your server.

Hi,

I would like to share this experience with everyone who might fall in to the same situation like me. Last month my server will be crashed every couple days randomly. Few days ago, I just found that it was from I have too many mysql connections. Below is an output from top command that I got before the server go down. I have 402 process running and 170 process were mysql. After this for a few mintues, the server will go down with last CPU load average that I saw about 62.

16:41:56 up 5 days, 50 min, 0 users, load average: 30.52, 19.98, 9.79
402 processes: 395 sleeping, 2 running, 5 zombie, 0 stopped
CPU0 states: 0.1% user 2.1% system 0.0% nice 0.0% iowait 97.0% idle
CPU1 states: 2.0% user 0.1% system 0.0% nice 0.0% iowait 97.1% idle
Mem: 1029256k av, 1019056k used, 10200k free, 0k shrd, 32396k buff
506132k actv, 48604k in_d, 11064k in_c
Swap: 1020088k av, 474904k used, 545184k free 98560k cached

I found that a user were using mysql_pconnect, with this command the connection to mysql will not be closed when script end. This will using resources and accumulate to nearly maximum limit of the server and the server will go down. Only reboot at power switch will fix this when it crash.

Then I go to php.ini and turn
mysql.allow_persistent = Off
and restart apache. It's now look like the server operate very good. I got mysql process below 20 almost all the time. I hope that it will help someone who are in the same situation like me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 11-17-2004, 10:46 PM
casey's Avatar
Registered User
 
Join Date: Jan 2003
Location: If there is trouble, it will find me
Posts: 2,335
casey is an unknown quantity at this point
Install watchmysql:
http://www.cplicensing.net/scripts.php
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 04:21 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© cPanel Inc