Set the Window Size for Window-Based Flow Control
By default, the consumer-window-size is set to 1 MiB (1024 * 1024 bytes). The value can be: -1 for an unbounded buffer 0 to not buffer any messages. See Section 11.1.32, “No Consumer Buffering� for working example of a consumer with no buffering. >0 for a buffer with the given maximum size in bytes. Setting the consumer window size can considerably improve performance depending on the messaging use case. As an example, let's consider the two extremes: Fast consumers Fast consumers can process messages as fast as they consume them (or even faster) To allow fast consumers, set the consumer-window-size to -1. This will allow unbounded message buffering on the client side. Use this setting with caution: it can overflow the client memory if the consumer is not able to process messages as fast as it receives them. Slow consumers Slow consumers takes significant time to process each message and it is desirable to prevent buffering messages on the client side so that they can be delivered to another consumer instead. Consider a situation where a queue has 2 consumers; 1 of which is very slow. Messages are delivered in a round robin fashion to both consumers, the fast consumer processes all of its messages very quickly until its buffer is empty. At this point there are still messages awaiting to be processed in the buffer of the slow consumer thus preventing them being processed by the fast consumer. The fast consumer is therefore sitting idle when it could be processing the other messages. To allow slow consumers, set the consumer-window-size to 0 (for no buffer at all). This will prevent the slow consumer from buffering any messages on the client side. Messages will remain on the server side ready to be consumed by other consumers. Setting this to 0 can give deterministic distribution between multiple consumers on a queue. Most of the consumers cannot be clearly identified as fast or slow consumers but are in-between. In that case, setting the value of consumer-window-size to optimize performance depends on the messaging use case and requires benchmarks to find the optimal value, but a value of 1MiB is fine in most cases.