Config Redis Cache with Magento 2

Config Redis Cache with Magento 2

1. Raise somaxconn above [tcp-backlog] value:

sudo nano /etc/rc.local

Add this:

sysctl -w net.core.somaxconn=65535

When you reboot the next time, the new setting will be to allow 65535 connections instead of 128 as before.

2. Make sure to disable Linux kernel feature transparent huge pages, it will affect greatly both memory usage and latency in a negative way. This is accomplished with the following command:

echo never > /sys/kernel/mm/transparent_hugepage/enabled.

then add the command to your /etc/rc.local file.

if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
      echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi

4. Redis standard configuration for Magento 2: app/code/env.php

'cache' => array( 'frontend' => array( 'default' => array( 'backend' => 'Cm_Cache_Backend_Redis', 'backend_options' => array( 'server' => 'localhost', 'port' => '6379', 'persistent' => '', 'database' => '0', 'force_standalone' => '0', 'connect_retries' => '1', 'read_timeout' => '10', 'automatic_cleaning_factor' => '0', 'compress_data' => '1', 'compress_tags' => '1', 'compress_threshold' => '20480', 'compression_lib' => 'gzip', 'use_lua' => '0', ) , ) , 'page_cache' => array( 'backend' => 'Cm_Cache_Backend_Redis', 'backend_options' => array( 'server' => 'localhost', 'port' => '6379', 'persistent' => '', 'database' => '1', 'force_standalone' => '0', 'connect_retries' => '1', 'read_timeout' => '10', 'automatic_cleaning_factor' => '0', 'compress_data' => '0', 'compress_tags' => '1', 'compress_threshold' => '20480', 'compression_lib' => 'gzip', 'lifetimelimit' => '57600', ) , ) , ) , )
Code language: PHP (php)

5. redis-benmark tool

http://antirez.com/news/84https://redis.io/topics/benchmarks

Comments are closed.