Stopping slow backends from causing DataPower memory pressure (Part 2)
Draft!!
In Part 1, we looked at why the invoke timeout doesn’t stop slow backends from holding open connections. If the invoke timeout won’t protect DataPower from a pileup, what does?
When a backend slows from 100 milliseconds to 30 seconds under heavy load, incoming client traffic does not pause. If you receive 200 requests per second, you go from holding 20 concurrent transactions in memory to holding 6,000. DataPower exhausts its memory buffers, triggers throttle mechanisms, and can restart.
To prevent pileups, you need a coordinated timeout hierarchy and strict concurrency boundaries.
The timeout hierarchy rule
Every layer in your traffic path must have a shorter timeout than the layer outside it.
[Client / App]
│ Timeout: 30s
▼
[Load Balancer / Ingress]
│ Timeout: 25s
▼
[DataPower API Gateway (Frontside)]
│ Timeout: 20s
▼
[Assembly Invoke Policy (Backside)]
│ Timeout: 5s - 10s
▼
[Backend Service SLA] (e.g. 500ms)
If your backend invoke timeout is 60 seconds but your Ingress controller cuts connections at 30 seconds, DataPower continues processing and buffering a backend transaction for 30 seconds after the client has already left. This ties up gateway memory unnecessarily.
The rule: Fail fast on the backend
Set your assembly invoke timeout to the maximum acceptable backend latency — not the gateway maximum. If your backend SLA is 500ms and anything over 5 seconds is a failure, set timeout: 5 on the invoke policy.
Do not give a failing backend 60 or 120 seconds to hold open connections on your gateway.
Tuning gateway timeouts via gateway extension
The API Connect UI exposes the invoke policy timeout, but global gateway timeout properties — such as frontside idle timeouts and backend persistent connection boundaries — require a gateway extension (gwd_extension).
IBM provides a reference implementation in Creating a gateway extension to tune timeout settings for API Gateway.
Here is a sample gwd_extension snippet that tunes the API Gateway object:
{
"apigw": {
"_global": {
"override": [
"api-gateway default front-timeout 30",
"api-gateway default gateway-timeout 60",
"api-gateway default persistent-timeout 30"
]
}
}
}
In the DataPower api-gateway object:
front-timeout— how long an idle frontside client connection remains open before DataPower closes the socket.gateway-timeout— the overall maximum duration the gateway allows for an API call to finish processing.persistent-timeout— how long DataPower maintains an idle persistent HTTP connection in the pool.
Warning: Caution is recommended when tuning these values to higher values as it will make the Gateway hold the transaction in memory longer and affects all transactions running through the API Gateway.
Increasing timeout numbers does not solve latency issues. It forces DataPower to reserve buffers and file descriptors for longer across every tenant API sharing that gateway service.
Capping concurrency to stop the queue
Timeouts handle individual stuck calls. If a backend slows down under heavy traffic, you need concurrency limits so requests don’t queue up in gateway memory.
When a backend is struggling, DataPower should reject excess traffic immediately rather than buffering thousands of active connections.
You can enforce concurrency limits in the assembly using an assembly-rate-limit or concurrency policy:
- rate-limit:
version: 1.0.0
title: backend-concurrency-cap
source: plan-default
rate:
- max: 50
interval: 1
unit: second
is-concurrency: true
When concurrent in-flight requests to that backend hit 50, DataPower rejects subsequent requests with HTTP 429 / 503 instead of allocating more memory buffers. The backend is protected from overwhelming traffic, and the gateway remains healthy for other APIs.
Limitations and Notes
- Raising frontside or backend timeouts increases the potential memory footprint per transaction during an incident. Always tune downward to fail fast, not upward to mask backend delays.
- Concurrency limits require shared state across the gateway peering group. Keep your gateway peering configuration tuned and healthy.
- If backends stream large payloads with chunked transfer encoding, combine strict invoke timeouts with response payload size limits to cap buffer consumption.
- When calling local sidecars or services over
localhost/127.0.0.1, remember that disabling persistence forces a new TCP handshake on each request and can lead to ephemeral port exhaustion at high transaction rates. Unless your application cannot tolerate an occasional race failure, keep persistence enabled.
Summary
To stop slow backends from causing DataPower pileups:
- Align the timeout hierarchy so inner layers fail faster than outer layers.
- Tighten
invokepolicy timeouts to fail fast when backends exceed their SLAs. - Apply concurrency caps so slowing backends do not exhaust gateway memory.
- Never increase global gateway timeouts to mask slow backends — it extends transaction lifetimes in memory and impacts every API sharing that gateway service.
