1
votes

I have a requirement that messages should never be written to disk. The RabbitMQ documentation states the following:

both persistent and transient messages can be written to disk. Persistent messages will be written to disk as soon as they reach the queue, while transient messages will be written to disk only so that they can be evicted from memory while under memory pressure.

It's somewhat vague on what 'while under memory pressure' means. Is there a way to make sure transient messages will never be written to disk? If it comes to it, it's ok to lose the message if it cannot be delivered in this case.

1

1 Answers

1
votes

Transient messages will only be flushed to disk if the server is under a high memory pressure, i.e have a high RAM usage. (This could, for example, happen if the number of queued messages rapidly is getting high.) When this happens, RabbitMQ will start flushing (page out) messages to disk in order to free up RAM - and when that happens, queueing speeds will deteriorate. Source here.

According to this thread: https://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2013-May/027161.html it looks like you can set vm_memory_high_watermark to a really high value. By doing that, RabbitMQ will be killed by OOM before it has a chance to write to disk because RabbitMQ will then behave as if it has a lot of available memory, while it hasn't.