32 lines
1.7 KiB
Plaintext
32 lines
1.7 KiB
Plaintext
|
---
|
||
|
layout: docs
|
||
|
page_title: Initialize Rate Limit Settings
|
||
|
description: Learn how to determine regular and peak loads in your network so that you can set the initial global rate limit configurations.
|
||
|
---
|
||
|
|
||
|
# Initialize rate limit settings
|
||
|
|
||
|
Because each network has different needs and application, you need to find out what the regular and peak loads in your network are before you set traffic limits. We recommend completing the following steps to benchmark request rates in your environment so that you can implement limits appropriate for your applications.
|
||
|
|
||
|
1. In the agent configuration file, specify a global rate limit with arbitrary values based on the following conditions:
|
||
|
|
||
|
- Environment where Consul servers are running
|
||
|
- Number of servers and the projected load
|
||
|
- Existing metrics expressing requests per second
|
||
|
|
||
|
1. Set the `mode` to `permissive`. In the following example, the configuration allows up to 1000 reads and 500 writes per second for each Consul agent:
|
||
|
|
||
|
```hcl
|
||
|
request_limits {
|
||
|
mode = "permissive"
|
||
|
read_rate = 1000.0
|
||
|
write_rate = 500.0
|
||
|
}
|
||
|
```
|
||
|
|
||
|
1. Observe the logs and metrics for your application's typical cycle, such as a 24 hour period. Refer to [`log_file`](/consul/docs/agent/config/config-files#log_file) for information about where to retrieve logs. Call the [`/agent/metrics`](/consul/api-docs/agent#view-metrics) HTTP API endpoint and check the data for the following metrics:
|
||
|
|
||
|
- `rpc.rate_limit.exceeded.read`
|
||
|
- `rpc.rate_limit.exceeded.write`
|
||
|
|
||
|
1. If the limits are not reached, set the `mode` configuration to `enforcing`. Otherwise, continue to adjust and iterate until you find your network's unique limits.
|