Quorum Queue compaction behavior #13103
-
Community Support Policy
RabbitMQ version used4.0.3 How is RabbitMQ deployed?RPM package Steps to reproduce the behavior in questionRabbitMQ version - 4.0.5 We have 3 node cluster each having 20 GB of space available for RabbitMQ storage. During some tests we noticed we quite often run out of space due to segments not being compacted, even when queues are empty or almost empty. Sometimes one node compacts its segments but others do not which in the end leads to disk alarms which blocks all producers. For example, current situation of one our queues: leader compacted its segments already several times (I was monitoring that) while followers did not compact in a "long" time (1 hour) meaning they are very close to disk alarm.
As you can see, Why is that leader compacted already several times while at the same time followers are not compacting their segments? I stopped producers/consumers processes to prevent triggering disk alarms, but queues are still not compacting after some time. Is it possible to force compaction via CLI? |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 2 replies
-
@kamilzzz no, it is not possible to trigger compaction via CLI tools. Start with
|
Beta Was this translation helpful? Give feedback.
-
Our Raft implementation does not perform compaction per se, if "compaction" defined as the process of combining data from N segment files with holes (acknowedged deliveries) into a new file without holes. The process is called "segment truncation" instead, and as the name suggests, it operates at the segment file level. With multi-megabyte messages, using a smaller segment file message count is something to consider. The only thing that stands out from the rabbitmq-diagnostics observer will provide access a few more QQ metrics. The general recommendation for large messages has always been "put them into a blob store and pass the relevant metadata around in messages". |
Beta Was this translation helpful? Give feedback.
-
One hypothesis I have is that it is not the segment files that explain the differences, it is snapshot files. Snapshots are sent from the leader to the followers, never the other way around, when a follower recovers (e.g. after a node restart). @kamilzzz see what files actually consume the disk space under the node's data directory, then under
I think that when the followers are up-to-date (as seen from the commit index), the snapshots can be safely deleted. Followers likely keep one of them around and usually no one even notices when messages are small. @kjnilsson would know best. |
Beta Was this translation helpful? Give feedback.
-
@kamilzzz please can you provide a description of the tests you've run, message sizes, throughput rates etc or even better provide a set of command lines for our perftest that I can use to reproduce it. Snapshotting changed a lot in 4.0 so there may be scenarios we didn't manage to cover as well as others. 20GB is too small for 1MB QQ workloads really. I would go with something 100GB+. |
Beta Was this translation helpful? Give feedback.
-
An earlier discussion that seems highly relevant because the behavior there was the "Snapshot index" discrepancy: #12147. |
Beta Was this translation helpful? Give feedback.
-
@michaelklishin @kjnilsson Thanks for responses. We had |
Beta Was this translation helpful? Give feedback.
We have documented this suggestion for installations where average message size is (expected to be) large.