Bundled Valkey doubles its memory during scheduled snapshots (fork copy-on-write); document headroom or set persistence explicitly
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- docker, redis
- Lĩnh vực
- devops, documentation
Hướng nghiên cứu
Start with the redis service's redis.conf, which sets only maxmemory 0 and maxmemory-policy volatile-lru and leaves the default snapshot schedule in place, and with the install and sizing docs that should mention memory headroom. Decide whether Sentry's Redis data can be rebuilt after a restart, which determines whether save "" or keeping RDB is appropriate. Done means the docs state the up-to-2x snapshot headroom and how to check used_memory, and redis.conf has an explicit persistence choice, agreed with maintainers first.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem Statement
The bundled Valkey (valkey/valkey:8.1.11-alpine, with redis.conf setting only maxmemory 0 and maxmemory-policy volatile-lru) keeps Valkey's default snapshot schedule. Every scheduled BGSAVE forks. While the child writes the RDB, every page Sentry modifies is copied (copy-on-write), so under a steady write load the container's memory climbs toward twice the dataset. That's what #3155 showed: redis-server at 26.5 GB RSS with redis-rdb-bgsave at another 26.4 GB, on a host where Redis already held 41% of memory. With maxmemory 0 nothing bounds the dataset, so the fork's extra copy is what tips a busy instance into OOM.
We measured it with self-hosted's exact image and redis.conf: 6M keys with 64-byte values, BGSAVE while two clients keep overwriting random keys, on an 8-vCPU host. Two runs:
| Valkey 8.1.11 (self-hosted config) | |
|---|---|
Peak container memory during BGSAVE |
1,282 / 1,283 MiB (dataset alone: ~640 MiB) |
Time to finish BGSAVE |
3.05 / 3.13 s |
So peak memory is about twice the data, as expected from fork + copy-on-write.
Solution Brainstorm
Options that help whatever server runs behind redis:
- Document the headroom. Install and sizing docs could say that the
rediscontainer needs up to about twice its dataset during a snapshot, and how to check the dataset size (INFO memory→used_memory). - Decide on persistence explicitly in
redis.conf. If Sentry's Redis data can be rebuilt after a restart,save ""removes the forks entirely. If it can't, either keep RDB with the headroom documented, or useappendonly yes, which forks only on an AOF rewrite. - Bound the dataset. A non-zero
maxmemorydefault (or a documented way to set one), as discussed in #3155 and #2262, so a backlog can't grow the dataset past what the host can fork.
A fork-free Redis-compatible server is a further option. Disclosure: we build one, KiviDB (AGPLv3). On the same test it peaked at 640 / 652 MiB and finished in 1.20 / 1.25 s. It captures the dataset in-process instead of forking, at the cost of one short write pause (about 61 ms here). We have not validated Sentry itself against it. Sentry's Lua scripts are the first thing to check, because KiviDB embeds Lua 5.4 and Valkey embeds 5.1 (a known difference: kividbio/kividb#747). So we're not proposing a swap here, only noting that the option exists. A longer write-up, with the Redis-side fixes in more detail: https://kividb.io/blog/redis-bgsave-memory-fork
cc @Swaroop-1613 @balaG4046, who reported the original memory doubling in #3155.
- Ngôn ngữ chính
- Shell
- Star
- 9.7k
- Fork
- 2k
- Merge trung bình
- 3 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 16
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của getsentry/self-hosted
-
Waiting for: Product Owner
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
getsentry/self-hosted#4644 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
getsentry/self-hosted#4518 · 3 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Waiting for: Product Owner
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 73/100
getsentry/self-hosted#4642 · 3 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Waiting for: Community
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 28/100
getsentry/self-hosted#4637 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Waiting for: Product Owner
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
getsentry/self-hosted#4634 ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của getsentry/self-hosted
Issue tương tự
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
ajithakdev/claude-desktop-rpm#43 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
aws/aws-networking-best-practices#256 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
area:terraform source:reader type:content-error
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
stephrobert/blog-roadmap#268 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
fossi-foundation/globalfoundries-pdk-libs-gf180mcu_fd_pv#61 ·
-
ChatGPT directory is behind mainĐang mởopenai-directory
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100