skip to Main Content

For Magento (v1.9 or lower), is okay to use a single Redis instance for both session and backend caching? Is there any extra configuration required?

3

Answers


  1. Chosen as BEST ANSWER

    After further research, it seems like using the same instance for both session and backend cache is easy to do with the only potential problem being running out of space (not an issue if you're on AWS using ElastiCache).

    Different port numbers are also not necessary. You just need to specify different "database numbers". The following is an example config:

      <cache>
        <backend>Cm_Cache_Backend_Redis</backend>
        <backend_options>
          <server>$REDIS_CACHE</server>
          <port>6379</port>
          <persistent></persistent>
          <database>1</database> <!-- DIFFERENT DB NUMBER -->
          <password></password>
          <force_standalone>0</force_standalone>
          <connect_retries>1</connect_retries>
          <read_timeout>10</read_timeout>
          <automatic_cleaning_factor>0</automatic_cleaning_factor>
          <compress_data>1</compress_data>
          <compress_tags>1</compress_tags>
          <compress_threshold>20480</compress_threshold>
          <compression_lib>gzip</compression_lib>
          <use_lua>0</use_lua>
        </backend_options>
      </cache>
      <session_save>db</session_save>
      <redis_session>
        <host>$REDIS_CACHE</host>
        <port>6379</port>
        <password></password>
        <timeout>2.5</timeout>
        <persistent></persistent>
        <db>2</db> <!-- DIFFERENT DB NUMBER -->
        <compression_threshold>2048</compression_threshold>
        <compression_lib>gzip</compression_lib>
        <log_level>1</log_level>
        <max_concurrency>6</max_concurrency>
        <break_after_frontend>5</break_after_frontend>
        <fail_after>10</fail_after>
        <break_after_adminhtml>30</break_after_adminhtml>
        <first_lifetime>600</first_lifetime>
        <bot_first_lifetime>60</bot_first_lifetime>
        <bot_lifetime>7200</bot_lifetime>
        <disable_locking>0</disable_locking>
        <min_lifetime>60</min_lifetime>
        <max_lifetime>2592000</max_lifetime>
      </redis_session>
    

  2. You can use a single instance, but you’d still use separate data stores for each of them, e.g. 6379 and 6380 but on the same Redis server.

    There’s no extra configuration required over having separate instances from the Magento side.

    Login or Signup to reply.
  3. I would recommend seperate instances.
    Advantages over single instance with same db, or even different dbs

    1. Space and configuration control : You would not want to logout a user because your caching is taking too much redis space. A redis object which stores some page cache might cause a session data key to get evicted, not good.

    2. Key name spacing control : Your keys would be seperated based on concern, and you can use things like flushing to clear all of your cache, or to logout your users on some major change. Instead of having to delete keys by pattern.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search