hashicorp / hashicorp/consul

Allow configuring `MaxConcurrentRequests ` for `local_app` cluster

Open
#23,193 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
1d 18h
Merged PRs (30d)
39

Description

#### Feature Description

Allow us to configure `max_requests` for the `local_app` cluster in the Envoy configuration.
It is already possible to configure `MaxInboundConnections` in service-defaults, which is then used to set `max_connections`for `local_app` in the envoy configuration, but unfortunately, for long-lived HTTP connections, `max_requests`must also be increased.

#### Szenario

We use Consul service mesh for inter-service communication.

Connection flow is like:
App A -> Sidecar A -> Sidecar B -> App B
App A has many instances (thousands)
App B has just a few instances (3-5)

Our app B service receives long-lived WebSocket connections. We only have a very few instances of this service, and they could hold a large number of connections (> 10k) but we're reaching the `max_requests` limit for the `local_app` cluster.

I've already raised `MaxInboundConnections` in service-defaults and confirmed it's applied to the Envoy configuration.
But since our service has HTTP protocol set and the requests are long-lived websocket connections, we also need to increase `max_requests` limit.

Some other configuration properties that unfortunaely don't fix my problem:
- With `MaxInboundConnections` in service-defaults for "App B", you can already configure the maximum of simultaneous connections for `local_app` cluster at sidecar b. But since we use web-sockets with HTTP protocol set for the service, `max_requests` must also be raised.
- With `UpstreamConfig` in service-defaults for "App A", you can configure max_requests but only at sidecar A.
- Set `LoadBalancer.Policy` to `least_conn` in service-router, but this also only applies to sidecar A.

Reference:
max_requests reference: https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/cluster/v3/circuit_breaker.proto#envoy-v3-api-field-config-cluster-v3-circuitbreakers-thresholds-max-requests

Contributor guide

Open the contributing guide

Research direction

Start by tracing how service-defaults and the local_app cluster are represented in the generated Envoy configuration, using the existing MaxInboundConnections handling as the reference point. Confirm how a configurable max_requests value should be carried through for long-lived WebSocket connections, and verify that the generated local_app configuration reflects it.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.