Loading..
Processing... Please wait...

Product was successfully added to your shopping cart.



Magento 2 Full Page Cache Benchmark

In today's article I want to benchmark various Magento 2 full page cache setups: built-in, redis and varnish. We will find out if there is a noticeable difference between these options.

I will be using Magento 2 on AWS setup.

 

 

I will be using JMeter test plan:

  1. A user visits homepage
  2. A user clicks on a category
  3. A user clicks on a product
  4. A user adds a product to cart
  5. A user goes to cart
  6. A user proceeds to checkout

I will be using 50 concurrent connections ie 50 concurrent visitors.

Disclaimer: I will be using default options for Redis and Varnish. I understand that I might get difference results if I fine tune these caching servers.

 

1. Magento 2 Built-in full page cache

This is the default Magento 2 setup. If you just installed Magento 2 and didn't change any configuration settings that is the setup you got.

Magento 2 Full Page Cache default setup Magento 2 Full Page Cache default setup

The Time to first byte (TTFB) over time graph is displayed below:

 

Magento 2 Built-in Full Page Cache Magento 2 Built-in Full Page Cache

 

2. Redis for session and full page cache

Now we will use Redis for session and full page cache storage.

Setup is simple.

First install redis server (I will use Debian 8):

apt-get install redis-server

Then edit app/etc/env.php file to set redis for session:

'session' => 
   array (
   'save' => 'redis',
   'redis' => 
      array (
	'host' => '127.0.0.1',
	'port' => '6379',
	'password' => '',
	'timeout' => '2.5',
	'persistent_identifier' => '',
	'database' => '0',
	'compression_threshold' => '2048',
	'compression_library' => 'gzip',
	'log_level' => '1',
	'max_concurrency' => '6',
	'break_after_frontend' => '5',
	'break_after_adminhtml' => '30',
	'first_lifetime' => '600',
	'bot_first_lifetime' => '60',
	'bot_lifetime' => '7200',
	'disable_locking' => '0',
	'min_lifetime' => '60',
	'max_lifetime' => '2592000'
    )
),

and for full page cache:

'cache' =>
array(
   'frontend' =>
   array(
      'default' =>
      array(
         'backend' => 'Cm_Cache_Backend_Redis',
         'backend_options' =>
         array(
            'server' => '127.0.0.1',
            'port' => '6379'
            ),
    ),
    'page_cache' =>
    array(
      'backend' => 'Cm_Cache_Backend_Redis',
      'backend_options' =>
       array(
         'server' => '127.0.0.1',
         'port' => '6379',
         'database' => '1',
         'compress_data' => '0'
       )
    )
  )
),

I run the same JMeter test and here is the results:

Magento 2 Redis Session and Full Page cache Magento 2 Redis Session and Full Page cache

I don't see any real difference between built-in option and redis. Do you?

 

3. Varnish for Magento 2 Full Page Cache

I have used Magento 2 official guide to setup varnish.

I am using Varnish 4.0.2 installed on Debian 8.

Magento 2 Varnish Full Page Cache Magento 2 Varnish Full Page Cache

 

Summary

I don't really see any noticeable difference between Redis, Varnish and built-in magento full page caches.

Out of the box configurations for redis and varnish are no better than the built-in Magento 2 caching solution.

Do you disagree? Share your points in comment section.

In the next articles I will try and optimize Redis and Varnish for optimal performance and will run benchmarks again. Stay tuned.

 

 

Other articles you might be interested in:

  1. Magento 1.9.3.2 vs 2.1.4 Performance Benchmark
  2. How to increase speed of magento website
  3. Magento Performance Optimization - 7 steps to faster website
  4. Magento 2 Performance Optimization - 90%+ PageSpeed
  5. Optimize Magento to get 100% Google Page Speed

  

Our Magento extensions you might be interested in:

  

If you find this post interesting do not hesitate to sign up for our newsletter and join the 853 people who receive Magento news, tips and tricks regularly.

Thank You!