v2026.11.18.0
Overview
The latest rate limit service handles a Redis failover or an unresponsive Redis in seconds. Previously, when Redis stopped answering without closing its connections (for example, a managed Redis failover that keeps the same IP), every rate limit call could hang, pods stayed healthy, and nothing was logged or counted.
The last release adds timeouts and limits that make the service fail fast, a readiness endpoint that reflects whether Redis answers, and metrics and logs that show what Redis is doing. All new settings are opt-in or keep the previous defaults, except the I/O timeout described under Upgrade notes.
Problems fixed
- Calls hung for about 15 minutes after a Redis failover.
REDIS_TIMEOUTonly bounded connecting, not waiting for replies. It now also bounds reads and writes, as documented, so stuck connections are replaced within the timeout. - Calls ignored the client's deadline. A call to an unresponsive Redis kept waiting long after Envoy's deadline (20 ms by default in Envoy Gateway). Calls now return as soon as the deadline expires, so Envoy can apply its failure mode without delay.
- Pods looked healthy while Redis was down. The health check did not reflect whether Redis answered, so traffic kept going to replicas that could not serve it. The optional Redis ping and
/readyendpoint fix this. - Outages were invisible. Stuck calls produced no errors, no logs and no latency samples. The new metrics and warning logs show them.
- Latency spikes persisted after Redis recovered. Under load, a slow but healthy Redis caused healthy connections to be dropped and re-opened repeatedly. Connections are now kept when a caller gives up.
REDIS_POOL_ON_EMPTY_BEHAVIOR=ERRORprevented startup. It is supported again.- Prometheus response time scaling depended on mapping order.
PROMETHEUS_RESPONSE_TIME_AS_MILLISECONDSnow applies only to the response time metric.
New configuration options
All options are environment variables. Each REDIS_* setting has a REDIS_PERSECOND_* twin for the per-second Redis, where one is configured.
| Setting | Default | What it solves |
|---|---|---|
REDIS_IO_TIMEOUT | Value of REDIS_TIMEOUT | Closes a connection when Redis does not reply in time, and reconnects to the current primary. This is what ends a failover outage on the rate limit side. |
REDIS_TCP_USER_TIMEOUT | Off (OS default) | Lets the kernel drop connections to a Redis that vanished, instead of retrying for about 15 minutes. Linux only. |
REDIS_TCP_KEEPALIVE | 10s | Makes the previously fixed TCP keepalive tunable; a negative value disables it. |
REDIS_MAX_INFLIGHT | 0 (unbounded) | Caps the Redis commands in flight, so a slow Redis cannot pile up unbounded work and memory. Excess calls fail right away. |
REDIS_POOL_ON_EMPTY_BEHAVIOR=ERROR | WAIT | Works again: fails calls immediately when no Redis connection is available, instead of waiting. Previously this value made the service fail at startup. |
REDIS_HEALTH_CHECK_PING_INTERVAL | 0 (off) | Pings Redis periodically; replicas that cannot reach Redis report not ready on the new /ready endpoint. |
REDIS_HEALTH_CHECK_FAILURE_THRESHOLD | 3 | Number of consecutive failed pings before /ready fails. One success recovers it. |
GRPC_MAX_CONCURRENT_STREAMS | 0 (gRPC default) | Limits concurrent calls per gRPC connection, so excess calls wait at the client instead of piling up in the service. |
New /ready endpoint
/ready is healthy when /healthcheck is and, with the Redis ping enabled, while Redis answers. Point readiness probes at /ready and keep liveness probes on /healthcheck.
New metrics and logs
- Per Redis pool: commands in flight, succeeded, failed, timed out, rejected, and command latency (
cmd_*), plus connection errors and connections closed after an error (cx_*). Command latency is also exported to Prometheus asratelimit_redis_cmd_time_seconds. call.should_rate_limit.inflight: rate limit calls received and not yet answered. It grows while calls are stuck.- Redis errors are now logged at warning level, rate-limited to one message every 10 seconds. Before, they were only visible at debug level.
Example settings for a Redis with failover
This applies to Sentinel, managed Redis such as GCP Memorystore or AWS ElastiCache, or a Kubernetes Service in front of a primary.
REDIS_TIMEOUT=1s # well above the slowest normal reply
REDIS_TCP_USER_TIMEOUT=5s # Linux only
REDIS_CLOSE_CONNECTION_ON_READONLY_ERROR=true # if the old primary stays behind the same address
REDIS_HEALTH_CHECK_PING_INTERVAL=1s # readiness probe on /ready, liveness on /healthcheck
REDIS_MAX_INFLIGHT=<a few times the normal number of concurrent calls>
Alert on redis_error, cmd_io_timeout and cx_local_close_error, and on inflight or cmd_inflight growing.
Upgrade notes
REDIS_TIMEOUTnow also limits how long the service waits for a Redis reply. Check that it sits well above your slowest normal Redis reply, including under load and across zones. A few hundred milliseconds to a couple of seconds suits most deployments. To keep the old connect-only behavior, setREDIS_IO_TIMEOUT=0(not recommended).- Commands sent to Redis always complete. A command already handed to Redis runs and counts toward the limit even if the client stops waiting. While Redis is slow, more commands run at once than calls are waiting; set
REDIS_MAX_INFLIGHTto bound them. - Client timeout. Keep the rate limit timeout in Envoy above the normal Redis round trip. Calls that miss it are not rate limited (or are denied, with
failure_mode_deny) even when Redis is healthy. - Probes. If you enable the Redis ping, move readiness probes to
/ready. Leave liveness on/healthcheckso a Redis outage does not restart every replica.