A lot of connections increase cpu ... server fall

LeroanZ

Member
Sep 15, 2013
6
0
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 ?
 

MaestriaNick

Well-Known Member
Aug 6, 2008
159
3
68
Can you please check the output of command "top" at that time ? That will show what processes / user causing high load in the server.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,201
363
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.
 

LeroanZ

Member
Sep 15, 2013
6
0
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 :)
 

LeroanZ

Member
Sep 15, 2013
6
0
1
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.
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...
 

quizknows

Well-Known Member
Oct 20, 2009
1,008
87
78
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.
 

LeroanZ

Member
Sep 15, 2013
6
0
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
 

quizknows

Well-Known Member
Oct 20, 2009
1,008
87
78
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
 

LeroanZ

Member
Sep 15, 2013
6
0
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
 

Aaron.Edwards

Active Member
Sep 21, 2013
36
0
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