Rate limit

EMQX allows for specifying limits on connection speed and messaging speed, using a backpressure scheme that avoids system overload at the entry point and guarantees system stability with predictable throughput.

Limiter Types

EMQX uses the following types of limiters to specify the rate limits:

TypeDescriptionPost-Overload Behavior
bytes_rateIncoming message size in bytes per second per clientPause receiving client messages
messages_rateIncoming messages per second per clientPause receiving client messages
max_conn_rateConnections per second per listenerPause receiving new connections

Limiter can work on the listener level. For example, to set a Limiter for the default TCP listener, You can configure it in emqx.conf as follows:

  1. listeners.tcp.default {
  2. bind = "0.0.0.0:1883"
  3. max_conn_rate = "1000/s"
  4. messages_rate = "1000/s"
  5. bytes_rate = "1000MB/s"
  6. }

Rate Unit

Time Unit

The supported time unit in the rate value could be:

  • s :: Second
  • m :: Minute
  • h :: Hour
  • d :: Day

The time unit also can be an interval value, like 1000/10s means setting the limit to 1000 per every 10 seconds.

Size Unit

The supported size unit in the rate value could be:

  • KB :: Kilobyte
  • MB :: Megabyte
  • GB :: Gigabyte