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
modetopermissive. 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_filefor information about where to retrieve logs. Call the/agent/metricsHTTP API endpoint and check the data for the following metrics:rpc.rate_limit.exceededwith valueglobal/readfor labellimit_typerpc.rate_limit.exceededwith valueglobal/writefor labellimit_type
If the limits are not reached, set the
modeconfiguration toenforcing. Otherwise adjust and iterate limits.