Consul
Initialize rate limit settings
In order to set limits for traffic, you must first understand regular and peak loads in your network. We recommend completing the following steps to benchmark request rates in your environment so that you can implement limits appropriate for your applications.
Specify a global rate limit with arbitrary values in the agent configuration file based on the following conditions:
- Environment where Consul servers are running
- Number of servers and the projected load
- Existing metrics expressing requests per second
Set the
mode
topermissive
. In the following example, Consul agents are allowed up to 1000 reads and 500 writes per second:request_limits { mode = "permissive" read_rate = 1000.0 write_rate =500.0 }
Observe the logs and metrics for your application's typical cycle, such as a 24 hour period. Refer to
log_file
for information about where to retrieve logs. Call the/agent/metrics
HTTP API endpoint and check the data for the following metrics:rpc.rate_limit.exceeded
with valueglobal/read
for labellimit_type
rpc.rate_limit.exceeded
with valueglobal/write
for labellimit_type
If the limits are not reached, set the
mode
configuration toenforcing
. Otherwise adjust and iterate limits.