Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Extremely slow TTFB

Discussion in 'Workarounds and Optimization' started by speedy200man, Feb 20, 2017.

Tags:
  1. speedy200man

    speedy200man Registered

    Joined:
    Feb 20, 2017
    Messages:
    4
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    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!
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,803
    Likes Received:
    1,898
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    You can find discussion of this topic on the following thread:

    Another TTFB thread

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. speedy200man

    speedy200man Registered

    Joined:
    Feb 20, 2017
    Messages:
    4
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    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 ?
     
  4. Jcats

    Jcats Well-Known Member

    Joined:
    May 25, 2011
    Messages:
    720
    Likes Received:
    123
    Trophy Points:
    168
    Location:
    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.
     

    Attached Files:

    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #4 Jcats, Feb 20, 2017
    Last edited by a moderator: Feb 20, 2017
    Del Drago and cPanelMichael like this.
  5. speedy200man

    speedy200man Registered

    Joined:
    Feb 20, 2017
    Messages:
    4
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Bucharest, Romania
    cPanel Access Level:
    Root Administrator
    Thank you so much! Will try all of that and get back to you!
     
  6. abubin

    abubin Well-Known Member

    Joined:
    Dec 7, 2004
    Messages:
    402
    Likes Received:
    3
    Trophy Points:
    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.
     
  7. speedy200man

    speedy200man Registered

    Joined:
    Feb 20, 2017
    Messages:
    4
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    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.
     
    cPanelMichael likes this.
  8. Danks

    Danks Active Member

    Joined:
    Oct 10, 2001
    Messages:
    26
    Likes Received:
    1
    Trophy Points:
    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.
     
    cPanelMichael likes this.
  9. James T Snell

    James T Snell Registered

    Joined:
    Feb 21, 2018
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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.
     
  10. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,803
    Likes Received:
    1,898
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. inspiredearth

    inspiredearth Member

    Joined:
    Dec 1, 2015
    Messages:
    19
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    New Zealand
    cPanel Access Level:
    Reseller Owner
    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...
     
    #11 inspiredearth, Mar 7, 2018
    Last edited by a moderator: Mar 7, 2018
  12. Jcats

    Jcats Well-Known Member

    Joined:
    May 25, 2011
    Messages:
    720
    Likes Received:
    123
    Trophy Points:
    168
    Location:
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #12 Jcats, Apr 2, 2018
    Last edited by a moderator: Apr 2, 2018
  13. CrazySerb

    CrazySerb Member

    Joined:
    Apr 1, 2015
    Messages:
    10
    Likes Received:
    3
    Trophy Points:
    3
    Location:
    Canada
    cPanel Access Level:
    Root Administrator
    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?
     

    Attached Files:

  14. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,803
    Likes Received:
    1,898
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice