# maxbytes

Topics and queues can specify the `maxbytes` property in the form:

maxbytes=value[KB|MB|GB]

where value is the number of bytes. For example:

       maxbytes=1000

Means 1000 bytes.

You can optionally include a KB, MB or GB after the number to specify kilobytes, megabytes, or gigabytes, respectively. For example:

       maxbytes=1000KB

Means 1000 kilobytes.

For queues, `maxbytes` defines the maximum size (in bytes) that the queue can store, summed over all messages in the queue. Should this limit be exceeded, messages will be rejected by the server and the message producer send calls will return an error (see also `overflowPolicy`). For example, if a receiver is off-line for a long time, then the queue size could reach this limit, which would prevent further memory allocation for additional messages.

If `maxbytes` is zero, or is not set, the server does not limit the memory allocation for the queue.

You can set both `maxmsgs` and `maxbytes` properties on the same queue. Exceeding either limit causes the server to reject new messages until consumers reduce the queue size to below these limits.

Warning: If the `maxbytes` limit is not set on a destination, the server still checks to see if that destination’s memory footprint is growing beyond a threshold. If so, a warning is logged. For more details, see `large_destination_memory` and `large_destination_count`.

For topics, `maxbytes` limits the maximum size (in bytes) that the topic can store for delivery to each durable or non-durable online subscriber on that topic. That is, the limit applies separately to each subscriber on the topic. For example, if a durable subscriber is off-line for a long time, pending messages accumulate until they exceed `maxbytes`; when the subscriber consumes messages (freeing storage) the topic can accept additional messages for the subscriber. For a non-durable subscriber, `maxbytes` limits the number of pending messages that can accumulate while the subscriber is online.

Warning: Under certain conditions, because of the pipelined nature of message processing or the requirements of transactional messaging, the `maxbytes` limit can be slightly exceeded. You may see message totals that are marginally larger than the set limit.

When a destination inherits different values of this property from several parent destinations, it inherits the smallest value.

Note: You can further protect against consumers that receive messages without acknowledging them using the parameter `disconnect_non_acking_consumers`.
Copyright © Cloud Software Group, Inc. All rights reserved.