gpt4 book ai didi

Redis 服务器在启动时使用所有 RAM

转载 作者:可可西里 更新时间:2023-11-01 11:24:56 26 4
gpt4 key购买 nike

我正在使用 redis 并注意到它崩溃并出现以下错误:

MISCONF Redis is configured to save RDB snapshots

我尝试了此 post 中建议的解决方案

但就权限和空间而言,一切似乎都还不错。

htop 命令告诉我,redis 消耗了 70% 的 RAM。我试图停止/重新启动 redis 以进行刷新,但在启动时,redis 使用的 RAM 量急剧增加并停止在 66% 左右。我很确定此时没有进程正在使用任何 redis 实例!

那里发生了什么?

最佳答案

不断增长的 ram 问题是 Redis 在首次加载数据时的预期行为,在重新启动后将数据写入磁盘(快照过程)。 Redis 倾向于尽可能多地分配内存,除非您不在 conf 文件中使用“maxmemory”选项。

它分配内存但不立即释放。有时需要几个小时,我看到过这样的情况。

关于 Redis 的众所周知的事实是,它可以分配最多两倍于它所保留的数据集的内存。

我建议你等待几个小时不要重启(Redis 可以在这段时间内工作,获取/设置操作等)并继续观察内存。

请查看that也是

Redis will not always free up (return) memory to the OS when keys are removed. This is not something special about Redis, but it is how most malloc() implementations work. For example if you fill an instance with 5GB worth of data, and then remove the equivalent of 2GB of data, the Resident Set Size (also known as the RSS, which is the number of memory pages consumed by the process) will probably still be around 5GB, even if Redis will claim that the user memory is around 3GB. This happens because the underlying allocator can't easily release the memory. For example often most of the removed keys were allocated in the same pages as the other keys that still exist.

关于Redis 服务器在启动时使用所有 RAM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48227341/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com