speedy200man

Member
Feb 20, 2017
16
1
53
Bucharest, Romania
cPanel Access Level
Root Administrator
Hello, this is my first post as a cpanel owner.
Please be so kind and advise me on how to improve my time-to-first-byte.
I have a dell R610 (2xsix-core) with 80 gb of ram, fiber connection, centos 7 and latest cpanel. My disk configuration is 2xraid 1 for the os and 4 disks in raid 5 (sas @ 10K rpm). My cpanel server is behind a gigabit new router, that forwards the necessary ports to the server.
Whenever I access the cpanel address directly, speed seems just fine, but whenever i access any website, it takes from 4 to 17 seconds until is starts loading the website. Until then it just sits there, looking for the domain.
I have done some tests and if the webpages are static, they load pretty fast. Others are simple wordpress sites without crazy plugins and I have tons of resources available.
Can you please give me some sort of advice to improve my ttfb ?
You can check the ttfb value for this website as an example: e-zine [dot] ro
Thank you!
 

speedy200man

Member
Feb 20, 2017
16
1
53
Bucharest, Romania
cPanel Access Level
Root Administrator
Hello! The offered solution is litespeed, which costs alot of money! Isn't there any other solution ? I would expected for the system to work in a better way. If I install a centos and put services separately, the performance is ok. Everyone praises the cpanel, i paid money for it, and i cannot accept a new monthly fee to improve performance, when i don't even run high traffic sites.
I know that are specific tweaks to the cpanel settings / mysql etc. Can anyone offer some solution to this ?
 

Jcats

Well-Known Member
PartnerNOC
May 25, 2011
807
160
168
New Jersey
cPanel Access Level
DataCenter Provider
I would...

Upgrade to EA4, if you haven't done so already.

Run EasyApache when done, choose the "All PHP Options + OpCache" profile. When you get to PHP options, search for 'opcache' as it doesn't enable by default for PHP 7 for some reason.

Run it, when done in WHM go to MultiPHP Manager and change your site over to PHP 7(hopefully its compatible but it should be if you want to take advantage of the performance benefits of PHP7)

In the same screen, enable PHP-FPM. I usually increase max children, and max requests, up to you.

Install Redis cache:

community.bigscoots.com/knowledge-base/cpanel-easyapache-4-installing-redis-redis-php-extension/

Once done, install W3-total-cache via your WP admin side:

wordpress.org/plugins/w3-total-cache/

Once installed configure:

Page Cache, Database Cache, and Object Cache to use Redis.

You can enable minify as well but most of the time causes issues.

Lastly, *not supported by cPanel, but you can install Nginx, best plugin to use:

github.com/engintron/engintron

One liner to install, takes a few minutes, and its ready to go.

Oh, you could also utilize CloudFlare, this will help as well. If you do choose CloudFlare, you will need to do one more step for Nginx

github.com/engintron/engintron/wiki/Engintron-&-CloudFlare

One more thing I noticed is some of the static content you are using on your site is god awful slow, check attachment.

You will want to either remove these images, or download them to your server and serve them from your server, stop linking to them from your site as they are slow slow!

With all this, you should hopefully be seeing some better load times.
 

Attachments

Last edited by a moderator:

abubin

Well-Known Member
Dec 7, 2004
401
3
168
i am also having slow TTFB. I am suspecting this to be optimization issue with cpanel on centos 7. We started using centos 7 as a few of our servers are using centos 5 which is no longer supported by cpanel. So we had a centos 7 server running with cpanel running latest stable release. However, we notice our TTFB is extremely slow. It takes up to 10 secs before server starts responding back to the browser.

We compared the same site to our centos 6 server and the TTFB is like 1 seconds only. On both servers we did not do any heavy optimization. Both cpanels are almost at default settings.

We already tried GZIP compression but that doesn't help with TTFB.

We are going to try installing mod_pagespeed next but this shouldn't have been necessary as fresh cPanel should have been optimized enough without needing third party software to get it to "usable" condition.

BTW, we are using EA4 with php56 if there is helpful information. We are going to try some of the suggestions provided by jcats.
 

speedy200man

Member
Feb 20, 2017
16
1
53
Bucharest, Romania
cPanel Access Level
Root Administrator
Hello! Just writing a short update. It seems that the biggest problem was with the router. Although it was a very good router with good specs, I do not know why but it choked the connection. My server is now connected directly to the internet and the speed is considerably better. I know cpanel does not encourage setting up behind NAT, but still, the lag was enormous. I can't say if the router is to blame or if it's cpanel. I will keep you posted with my future findings here, as soon as I have results.
 
  • Like
Reactions: cPanelMichael

Danks

Active Member
Oct 10, 2001
26
1
303
I had a similar issue and mine turned out to be from mod_security rules (using a commercial rule set). The ones with dns lookups were the cause like rbl and others. There is no slowdown with this rules using Litespeed, but there is with apache - so another win for litespeed if you are having slow first byte.
 
  • Like
Reactions: cPanelMichael

James T Snell

Registered
Feb 21, 2018
1
0
1
Calgary
cPanel Access Level
DataCenter Provider
I had a similar problem with an Apache server running on CentOS 7. I disabled Apache modules one at a time to see if I could find an issue in one of them. When I disabled the proxy module, my site started consistently loading pages under 900ms. Before that, some loads would take over 21000ms! I would guess that my virtual host or server could have something misconfigured with respect to mod_proxy, but since I don't at all need that module on this server, I don't mind simply leaving it disabled.

I hope that helps someone.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463

inspiredearth

Member
Dec 1, 2015
19
2
3
New Zealand
cPanel Access Level
Reseller Owner
In the same screen, enable PHP-FPM. I usually increase max children, and max requests, up to you.
Thanks for this guide, and the related links. Working through them now.

This guide help.bigscoots.com/cpanel/cpanel-easyapache-4-installing-redis-and-redis-php-extension , by the way, is exceptionally helpful. Much appreciated.

Any suggestions on how to determine what to set max children and max requests to? You say you normally increase them, and I suspect I should to. But by how much?
Cheers...
 
Last edited by a moderator:

Jcats

Well-Known Member
PartnerNOC
May 25, 2011
807
160
168
New Jersey
cPanel Access Level
DataCenter Provider
Depends mainly on your available memory, but you can use this script:

github.com/jcatello/bigscoots/blob/master/chkphpfpm

Set it up on a 1 minute cronjob

Change out the email

and then, anytime you hit max children, it will send you an email letting you know. If its pretty frequent that you get the emails, then definitely increase it as it will cause slow load times for viewers while they wait for a process to free up and/or eventually just timeout completely for the viewer. You can look at the processes and take an average of how much memory they are using, and then basically use that to judge how many processes you could spawn if needed without running out of memory
 
Last edited by a moderator:

CrazySerb

Active Member
Apr 1, 2015
34
12
58
Canada
cPanel Access Level
Root Administrator
I had a similar problem with an Apache server running on CentOS 7. I disabled Apache modules one at a time to see if I could find an issue in one of them. When I disabled the proxy module, my site started consistently loading pages under 900ms. Before that, some loads would take over 21000ms! I would guess that my virtual host or server could have something misconfigured with respect to mod_proxy, but since I don't at all need that module on this server, I don't mind simply leaving it disabled.

I hope that helps someone.
How did you manage to disable mod_proxy on its own?

I tried to do so in EasyApache with any of the mod_mpm_* modules and it would disable all the modules as well.

As in, it wouldn't let me set up a working/active MPM module in EasyApache without keeping the mod_proxy turned on.

So how would you go about disabling the mod_proxy then?
 

Attachments

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
How did you manage to disable mod_proxy on its own?
Hello @CrazySerb,

Uninstalling Mod_Proxy isn't supported at this time due to it's requirement for features such as proxy subdomains to work. Internal case CPANEL-23090 is open to prevent users from toggling mod_proxy off in EA4 UI, as it will lead to a loop where it suggests choosing a new MPM and then automatically enables mod_proxy again when a new MPM is chosen.

thank you.