Page 1 of 1

Server Keeps Going Under — Incredible # of Connections

Posted: Sun Feb 21, 2016 6:27 pm
by geekplaya
I have been troubleshooting this problem for months now. For whatever reason, my web server keeps going down.

Randomly, a couple times a week, the server gets overloaded, all the memory becomes consumed, and the sites become inaccessible. I will also get e-mails from VestaCP telling me that the files cannot backed up.

I have tried enabling mod_status, I have tried optimizing Apache2 and MySQL, and I have implemented Cloudflare in case it was a DDOS.

Take a look at the graphs. The numbers are ridiculous:

Image
Image
Image
Image

Right where you see the first peak is where the server goes down.

How could that many SQL queries even be executed?

How can I trace this and find out where the problem is? Is it a memory leak? Is it an injection? What's going on! For months I've been dealing with this.

Restarting Apache and clearing the memory brings everything back online, but it just happens again.

Here's the Apache config:

Code: Select all

PidFile ${APACHE_PID_FILE}
Timeout 30
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 1

<IfModule mpm_prefork_module>
    StartServers                 5
    MinSpareServers              1
    MaxSpareServers              5
    ServerLimit                  10
    MaxRequestsWorkers           10
    MaxClients                   10
    MaxRequestsPerChild          100
</IfModule>

Re: Server Keeps Going Under — Incredible # of Connections

Posted: Sun Feb 21, 2016 10:13 pm
by tjebbeke
Are you using some CMS? Have you checked the log files? MySQL logs, Errors logs, access logs ...

Re: Server Keeps Going Under — Incredible # of Connections

Posted: Mon Feb 22, 2016 3:34 pm
by geekplaya
tjebbeke wrote:Are you using some CMS? Have you checked the log files? MySQL logs, Errors logs, access logs ...
I am using 5 installations of WordPress. I have 2GB of RAM, and the site will run stable (as you can see from the graphs) for a while, then suddenly spike a tremendous amount.

When I run the top command, it shows nothing out of the ordinary which is the strangest part.

Re: Server Keeps Going Under — Incredible # of Connections

Posted: Thu Jul 05, 2018 10:23 am
by websystems
Similar problem here. Did you find a solution?

Re: Server Keeps Going Under — Incredible # of Connections

Posted: Sat Jul 07, 2018 11:03 pm
by dreiggy
First, try to find out which page has most of users visits. You can do this for example:

Code: Select all

# du -s /var/log/httpd/domains/*.log | sort -n | tail
Then try to analyze the biggest log file with goaccess:

Code: Select all

yum install epel-release -y
yum install goaccess -y
Then: goaccess -f /var/log/httpd/domains/domain.log

By the way try scan websites with maldet.

Re: Server Keeps Going Under — Incredible # of Connections

Posted: Sun Jul 15, 2018 4:29 pm
by Yikmings
Same problem after upgrade to 22