Per-URL configuration
- The OBRH POC's route matches, dedicated cluster and independent concurrency limits, with YAML.
Select a component to trace its direct connections. Drag to pan · Ctrl + wheel or pinch to zoom.
- In this POC, an Envoy cluster is an upstream target with its own connection pool and request budget. Both clusters point to the same application port.
- The first route matches the selected request header and chooses a 50-active-request cluster. The fallback chooses the ordinary 200-request cluster. Select the first route to inspect its YAML.
Reading
Envoy sidecar rate limits
- The limiter is a filter inside each application Pod's Envoy. Effective coverage on every live workload is unverified. The local token bucket consumes arrivals and refills over time. A normal process-local bucket is not one shared allowance across replicas; restart, rollout and skew change the aggregate admission envelope. A slow provider can increase outstanding work even at a stable arrival rate.
- 01-local-rate-limit.yaml is a simplified, commented reconstruction of the mechanism, not a copy of deployed values. Existing URL/group descriptors must be retained when changing actual configuration.
- Keep coarse Pod Envoy protection; for selected shared ceilings, each Direct/IL JVM owns a bounded post-auth RLS decision from verified identity/RBAC before provider work.
- Separate app recovery breakers, proxy resource limits and outlier ejection, with one logical retry owner.
Illustrative local token bucketyaml
# Illustrative Istio EnvoyFilter v3 API example; NOT an installed OBRH manifest.
# Reconcile the existing filter instead of installing a second local limiter.
# Intended scope: the HTTP inbound listener of each matching Pod Envoy.
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: example-obrh-local-rate-limit
namespace: obrh-example
spec:
workloadSelector:
labels:
app: obrh-direct-example
configPatches:
- applyTo: HTTP_FILTER
match:
context: SIDECAR_INBOUND
listener:
portNumber: 8080
filterChain:
filter:
name: envoy.filters.network.http_connection_manager
subFilter:
name: envoy.filters.http.router
patch:
operation: INSERT_BEFORE
value:
name: envoy.filters.http.local_ratelimit
typed_config:
'@type': type.googleapis.com/envoy.extensions.filters.http.local_ratelimit.v3.LocalRateLimit
stat_prefix: obrh_local_admission
# One proxy-process bucket, not a quota shared by replicas.
local_rate_limit_per_downstream_connection: false
token_bucket:
max_tokens: 100 # Illustrative initial/burst allowance.
tokens_per_fill: 100 # Illustrative refill, not a concurrency setting.
fill_interval: 1s
filter_enabled:
runtime_key: obrh_local_admission_enabled
default_value:
numerator: 100
denominator: HUNDRED
filter_enforced:
runtime_key: obrh_local_admission_enforced
default_value:
numerator: 100
denominator: HUNDRED
# This simple example intentionally has no URL/group descriptors.
# Preserve existing descriptor buckets/actions when adapting the real policy.
# INSERT_BEFORE router alone does not prove placement before a body-buffer filter.
# Verify actual filter order; choose the intended pre-buffer admission placement.
Independent URL admission budgets
- The prepared concurrency companion adds a STATIC cluster and a first-match route that selects it through trusted REQUEST-URL identity. Direct uses REQUEST-URL; IL uses its corresponding OBP-URL. The gateway must overwrite/normalize caller-supplied values after path rewrite. A route.name does not create a cluster, and new sibling routes do not inherit rate-limit actions.
- 50 is not nested inside a combined 200 cap. The selected custom cluster bypasses the ordinary cluster counter. Both target the same JVM. The independent configured active-request thresholds sum to 250; effective concurrency also depends on upstream protocol, connection limits and the JVM gate.
- The illustrated ordinary cluster permits 100 upstream connections and the custom cluster 50, so an HTTP/1.1 upstream path can encounter those limits before its active-request threshold. Downstream HTTP/2 does not establish HTTP/2 on the local Envoy-to-JVM leg. Separate cluster counters isolate proxy admission rather than CPU, DB sessions or all other resources.
- Use one application-wide gate for a combined bound.
- The gateway routes to selected application endpoints and sets the API identity header before forwarding. The Kubernetes Service defines the destination/endpoint selection; it is not drawn as an additional proxy hop. Each selected Pod has its own Envoy state.
- These are separate budgets, not 50 nested inside a combined 200 cap. Selecting the custom cluster bypasses the ordinary cluster's counter. Both target the same 127.0.0.1:8080 JVM. This arrangement isolates Envoy admission counters, not JVM CPU, memory, DB pools or downstream dependencies.
- The direct example uses the gateway-set REQUEST-URL header because the gateway can rewrite the actual path before the request reaches the application sidecar. IL uses OBP-URL with its corresponding configured URL.
- The route below has no HTTP-method predicate: matching GET, POST and other methods use the same URL cluster. The header must be set or normalized by a trusted gateway; an arbitrary client header is not proof of the operation executed. Direct access that bypasses the gateway needs equivalent identity enforcement.
- CLUSTER / ADD creates debitCreditTxn-v2 with its endpoint and active-request limit.
- HTTP_ROUTE / INSERT_FIRST creates a header-matching route whose route.cluster references that cluster.
Illustrative ordinary inbound poolyaml
# Illustrative target; inboundConnectionPool requires Istio >= 1.21 and matching CRDs.
# v1beta1 avoids assuming networking v1 CRDs on the 1.21 minimum.
# This resource CONFIGURES an existing injected sidecar; it does not inject one.
apiVersion: networking.istio.io/v1beta1
kind: Sidecar
metadata:
name: example-obrh-inbound-capacity
namespace: obrh-example
spec:
workloadSelector:
labels:
app: obrh-direct-example
inboundConnectionPool:
tcp:
maxConnections: 100 # Upstream sockets from Envoy to its local JVM.
connectTimeout: 1s
http:
http2MaxRequests: 200 # Active HTTP requests, including HTTP/1.1.
http1MaxPendingRequests: 20 # Waiting for pool capacity, including HTTP/2.
maxRetries: 1 # Finite simultaneous retry allowance; DOES NOT enable retries.
# Disable retries in the owning route policy when the local leg must not retry.
# Istio 1.21 ignores maxRetries: 0 in translation; it is NOT a no-retry bound.
ingress:
- port:
number: 8080
name: http-8080
protocol: HTTP
defaultEndpoint: 127.0.0.1:8080 # Same Pod network namespace / local JVM.
# Deliberately no egress.hosts override: retain existing outbound configuration.
# An inbound-only installation may retain its verified ~/* plus capture bypass.
# Do not add a second overlapping Sidecar for the same workload.
Bounded illustrative URL cluster and routeyaml
# Illustrative extension to 02, based on the prepared istio-concurrency POC.
# Custom Envoy objects depend on generated route/vhost names and exact proxy version.
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: example-obrh-url-capacity
namespace: obrh-example
spec:
priority: -10 # Ordering is NOT inheritance of sibling route policies.
workloadSelector:
labels:
app: obrh-direct-example
configPatches:
- applyTo: CLUSTER
match:
context: SIDECAR_INBOUND
patch:
operation: ADD
value:
name: example-debit-credit-v2
type: STATIC
connect_timeout: 1s
load_assignment:
cluster_name: example-debit-credit-v2
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 127.0.0.1
port_value: 8080
circuit_breakers:
thresholds:
- priority: DEFAULT
max_connections: 50
max_pending_requests: 5 # Explicit finite wait capacity; not a deadline.
max_requests: 50 # Independent of the ordinary cluster's 200.
max_retries: 0
- applyTo: HTTP_ROUTE
match:
context: SIDECAR_INBOUND
routeConfiguration:
vhost:
name: inbound|http|8080 # Verify this name in the selected proxy's xDS.
patch:
operation: INSERT_FIRST
value:
name: example-debit-credit-v2
match:
prefix: /
headers:
- name: REQUEST-URL # Trusted gateway must overwrite/normalize this header.
string_match:
exact: /clearing-settlement/casa-payment-upi/debitCreditTxn/v2
route:
cluster: example-debit-credit-v2
timeout: 5s # Illustrative bounded route deadline; tune to business budget.
retry_policy:
num_retries: 0 # Payment retries require a separate idempotency contract.
# Keep actions only where the matching existing bucket/filter is enabled.
# Actions generate descriptors; they do not define token buckets.
rate_limits:
- actions:
- request_headers:
header_name: REQUEST-URL
descriptor_key: path
- actions:
- request_headers:
header_name: PRODUCT-PROCESSOR
descriptor_key: pp
# IL uses its own trusted OBP-URL identity and selector; do not reuse this Direct match.
# One selected route uses one cluster; the ordinary 200 counter is not also debited.
Prepared POC URL cluster and routeyaml
# URL concurrency — add a named cluster and a route that selects it
# Documentation copy; all configuration values match the prepared POC manifest.
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: poc-url-concurrency-ef
namespace: "poc-iut-ns" # Workload selection is limited to this namespace.
spec:
# Stable ordering; route-policy inheritance is not implied by this priority.
priority: -10
workloadSelector:
labels:
app: poc-cmc # Configure only these application sidecars.
configPatches:
- applyTo: CLUSTER # A cluster owns an upstream endpoint set and resource limits.
match:
context: SIDECAR_INBOUND # Patch application-side inbound configuration, not gateways.
patch:
operation: ADD # Create a separate Envoy cluster; no Kubernetes Service is created.
value:
name: debitCreditTxn-v2 # Cluster identifier referenced by route.cluster below.
type: STATIC # Endpoint addresses are supplied explicitly in load_assignment.
load_assignment: # Explicit endpoint membership for this cluster.
cluster_name: debitCreditTxn-v2 # Associates this assignment with the cluster.
endpoints: # Endpoint groups; a group may carry locality information.
- lb_endpoints: # Hosts available to the cluster's load balancer.
- endpoint:
address:
socket_address:
address: 127.0.0.1 # Same Pod network namespace as the application.
port_value: 8080 # Same JVM endpoint as the ordinary inbound cluster.
circuit_breakers: # Resource admission limits, not failure-based host ejection.
thresholds: # Per routing priority; omitted priority means DEFAULT.
- max_requests: 50 # Independent active-request allowance; not nested under 200.
- applyTo: HTTP_ROUTE # A route matches requests and names a cluster; it is not a cluster.
match:
context: SIDECAR_INBOUND
routeConfiguration: # Narrow the configuration objects receiving this patch.
vhost:
name: inbound|http|8080 # Select the existing inbound virtual host to patch.
patch:
operation: INSERT_FIRST # Specific match before the existing catch-all route.
value:
name: debitCreditTxn-v2 # Route identifier; matching the cluster name is optional.
match:
prefix: / # Any actual path, provided the exact URL-identity header also matches.
headers:
- name: "REQUEST-URL" # Read the trusted gateway-set API identity, after rewrite.
string_match:
exact: "/clearing-settlement/casa-payment-upi/debitCreditTxn/v2"
route:
cluster: debitCreditTxn-v2 # This reference selects the separately defined cluster.
timeout: 0s # Disable this route timeout; other timeout mechanisms still apply.
# Istio merges existing routes before inserting new ones. Carry the
# enabled descriptor actions here; buckets remain in their own filters.
rate_limits: # Route descriptor rules; these are not token-bucket definitions.
- actions:
- request_headers: # Read an existing header; do not add a new HTTP header.
header_name: "REQUEST-URL"
descriptor_key: path # Generate path=<header value> for the existing URL bucket.
- actions:
- request_headers: # Separate descriptor action for the existing group bucket.
header_name: PRODUCT-PROCESSOR
descriptor_key: pp # Generate pp=<header value>; bucket definitions stay separate.
Prepared POC ordinary inbound Sidecaryaml
# Sidecar — inbound request limits and no imported outbound services
# Documentation copy of the prepared POC manifest; comments do not change its values.
apiVersion: networking.istio.io/v1beta1
kind: Sidecar # Configures existing proxies; does not create or inject a container.
metadata:
name: poc-sidecar
namespace: "poc-iut-ns" # Scope: workloads in this namespace, not every namespace.
spec:
workloadSelector:
labels:
app: poc-cmc # Select these Pods within poc-iut-ns.
inboundConnectionPool:
http:
http2MaxRequests: 200 # Active HTTP requests in the normal inbound cluster (H1/H2).
egress:
- hosts:
- "~/*" # Intentional: import no outbound services, including this namespace's.
# This trims proxy configuration; outbound traffic capture is controlled separately.
ingress:
- port:
number: 8080 # Application-facing inbound port governed by this configuration.
protocol: HTTP # Enables HTTP processing on this inbound port.
name: http-8080
defaultEndpoint: 127.0.0.1:8080 # Forward to the application in the same Pod.
POC configuration objects
POC configuration objects
Istio 1.22.6 · Envoy 1.30.7 · prepared chart 0.1.3
- The prepared POC creates a separate cluster with CLUSTER / ADD and an early route with HTTP_ROUTE / INSERT_FIRST. Matching a workload or patch target acts during configuration; the new route match acts on each request.
- The custom cluster allows 50 active requests and the ordinary inbound cluster 200, independently. Both target the same 127.0.0.1:8080 JVM; neither is a new Service or application Pod.
- For the source-inspected Istio 1.22.6 inbound builder, the route table is inline in LDS. The STATIC cluster carries its own load_assignment; separate RDS or EDS delivery is not implied.
POC execution and rejection
Istio 1.22.6 · Envoy 1.30.7 · prepared chart 0.1.3
- In the source-inspected Envoy v1.30.7 path, HCM resolves/caches the route before HTTP decoder filters. The local limiter reads that route policy before router forwarding.
- Local-rate-limit denial returns 429, excessive buffered body returns 413, and failed upstream allocation can return 503/UO. Those rejection paths do not forward the request into the JVM; response encoder processing still occurs.
- One selected route chooses one cluster. A 503 alone does not establish overflow, and UO alone does not identify the exhausted connection, pending or active-request resource.
POC token and concurrency state
Istio 1.22.6 · Envoy 1.30.7 · prepared chart 0.1.3
- Route actions generate separate path and product-processor descriptors. One installed local limiter owns the default, URL and group bucket definitions and mutable balances.
- The prepared chart uses 1000-token capacities and 1000-token refill amounts per second. Consumption is not transactional and later rejection does not refund consumed tokens; this is not an exact rolling-window TPS guarantee.
- Default and descriptor token state is shared across workers for this filter configuration inside one Envoy process. Per-cluster/per-priority request counters are also shared across workers with documented eventual consistency; the 50 and 200 budgets remain separate.
- Token balances and active counts in the figure are illustrations, not observed runtime values. Stream completion/reset releases concurrency accounting; time-based refill restores tokens.
One JVM admission gate
- Install one SemaphoreValve instance at the intended Context/Host/Engine scope. Business and ordinary readiness dispatch must reach that same object. Identical separate instances do not share permits. block=false and highConcurrencyStatus=503 reject overload immediately. Stock permit lifetime ends when the downstream invocation returns; asynchronous servlet/provider work can continue afterward.
- An async implementation needs completion/cancellation-aware accounting.
- Executor maxThreads limits active platform workers and maxQueueSize limits queued runnable tasks. With an Executor attached, Connector maxThreads does not supply another worker bound. Tomcat Executor. Connector maxConnections limits accepted sockets; acceptCount supplies the OS backlog once that limit is reached.
- Neither is a business request cap, particularly with keep-alive/H2. connectionTimeout is not a total business deadline. Executor rejection may close a connection rather than produce a clean application 503; test that boundary.
- Bypassing the semaphore does not reserve CPU or connector workers. Add bounded management execution capacity where required. Kubelet readiness thresholds withdraw/restore Service eligibility only after observations and propagation; local rejection is still needed while updates propagate. Accepted work continues.
- A dependency outage or ordinary saturation must not be converted into a JVM restart loop. The LB diagnostic reuses local DB/route health with a separate protected low-rate budget and does not test real providers. Pod health and propagation contract, traffic/site health.
Illustrative Tomcat worker and admission limitsxml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Illustrative Tomcat 9 server.xml skeleton, not a replacement for an installed file.
Tomcat 10+ uses jakarta packages; compile the custom Valve against actual version.
All numbers and context path below are examples to tune. -->
<Server port="-1">
<Service name="Catalina">
<!-- Must precede the Connector that references it. Bound runnable waiting work. -->
<Executor name="obrhWorkers" namePrefix="obrh-http-"
maxThreads="160" minSpareThreads="16" maxQueueSize="32" />
<!-- maxConnections = sockets; acceptCount = OS backlog after connection limit.
Executor maxThreads governs workers; a Connector maxThreads would be ignored. -->
<Connector port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol"
executor="obrhWorkers" maxConnections="300" acceptCount="32"
connectionTimeout="2000" keepAliveTimeout="5000" />
<Engine name="Catalina" defaultHost="localhost">
<Host name="localhost" appBase="webapps" autoDeploy="false">
<Context path="/obrh" docBase="obrh-example">
<!-- ONE instance covers business and ordinary readiness /route/dispatch.
An earlier trusted diagnostic guard must mark restricted LB requests.
Install the custom class in the correct Tomcat common classloader. -->
<Valve className="example.obrh.ControlledSemaphoreValve"
concurrency="120" block="false" highConcurrencyStatus="503" />
</Context>
</Host>
</Engine>
</Service>
</Server>
Controlled SemaphoreValve extensionjava
package example.obrh;
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
import org.apache.catalina.valves.SemaphoreValve;
/**
* Tomcat 9 extension-point example. Compile against the installed Catalina API.
* Scope is ONE Context pipeline instance, never one instance per URL.
* Does not implement authentication or a full asynchronous request-lifetime cap.
*/
public final class ControlledSemaphoreValve extends SemaphoreValve {
// Exact proposed paths relative to the selected Context; no prefix bypass.
private static final String LIVENESS = "/actuator/health/liveness";
private static final String LB_DIAGNOSTIC = "/internal/lb-system-health";
// Set only by a trusted earlier container guard after authorization + finite budget.
// A servlet filter later in the pipeline is too late to establish this attribute.
public static final String TRUSTED_LB_DIAGNOSTIC =
"example.obrh.trustedLbDiagnostic";
@Override
public boolean controlConcurrency(Request request, Response response) {
String context = request.getContextPath();
String uri = request.getRequestURI();
boolean get = "GET".equals(request.getMethod());
if (get && (context + LIVENESS).equals(uri)) {
return false;
}
if (get && (context + LB_DIAGNOSTIC).equals(uri)
&& Boolean.TRUE.equals(request.getAttribute(TRUSTED_LB_DIAGNOSTIC))) {
return false;
}
// Ordinary readiness dispatch, other methods, aliases and unknown paths count.
return true;
}
}
Endpoint and provider isolation
- A busy endpoint can exhaust a shared HTTP manager/pool within one JVM.
- Different URL paths may share the same host/port transport route, so pool-route limits alone do not isolate business operations.
- Construct the Java 17 endpoint bulkhead once per JVM/provider capacity domain. It acquires an aggregate provider permit and then an operation permit without waiting. Every acquired permit is released in finally; HTTP/DB acquisition occurs inside that scope with a finite remaining-deadline budget. Canonical operation identities are a bounded allowlist, not arbitrary URL/tenant-created map entries.
- BoundedBlockingExecutor.java supplies an optional eight-worker, sixteen-queued-task illustration using rejection. Queueing does not manufacture capacity. Reject/cancel expired queued work, propagate/clear request context, and keep logical-request accounting while queued. Future.cancel returning does not prove that I/O stopped.
- Async callbacks must retain attempt permits until actual work ends; adapting the synchronous example by releasing when a Future is returned is incorrect.
- The coupled example allocates A eight attempt permits, B four, and an aggregate provider budget of twelve against the shared HTTP route's twelve connections. This assumes every user of that route follows the same admission accounting and an attempt does not retain multiple leases.
- Slow A while healthy B calls the same provider host: A's eight-permit budget bounds competition and leaves room for B in this profile. Permits alone do not guarantee useful transport/DB/CPU capacity or fair lease scheduling; verify the complete pool-sharing and acquisition behavior, or partition resources where a stronger reservation is required.
- Separate Direct/IL JVMs isolate local resources; they still compete for shared DB/provider capacity.
Java 17 operation bulkheadsjava
package example.obrh;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.Semaphore;
/** Java 17 synchronous example. Construct ONCE per JVM/capacity domain, not per request. */
public final class EndpointBulkheads {
// Illustrative aggregate provider work; separate from the Tomcat request gate.
// Coupled profile: 12 shared-route HTTP connections in HttpPoolExample, A <= 8,
// B <= 4, and no other unbudgeted users of that transport route.
private final Semaphore providerTotal = new Semaphore(12);
// Bounded canonical identities from trusted operation classification.
private final Map<String, Semaphore> operations = Map.of(
"providerA.balance", new Semaphore(8),
"providerA.payment", new Semaphore(4));
public <T> T invoke(String operation, long deadlineNanos, Callable<T> attempt)
throws Exception {
Semaphore local = operations.get(operation);
if (local == null) {
throw new IllegalArgumentException("Unknown operation");
}
if (System.nanoTime() - deadlineNanos >= 0 || !providerTotal.tryAcquire()) {
throw new RejectedExecutionException("Provider work budget exhausted");
}
boolean admittedOperation = false;
try {
admittedOperation = local.tryAcquire();
if (!admittedOperation) {
throw new RejectedExecutionException("Operation work budget exhausted");
}
if (System.nanoTime() - deadlineNanos >= 0) {
throw new RejectedExecutionException("Deadline expired before attempt");
}
// Borrow HTTP/DB resources INSIDE this scope with remaining-deadline waits.
// This synchronous Callable must return only after underlying work stops.
// Release its response/connection in its own try-with-resources.
return attempt.call();
} finally {
if (admittedOperation) {
local.release();
}
providerTotal.release();
}
}
// Retry outside invoke: backoff holds no attempt permit/HTTP lease.
// Retain logical request admission until the whole request really completes.
// Permits bound competition, not scheduling guarantees. Useful B capacity also
// needs coherent pool sharing/lease behavior and adequate CPU/DB/provider capacity.
}
Bounded blocking executor illustrationjava
package example.obrh;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/** Java 17 optional blocking-worker example; one managed instance per isolation domain. */
public final class BoundedBlockingExecutor {
private BoundedBlockingExecutor() { }
public static ThreadPoolExecutor create() {
return new ThreadPoolExecutor(8, 8, 0L, TimeUnit.MILLISECONDS,
new ArrayBlockingQueue<>(16),
new ThreadPoolExecutor.AbortPolicy());
}
// RejectedExecutionException must map to a deliberate overload response.
// Do not use CallerRunsPolicy: it can move provider stalls back onto Tomcat workers.
// Submission requires logical admission and a finite remaining deadline.
// Acquire attempt permits in the worker immediately before scarce-resource waits.
// Observe queue delay separately; remove/cancel queued work when its deadline ends.
// Release active permits only when the worker actually exits, not when Future.cancel
// returns. Interruption does not guarantee that an underlying provider call stops.
// Propagate bounded trace/security/tenant context explicitly; clear it in finally.
// Owner drains/shuts down this executor as part of the application lifecycle.
}
HTTP manager ownership
- Identify the actual shared manager and route before assigning endpoint budgets. Close responses and retire replaced manager generations deliberately.
Apache HttpClient 4.5 pool examplejava
package example.obrh;
import java.io.IOException;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.util.EntityUtils;
/** Apache HttpClient 4.5 API example; not a claim about the installed client version. */
public final class HttpPoolExample implements AutoCloseable {
private final CloseableHttpClient client;
public HttpPoolExample() {
PoolingHttpClientConnectionManager manager =
new PoolingHttpClientConnectionManager();
manager.setMaxTotal(24); // Illustrative total sockets for this manager.
manager.setDefaultMaxPerRoute(12); // Transport route, NOT each business URL.
// Coupled EndpointBulkheads profile: A8 + B4, aggregate12, all route users
// budgeted, no multiple retained leases per attempt. Other route consumers
// can invalidate the intended headroom; partition resources if required.
RequestConfig budgets = RequestConfig.custom()
.setConnectionRequestTimeout(200) // Pool lease wait, milliseconds.
.setConnectTimeout(500) // Socket establishment, milliseconds.
.setSocketTimeout(1000) // Read inactivity, not complete request deadline.
.build();
client = HttpClients.custom().setConnectionManager(manager)
.setDefaultRequestConfig(budgets)
.disableAutomaticRetries() // One retry owner, explicit operation contract.
.evictExpiredConnections()
.evictIdleConnections(30, java.util.concurrent.TimeUnit.SECONDS)
.build(); // Client owns manager and eviction lifecycle.
}
public int readOnlyStatus() throws IOException {
// Use an operation bulkhead before execution and restrict response sizes.
HttpGet request = new HttpGet("https://provider.example.com/reference-data/status");
try (CloseableHttpResponse response = client.execute(request)) {
int status = response.getStatusLine().getStatusCode();
EntityUtils.consume(response.getEntity()); // Release reusable lease.
return status;
} // On failure, close response/connection; never retain an unconsumed response.
}
@Override
public void close() throws IOException {
client.close(); // Drain application users before replacing/closing this owner.
}
// JVM HTTPS is opaque to a forwarding sidecar: HTTP retries/status ejection there
// cannot be assumed. This example intentionally has no partner client certificate.
}
Physical DB pool ownership
- Resolve JNDI and physical pool ownership independently of WAR count. Include every replica and release generation in the DB session budget.
Oracle UCP acquisition and lifecycle examplejava
package example.obrh;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import oracle.ucp.jdbc.PoolDataSource;
import oracle.ucp.jdbc.PoolDataSourceFactory;
/** UCP API illustration. Reconcile an existing JNDI owner; don't create a duplicate pool. */
public final class UcpPoolExample {
private UcpPoolExample() { }
public static PoolDataSource configure(String jdbcUrl, String username, String password)
throws SQLException {
PoolDataSource pool = PoolDataSourceFactory.getPoolDataSource();
pool.setConnectionFactoryClassName("oracle.jdbc.pool.OracleDataSource");
pool.setURL(jdbcUrl); // Credentials supplied by approved secret handling.
pool.setUser(username);
pool.setPassword(password);
pool.setConnectionPoolName("example-application-pool");
pool.setInitialPoolSize(2);
pool.setMinPoolSize(2);
pool.setMaxPoolSize(12); // Illustrative per-physical-pool session allocation.
pool.setConnectionWaitTimeout(1); // Seconds, wait for pool connection availability.
pool.setValidateConnectionOnBorrow(true);
pool.setSQLForValidateConnection("SELECT 1 FROM DUAL");
return pool; // Application/container owner must manage shutdown/drain.
}
public static boolean readOnlyProbe(PoolDataSource pool) throws SQLException {
// Borrow inside endpoint admission; no connection held while calling provider.
try (Connection connection = pool.getConnection();
PreparedStatement statement = connection.prepareStatement("SELECT 1 FROM DUAL")) {
statement.setQueryTimeout(1); // Seconds; driver/database cancellation semantics.
try (ResultSet rows = statement.executeQuery()) {
return rows.next() && rows.getInt(1) == 1;
}
} // close() returns borrowed connection to pool, including exception paths.
}
// Pool wait is separate from physical login/connect, SQL, transaction and network
// timeouts. Budget each against the remaining logical-request deadline.
// This generic SELECT is NOT the existing OBRH DB/Camel health-check implementation.
}
Timeouts, retries and load amplification
Istio HTTP route API v1 · Java 17 example · illustrative retry policies
Retry ownership on Direct and IL routes
- The representative Direct/IL profiles exclude outbound IPv4/IPv6 traffic from Envoy capture.
- Selected Direct, IL-OBP and IL-SOA VirtualServices omit explicit timeout/retry fields.
- Application/client policies remain separate. Check retry policy on the selected inbound and provider routes independently.
Inventory inbound and outbound attempt owners
- Ingress retries can repeat the application pipeline and its downstream calls.
- Inventory retry policies at the caller, ingress, application/client and outbound proxy.
| Owner | Maximum total attempts | What it can repeat |
|---|---|---|
| Caller | C | The entire request through ingress |
| Istio ingress Envoy | G per caller attempt | An incoming application execution and its downstream work |
| Application / client library | A per application execution | The selected provider call |
| Outbound HTTP-visible Envoy | P per application attempt | A wire send to the selected provider |
- These are possible policy owners; activation depends on the workload configuration.
- Route timeout, per-try timeout, client wait and business deadline start at different boundaries.
Separate execution amplification from provider sends
Application executions: at most C × G.
Provider sends: at most C × G × A × P for one nested call path.
Example: C=1 and G=A=P=2 permits up to two application executions and eight provider sends.
Count the initial attempt: two retries allow three total attempts.
The bound assumes every shown retry layer is active and nests that downstream call.
Success, deadlines, admission, completed cancellation and deduplication can reduce the count.
Inventory separate downstream operations separately; this is not a universal transaction bound.
G2 may arrive while G1 is still running. Keep capacity accounting tied to actual in-flight work.
A reset does not prove that the Java task, DB statement or remote transaction stopped.
Coordinate time, admission and replay safety
Assign a retry owner for each failure class; bound overlapping retry layers.
Before retrying, check remaining time, attempt/concurrency budgets, retryable failure and replay safety.
Backoff and jitter spend the same deadline. Jitter spreads retries; it does not bound them.
Ingress retries can repeat business side effects; the HTTP method alone is insufficient protection.
Preserve an operation identity only with a receiver-supported deduplication/result contract.
Use admission or load shedding so retries cannot consume all capacity.
Check capture and HTTP visibility at the relevant hop
Ingress: matched HTTP route policy can govern calls to the application.
Outbound: provider policy requires capture, visible HTTP and an accepted matching route.
Sidecar presence alone proves neither policy is active.
JVM-owned HTTPS forwarded as TCP is opaque to HTTP retry/status matching.
Proxy TLS termination/origination changes ownership.
The inspected OBRH templates exclude outbound capture; this lane shows a possible policy, not verified activation.
Translate examples into budgets before using them
The illustrative catalog GET has a 3-second route timeout, 800 ms per try and two additional retries.
It demonstrates one retry owner; do not copy that policy to every hop.
An ingress route can use the same fields with its own host/gateway/route matching.
attempts: 2permits the initial attempt plus two retries.perTryTimeoutalso applies to the initial attempt.The route deadline can stop the sequence before all attempts occur.
Illustrative HTTP route — one retry owneryaml
# Generic read-only demonstration, not a deployed workload profile.
# The application makes ONE explicit call; this mesh route owns retries.
# Requires a matching, visible HTTP route and a real catalog Service.
apiVersion: networking.istio.io/v1
kind: VirtualService
metadata:
name: catalog-read-budget
namespace: demo
spec:
hosts:
- catalog.demo.svc.cluster.local
gateways:
- mesh
http:
- name: retry-safe-catalog-read
match:
- method:
exact: GET
uri:
prefix: /api/catalog/
timeout: 3s # Total proxy route budget; includes proxy retries.
retries:
attempts: 2 # Two retries, so at most three upstream attempts.
perTryTimeout: 800ms # Initial upstream attempt and each retry.
retryOn: connect-failure,refused-stream,gateway-error
route:
- destination:
host: catalog.demo.svc.cluster.local
port:
number: 8080
Keep the application deadline even when another layer retries
The Java 17 example makes one explicit attempt within a caller-supplied monotonic deadline.
Start the deadline before the work it must cover; do not reset it on retry.
Expired waiting triggers a cancellation attempt, not proof of remote completion, rollback or freed capacity.
Inventory automatic client/framework retries separately from this example.
Java 17 — one attempt within a caller deadlinejava
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
// Generic Java 17 sketch. No main method and no automatic application retry.
// Build/reuse the HttpClient outside request processing. Its connect and pool
// settings are separate concerns. The matching mesh demo owns HTTP retries.
final class ResilienceDeadlineExample {
static String readCatalog(HttpClient client, URI uri, long deadlineNanos)
throws InterruptedException, ExecutionException, TimeoutException {
// Caller creates the deadline before the work it wants to budget:
// long deadline = System.nanoTime() + Duration.ofSeconds(4).toNanos();
long remaining = deadlineNanos - System.nanoTime();
if (remaining <= 0) {
throw new TimeoutException("Operation budget exhausted before send");
}
HttpRequest request = HttpRequest.newBuilder(uri)
.timeout(Duration.ofNanos(remaining))
.GET()
.build();
var pending = client.sendAsync(request, HttpResponse.BodyHandlers.ofString());
try {
remaining = deadlineNanos - System.nanoTime();
if (remaining <= 0) {
throw new TimeoutException("Operation budget exhausted after dispatch");
}
var response = pending.get(remaining, TimeUnit.NANOSECONDS);
// A real caller must classify status/business outcome and bound body size.
return response.body();
} catch (TimeoutException | InterruptedException failure) {
pending.cancel(true); // Cancellation request, not proof of remote rollback.
throw failure;
}
}
}
- Request timeout/retry/breaker settings need scoped source/runtime evidence; this table does not infer enabled defaults.
- The owning unit is a provider operation inside its request runtime, not a set of Deadline/Retry/Permit servers.
- Use a remaining request deadline and a bounded replay budget owned by the operation/connector.
- Treat overload rejection, eligible transient failure and uncertain after-send outcome separately.
Request execution and resource budgets
Tomcat 9.0.122 standard platform-thread NIO model · illustrative budgets, not effective OBRH settings
Count the resource that can actually run out
| Boundary | Count | Waiting / failure |
|---|---|---|
| OS accept backlog | Connections awaiting acceptance | Connect delay, refusal or timeout |
| Connector | Accepted TCP sockets | Includes idle keep-alive; not active business work |
| Request Executor | Busy workers and queued Runnable tasks | Wait for a worker; full queue can reject socket processing |
| Business admission | Admitted logical operations | Immediate policy rejection, or a separately bounded wait |
| HTTP client pool | Leased connections / streams, plus acquisition waiters | Provider-route pool can saturate while other workers are idle |
| DB pool | Borrowed physical DB connections and acquisition waiters | Session capacity and lock/SQL time remain separate |
| JVM / container | CPU time, heap, native memory and deadline | Throttling, GC, memory failure and expired useful work |
- These counts overlap. One synchronous operation can hold a worker, an admission permit and an HTTP lease at the same time. Adding their limits does not produce a request capacity.
- HTTP pooling is a real capacity boundary; it is one resource within request execution. Pool size alone does not establish TPS.
Separate the design model from Current evidence
Connector and application limits
A representative Tomcat configuration allows 800 connections, 600 maximum request threads and 50 minimum spare threads. The launcher writes these settings into server.xml.
Check the effective Connector and its Executor. When a Connector references a shared Executor, that Executor owns the worker and task-queue limits.
The application executor has separate core, maximum and queue settings. Count its capacity only for paths that submit work to it. An offloaded call can occupy both a servlet worker and an application worker when the caller blocks for the result.
The Connector text rewrite can no-op when its exact prefix differs, or duplicate attributes on retained patched XML. Validate resulting XML and the selected Executor before interpreting those values.
The worked XML uses different values to illustrate a bounded queue. Measure the deployed worker occupancy and acquisition waits before choosing a limit.
Follow the owner before tuning
- The map follows one application JVM in one functional domain. Direct and IL JVMs have separate local workers and clients unless actual ownership proves otherwise.
- This is one phase-neutral mechanism map: there is no invented Current/Proposed difference. The bounded Executor XML and arithmetic are illustrative design inputs.
- Select the queue or workers for the concrete Tomcat fragment; select business work for the lifetime rule; select HTTP/DB pools for their resource owners.
- The lower budget objects explain how latency, CPU and replica overlap constrain the same path.
Dependency recovery
- Application breakers, proxy resource overflow and endpoint ejection are distinct controls. Source observations do not establish a recoverable production breaker policy.
Resilience4j 2.x provider breaker examplejava
package example.obrh;
import java.time.Duration;
import io.github.resilience4j.circuitbreaker.CircuitBreaker;
import io.github.resilience4j.circuitbreaker.CircuitBreakerConfig;
/** Resilience4j 1.7.1 API illustration, not an existing deployed OBRH breaker. */
public final class ProviderBreakerExample {
private ProviderBreakerExample() { }
public static CircuitBreaker create() {
CircuitBreakerConfig config = CircuitBreakerConfig.custom()
.slidingWindowType(CircuitBreakerConfig.SlidingWindowType.COUNT_BASED)
.slidingWindowSize(20)
.minimumNumberOfCalls(10)
.failureRateThreshold(50)
.waitDurationInOpenState(Duration.ofSeconds(30))
.permittedNumberOfCallsInHalfOpenState(2)
// Other exceptions (e.g. local overload / pre-send lease rejection)
// must neither increment provider failures nor count as successes.
.recordException(error -> error instanceof ProviderFailure)
.ignoreException(error -> !(error instanceof ProviderFailure))
.build();
return CircuitBreaker.of("example-provider-operation", config);
}
/** Connector maps a confirmed provider failure to this type; preserve its cause. */
public static final class ProviderFailure extends RuntimeException {
private static final long serialVersionUID = 1L;
public ProviderFailure(String message, Throwable cause) {
super(message, cause);
}
}
// Execute synchronously with breaker.executeCallable(() -> bulkheads.invoke(...)).
// Inspect actual exception wrapping before applying the classification predicate.
// This does not permit unsafe retry, reserve threads, or clear operator route STOP.
// HALF_OPEN work still needs endpoint admission, finite timeouts and safe semantics.
}
Failure outcomes and recovery
HTTP semantics: RFC 9110 · Java 17 cancellation behavior
Choose recovery from what is known
| Observation | What is known | Recovery consequence |
|---|---|---|
| Proven failure before send | This attempt did not reach the remote operation | Retry only within the remaining budget and applicable failure policy |
| Explicit rejected result | A defined result is available | Follow that result contract; do not convert all rejections into retries |
| Timeout/reset after send or ambiguous progress | Remote work may have started or committed | Look up/reconcile with the operation authority; repeat only with safe replay or supported deduplication |
| Gateway retries the application | A new incoming execution can overlap the old one | Preserve business identity where supported and retain accounting for real in-flight work |
- A timeout describes a wait, not whether the business operation happened.
- Apply that distinction at both ingress-to-application and application-to-provider boundaries.
Reconcile the original operation
- Query the authority with the original business-operation identity.
- Handle committed results, known rejection and unresolved state according to that contract.
- An idempotency header requires receiver support; a proxy retry or container restart creates no durable result store.
Release capacity when work actually ends
- Java 17 HttpClient attempts cancellation for the relevant interrupt/future paths.
- Cancellation can race with sending; resource release may be asynchronous.
- A stream reset is not a distributed rollback.
- Track timeout, cancellation request, actual completion and business result separately.
Request workers and Executor ownership
Tomcat 9.0.122 standard platform-thread NIO model · illustrative budgets, not effective OBRH settings
Configure the owner of the threads
- This is a Service fragment for standalone Tomcat 9.0.122, with the existing Engine/Host intentionally omitted. Merge it into the real server.xml; it is not a complete replacement server.
- The named StandardThreadExecutor owns maxThreads=80, minSpareThreads=20 and maxQueueSize=40. Declare it before the Connector.
- Every Connector referencing requestWorkers competes for those same 80 workers and 40 queue slots. A second Connector does not get another independent allowance.
- When a named Executor is referenced, Connector maxThreads and other thread-pool settings are ignored. Keep socket settings on each Connector.
Illustrative server.xml Service fragment: 80 shared workers, 40 queued tasksxml
<!-- Illustrative Tomcat 9.0.122 Service fragment, not an OBRH deployment.
Merge the Executor and Connector into the existing Service in server.xml.
Keep the existing Engine/Host, TLS, proxy and application configuration.
Restart/activation and load validation are outside this documentation example.
A standard platform-thread executor is shared by every Connector naming it.
These values are sizing inputs, not measured safe limits. -->
<Service name="Catalina">
<!-- Declare before Connectors. This object owns worker and task-queue limits. -->
<Executor name="requestWorkers"
className="org.apache.catalina.core.StandardThreadExecutor"
namePrefix="request-worker-"
maxThreads="80"
minSpareThreads="20"
maxQueueSize="40" />
<!-- This object owns socket capacity and the requested OS listen backlog.
Do not add maxThreads/maxQueueSize here: the referenced Executor owns them.
connectionTimeout is not a business-operation deadline. -->
<Connector port="8080"
protocol="org.apache.coyote.http11.Http11NioProtocol"
executor="requestWorkers"
maxConnections="1000"
acceptCount="100"
connectionTimeout="5000"
keepAliveTimeout="5000" />
<!-- Existing Engine/Host configuration belongs here; intentionally omitted. -->
</Service>
Follow worker occupancy through a synchronous call
- An accepted socket becomes eligible for processing through the NIO poller. A submitted socket-processing task runs on an Executor worker. An idle keep-alive socket does not permanently occupy a worker.
- Parsing, authentication and application handling use execution capacity. A post-authentication admission gate has already consumed a request worker and pre-gate CPU; it cannot protect the accept backlog or erase parsing cost.
- A synchronous HTTP-pool acquisition, provider read, DB acquisition or SQL call normally retains the servlet worker while blocked. CPU may be low while all request workers are busy.
- Increasing maxThreads can hide blocking briefly while increasing stacks, scheduling and downstream contention. Measure thread states and acquisition wait before choosing that change.
An application executor is another boundary
- A bounded business ThreadPoolExecutor is separate from the servlet Executor. Offloading then blocking on Future.get keeps the servlet worker and consumes business-executor capacity.
- Servlet async can release the request worker after returning from dispatch; the continuation, request buffers and business permit remain until actual completion. Async does not create CPU or downstream capacity.
- If adding a business executor, bound its queue, define explicit rejection and cancellation, propagate context deliberately, and own shutdown. CallerRunsPolicy can execute provider work on the submitting request worker and silently defeat the intended isolation.
- The existing bounded-executor example belongs to the operation-isolation concern; it is not a replacement for this server.xml worker configuration.
Socket backlog and bounded task waiting
Tomcat 9.0.122 standard platform-thread NIO model · illustrative budgets, not effective OBRH settings
Two queues with different units
- acceptCount requests an OS listen-backlog bound. It concerns connections waiting for acceptance, subject to operating-system behavior. It is not a queue of authenticated API operations.
- maxConnections concerns Connector connections, including keep-alive. A single connection can carry multiple requests over time; HTTP/2 streams further break any one-socket/one-request assumption.
- maxQueueSize on the named Executor bounds queued Runnable tasks inside the JVM. Socket events and asynchronous redispatch mean a task is not universally a whole business request.
Understand the pool-growth and rejection path
- Tomcat TaskQueue encourages pool growth toward maxThreads when existing workers cannot take submitted work; once the pool is at its limit, more tasks can queue. This is Tomcat-specific behavior.
- The standard Executor default queue limit is Integer.MAX_VALUE. That is a theoretical element bound, not a useful small overload buffer or a preallocation of billions of tasks.
- The fragment deliberately changes that queue to 40; no OBRH Current value is implied.
Illustrative bounded Executor and separate Connector socket settingsxml
<!-- Illustrative Tomcat 9.0.122 Service fragment, not an OBRH deployment.
Merge the Executor and Connector into the existing Service in server.xml.
Keep the existing Engine/Host, TLS, proxy and application configuration.
Restart/activation and load validation are outside this documentation example.
A standard platform-thread executor is shared by every Connector naming it.
These values are sizing inputs, not measured safe limits. -->
<Service name="Catalina">
<!-- Declare before Connectors. This object owns worker and task-queue limits. -->
<Executor name="requestWorkers"
className="org.apache.catalina.core.StandardThreadExecutor"
namePrefix="request-worker-"
maxThreads="80"
minSpareThreads="20"
maxQueueSize="40" />
<!-- This object owns socket capacity and the requested OS listen backlog.
Do not add maxThreads/maxQueueSize here: the referenced Executor owns them.
connectionTimeout is not a business-operation deadline. -->
<Connector port="8080"
protocol="org.apache.coyote.http11.Http11NioProtocol"
executor="requestWorkers"
maxConnections="1000"
acceptCount="100"
connectionTimeout="5000"
keepAliveTimeout="5000" />
<!-- Existing Engine/Host configuration belongs here; intentionally omitted. -->
</Service>
Choose a wait that can still finish usefully
- Estimate queue delay against remaining deadline, then test burst and tail behavior. More queue slots retain more request/socket state and can turn overload into slow timeouts.
- Full Executor-queue rejection happens before an application response can necessarily be generated; socket closure/reset is possible. Do not advertise it as a guaranteed HTTP 503. An application admission gate can send a deliberate status once it is executing.
- Queue capacity does not expire stale tasks automatically. Recheck deadline at application entry and before expensive acquisition; distinguish caller timeout from confirmed cancellation.
- Reserve observable headroom for health checks, management traffic and completion/redispatch. A shared Executor offers no per-Connector reservation by itself.
Business admission and synchronous or async lifetime
Tomcat 9.0.122 standard platform-thread NIO model · illustrative budgets, not effective OBRH settings
Place admission honestly
- The map places the illustrative nonblocking business gate after authentication, on a request worker. Rejected calls still spent connector, queue, parsing and authentication resources.
- A proxy-side gate can shed earlier in a different process, but its counters and policy are not automatically the JVM business-operation counter.
- A 64-permit JVM gate means at most 64 logical operations admitted by that gate while its permit is held. Separate endpoint gates or executors share the JVM CPU and any common HTTP/DB pools.
- Use a bounded, explicitly budgeted admission wait only when it can finish within the caller deadline. A zero-wait gate sheds immediately; it does not consume another hidden application waiting queue.
Release at actual completion
| Execution style | Request worker | Business permit / work |
|---|---|---|
| Synchronous provider/DB wait | Retained while blocking | Held until the logical operation completes |
| Offload then Future.get | Still retained | Also consumes offload worker or its queue |
| Servlet async / continuation | Can return to request pool between dispatches | Remains in flight; actual termination owns release |
- Release the permit exactly once when the admitted operation actually terminates, including terminal success, failure or rejection after admission. Timeout and cancellation paths must retain accounting for work that continues. A finally block around the initial servlet invocation is too short for work that outlives it.
- A caller timeout or an accepted cancellation request does not prove provider work or a JDBC operation stopped. Track lingering work and pool release.
Match business and physical-resource limits
- A permit bounds admitted operations, not simultaneous leased HTTP connections or DB sessions. Branches, retries and parallel fan-out can acquire several resources per operation.
- HTTP pool maxTotal/per-route limits, lease timeout, connection/read timeout and response closure are separate controls. HTTP/2 stream concurrency requires protocol-specific accounting.
- DB acquisition timeout, pool maximum, transaction duration, locks and session capacity need an independent budget.
- Set a shared deadline and spend it across admission, executor wait, client-pool acquisition, remote I/O and response. Recheck what time remains before retrying. A Connector connectionTimeout does not supply this business deadline.
Worked occupancy, burst and slowdown example
Tomcat 9.0.122 standard platform-thread NIO model · illustrative budgets, not effective OBRH settings
Declare the workload before doing arithmetic
- Illustration only: one JVM, 240 requests/s, homogeneous synchronous calls, no retries, one concurrent HTTP/1.1 request per lease and one DB visit per request. Durations below are mean occupancy of each resource; they are not independent stages to add again.
- Worker occupancy 250 ms includes 200 ms inside business admission plus pre/post-gate processing. HTTP lease 150 ms and DB borrow 25 ms occur within that work.
- CPU service is 8 ms/request with four available core-equivalents; it excludes GC/background CPU. The separate 70% planning ceiling leaves room for overhead and variance, without proving that reserve sufficient.
- Limits: 80 request workers, 64 business permits, 48 route connections, 12 DB connections and 40 waiting executor tasks. These illustrative limits agree with the Executor fragment; the other limits are planning inputs only.
Illustrative workload, limits and scenario inputs; no benchmark claimjson
{
"kind": "illustrative-capacity-planning-inputs",
"scope": "One JVM; homogeneous synchronous requests; one concurrent HTTP/1.1 request per lease and one DB visit per request; no retries; four available CPU core-equivalents; per-request CPU service excludes GC and background work",
"measured": false,
"targetArrivalRequestsPerSecond": 240,
"limits": {
"requestWorkers": 80,
"executorWaitingTasks": 40,
"businessInflight": 64,
"httpRouteConnections": 48,
"dbConnections": 12,
"cpuCores": 4,
"plannedCpuUtilizationFraction": 0.7,
"callerDeadlineMs": 500
},
"meanOccupancyMs": {
"requestWorker": 250,
"businessInflight": 200,
"httpLease": 150,
"dbLease": 25,
"cpuService": 8
},
"burst": {
"arrivalRequestsPerSecond": 480,
"assumedCompletionRequestsPerSecond": 320,
"queueInitiallyEmpty": true,
"assumedExecutorTasksPerRequest": 1
},
"slowProvider": {
"httpLeaseMs": 550,
"requestWorkerMs": 650,
"businessInflightMs": 600
},
"replicaOverlap": {
"oldJvms": 3,
"newJvms": 3,
"dbConnectionsPerJvm": 12
},
"limitsOfCalculation": [
"Little's Law describes stable average populations; mean occupancy does not predict p99 queueing or safe TPS.",
"Executor tasks include socket events and redispatch; one task per request is a burst-model simplification.",
"Gate placement, HTTP protocol, pool ownership, traffic mix, CPU throttling and cancellation change the result.",
"Queue capacity does not guarantee deadlines or explicit HTTP rejection.",
"No workload, benchmark, installed Tomcat setting or live OBRH capacity is claimed."
]
}
Use average occupancy, then keep headroom
For a stable boundary, mean population = arrival rate × mean time held. Count acquisitions/attempts for that resource, including fan-out and retries.
| Resource | At 240 requests/s | Illustrative limit | Average occupancy |
|---|---|---|---|
| Request workers | 240 × 0.250 = 60 | 80 | 75% |
| Business work | 240 × 0.200 = 48 | 64 | 75% |
| HTTP leases | 240 × 0.150 = 36 | 48 | 75% |
| DB leases | 240 × 0.025 = 6 | 12 | 50% |
| CPU | 240 × 0.008 = 1.92 core-seconds/s | 4 cores | 48% of physical CPU |
- Inverting those averages gives worker/business/HTTP ceilings of 320 requests/s and DB 480 requests/s. With an illustrative CPU planning ceiling of 70%, CPU allows 4 × 0.70 / 0.008 = 350 requests/s.
- The smallest average ceiling is 320; it is not measured safe TPS. Variance, queueing, uneven routes, GC and scheduling make high-utilization tails worse. Target 240 leaves 25% of those three average limits unused; a tail-latency SLO still needs testing.
Evaluate the burst buffer against the deadline
- Simplified burst model: arrivals jump to 480 requests/s, completions stay at 320/s, queue starts empty, and each request produces exactly one executor task. Real socket events/redispatch differ.
- Backlog grows at 480 − 320 = 160 tasks/s. Forty slots fill in 40 / 160 = 0.25 s if this excess is sustained and admission does not shed earlier.
- With no new arrivals and 320 completions/s, draining 40 tasks takes about 125 ms. If arrivals remain at 480/s, the backlog continues growing. The 125 ms fluid estimate for processing 40 tasks ahead is not a p99 wait or a per-request guarantee.
- A 500 ms caller budget minus 250 ms base work and 125 ms queue wait leaves only 125 ms for network variation and other waits. A bigger queue can retain requests that can no longer finish.
- Prefer deliberate early admission/rejection with a retry policy over unbounded waiting. Measure offered, admitted, completed and rejected rates separately.
Recalculate when the provider slows
- If HTTP hold grows to 550 ms and worker/business occupancy grows to 650/600 ms, sustaining 240/s would need 132 HTTP leases, 156 workers and 144 permits. The original limits cannot support it.
- At unchanged limits, the average ceilings fall to 48 / 0.550 ≈ 87 HTTP calls/s, 80 / 0.650 ≈ 123 request executions/s and 64 / 0.600 ≈ 107 admitted operations/s. The HTTP boundary becomes the first average bottleneck.
- Expanding the request pool does not repair the provider. Deadline-aware shedding, provider recovery and safe retry ownership matter; a timeout does not instantly release remote work.
- Async can reduce worker occupancy but leaves the HTTP hold and business in-flight problem.
CPU, memory, deadlines and replica overlap
Tomcat 9.0.122 standard platform-thread NIO model · illustrative budgets, not effective OBRH settings
Budget the whole JVM
- Request workers, business executors, GC, health probes and client callbacks share CPU. A larger thread pool cannot create CPU quota; throttling can increase every occupancy time.
- Account for native thread stacks, heap request bodies, queued tasks, connection buffers, TLS/native memory, response buffers and retained async state. Queues consume memory even when CPU is idle.
- Bound body sizes and acquisition waits as well as counts. Avoid multiplying worst-case body size by a small count and calling that a complete heap estimate; object expansion, framework state and copies also matter.
- A separate executor isolates scheduling slots, not heap, CPU, DB locks or a shared client manager.
Multiply physical owners across releases
- For three old JVMs plus three new JVMs during release overlap, a distinct DB pool of 12 per JVM permits 6 × 12 = 72 sessions before other applications, maintenance or extra pools. Three steady JVMs would allow 36.
- Count the actual physical pool owners, not WARs. Include Direct/IL runtimes, active/preview/draining replicas, sites, schedulers and retries according to the real deployment.
- Local gates multiply too: six JVMs with 64 permits can admit up to 384 operations under evenly available capacity. A per-JVM gate is not a global provider quota.
- Domain deployment separation contains local worker failure. A shared provider, database or storage system can still constrain multiple domains.
Validate the boundary that failed
| Observation | Discriminating evidence |
|---|---|
| Busy workers with low CPU | Thread-state samples; provider/DB/pool waits |
| Growing task queue | Executor owner, queue depth and age, dispatch/rejection counters |
| HTTP acquisition delay | Actual manager/route lease counts and pending acquisition |
| DB acquisition delay | Physical pool borrowed/waiters, transaction time, DB sessions/locks |
| Deadline failures after caller disconnect | Lingering business operations and actual resource release |
| CPU pressure / GC / memory | Container quota/throttling, allocation, retained bodies and async state |
- Test realistic arrival mix, provider latency, bursts, retries and release overlap. Record p95/p99, useful completions, rejects, queue age and resource occupancy together.
- Raise a limit only after identifying its owner and the next bottleneck. The calculated example supplies a hypothesis and a test target; it does not certify production capacity.