Concrete5 & Slow TTFB - Solution!

Permalink 1 user found helpful
Hello fellow web developers, I wanted to share my recent experience in developing a new website and having to deal with a terribly slow time to first byte issue.

So my troubles started a few months ago when I made the decision that we should really look at upgrading our website. It has been about 5 years now and we were still running on Concrete 5.6 with no good way to get to 5.8 besides a complete redesign. So I offered to start working on that project. Initially we worked with a local web design company to transition us to Concrete5 back in 2013. Well they're no longer in business and we essentially cut our ties from them prior to that because of their poor service. It was a big fiasco, but it did introduce me to Concrete5, so that's nice.

Now we host our current website on a sister campus as we don't have the resources to run a live website locally. Our current 5.6 runs quick enough, though it could run better. It really didn't turn into a problem until I started working on the new website on the development server they setup for me. Loading each page took several seconds. Every. Single. Page. Took several seconds to load. I fought through it and customized the theme I was working with and started fun task of batch importing pages from the old site. But this process really pushed me over the edge to start investigating what the heck was wrong with this server. It should not be this slow! I've built several concrete5 websites in hosted environments and they were not this slow. I started to get 30 second time-out messages more frequently, so I knew something was wrong.

Only part of my job is webmaster for the local college that employees me. So I'm not an expert in any means when it comes to web development and troubleshooting. So I spent a good amount of time trying to figure out what was wrong. I was coming up empty handed and gave up for a couple of months to work on other more important projects.

Fast forward to last week (from this post) I decided it was time to revisit the issue of our slow development site. I wanted to start fresh so that means setting up some test servers. Initially we started with a virtual server running Windows 2012. I was able to transfer the database and files over and get that setup. I had it running but it was even slower! I was experiencing TTFB of 7,000+ ms! To illustrate the issue, you navigate to our website, the web browser then sits there for 7 full seconds trying to communicate to the server, and finally the page loads and finishes at about 10-11 seconds. That's every. single. page.

The next step I wanted to try was loading the website on a dedicated server. This website has only been loaded in virtual servers, maybe there's a misconfiguration there? I have a Windows 2016 server setup for our other network and gave that a shot. I got the website transferred over into an instance of XAMPP and I was still experiencing the same TTFB issues. Ugh. So that led me to do more research. I tried many different things and with the help of GTMatrix & Pingdom Tools it started to narrow down the issues. I could get the website optimized. I enabled G-Zip Compression and dropped the file size of the website from a few megabytes to 400KB. I was getting great scores on those speed test websites, but the load time was still bad. At least 5 seconds to load an essentially empty page. TTFB was still way too high. No, there's something that's not configured properly.

Then I discovered it. I can't remember which website I found the solution on, but it was a simple solution. I needed to enable Zend OpCache. All that was required to enable it within the XAMPP package is to add one line of code to the php.ini file and restart the Apache server. That's it. At line 802 in the php.ini file I added

zend_extension=php_opcache.dll


Dropped my TTFB from 7,000ms to 700ms and even better. It was now taking only 1/3 to 2/3 of a second to start sending the website from the server to the browser. I then enabled caching within Concrete5 and the pages would fully load in 1-2 seconds instead of 5-10 seconds. Wow. What a difference! Here's a couple screenshots of the resultshttp://imgur.com/a/2jM6K1m

I just wanted to share my solution in hopes it helps someone else out so that they don't have to spend days, weeks, or months trying to resolve something so frustrating that can be resolved with a single line of code. lol

DCBjacob
 
mnakalay replied on at Permalink Reply
mnakalay
Thank you for sharing.
A3020 replied on at Permalink Reply
A3020
Related blog post: "The ultimate guide to a fast concrete5 website". https://a3020.com/blog/the-ultimate-guide-to-a-fast-concrete5-websit...
DCBjacob replied on at Permalink Reply
DCBjacob
Bookmarked, thanks for the link!