The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

MySQL Processes Not Dying?

Discussion in 'General Discussion' started by Curto, Jun 13, 2004.

  1. Curto

    Curto Active Member

    Joined:
    Sep 4, 2003
    Messages:
    40
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    NY, USA
    Hi all,

    I've got a odd problem. On one of my boxes (dual xeon 2.8ghz with 2gb ram) I host several medium forums. MySQL gets quite a lot of use with usually 5-15 connections in use at a time.

    However, the processes seem to multiply without many dying off.

    Example:
    I restarted MySQL today at approx 10:12am EST.
    The server starts with just a few processes.
    Forums get used moderately during the day (being a weekend) - none use persistent connections.
    Right now (8:30pm EST) there are 132 mysqld processes running (ps aux | grep mysqld | wc -l)

    These processes are mostly using 0 cpu, but all are using some ram... and it all adds up.

    Is there anyway to force mysql processes to die off after a certain amount of inactivity (like the apache min/maxservers)?
     
  2. xphost

    xphost Well-Known Member

    Joined:
    Nov 12, 2003
    Messages:
    76
    Likes Received:
    0
    Trophy Points:
    6
    i have similar problem

    mysql needed restart every day because everytime growing
     
  3. xphost

    xphost Well-Known Member

    Joined:
    Nov 12, 2003
    Messages:
    76
    Likes Received:
    0
    Trophy Points:
    6
    may be i solve problem

    it was new configured server and i was need some change

    in /usr/local/lib/php.ini

    found mysql.allow_persistent=On

    and setup mysql.allow_persistent=Off
     
  4. Curto

    Curto Active Member

    Joined:
    Sep 4, 2003
    Messages:
    40
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    NY, USA
    I already have that set to Off.

    One idea... what would happen if a poorly written php script did NOT close its database connections at the end of execution... would the processes remain idle waiting for further instructions from that script (which of course would never come as it had finished execution)?

    Here's a example of the quantity of processes of each apache and mysql (at 11:08am EST)
    root@xxx [~]# pidof mysqld
    32463 32461 32460 32459 32458 32457 32456 32455 32453 32452 32451 32450 32449 32448 32447 32446 32444 32443 32441 32440 32439 32438 32434 32433 32432 32431 32430 13113 13112 13111 13110 13109 13108 13107 13106 13105 13104 13102 13101 13100 13099 13098 13097 13096 13095 13094 13093 13092 13091 13090 13089 13088 13087 13086 13085 13084 13083 13082 13081 13080 13079 13078 13056 13055 13054 13053 13052 13051 13050 13032 13031 13028 2251 2250 2249 2248 2247 2246 2245 2244 2225 2222 2220 2217 2216 2215 2212 2208 2207 2206 2205 2203 2201 2199 2195 2192 2191 2190 2189 2188 2186 2178 2177 2173 2172 2169 2151 2150 2149 2145 2142 2070 2069 2044 2032 2029 2028 2027 2026 2001 1993 1992 1990 1989 1985 1977 1975 1973 1972 1970 1969 1967 1966 1960 1952 1950 1949 1945 1937 1936 1935 1934
    root@xxx [~]# pidof httpd
    16629 16628 16627 16626 16625 16624 16623 16622 16621 16620 16619 16618 16617 16616 16615 16614 16613 16612 16611 16609 16608 16607 16606 16604 16603 16602 16601 16600 16599 16598 16597 16596 16595 16594 16593 16590 16589 16588 16587 16585 16584 16583 16582 16566 16565 16564 16563 16562 16561 16552 16515 16514 16506 8997
     
  5. xphost

    xphost Well-Known Member

    Joined:
    Nov 12, 2003
    Messages:
    76
    Likes Received:
    0
    Trophy Points:
    6
    strange situation

    i found that one account create many mysql connections

    its not very bad, but after that connections die apache still have +100 additional processes

    may be i need reconfigure httpd.conf

    | 2410 | omt_omtadmin | localhost | omt_nuketest | Sleep | 15 | | |
    | 2411 | omt_omtadmin | localhost | omt_nuketest | Sleep | 15 | | |
    | 2417 | omt_omtadmin | localhost | omt_nuketest | Sleep | 15 | | |
    | 2423 | omt_omtadmin | localhost | omt_nuketest | Sleep | 15 | | |
    | 2426 | omt_omtadmin | localhost | omt_nuketest | Sleep | 15 | | |
    | 2432 | omt_omtadmin | localhost | omt_nuketest | Sleep | 13 | | |
    | 2433 | omt_omtadmin | localhost | omt_nuketest | Sleep | 13 | | |
    | 2434 | omt_omtadmin | localhost | omt_nuketest | Sleep | 13 | | |
    | 2441 | omt_omtadmin | localhost | omt_nuketest | Sleep | 12 | | |
    | 2444 | omt_omtadmin | localhost | omt_nuketest | Sleep | 10 | | |
    | 2445 | omt_omtadmin | localhost | omt_nuketest | Sleep | 10 | | |
    | 2446 | omt_omtadmin | localhost | omt_nuketest | Sleep | 9 | | |
    | 2447 | omt_omtadmin | localhost | omt_nuketest | Sleep | 9 | | |
    | 2448 | omt_omtadmin | localhost | omt_nuketest | Sleep | 9 | | |
    | 2451 | omt_omtadmin | localhost | omt_nuketest | Sleep | 8 | | |
    | 2453 | omt_omtadmin | localhost | omt_nuketest | Sleep | 9 | | |
    | 2455 | omt_omtadmin | localhost | omt_nuketest | Sleep | 7 | | |
    | 2456 | omt_omtadmin | localhost | omt_nuketest | Sleep | 9 | | |
    | 2457 | omt_omtadmin | localhost | omt_nuketest | Sleep | 8 | | |
    | 2459 | omt_omtadmin | localhost | omt_nuketest | Sleep | 6 | | |
    | 2460 | omt_omtadmin | localhost | omt_nuketest | Sleep | 8 | | |
    | 2463 | omt_omtadmin | localhost | omt_nuketest | Sleep | 7 | | |
    | 2464 | omt_omtadmin | localhost | omt_nuketest | Sleep | 6 | | |
    | 2466 | omt_omtadmin | localhost | omt_nuketest | Sleep | 8 | | |
    | 2469 | omt_omtadmin | localhost | omt_nuketest | Sleep | 7 | | |
    | 2470 | omt_omtadmin | localhost | omt_nuketest | Sleep | 7 | | |
    | 2475 | omt_omtadmin | localhost | omt_nuketest | Sleep | 6 | | |
    | 2476 | omt_omtadmin | localhost | omt_nuketest | Sleep | 6 | | |
    | 2477 | omt_omtadmin | localhost | omt_nuketest | Sleep | 7 | | |
    | 2478 | omt_omtadmin | localhost | omt_nuketest | Sleep | 6 | | |
    | 2480 | omt_omtadmin | localhost | omt_nuketest | Sleep | 6 | | |
    | 2482 | omt_omtadmin | localhost | omt_nuketest | Sleep | 5 | | |
    | 2483 | omt_omtadmin | localhost | omt_nuketest | Sleep | 6 | | |
    | 2486 | omt_omtadmin | localhost | omt_nuketest | Sleep | 4 | | |
    | 2487 | omt_omtadmin | localhost | omt_nuketest | Sleep | 4 | | |
    | 2488 | omt_omtadmin | localhost | omt_nuketest | Sleep | 5 | | |
    | 2489 | omt_omtadmin | localhost | omt_nuketest | Sleep | 5 | | |
    | 2490 | omt_omtadmin | localhost | omt_nuketest | Sleep | 4 | | |
    | 2491 | omt_omtadmin | localhost | omt_nuketest | Sleep | 4 | | |
    | 2493 | omt_omtadmin | localhost | omt_nuketest | Sleep | 4 | | |
    | 2495 | omt_omtadmin | localhost | omt_nuketest | Sleep | 3 | | |
    | 2496 | omt_omtadmin | localhost | omt_nuketest | Sleep | 2 | | |
    | 2497 | omt_omtadmin | localhost | omt_nuketest | Sleep | 2 | | |
    | 2505 | omt_omtadmin | localhost | omt_nuketest | Sleep | 1 | | |
    | 2507 | omt_omtadmin | localhost | omt_nuketest | Sleep | 1 | | |
    | 2508 | omt_omtadmin | localhost | omt_nuketest | Sleep | 0 | | |
     
  6. Curto

    Curto Active Member

    Joined:
    Sep 4, 2003
    Messages:
    40
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    NY, USA
    I found, despite having mysql.allow_persistent = Off in my php.ini a site was still using mysql_pconnect. I changed that to mysql_connect and now all is well :)
     
Loading...

Share This Page