ERR redis resource_error ai_generated true

ERR 消费者组 'mygroup' 在流 'mystream' 上的待处理条目列表过大:50000 条,请考虑修剪

ERR PEL too large for consumer group 'mygroup' on stream 'mystream': 50000 entries, consider trimming

ID: redis/stream-pending-entry-list-too-large

其他格式: JSON · Markdown 中文 · English
79%修复率
86%置信度
1证据数
2024-08-22首次发现

版本兼容性

版本状态引入弃用备注
7.2.0 active
7.4.0 active
8.0.0 active

根因分析

消费者组的待处理条目列表(PEL)增长过大,消耗内存并拖慢 XREADGROUP 和 XACK 操作。

English

The pending entries list (PEL) for a consumer group has grown excessively large, consuming memory and slowing down XREADGROUP and XACK operations.

generic

官方文档

https://redis.io/docs/data-types/streams/

解决方案

  1. Use XAUTOCLAIM to reclaim and acknowledge old pending entries: 'XAUTOCLAIM mystream mygroup myconsumer 3600000 0-0 COUNT 1000' then XACK each claimed entry. Repeat until PEL is reduced.
  2. Implement a periodic cleanup job in the consumer that checks PEL size via XINFO GROUPS and automatically trims old entries using XDEL after confirming they are no longer needed

无效尝试

常见但无效的做法:

  1. Increasing maxmemory to accommodate the large PEL 80% 失败

    This only delays the problem; the PEL will continue to grow until memory is exhausted again, and it does not improve performance.

  2. Deleting the consumer group and recreating it 90% 失败

    This loses all pending entry state, potentially causing data loss if entries were not processed.

  3. Setting a very high XREADGROUP COUNT to read more entries 70% 失败

    This increases load on the server and does not reduce the PEL size; it may actually grow it faster.