The Day Our Own Queries DoS’ed Us: Inside Zalando Search
A Zalando Elasticsearch cluster serving two large markets was overwhelmed by a self-inflicted denial of service: a bug in an internal maintenance workload made an application send only 20-100 requests per second of faceting queries aggregating on SKU, a unique-per-product, extremely high-cardinality field. Because the traffic was low-volume, syntactically valid and untagged, it went unnoticed, and the usual mitigations (longer cache TTLs, scaling coordinator and data nodes, lower query termination thresholds) gave no relief. Splitting the markets via shard allocation isolated the problem, and trace analysis in Lightstep linked a 50x query spike from the internal client to the incident. High-cardinality terms aggregations run as heavy work on the shard-level search thread pool, not the parallel slice collectors, so a handful of them can saturate CPU and queues and starve normal traffic.
Related posts
- Interning at incident.io: rate limiting, resiliently
incident.io mediumAdeptincident.io made its rate limiter keep working when its Valkey backing store (Google Cloud Memorystore) is unavailable, instead of failing open. Each pod tracks the top-k busiest traffic gates in local memory and keeps an in-memory budget buffer for them, so it can grant up to its local budget and then deny. A simulation benchmark chose HeavyKeeper over Space-saving because Space-saving lost precision under high-cardinality traffic. The change was validated by killing a local Valkey cluster mid-test and was rolled out gradually by gate risk; a follow-up used a Kubernetes informer to divide the limit by the live pod count so the effective limit didn't become limit × pods. The post is framed as an intern's experience and recruiting pitch.
- The search for speed in Figma
Figma mediumAdept
Figma's search slowness traced mostly to its own stack, not OpenSearch: OpenSearch's headline 8 ms metric was per-shard time, and only the "took" field in responses reveals overall query latency, which accounted for under 30% of API time. Fixes included reordering and slimming Ruby permission checks, repairing a database connection setup bug that also sped up the rest of Figma, and trimming index size by 50% and then 90% so the data fit in the OS page cache. Load tests with a custom Go benchmark showed AWS sizing guidance suited log workloads, not latency-sensitive search. Cutting shards from 450 to 180 and moving to nodes with less CPU and more RAM paid off, while concurrent segment search hurt. Overall API latency fell about 60%, peak QPS rose over 50%, and cost dropped more than 50%.
- ClickHouse vs. Elasticsearch: The Billion-Row Matchup
ClickHouse mediumAdept
On a single 32-core c6a.8xlarge node loaded with 1, 10 and 100 billion PyPI download rows, ClickHouse beats Elasticsearch on count(*) GROUP BY aggregations (Elasticsearch terms aggregations). ClickHouse needs 12–19x less storage and delivers at least 5x lower query latency, so roughly 4x cheaper hardware matches Elasticsearch's latency. Its materialized views are also cheaper in storage and compute than Elasticsearch transforms for continuous summarization. The setup details cover ILM rollover, index sorting by cardinality, LZ4 vs DEFLATE/ZSTD codecs, _source tradeoffs and shard parallelism, and note that Elasticsearch could not ingest the 100B-row dataset.
- Client-Side Load Balancing at a Million Requests Per Second
Zalando Engineering hardMasterZalando moved the high fan-out internal traffic of its Product Read API (over a million requests per second at peak) off the shared Skipper ingress and onto an in-process client-side load balancer. The balancer reproduces Skipper's xxHash64 consistent-hash ring with 100 virtual nodes so caches stay aligned during migration, and discovers pods through a watch-based Kubernetes EndpointSlice informer with a 2-second debounce. Rollout ran behind percentage toggles with a transparent Skipper fallback. It flattened latency spikes and shrank Skipper's fleet from over 50 pods to 8, cutting daily node cost from about $450 to $110. Owning the balancer also enabled N-ring fade-in, which warms new pods with exactly the keys they will keep, and bounded load driven by per-pod occupancy (seconds of work per second) rather than in-flight counts. The work was made possible by first cutting median deploy time from 289 to 128 minutes.
- Failing to Auto Scale Elasticsearch in Kubernetes
Zalando Engineering mediumAdeptA schedule-driven Elasticsearch cluster run by es-operator on Kubernetes repeatedly failed to scale out for the morning peak. A drain retry loop ignored context cancellation, so a nightly scale-in got stuck on the last node in an availability zone because zone awareness blocked shard relocation. After a Kubernetes 1.28 upgrade reshuffled pods on ephemeral storage, a second bug surfaced: interrupted scale-ins never removed the node from cluster.routing.allocation.exclude._ip, leaving 'zombie' excluded nodes. Mitigations were raising the nightly node count, manually clearing the exclusion list and fixing a forgotten cronjob. Crash-safe cleanup remains an open problem, and the lesson drawn is to read the code.