Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Port changes in two-level-cache article from 2.4 #8186

Merged
merged 3 commits into from
Nov 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/guides/v2.3/config-guide/cache/two-level-cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ functional_areas:
- Cache
---

Caching allows us to reduce network traffic between the remote cache storage and Magento. A standard Magento instance transfers around 300kb per request, and traffic may quickly grow to over ~1000 requests in some situations.
Caching enables a reduction in network traffic between the remote cache storage and Magento. A standard Magento instance transfers around 300kb per request, and traffic may quickly grow to over ~1000 requests in some situations.

To reduce the network bandwidth to Redis, we can store cache data locally on each web node and use the remote cache for two purposes:

- To check the cache data version, ensuring we have the latest cache stored locally.
- If the data is out of date, transfer the latest cache from the remote machine to the local machine.

Magento stores the hashed data version in Redis, with the suffix ':version' appended to the regular key. In case of an outdated local cache, we tranfer the data to the local machine with a cache adapter.
Magento stores the hashed data version in Redis, with the suffix ':version' appended to the regular key. In case of an outdated local cache, the data is transferred to the local machine with a cache adapter.

## Configuration example

Expand Down Expand Up @@ -51,10 +51,11 @@ Magento stores the hashed data version in Redis, with the suffix ':version' appe

Where:

- `backend` is our remote L2 cache implementation.
- `backend` is the remote L2 cache implementation.
- `remote_backend` is the remote cache implementation: Redis or MySQL.
- `remote_backend_options` are Redis or MySQL-specific options.
- `local_backend` is the local cache implementation: Cm_Cache_Backend_File or the APC adapter
- `local_backend` is the local cache implementation: `Cm_Cache_Backend_File` or the APC adapter.
- `cache_dir` is a directory where the local cache will be stored. It is suggested to use `/dev/shm/`.

We recommend the use of Redis for remote caching - `\Magento\Framework\Cache\Backend\Redis`, and the File cache implementation - `Cm_Cache_Backend_File` as the local cache.
We also recommend the use of the `cache preload` feature, as it will drastically decrease the pressure on Redis.
We also recommend the use of the [`cache preload`]({{page.baseurl}/config-guide/redis/redis-pg-cache.html#redis-preload-feature) feature, as it will drastically decrease the pressure on Redis. Do not forget to add suffix ':version' for preload keys.