Serving PHP Sites is getting slow till i restart Apache

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
joschi
Posts: 9
Joined: Sat Sep 27, 2014 3:41 am

Serving PHP Sites is getting slow till i restart Apache

Postby joschi » Thu Nov 30, 2017 12:29 pm

Hi, @ all
@VestaCpTeam, Thank you for this great piece of software. I am using VestaCP now for several years without any big issues.

Problem: I am running Vesta CP on 2 different servers. My site loads with 0.8 seconds which is great! Problem is, after a while the sites needs 2.5 seconds to load and stays at this level.
When i restart (only) apache2 everything is back to fast again, but just for a few hours, then its getting slow again.

- Both servers run Apache + Nginx
- its the same on both of my servers.
- Both servers have a quad core and 8gb of ram which seems not to be full

Where can i start to investigate this issue?
Anay help is highly appreciated!

Kind regards
Patrick

mehargags
Moderators
Posts: 818
Joined: Sat Sep 06, 2014 9:58 pm
Contact:

Re: Serving PHP Sites is getting slow till i restart Apache

Postby mehargags » Fri Dec 01, 2017 8:33 pm

This can be a time taking procedure, but there isn't a shortcut I'm afraid.

♦Monitor your CPU / RAM usage with HTOP, try to see the threads that are taking up CPU Cycles or RAM.
♦Monitor your network throughput for outgoing traffic using iftop, iptraf or netstat

How many sites you have on the server ? Try suspending them one by one and observing performance after suspending each on to of them. It is entirely possible that one or your site's is compromised and is being abused eating up network and CPU resources.

Good luck

joschi
Posts: 9
Joined: Sat Sep 27, 2014 3:41 am

Re: Serving PHP Sites is getting slow till i restart Apache

Postby joschi » Sun Dec 03, 2017 3:15 pm

Hi mehargags, thanks for pointing this out,
Luckily i already monitor those stats in detail.

I have round about 40 WordPress Sites on each Server, most of them very low traffic, some get a few thousand visitors a day. The Servers have a Gbit connection tho. There are not used for heavy downloads but only for serving normal websites.

Here are the stats from the last month, where i did not do any restarts. For me everything seems pretty normal, also when you zoom in to just a day. Do you think otherwhise?

RAM:
Image

Network:
Image

CPU
Image

Any other ideas? :)
Kind regards
Patrick

mehargags
Moderators
Posts: 818
Joined: Sat Sep 06, 2014 9:58 pm
Contact:

Re: Serving PHP Sites is getting slow till i restart Apache

Postby mehargags » Sun Dec 03, 2017 8:33 pm

Mere looking at the graph is not how you find the problem...You did not follow my suggestion, please read carefully the action I suggested.

joschi
Posts: 9
Joined: Sat Sep 27, 2014 3:41 am

Re: Serving PHP Sites is getting slow till i restart Apache

Postby joschi » Sun Dec 03, 2017 9:43 pm

Hi mehargags, thank you for your time.

I checked the CPU Load as well as network stats with slurm, und just wanted to say that there was nothing special at any time. I will check again, i have to wait a while tho till the circumstances apear again :) Then i will suspend one site after another till only one is left, and then see if something changes and report back here.
Thanks
Patrick

mehargags
Moderators
Posts: 818
Joined: Sat Sep 06, 2014 9:58 pm
Contact:

Re: Serving PHP Sites is getting slow till i restart Apache

Postby mehargags » Mon Dec 04, 2017 8:20 am

since there are many sites, you can do it in badges of 5 to speed up the process.

However,
Don't try to make too much money out of one server, you risk all eggs in one basket.
The proper, easeier way to do this would be to get a second server ( may be a bit smaller/cheaper) and put the very low sites onto it... in badges of 5. This way you have your sites running all the time so the customers don't complain, and also pin point which one's slowing down the resources.

By the way, what is your send mail queue count?

Code: Select all

exim -bpc

joschi
Posts: 9
Joined: Sat Sep 27, 2014 3:41 am

Re: Serving PHP Sites is getting slow till i restart Apache

Postby joschi » Mon Dec 04, 2017 2:11 pm

Most sites are private / for testing purpose, thats why they get very little traffic if at all...
So you think it could help if i dedicate more ram to the servers? As i mentioned, it does not seem like the servers are bussy in any way.
This it what it looks most of the time... But it would be no problem for me to give them some extra ram if that could help.
https://gyazo.com/ab165d669f3023c13a26d8b00fe29c1a

All websites are WordPress based and have caching enabled. This helps a lot reducing the server load.

My first server has 7 mails in the queue the second 0. But i dont use vestacp to send mails. :)

kind regards
Patrick

mehargags
Moderators
Posts: 818
Joined: Sat Sep 06, 2014 9:58 pm
Contact:

Re: Serving PHP Sites is getting slow till i restart Apache

Postby mehargags » Mon Dec 04, 2017 3:41 pm

In that case, I guess suspending a few sites (in batches) and watching performance is best bet.

Those 7 mails in queue, where are they going ? Refer http://bradthemad.org/tech/notes/exim_cheatsheet.php

You can PM me for sensitive information, I'll take a look :)

joschi
Posts: 9
Joined: Sat Sep 27, 2014 3:41 am

Re: Serving PHP Sites is getting slow till i restart Apache

Postby joschi » Wed Dec 06, 2017 2:07 am

Ok, i will do so next weekend at night :)

Only 4 mails in there right now, basically they are system mails marked as "frozen" going to root, nothing special from my point of view.

Kind regards
Patrick

aman2254
Posts: 1
Joined: Wed Dec 06, 2017 5:21 pm

Re: Serving PHP Sites is getting slow till i restart Apache

Postby aman2254 » Wed Dec 06, 2017 5:25 pm

may be u getting ddos attack on ur server reboot and protect ur ssh try this


Return to “Web Server”



Who is online

Users browsing this forum: No registered users and 6 guests

cron