gpt4 book ai didi

memory - RabbitMQ + 内存限制

转载 作者:IT王子 更新时间:2023-10-28 23:30:54 26 4
gpt4 key购买 nike

我只是在查看 RabbitMQ 的配置细节并遇到了

[{rabbit, [{vm_memory_high_watermark, 0}, 
{disk_free_limit, {mem_relative, 1.0}}
]
}]

这个配置是什么意思?

vm_memory_high_watermark 设置为 0 表示 => 在 rabbitmq 应用程序启动时立即阻止所有发布者?但是我们仍然看到 rabbitmq 能够将我们发送的任何消息排队。

16720 rabbitmq  20   0  142m  62m 2408 S    0  **1.6**   0:06.88 beam.smp

每当我们向代理发送消息时,我们都会看到此进程的内存使用量增加。那么,这是否意味着尽管水印设置为 0,但消息仍在内存中?

我们很想知道如果 ram 的内存限制达到并且仍在发送 msgs 会发生什么?要么发布者被阻止?或者如果可用,消息会被换出到磁盘?

最佳答案

vm_memory_high_watermark 是一个百分比值,与 RabbitMQ 中的内存流量控制有关。

如果你看看 Memory flow control您会看到它在“基于内存的流量控制”标题下显示:

The RabbitMQ server detects the total amount of RAM installed in the computer on startup and when rabbitmqctl set_vm_memory_high_watermark fraction is executed. By default, when the RabbitMQ server uses above 40% of the installed RAM, it raises a memory alarm and blocks all connections. Once the memory alarm has cleared (e.g. due to the server paging messages to disk or delivering them to clients) normal service resumes.

因此,通过将此值设置为 0,它当然会立即触发!如果您希望允许 RabbitMQ 使用更多内存,那么您将需要增加该值。

另一个重要提示:

The default memory threshold is set to 40% of installed RAM. Note that this does not prevent the RabbitMQ server from using more than 40%, it is merely the point at which publishers are throttled.

因此,如果您在警报响起时尝试发布消息,那么您的发布者将被阻止发送消息。

如果您想阻止所有发布者,则将 vm_memory_high_watermark 设置为 0。如果您想“禁用”基于内存的流量控制,则将 vm_memory_high_watermark 设置为 100。请参阅上面的链接中的详细信息:

A value of 0 makes the memory alarm go off immediately and thus disables all publishing (this may be useful if you wish to disable publishing globally; use rabbitmqctl set_vm_memory_high_watermark 0). To prevent the memory alarm from going off at all, set some high multiplier such as 100.

关于memory - RabbitMQ + 内存限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12175156/

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