Magento Expert Forum - Improve your Magento experience

Results 1 to 4 of 4

How to configure Magento 2 to use Redis

  1. #1

  2. #2
    Junior Member
    Join Date
    Sep 2016
    Posts
    130
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default

    I have not familiar with this, but read it some where, so sharing with you, Out of the box Magento 2 is shipped with redis support and we can use it for cache, sessions and full page cache. Magento 2 cache entries are organized in groups like Configuration, Layous, Blocks HTML Output and so on. If you have shop(s) with a huge amount of products your cache will be very big. Because of that it's highly recommended to use redis as cache backend. Out of the box Magento 2 uses the file system as cache storage which isn't really recommended because it's the slowest cache storage you can use. For each cache group deletion Magento needs to open all files to check if it's in the cache group or not. If you do this with thousand of files, which you will have with a big shop, it will extremely slow down your shop.


    Franchise for Sale | Selling a Business | Small Business for Sale | Business for Sale in Delhi | Small Business Ideas in Delhi

  3. #3
    Junior Member kajal's Avatar
    Join Date
    Sep 2014
    Location
    Bangalore
    Posts
    478
    Thanks
    0
    Thanked 8 Times in 8 Posts

    Default

    Magento 2 is shipped with redis support and we can use it for cache, sessions and full page cache.:
    To configure Redis for Magento 2 cache, just add the following example to your app/etc/env.php:

    'cache' =>
    array (
    'frontend' =>
    array (
    'default' =>
    array (
    'backend' => 'Cm_Cache_Backend_Redis',
    'backend_options' =>
    array (
    'server' => '127.0.0.1',
    'port' => '6379',
    'persistent' => 0,
    'database' => '0',
    'force_standalone' => '0',
    'connect_retries' => '10',
    'read_timeout' => '30',
    'automatic_cleaning_factor' => '0',
    'compress_data' => '1',
    'compress_tags' => '1',
    'compress_threshold' => '20480',
    'compression_lib' => 'gzip',
    ),
    ),
    ),
    ),


    To configure Magento 2 to use Redis for sessions, just add the following lines to your app/etc/env.php:

    'session' =>
    array (
    'save' => 'redis',
    'redis' =>
    array (
    'host' => '127.0.0.1',
    'port' => '6379',
    'password' => '',
    'timeout' => '5',
    'persistent_identifier' => '',
    'database' => '1',
    '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'
    )
    )

  4. #4
    Junior Member fay_khattak's Avatar
    Join Date
    Jan 2016
    Location
    Karachi, Pakistan
    Posts
    50
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Redis is a high-speed backend cache with full cache tag support, no need for low-level file system cache and on high traffic Magento stores, the performance is excellent and stable. It is also highly recommended in multi-server environments.

    The following are the prerequisites to configure Redis Cache on Magento 2:

    - Redis Server
    - PHP Redis Extension

    The latest versions are always preferable. To assist you further, I have written a brief tutorial on how to configure Redis with Magento 2. Please have a look at it:

    Install Redis Cache On Magento 2

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •