From 48ff8f7bca375dd689207ad4a29a27da244c6e7b Mon Sep 17 00:00:00 2001 From: trujillo-adam Date: Tue, 21 Feb 2023 11:42:16 -0800 Subject: [PATCH] added steps for initializing rate limits --- .../docs/agent/limits/init-rate-limits.mdx | 32 +++++++++++++++++++ .../limits/set-global-traffic-rate-limits.mdx | 2 ++ 2 files changed, 34 insertions(+) diff --git a/website/content/docs/agent/limits/init-rate-limits.mdx b/website/content/docs/agent/limits/init-rate-limits.mdx index e69de29bb2..5f9b5ac058 100644 --- a/website/content/docs/agent/limits/init-rate-limits.mdx +++ b/website/content/docs/agent/limits/init-rate-limits.mdx @@ -0,0 +1,32 @@ +--- +layout: docs +page_title: Initialize Rate Limit Settings +description: Learn how to determins regular and peak loads in your network so that you can set the initial global rate limit configurations. +--- + +# 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. + +1. 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 + +1. Set the `mode` to `permissive`. In the following example, Consul agents are allowed up to 1000 reads and 500 writes per second: + + ```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 adjust and iterate limits. \ No newline at end of file diff --git a/website/content/docs/agent/limits/set-global-traffic-rate-limits.mdx b/website/content/docs/agent/limits/set-global-traffic-rate-limits.mdx index 851d7eba12..6e14ea2b1c 100644 --- a/website/content/docs/agent/limits/set-global-traffic-rate-limits.mdx +++ b/website/content/docs/agent/limits/set-global-traffic-rate-limits.mdx @@ -12,6 +12,8 @@ Rate limits apply to each Consul server separately and are intended to limit the Because all requests coming to a Consul server eventually perform an RPC or an internal gRPC request, these limits also apply to other user interfaces, such as the HTTP API interface, the CLI, and the external gRPC endpoint for services in the Consul service mesh. +Refer to [Initialize Rate Limit Settings]() for additional information about right-sizing your gRPC request configurations. + ## Set a global rate limit for a Consul server Configure the following settings in your Consul server configuration to limit the RPC and gRPC traffic rates.