Reduce Server Response time - Website load time

I have a website on a self hosted centos server. When doing a page speed test through google I get a message that it takes 5.8 seconds for the website server to respond where it is supposed to respond within 200ms. How do I get to the bottom of this load time?

We staged this website on another URL on a shared hosting server with much less resources but it performs much better.

WHM Centos Version : 68.0.36
Apache : 2.4.27
SQL : 5.6.38

Problem URL : ( 5.8 server response )
Staging Server : ( 800ms server response )
Leroy LuffHead of IT & DIgitalAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

theGhost_k8Database ConsultantCommented:
Why this is being printed --> "echo do_shortcode('[sg_popup id="3"]');"
Lucas BishopClick TrackerCommented:
Self-hosted, as in you are hosting it on an IP at your office/home? If so, the difference in response time is likely related to network latency.

Web hosts generally are located inside of a data center that is directly connected to the Internet backbone:

Backbone speeds can be in the Tbps range.

Your Internet connection at home/office is generally on last mile connection and will hav a very slow upload/response speed:

Last Mile speeds are usually in the Mbps range.

Google Speed Test is hosted on the backbone. A backbone to backbone test will be blazing fast. A backbone to last-mile test will be slow. The two can't be compared. The server hardware/resources will barely factor in the test, as the network connections are vastly different.

On top of that, if you lookup the IP of both domains listed above. One is hosted in Gauteng, Johannesburg and the other is located in Phoenix Arizona. The proximity of the speed-test server, to the tested IP, will also play significantly into the difference in response time, even if the two hosts have the same network/hardware performance.
Leroy LuffHead of IT & DIgitalAuthor Commented:
@Lucas I only meant it is on a self managed server. It is a hosted server at The ip points to Arizona because we make use of cloudflare. The site should be available on a CDN network. I.e if I am in johannesburg i should get it loaded from cloudflares JHB server and not Arizona.

@ KV - We had some issues with a popup and I think the dev's enabled verbose or something. That still has to be cleaned up.
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

Lucas BishopClick TrackerCommented:
Put both domains through the speed test at and use the same location for both. I used the NY server.

One thing you'll notice is that domain takes almost 4 seconds to 301 redirect to the non-www version, when tested from New York:
pingdom test of www version
If you test from Sweden, that redirect takes almost half as long.

In any event, that redirect seems to be a problem.

However, even if you test the non-www version (to exclude the redirect), from Sweden, the time waiting to receive the initial html file is really long:
pingdom test of non-www version from Sweden
However, you mentioned that your developers have enabled a different configuration on this version of the site. Is it the same as the one your testing against? If not, that's an issue. Also, the file sizes of the main html file appear to be different between the two servers.

You have a lot of different variables here. You should equalize the ones you have control over (file sizes, php code, etc.), otherwise you're shooting in the dark.

Then start testing to see where the slowdown is. It could be one server is absolutely at max capacity and the other isn't. Could be a specific server in the route is a problem. Could be geo-location of the test. etc.
David Johnson, CD, MVPOwnerCommented:
If I disable the cache the sites are comparable 14.7 seconds
Cache Enabled
FAST Site 1.6 KB Transferred
Slow Site 28.8 KB Transferred

optimized files for both sites
Leroy LuffHead of IT & DIgitalAuthor Commented:
As far as I know the websites should be exact duplicates.

Only the server hosting it is different - Ironically the server hosting the slow site is much more powerfull than the one hosting the fast site.

Please bear with me as I am no Guru.

* Could the issue be at DNS level?
* Could the issue be tat server level with regard to software vesions of sql/php/apache etc.
* Could the problems be couldflare taking longer to resolve the server with the slow website than the server with the fast website?
* Could the problems be that the actual php/wordpress files are different?
Lucas BishopClick TrackerCommented:
The fact that a 301 redirect is taking upwards of 4 seconds, makes me think the "fast" server is at capacity. Is it a shared host?
Lucas BishopClick TrackerCommented:
I meant the slow server.
Leroy LuffHead of IT & DIgitalAuthor Commented:
No it is a self managed host. How do i test the load on the server to rule that out?
Leroy LuffHead of IT & DIgitalAuthor Commented:
The server load is between 2.6 and 3.2 and i have 6 CPUs. This tells me the server is at 50% load cpu wise?

The memory is at 28%. 2.3 of 8 is being used.
Leroy LuffHead of IT & DIgitalAuthor Commented:
I have a suspicion that it might be the software vesions.

Apache : 2.4.27  > Any concerns to upgrade to version 4?
SQL : 5.6.38 > Any concerns to upgrade to mariadb10?

I have other websites on this same server and they take +- 1 second to respond but they are not near the same size. Not sure what this means for me though...
Leroy LuffHead of IT & DIgitalAuthor Commented:
Could it be DDOS attacks that is slowing down the network capacity of the server? Is there any way of checking this?
Leroy LuffHead of IT & DIgitalAuthor Commented:
Hi Everybody,

Thank you for taking the time to give input.

I have managed to track down the issue.. Druuuum Rolll.....

It was a plugin causing the issue : Wordfence. One of those plugins that you are damned if you use it and damned if you dont.

Anyways how do i close the questions or do i just choose a help candidate to get the points?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Lucas BishopClick TrackerCommented:
You can select your own comment as the answer to the question if I recall correctly.

Out of curiosity, was wordfence only installed on one of the two versions of the site?
Leroy LuffHead of IT & DIgitalAuthor Commented:
Thanks for all the assistance EE.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.