Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Member
    Join Date
    Oct 2001
    Posts
    30

    Default 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.

  2. #2
    Member casey's Avatar
    Join Date
    Jan 2003
    Location
    If there is trouble, it will find me
    Posts
    2,336

Similar Threads & Tags
Similar threads

  1. This site may harm your compute
    By crazyaboutlinux in forum Data Protection
    Replies: 5
    Last Post: 07-05-2009, 05:07 PM
  2. Beware: spam injection
    By panayot in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 12-05-2005, 11:52 AM
  3. Any harm to updating curl from source?
    By docjohn in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 10-01-2005, 05:23 AM
  4. mysql_pconnect better or mysql_connect better?
    By Jedia in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 11-04-2004, 10:57 PM
  5. Warning: mysql_pconnect(): Too many connections
    By darenburbridge in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 11-02-2004, 05:10 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube