What is holding up First Byte

Hello - just looking for a little help with what is going on with the waterfall and slowing the TTFB: http://www.webpagetest.org/result/150609_02_b550468b6997a2c8ecb4d54a2f3c4899/5/details/

Time to first byte is ~700ms. We have tried making various changes but kept breaking things on the site :angel:

We have a dedicated server.
Server Info:-
PHP Version 5.3.28
Apache Server: 2.2.23 (Unix)
Apache Cpanel: v3.18.0 rev9999
OS: Linux CENTOS 6.6 x86_64 standard
Processors: 8 x Intel Xeon E31230 @3.20GHz (Cache 8192kb)
RAM: 4096MB DDR3
We use Incapsula as CDN.

We also have a WP blog running off the same server that gets a clean sweep of A’s: http://www.webpagetest.org/result/150529_BT_f25aad9724df0b1ad1f4dfe984a3743a/

What changes have you tried?
My guess is that the sheer complexity of the page is causing a wave of database queries. Here’s some areas to look into and see what you find.

Database performance tuning.
Commit your entire DB to RAM. You will have to check your MySQL config and you might need to add ram to your server to accomplish this.
Log slow queries and consider hiring someone to tune the database setup if you don’t have the expertise yourself.
Consider using MariaDB (drop-in replacement for MySQL) for a possible performance increase
Experiment with different types of php opcode caches and compare notes: xcache, eaccelerator, APC, memcache.

Other things, not related to TTFB but I would still reccomend to make the site rip…

Reduce the number of objects on your landing page(s)
You have 150 objects on your main page. Simplify this at a front end level as much as you can. Consider consulting with an ecommerce conversion expert on this. It will most likely reap benefits from a UX POV as well as giving mobile users especially a better experience.
Image optimization…lots of pngs there that are larger than their jpg counterparts
Leverage Nginx+SSL+SPDY for an improvement in performance. Spdy allows multiple objects to be downloaded from a single request, but it cannot be done without SSL.

In short, I’d drop incapsula and go with cloudflare pro. Heres’ my Rationale
Mirage will take care of image optimization, on the fly, per users device and connection type. Incapsula compresses image, but it’s not connection/device aware
You can setup Nginx+SSL+Spdy with the click of a slider button
Of course you have the other benefits of minification of css and html too
In cloudflare create page rules for aggressive caching of pages that are not very dynamic in content.

Tricky to answer this.

You are a bit limited with CPanel on what infrastructure changes you can make ( and I’m really rusty! )

I would recommend:

  • your database has plenty if resources, especially innodb. There’s a great tuning-primer.sh available out there to help ( I also use Percona MySQL 5.6 - much faster innodb engine than Oracle )
  • ensure php is running in FPM mode, and has plenty of memory available.
  • ensure you’re running a decently configured APC cacher
  • look at putting the cache folder under tmpfs control ( and look at Colin Mollenheur’s extension )
  • use PHP 5.4
  • you have a mix of http and https… I’d tidy that up

I don’t have much virtuemart knowledge so can’t really comment more specifically. However, I will disagree with anyone who considers that cf is a worthwhile product: if you want to use a CDN, then do so, but not one that takes over your DNS and positions itself in front of your site. In a word, drop Incapsula and use maxcdn more ( at least you’ll then be testing YOUR server’s performance, not Incapsulas over which you have no control.

Guys thank you for comments - plenty for us to be getting on with there, so thanks again :slight_smile:

I think to dismiss Cloudfront’s because of their DNS approach is a bit premature. Each CDN has pluses and minuses. One thing I will say about it is when you make a change in CF it propagates very fast and you also benefit from their DNS infrastructure is which is likely to be stronger than other (non CDN) offerings available to you. The fixed cost per month is a predictable one and the device\connection aware image delivery is a big benefit if you have mobile users looking to buy from your ecommerce site

Swings and roundabouts. Both CF and MaxCDN are great products.

But when testing and server tuning, yes you will want to put your CDN in development mode (if available) so that you are testing directly against your server.

CloudFront is not a CDN, but a proxy server pretending to be a CDN. This will always slow down a dynamic page as it has to go to the original site, and then propagate the response from that.

This is why the TTFB is slow.

I consider this to be a BAD THING. Always. You have basically handed control of the performance of your site to them. Maybe they do a good job, maybe not. The problem is far worse for those of us who live in the Anipodes as the delays are greatest.

Using a CDN to deliver static content with expiry headers to further improve performance is a good idea, as it lessens the load on your server’s network and leaves plenty of space for the hard work of generating the dynamic stuff. But when you’ve carefully placed your server near your target audience, what do you gain from CF? Absolutely nothing. What do they gain? Marketing potential… it’s the same approach as google.

Luckily it’s a free world, so we’ll just agree to disagree eh? (:

It seems like GreenGecko and James are referring to CloudFlare not Amazon’s Cloudfront?

Yep cloudflare. I think GG just typed cloudfront by mistake.

GreenGecko, I think there are use cases for both of them even for dynamic content. It depends largely on one’s own unique mix of CMS/software/hardware, audience, expertise and budget.
Yes we can agree to disagree. Life would be boring otherwise :slight_smile:

I did sorry. I happily use CloudFRONT, especially cost effective when already using Amazon EC2.