Redis Streams 如何处理用完所有可用内存? [英] How does Redis Streams handle using up all available memory?
问题描述
当所有可用内存都用完时,Redis 将如何处理 XADD?是否会从流中删除最旧的项目并添加新项目?从添加时起,旧项目是否仍然存在于 AOF 文件中?它只会抛出错误而不添加新项目吗?我应该期待什么?
How will Redis handle an XADD when all available memory is used? Will the oldest item(s) be deleted from the stream and the new item added? Will the old item still exist in the AOF file from when it was added? Will it just throw an error and not add the new item? What should I expect?
推荐答案
Streams 和其他所有数据结构一样,因此 Redis 将尊重 maxmemory
和 maxmemory-policy
RAM压力的情况.根据政策,新的写入请求将被拒绝,或者现有的密钥(流与否)将被驱逐.
Streams are data structures like all others, so Redis will respect the maxmemory
and maxmemory-policy
in case of RAM pressure. Depending on the policy, new write requests will be denied, or existing keys (streams or not) will be evicted.
在 https://redis.io/topics/lru-cache
这篇关于Redis Streams 如何处理用完所有可用内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!