This PR adds all the guides from [Visual Guides](https://bytebytego.com/guides/) section on bytebytego to the repository with proper links. - [x] Markdown files for guides and categories are placed inside `data/guides` and `data/categories` - [x] Guide links in readme are auto-generated using `scripts/readme.ts`. Everytime you run the script `npm run update-readme`, it reads the categories and guides from the above mentioned folders, generate production links for guides and categories and populate the table of content in the readme. This ensures that any future guides and categories will automatically get added to the readme. - [x] Sorting inside the readme matches the actual category and guides sorting on production
1.5 KiB
title, description, image, createdAt, draft, categories, tags
| title | description | image | createdAt | draft | categories | tags | |||
|---|---|---|---|---|---|---|---|---|---|
| How Big Keys Impact Redis Persistence | Explore the impact of large keys on Redis AOF persistence modes. | https://assets.bytebytego.com/diagrams/0085-big-keys.png | 2024-02-17 | false |
|
|
We call a key that contains a large size of data a big key. For example, the size of the key is 5 MB.
The diagram shows how big keys impact Redis AOF (Append-Only-File) persistence.
There are three modes when we turn on AOF persistence:
-
Always - synchronously write data to the disk whenever there is a data update in memory.
-
EverySec - write to the disk every second.
-
No - Redis doesn’t control when the data is written to the disk. Instead, the operating system decides when the data is written to the disk.
How do we analyze the impact of big keys?
Redis writes keys into memory first, then calls write() to write the data into the kernel buffer cache. Then fsync() flushes all modified in-core data of the file to the disk device. There are 3 modes.
In “Always” mode, it calls fsync() synchronously. If we need to update a big key, the main thread will be blocked because it has to wait for the write to complete.
“EveySec” starts a background timer task to call fsync() every second, so big keys have no impact on the Redis main thread.
“No” mode never calls fsync(). It is up to the operating system. Big keys have no impact on the main thread.
