POC runtime state

  • Distinguish refillable token balances from independent in-flight request counters.
100%

OBRH POC 0.1.3 example · prepared configuration; no live deployment claim

Runtime state · OBRH POC exampleFour views show configuration objects, request rejection, runtime state, and generic Envoy internal architecture. Sections A to C use prepared POC examples, not live deployment evidence. Section D shows the generic TCP and HTTP1-2 architecture. Runtime state · OBRH POC example Shared across workers · local to this sidecar · illustrative state, not measured values C1 · Local rate limiter: mutable token balances Default bucketalways consumed on allowD / 1000 tokens−1 on consumption URL descriptor bucketpath = U1U / 1000 tokens−1 on consumption Group descriptor bucketpp = FCUPIG / 1000 tokens−1 on consumption TIME-BASED REFILL1000 tokens / 1s per bucket C2 · Per-cluster active-request counters debitCreditTxn-v2 inbound|8080|| n / 50 m / 200 admit +1finish / reset −1 admit +1finish / reset −1 Different cluster → different counter route.rate_limits = rules token buckets = rate state cluster counter = concurrency 50 and 200 are separate budgets

Select a component to trace its direct connections. Drag to pan · Ctrl + wheel or pinch to zoom.

  • The local limiter spends tokens when it admits a matching request and replenishes them on a timer. The cluster’s active-request counter measures concurrent upstream requests and falls as those requests end.
  • A slow response can occupy a cluster slot after its rate bucket has refilled. Adding a proxy replica gives it its own local state, so a single proxy’s balance or counter describes only that replica.
URL cluster · 50 active requests

URL cluster · 50 active requests

Istio 1.22.6 · Envoy 1.30.7 · prepared chart 0.1.3

The separately added cluster

This exact CLUSTER / ADD excerpt defines the object referenced by Route 1. It names the explicit loopback endpoint and sets that cluster’s active-request threshold.

Exact CLUSTER / ADD patchyaml
  - applyTo: CLUSTER
    match:
      context: SIDECAR_INBOUND
    patch:
      operation: ADD
      value:
        name: debitCreditTxn-v2
        type: STATIC
        load_assignment:
          cluster_name: debitCreditTxn-v2
          endpoints:
          - lb_endpoints:
            - endpoint:
                address:
                  socket_address:
                    address: 127.0.0.1
                    port_value: 8080
        circuit_breakers:
          thresholds:
          - max_requests: 50

Same address, different accounting

STATIC means the endpoint is supplied in load_assignment; it needs neither DNS resolution nor a separate EDS subscription. Istiod can still update the cluster through CDS. The same endpoint address in two cluster objects does not share their pools or request counters.

What this fragment leaves unset

Only max_requests is set. Raw Envoy defaults remain for omitted thresholds, including 1,024 connections and 1,024 pending requests in the examined version. This does not configure a zero-length queue or clone the ordinary inbound cluster’s policy. A second independent URL budget needs another named cluster and an explicit matching route; several routes can deliberately share one cluster.

Ordinary inbound cluster · 200 active requests

Ordinary inbound cluster · 200 active requests

Istio 1.22.6 · Envoy 1.30.7 · prepared chart 0.1.3

The Sidecar that owns the ordinary pool

This is the exact prepared Sidecar. inboundConnectionPool.http.http2MaxRequests: 200 sets active HTTP requests on the ordinary inbound pool. The field applies to HTTP/1.1 as well as HTTP/2. kind: Sidecar configures a proxy that already exists; it does not create or inject the proxy container.

Full prepared Sidecaryaml
---
# Source: poc/templates/sidecar.yaml
apiVersion: networking.istio.io/v1beta1
kind: Sidecar
metadata:
  name: poc-sidecar
  namespace: "poc-iut-ns"
spec:
  workloadSelector:
    labels:
      app: poc-cmc
  inboundConnectionPool:
    http:
      http2MaxRequests: 200
  egress:
  - hosts:
    - "~/*"
  ingress:
  - port:
      number: 8080
      protocol: HTTP
      name: http-8080
    defaultEndpoint: 127.0.0.1:8080

The custom cluster bypasses this counter

The fallback route references inbound|8080||; Route 1 references debitCreditTxn-v2 instead. The two thresholds can therefore allow approximately 200 + 50 active proxy requests to the same application, subject to other limits and cross-worker accounting. This is not an exact JVM semaphore or a shared service-wide allowance. The manifest sets no explicit pending-request limit.

Version and scope differences

Upstream Istio 1.21 introduced the Sidecar inbound connection-pool fields. Earlier APIs cannot be assumed to accept them. Per-port Sidecar pool settings override its top-level pool, ahead of applicable DestinationRule settings; the pool configurations are replaced rather than merged field by field. The prepared ~/* egress scope restricts imported outbound configuration; it is not a firewall or a guarantee that outbound packets bypass the proxy.

Rate descriptors · actions versus buckets

Rate descriptors · actions versus buckets

Istio 1.22.6 · Envoy 1.30.7 · prepared chart 0.1.3

Definitions belong to the installed limiter

poc-base-ef installs the local-rate-limit filter once. poc-url-ratelimit-ef and poc-group-ratelimit-ef merge bucket definitions into it. This combined fragment illustrates their Direct configuration after composition; each entries list is one descriptor, so URL and group are independent matches.

Illustrative composed URL and group bucket definitionsyaml
# Illustrative combined typed_config excerpt after the URL/group MERGE patches.
# The two definitions belong to the existing local_ratelimit filter.
# Not a live config dump or a complete filter manifest.
descriptors:
- entries:
  - key: path
    value: /clearing-settlement/casa-payment-upi/debitCreditTxn/v2
  token_bucket:
    max_tokens: 1000
    tokens_per_fill: 1000
    fill_interval: 1s
- entries:
  - key: pp
    value: FCUPI
  token_bucket:
    max_tokens: 1000
    tokens_per_fill: 1000
    fill_interval: 1s

Actions belong to the selected route

Route actions translate the existing request headers to path and pp descriptors. Matching descriptors select the definitions above; mutable token balances live in the runtime limiter. The successful prepared request needs available tokens in its matching URL and group buckets plus the default bucket. Neither these actions nor the bucket definitions set a concurrency allowance.

Default bucket and enforcement

This exact base-filter excerpt enables and enforces checks at 100% by default, and keeps default-bucket consumption enabled. Runtime controls can change enforcement. Capacity/refill of 1,000 per second is a token-bucket policy with bursts, not an exact rolling-window TPS promise.

Exact default limiter configuration excerptyaml
        name: envoy.filters.http.local_ratelimit
        typed_config:
          "@type": type.googleapis.com/envoy.extensions.filters.http.local_ratelimit.v3.LocalRateLimit
          stat_prefix: poc_inbound_local_rate_limit
          token_bucket:
            max_tokens: 1000
            tokens_per_fill: 1000
            fill_interval: 1s
          always_consume_default_token_bucket: true
          filter_enabled:
            runtime_key: poc_inbound_local_rate_limit_enabled
            default_value: { numerator: 100, denominator: HUNDRED }
          filter_enforced:
            runtime_key: poc_inbound_local_rate_limit_enforced
            default_value: { numerator: 100, denominator: HUNDRED }
          response_headers_to_add:
          - append_action: OVERWRITE_IF_EXISTS_OR_ADD
            header:
              key: x-local-rate-limit
              value: "true"
Runtime state · refill versus release

Runtime state · refill versus release

Istio 1.22.6 · Envoy 1.30.7 · prepared chart 0.1.3

Tokens are consumed; request slots are released

State shown in the diagram Admission changes it Capacity returns when
Default / URL / group token balance Applicable bucket consumes a token Time-based refill
Selected cluster active-request counter Upstream HTTP stream is admitted Upstream stream closes or resets

Finishing the request does not refund rate tokens. Time passing does not by itself release an in-flight request counter.

Scope and partial consumption

The prepared limiter does not enable per-downstream-connection state. Its runtime balances are shared across workers for this filter configuration in one Envoy process. Descriptor buckets are checked before the default; equal-rate descriptors have no promised URL-before-group order. A later denial can leave earlier tokens consumed.

Independent clusters and replicas

Cluster request accounting is per proxy, cluster and routing priority, shared across workers with eventual-consistency limits. It is not an exact cross-thread Java semaphore. A second replica owns another set of buckets and counters. Both clusters still share the application’s CPU, heap and downstream dependencies.

Check what the example is intended to prove

For a selected proxy, inspect accepted listener/route/cluster state before a bounded load test. Confirm route order, both cluster thresholds, descriptor actions and the body limit. Exercise the selected URL and fallback concurrently, then test absent/wrong identity headers. Compare completed work, latency, 429, 413 and overflow counters together. The prepared files and diagrams do not establish runtime enforcement.