内核 Valkey 的内存代差:5000 万 sorted set 实测少 ~10% 内存
- 一句话
- Valkey 9.1.2 在 5000 万成员的 sorted set 基准上,比 Redis 8.10.2 少约 10% 内存、吞吐小幅稳定领先;Redis 的追赶有明确的"迟到一年"的 PR 证据链。Valkey 9.1.2 uses ~10% less memory than Redis 8.10.2 on a 50-million-member sorted set benchmark, with a small but stable throughput lead; and Redis's catch-up has a documented "one year late" PR paper trail.
- 窄场景
- 内存敏感型大 Key 场景——排行榜/计分板(sorted set)、会话存储;workload 是千万级以上成员、内存成本占大头的缓存/计数服务。Memory-sensitive big-key workloads — leaderboards/scoreboards (sorted sets), session stores; tens of millions of members where memory cost dominates the cache/counter service.
- 机制
- 差距来自两次具体的内存结构手术,全是 Valkey 先做、Redis 后抄——① Valkey PR #1427(2025-01 合并、8.1 发布):sorted set 的哈希查找结构改成直指 skiplist 节点,不再各存一份映射(4.83GB→3.77GB);② Valkey PR #2508(2025-11 合并、9.1 发布):member 字符串直接嵌入 skiplist 节点,省掉每个元素一个指针 + 一次独立分配(3.77GB→3.34GB)。Redis PR #14701(2026-01 合并,晚了一年零十天)原文写着 "This is based on: valkey-io/valkey/pull/1427",只在 8.6 落地。Momento 的原话:"2026 年末的 Redis,按字节算,大约就是 2025 年 4 月的 Valkey。"The gap comes from two concrete memory-structure surgeries, both done by Valkey first and Redis second — ① Valkey PR #1427 (merged 2025-01, shipped in 8.1): the sorted set's hash lookup structure points directly at skiplist nodes instead of keeping a separate mapping (4.83GB→3.77GB); ② Valkey PR #2508 (merged 2025-11, shipped in 9.1): member strings embedded directly in skiplist nodes, saving one pointer + one independent allocation per element (3.77GB→3.34GB). Redis PR #14701 (merged 2026-01, a year and ten days later) states verbatim in its description: "This is based on: valkey-io/valkey/pull/1427" — and only landed in 8.6. Momento's own words: "Redis, as of late 2026, is roughly Valkey as of April 2025, byte for byte."
- 生产验证
- Momento(独立缓存厂商)2026 年 9 月底发布的第三轮《50 Million Sorted Sets》基准:Valkey 9.1.2 是"所测配置里最小且最快的"(https://www.gomomento.com/blog/50-million-sorted-sets-round-three-redis-and-valkey-compared/);另有 Percona 2025、ScyllaDB 开源缓存测试、Tech Insider 2026 等五组独立基准方向一致(Valkey 领先 1.6%–8% 吞吐、15% p99 延迟)(https://tech-insider.org/valkey-vs-redis-2026/)。Momento's (independent cache vendor) third-round "50 Million Sorted Sets" benchmark, published late Sep 2026: Valkey 9.1.2 was "the smallest and fastest of all configurations tested" (https://www.gomomento.com/blog/50-million-sorted-sets-round-three-redis-and-valkey-compared/); five more independent benchmarks (Percona 2025, ScyllaDB's open cache tests, Tech Insider 2026, etc.) agree in direction — Valkey leads by 1.6%–8% throughput and 15% p99 latency (https://tech-insider.org/valkey-vs-redis-2026/).
- 竞品差距
- Redis——同一协议,内存与性能上"追赶中",且追赶动作本身证明 Valkey 是上游创新方;其余 30 款里没有 RESP 协议兼容的内存 KV——"没有"。Redis — same protocol, "catching up" on memory and performance, and the catch-up itself proves Valkey is the upstream innovator; no other product among the remaining 30 is RESP-protocol compatible — "none."
- 证据等级
- 独立实测(第三方基准 + PR 时间线交叉验证)。诚实备注:Redis 官方 2026 年 6 月的对比稿承认 Valkey 9 在 2000 节点集群跑出超 10 亿 RPS,但 Momento 的 PR 考古证明 Redis 的内存优化是照抄 Valkey 一年前的方案——**创新方向盘在 Valkey 社区手里**,"Redis 后续会跟上"不等于"现在一样"。Independent measurement (third-party benchmarks + PR-timeline cross-validation). Honest note: Redis's June 2026 comparison piece concedes Valkey 9 ran 1B+ RPS on a 2,000-node cluster — but Momento's PR archaeology proves Redis's memory optimizations were copied from Valkey's year-old work. **The innovation steering wheel is in Valkey's community's hands** — "Redis will catch up eventually" is not "they're equal now."
- 最后核验
- 2026-10-012026-10-01