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.

A lot of connections increase cpu ... server fall

Discussion in 'Security' started by LeroanZ, Sep 15, 2013.

  1. LeroanZ

    LeroanZ Member

    Joined:
    Sep 15, 2013
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi guys I m using linux vps and my all sites, when i open one of the my sites, and clicking F5 3 4 times cpu is increasing how can i fix this solution ?
     
  2. MaestriaNick

    MaestriaNick Well-Known Member

    Joined:
    Aug 6, 2008
    Messages:
    159
    Likes Received:
    3
    Trophy Points:
    18
    Can you please check the output of command "top" at that time ? That will show what processes / user causing high load in the server.
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,743
    Likes Received:
    662
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    How much is the CPU increasing? Are the sites loading slower, and what type of content do the websites use? Are they MySQL-based websites?

    Thank you.
     
  4. LeroanZ

    LeroanZ Member

    Joined:
    Sep 15, 2013
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I m sorry about my bad english firstly :)
    Yes Mysql Based web sites, of course php :)
    now for example i have a web site xxx.com and i open it on browser. When i press the F5 button till 10 seconds are enough and sites give error php error and after 10 seconds, cpu down and all server is down...
    when i see the top command when this action, it shows

    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    7622 aykut72 20 0 76496 38m 13m R 22.0 1.3 0:05.36 httpd

    therefore, a little hack tool or ip flood tools are very effective on my sites :)
     
  5. LeroanZ

    LeroanZ Member

    Joined:
    Sep 15, 2013
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    In Addition, Before i use suphp this action down Mysql, i had to use this command after this actions: server mysql restart... i turned dso and it just led to php error and when i stop the flood, 10 seconds later it comes itself again...
     
  6. quizknows

    quizknows Well-Known Member

    Joined:
    Oct 20, 2009
    Messages:
    940
    Likes Received:
    55
    Trophy Points:
    28
    cPanel Access Level:
    DataCenter Provider
    This is most likely not a server problem, but a problem with your PHP code or MySQL queries causing them to create high load on the server. You need to troubleshoot your application code.

    You may be able to try things like enabling a slow query log for MySQL or various tricks to analyze the PHP scripts. However this is most likely not security related, nor server related.
     
  7. LeroanZ

    LeroanZ Member

    Joined:
    Sep 15, 2013
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    No man, it happens on all web sites...
    and there is a different server i have my friend is using it, same problem in there... how can i fix it
     
  8. quizknows

    quizknows Well-Known Member

    Joined:
    Oct 20, 2009
    Messages:
    940
    Likes Received:
    55
    Trophy Points:
    28
    cPanel Access Level:
    DataCenter Provider
    I'd start with the apache error log and any php error_log files. You mention VPS hosting, perhaps your server just does not have enough resources for dynamic PHP/MySQL sites. Even common CMS software like wordpress/joomla requires a pretty decent server nowadays. If you are using CMS software, look into caching plugins.

    Still this is not a security issue. While it is possible your server may be mis-configured, given your descriptions, it is far more likely that either your code for your sites is too load intensive, has bad SQL queries, or your server does not have enough resources to run the code for multiple visitors. While more RAM and CPU may help in the short term you need to optimize your site code and SQL queries.

    You could watch mysql queries from a ssh terminal while loading the pages to see if that is the cause, with a command like this as root:
    Code:
    watch -n 1 mysqladmin proc
     
  9. LeroanZ

    LeroanZ Member

    Joined:
    Sep 15, 2013
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    yes i use generally cms, there is no problem other services. when i watch via this command, and press button f5 more... there are a lot of lines in there, but i can't copy here because it goes immediatly
     
  10. quizknows

    quizknows Well-Known Member

    Joined:
    Oct 20, 2009
    Messages:
    940
    Likes Received:
    55
    Trophy Points:
    28
    cPanel Access Level:
    DataCenter Provider
    That's a good thing, that means your SQL queries are likely completing quickly. At that point look at the PHP code. Perhaps use a tool like Xdebug: Documentation
     
  11. LeroanZ

    LeroanZ Member

    Joined:
    Sep 15, 2013
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    how can i do this i have a vps, what is this? plugin for php ?
     
  12. Aaron.Edwards

    Aaron.Edwards Active Member

    Joined:
    Sep 21, 2013
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    Can you check the below and post here ?

    # free -m

    # grep KeepAlive /usr/local/apache/conf/httpd.conf

    # grep StartServers /usr/local/apache/conf/httpd.conf

    # grep MaxClients /usr/local/apache/conf/httpd.conf

    # grep MaxRequestsPerChild /usr/local/apache/conf/httpd.conf

    # netstat -tun | awk '{print $6}' | sort | uniq -c | sort -n

    # netstat -nut | awk '{print $4}' |grep ':80' | wc -l
     
Loading...

Share This Page