Decreasing page load time and how Excessive Zend routes can prevent optimal caching | 9xb Digital Agency

Decreasing page load time and how Excessive Zend routes can prevent optimal caching

Page load time is a vital part of any website’s user experience because while load time isn’t a large contributor to SEO rankings, it can have a significant effect on your conversion rate. For every second saved on load time, you’ll boost customer confidence and trust in your site. The reverse unfortunately also applies. Interesting surveys done by Akamai and provide a few statistics which illustrate these points:    

  • Almost half of all consumers expect a load time of 2 seconds or less and over a third will abandon the website if it takes more than 3 seconds.
  • A single second delay in page response can result in a 7% conversion reduction
  • Concerning optimising for mobile, 73% of mobile internet users have encountered a website that was too slow to load and so becomes unusable.

One regular method used to decrease load time is to cache as much data as possible that is not session-dependent. Last week Chris and I spent some time on speeding up one of our sites, which I’ll identify as Parts of the site that change fairly infrequently such as the footer and home page panels are now being cached, which is shaving off vital time in the strive towards zero page generation time. However, we noticed that the page generation time was still suspiciously high, even when practically everything being displayed was coming from cache.  Appending XDEBUG_PROFILE to the request and opening the resultant profile in WinCacheGrind showed the following: _initRouter was taking 60% of page generation time?  After drilling down through the profile and looking at the function it revealed that it is suffering from two issues:

  1. The ‘rampant routes’ pattern of iterating a DB result and adding 1 or more static routes for each result...
  2. ...and subsequently not caching the large amount of routes this generates.

While there was some caching for routes, the ‘blog post preview’ routes were not being cached.