- Notifications
You must be signed in to change notification settings - Fork4k
[Suggestion] Compression for stream replication#14978
-
RabbitMQ series4.2.x Operating system (distribution) usedmacOS How is RabbitMQ deployed?Community Docker image What would you like to suggest for a future version of RabbitMQ?Streaming incurs considerable cross-AZ replication cost. Stream replication in RabbitMQ (and Apache Kafka) make identical copies on replica members for the sake of durability and availability. In the Kafka world, blog posts and "disk-less Kafka" KIPs cite cross-AZ replication as a major cost. (Aiven blog,KIP-1150 "Disk-less Topics",KIP-1176 "Slack's KIP",Confluent blog.) We could add an opt-in feature to compress replication traffic to make it possible to reduce this cost. This option would trade lower traffic costs for lower max-throughput and higher latencies. Osiris replica-readers can compress each chunk before sending it to the Osiris replica. This necessary changes to Initial testingFor realistic-ish bodies we use the Max potential throughput drops in this scenario by 28.24%. Keep in mind this is AMQP 0-9-1 without publisher confirms. In another scenario we keep the ingress consistent and, by measuring bytes sent for replication, we see an overall reduction for replication of 32.5%. I measured this by adding a counter to While not shown here, commit and end-to-end latency seems to increase by some small but significant factor, say 30% (eyeballing it). Further testing is needed. Configuration# rabbitmq.conf example:stream.compression.algorithm = zstd# prefer lower CPU cost for larger size:stream.compression.level = -7 Compression algorithm and maybe also compression arguments could be configured in Cuttlefish config. Users serious about throughput would not enable compression but lower-throughput users aiming for cost efficiency could consider it. The configuration for this applies per-writer-node and can be changed - a cluster could even run a mixed set of compression configurations (during the rollout of a config change for example). Algorithms
|
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 1 comment 4 replies
-
I have a fundamental aversion towards putting any additional compute / latency into the replication/consensus part of any data system. Although there may be some (artificial?) use cases where compression can seem beneficial we have to look at the overall stability of the entire broker cluster, not just a single link. I'd rather not have the option than risk users enabling it (for "efficiency") and then experience hard to debug cluster issues due to undue computational work affecting scheduling. There issome benefit in perhaps doing compression for very few selected WAN links over the stream protocol but that is a different aspect all together. If costs are a concern there are cloud providers that do not charge for "AZ" transfers... |
BetaWas this translation helpful?Give feedback.
All reactions
-
Oh in addition streams support compressed sub-batches that can be used for stream protocol only user cases which offload compression compute work on to client applications (which can then be scaled to cover the additional compute) |
BetaWas this translation helpful?Give feedback.
All reactions
-
Great points, thanks for weighing in! Yeah I imagine you would not want to use replication compression if you were already using client-side compression. The two together probably wouldn't work well, the replication compression would probably just be wasteful. And client-side compression saves you on traffic in publishing, consuming and on-disk. I was thinking it would be mostly useful for messaging protocols which don't have a way to use the streams-protocol batching+compression. I will do some testing at scale when I get the chance and try to figure out if replication compression makes sense on a busy Rabbit cluster or if it does more harm than good. I could forsee users possibly shooting themselves in the foot with this if it's more intensive than I am thinking as you say. Adding the option in Osiris could be interesting even if it is not configurable in RabbitMQ directly. Some sort of shovel-related tool that transmits the stream data outside of the cluster might be able to take advantage of it. (I think I saw some feature in the Kafka world like that but I can't find it in my notes now :/) |
BetaWas this translation helpful?Give feedback.
All reactions
-
First I also thought that the stream client already supports compression. AMQP clients could also compress the payload, but if the payloads are small (especially in case of MQTT) and this proposal works on the stream chunk level, compressing many messages together, it seems to have an advantage of broker-side compression too. I was going to propose a hookable solution, so compression does not have to go to upstream RabbitMQ, but there are already a lot of callback points in RabbitMQ. Instead only making it configurable in osiris is a good idea. (ofc if tests show this whole thing makes sense) |
BetaWas this translation helpful?Give feedback.
All reactions
-
I dont think such a tool would use the replication "protocol" but rather be done over the stream protocol, so more in line with what I suggested above where it would make more sense to compress over the stream protocol. |
BetaWas this translation helpful?Give feedback.