IL-0247 Pinterest · 2025-07-16 (published)kubernetesaws
One in a million search requests took 100 times longer on Pinterest's Manas leaf nodes after moving to Kubernetes
Manas is Pinterest's in-house search system; it serves dozens of search indices from more than 100 clusters on thousands of hosts. In 2024 Pinterest built a new setup for Manas on PinCompute, its in-house Kubernetes platform, and in early 2025 began performance testing it. A root node fans each request out to leaf nodes, and each leaf serves one shard of an index with memory-mapped lookups during retrieval and ranking. On the test cluster a small but persistent share of requests timed out because leaf max latency spiked as high as 5s, and Pinterest paused the migration to find the cause.
Changing the hardware, node image, cgroup limits and container setup and isolating the CPUs did not help. Suspending processes one by one showed that cAdvisor caused the spikes, and perf showed it spending its time in the kernel's smaps feature. The cause was the metric container_referenced_bytes, which cAdvisor enables by default and whose documentation marks it as intrusive to collect. It estimates working set size by scanning the whole page table, counting accessed bits and then clearing every one of them, and PinCompute ran cAdvisor every 30 seconds. Manas leaf indices can be hundreds of gigabytes, and a host with 100GB of used memory can have 25 million page table entries; smaps and clear_refs each take locks while scanning all of the kernel's page structures, and clear_refs also flushes the working set from the TLB; Pinterest concluded that this memory contention was the likely cause of the stalls in the memory-intensive leaf process. Pinterest turned off cAdvisor's working set estimation on all PinCompute nodes with a one-line change and opened an issue in the cAdvisor repository. cAdvisor itself could not be removed because PinCompute needs its container metrics, including for workload autoscaling.
- Severity
- –
- Scope
- Manas test search cluster on PinCompute during the migration to Kubernetes; the migration was paused
- Users affected
- –
- Region
- –
- Time to detect
- –
- Time to resolve
- –
Symptoms
During performance testing of Pinterest's search system Manas on its new Kubernetes platform, a small but persistent share of search requests timed out. About one request in a million took 100 times longer than usual.
Across the leaf nodes, p9999 and lower latencies stayed in the normal range, but max latency reached up to 5s where under 60ms was expected. On a single leaf node, the max latency of both the retrieval and the ranking phase showed sharp spikes every few minutes and fell back almost to normal between them. Both phases run in a single thread per request, so something was either taking that thread off the CPU or making its work slow.
Removing variables had no effect at all. Manas already had exclusive nodes and dedicated networking; the test cluster was moved to a larger EC2 instance type that held the whole index in memory, given the same AMI as the production EC2 Manas clusters, run without cgroup CPU and memory limits, and finally run directly on the node outside a container. Sampling CPU, memory and network use, comparing preemption with perf, checking cache use and kernel lock contention, and shielding the Manas leaf process onto almost all CPUs with taskset and cpusets showed no CPU stealing or preemption and did not change the spikes.
The team then paused nonessential processes one at a time with sudo kill -STOP, including logging, stats pipelines, security, the kubelet and Pinterest daemons, and the latency spikes disappeared as soon as cAdvisor was suspended. perf top on the CPUs not used by Manas showed most CPU time in memory-related kernel spans, with cAdvisor calling the kernel's smaps feature.
Root cause
Root cause Software defect
- Trigger
- –
Detection
Performance testing with traffic sent to a test cluster showed a small but persistent percentage of requests timing out.
Remediation
- Disabled cAdvisor's working set size estimation on all PinCompute nodes
Action items
–
Lessons
CPU shielding does not fully isolate a process from its neighbours. Showing early that the node image was not the cause narrowed the search and avoided dead ends. Simple blackbox debugging, breaking things until the system stops working, works as a way of bisecting the problem.
Sources
Related cases
IL-0138A failed Nvidia driver build left broken kernel packages on the only Kubernetes master node, which hit a kernel panic on reboot after a power outage and took the homelab cluster down for six daysBarush Mendez · 2025same root cause · shared Linux kernel
IL-0373Heroku Postgres Essential-tier databases in the EU region ran out of memory and refused connections, twice in four daysHeroku · 2024same root cause · shared Telemetry agent
IL-0174After an upgrade to Fluent Bit 2.0, logging sidecars that used the Kafka output plugin kept restarting with SIGSEGV because the plugin read a corrupted record as a map without checking its typeHyperconnect · 2023same root cause · shared Telemetry agent
IL-0112The daily node rollover put DFDS's EKS nodes on an AMI later recalled for a kernel issue, causing "PLEG is not healthy" NodeNotReady flaps and pod network timeoutsDFDS · 2022same root cause · shared Linux kernel
IL-0462Some MySQL pods on Shopify's GKE clusters took up to 30 minutes to start, slowing instance replacementShopify · 2021same root cause · shared Linux kernel
IL-0041fluent-bit silently stopped shipping application logs from one node to ElasticsearchPrometheusKube · 2020same root cause · shared Telemetry agent
IL-0029Slow user-facing services from CPU throttling on containers that used far less CPU than their limitBuffer · 2020same root cause · shared Linux kernel
IL-0012CPU limits and an unpatched kernel CFS quota bug throttled multi-threaded services into stalls, failed health checks and timeoutsOmio · 2020same root cause · shared Linux kernel
IL-0143GKE nodes upgraded to certain 1.13 and 1.14 versions had an elevated number of kernel panics, fixed by releases that downgraded the Container-Optimized OS imageGoogle Cloud · 2019same root cause · shared Linux kernel
IL-0277Patching Elastic Cloud's ZooKeeper ensemble in us-east-1 lost quorum, and hosted clusters and Kibana went unreachableElastic · 2019same root cause · shared Linux kernel
IL-0051A third-party log shipping client leaked file descriptors with every new container until nodes failed with too many open filesthredUP · 2018same root cause · shared Telemetry agent
IL-0439Database access slowed after each block device and filesystem expansion because the Linux kernel dropped the page cacheCybozu · 2018same root cause · shared Linux kernel
Check your cluster for this
For AI tools and scripts
- This case as JSON: https://incidentlib-api.benchlet.com/cases/IL-0247
- The cases most like it: https://incidentlib-api.benchlet.com/cases/IL-0247/similar
- MCP server (Streamable HTTP, no key):
https://incidentlib-mcp.benchlet.com/mcp
The API needs no key. The MCP server offers search_incidents, get_incident, list_incidents, get_topic and vocab; both are explained on API and MCP.