[rabbitmq-discuss] When are messages persisted to disk?

Matthew Sackman matthew at rabbitmq.com
Wed Aug 31 23:31:27 BST 2011


On Thu, Sep 01, 2011 at 12:14:07AM +0200, Alvaro Videla wrote:
> I would assume that if the message is published with: delivery-mode = 2  then it will be persisted ALWAYS. Is that the case?

No. delivery-mode=2 _AND_ msg arrives in durable queue. This is the only
case in which msgs _MUST_ be written to disk.

When memory is plentiful, even msgs with delivery-mode=2 and in durable
queues will be held in RAM _in addition_ to being on disk.

When memory is tight, these RAM copies will be forgotten. When memory is
tight, other messages that are currently _only_ in RAM may be written to
disk, and yes, they'll go to the transient msg store.

> Is it correct to say that transient queues get their messages saved to
> the TRANSIENT_MSG_STORE which is wiped out if RabbitMQ restarts?

Yes, but equally delivery-mode=1 msgs in durable queues go to the
transient msg store.

> Are there situations where the message is directly delivered to the consumer without being persisted to disk?

Yes. Or at least once a certain bug makes it through QA, then it will
be. If a msg that should be written to disk arrives in a queue and that
queue is able to send the msg out to a consumer and that consumer acks
the msg (or the consumer is consuming/getting with noAck=true) then
there's a possibility that the msg will never get written to disk. It's
a race. If we find out soon enough that the msg has been sent to a
consumer that's taken responsibility for the msg then we'll avoid
writing it. That doesn't quite happen in 2.6.0, but it hopefully will by
the next release.

Matthew


More information about the rabbitmq-discuss mailing list