Slow stores sell less
Its a fact and you don't need a fancy report from Kiss or Amazon to demonstrate it - if a page is slow to load, you'll give up trying and go elsewhere; and that's exactly what your customers will do. Speed up your site, you'll not only reduce bounce, but increase conversion and revenue.
But if you aren't convinced, use our speed test and see how slow your store is (you can also use the history on the tool to measure performance improvements).
- Where to begin
- Measuring performance
- Performance check-list
Where to begin
When it comes to speeding up your store, there's actually three distinct areas for improvement and each has a different approach. All are equally important, but addressing each requires a different approach.
- Initial page load (otherwise known as TTFB - time to first byte)
- Total page load (including total asset download but excluding browser render)
- Total page render (including CSS render and JS execution)
The three are different because adjusting server configuration often only improves TTFB - and equally, making template adjustments often only affects total page load time, making CSS and JS changes only affects render time. But regardless of which you are trying to improve, the most important thing is to set up a test tool that reflects the right workload, so that you can measure your improvements.
|Page type||Enterprise Edition||Community Edition|
Measuring performance (point in time)
In the pursuit of performance, before you start making changes, you need to know where you are starting from, so you've got figures to compare to later. It is important to disable any full page cache (or Varnish) prior to any testing, as it will only skew the results. If you are making changes at a code level to improve performance (eg. re-factoring/removing modules), you should also disable all the Magento caches (apart from the configuration cache).
Testing with all caches off will give you the real figure and allow you to accurately measure improvements.
Test locally, not remotely
Never execute a remote test when measuring TTFB, always test locally. You don't want the fluctuations in latency to give you a false positive in terms of confirming the positive or negative effects of a change.
Remote tools (like MageStack speed test) are great as a rough indicator - but shouldn't be used to test incremental changes; but by all means, use it to test major changes, so you can use the historic graph to view improvements.
Don't test concurrency
Capacity is different from performance. You can have a high performance store with limited capacity, equally, you can have a low performance store with huge capacity (think a Ferrari vs. a truck - one is fast and carries little, the other is slow and carries a lot). So avoid tools that focus more on concurrency than outright performance (eg. Siege, AB, jMeter)
My preferred test method is the most simple,
For example, if I wanted to test the load time of the homepage, I'd run the following command from the web server itself
./mage-perftest -b -u https://www.sonassi.com -r 3 Spawning 3 Mage crawlers ... Testing URL https://www.sonassi.com Testing URL https://www.sonassi.com Testing URL https://www.sonassi.com Waiting for Mage crawlers to finish ... Test Summary ============ Total files: 3 Total downloaded: 12.000K Avg. page weight: 4.000K Total time: 0.106s Min response: 0.026s Max response: 0.054s Avg. page response: 0.035s Concurrency/Repeats: 3 Transactions/s 36.58 Test URL: https://www.sonassi.com Success rate: 3/3 (100.00%)
This tells me that the average TTFB is
0.035s - and now I've got my starting point for optimisations.
Total load time
You can use your browser, combined with the net output (like the Firefox Firebug net output or Network panel in Chrome) - but this has its drawbacks that it will be subject to latency. Its good for a rounded view and will provide a waterfall - but can be misleading if your own internet connection has a brief period of congestion.
Alternatively, testing from the server itself is preferred; PhantomJS is the perfect tool to generate a HAR file to later be viewed on your PC; but compiling it from source is a little beyond the scope of this article.
So we can use the
mage-perftest utility again, but omitting the
-b parameter instead for a rounded overview (
-f is used to ignore font files)
./mage-perftest -u https://www.sonassi.com -f -r 3 Spawning 3 Mage crawlers ... Testing URL https://www.sonassi.com Testing URL https://www.sonassi.com Testing URL https://www.sonassi.com Waiting for Mage crawlers to finish ... Test Summary ============ Total files: 87 Total downloaded: 1848.000K Avg. page weight: 616.000K Total time: 0.118s Min response: 0.024s Max response: 0.069s Avg. page response: 0.039s Concurrency/Repeats: 3 Transactions/s 750.00 Test URL: https://www.sonassi.com
Measuring performance (real time)
Seeing the real-world effects of your changes over the course of a full day is the best way to measure actual results. Synthetic tests (like those above) are great for being able to measure the difference between changes, which you can then supplement with by observing the real-time, real-world load statistics.
There is no better place on MageStack than Kibana - with a variety of pre-made dashboards and the ability to make save and distribute your own; it will give you an extremely quick, interactive view.
From here, you can evaluate two metrics,
- The PHP render time for all dynamic requests
- The total amount of data sent to customers (if you've losslessly compressed images, you'll see the impact of the change here with less data being sent to customers)
This is one of the best dashboards to show a breakdown of page load time per area on the store. By default, we've added measurement of a few key areas,
- 3rd party modules
You can even correlate the performance in the frontend, to actions made in the backend, as we're also tracking,
- API requests
- Cache manipulation
- Index management
- Product saves
This dashboard is not only great for measuring performance per area, but also seeing the impact of your actions (as an administrator on the store).
Finally, a brilliant dashboard that combines both sales performance and store performance.