Skip to main content
Version: 4.1

Per-user Resource Limits

Overview

Similarly to per-virtual host resource limits, it is possible to limit how many connections and channels a specific user can open.

These limits can be used as guard rails in environments where applications cannot be trusted and monitored in detail, for example, when RabbitMQ clusters are offered as a service.

The limits can be configured using CLI tools or the HTTP API.

Maximum Number of Connections

To limit how many connection a user can open, set the max-connections limit to a positive integer:

rabbitmqctl set_user_limits user1 '{"max-connections": 10}'

Maximum Number of Channels

To limit how many channels, in total, a user can open, set the max-channels limit to a positive integer:

rabbitmqctl set_user_limits guest '{"max-connections": 10, "max-channels": 20}'

The limit is applied to the total number of channels across all connections opened by the user. Therefore, it must be equal or greater than that the aforementioned maximum connection limit.

Listing User Limits

To list limits for a specific user:

rabbitmqctl list_user_limits user1

Clearing User Limits

To clear limits for a user, use CLI tools or the HTTP API.

# clears the maximum number of connections limit
rabbitmqctl clear_user_limits user1 'max-connections'

# clears the maximum number of channels limit
rabbitmqctl clear_user_limits user1 'max-channels'

# clears all limits in a single operation
rabbitmqctl clear_user_limits user1 all