Design Fleet-Wide Continuous CPU Profiling to Find Wasted Compute
Last updated: November 29, 2026
Quick Overview
Design a system that continuously samples stack traces from every server at Meta with very low overhead, aggregates them, and lets engineers see which functions consume the most CPU across the fleet and how that changes between builds.
Meta
November 29, 20260
0
0 solved
Design a system that continuously samples stack traces from every server at Meta with very low overhead, aggregates them, and lets engineers see which functions consume the most CPU across the fleet and how that changes between builds.
At Meta's scale a 0.5% efficiency win on a hot service saves many servers, so fleet profiling is a real infrastructure priority. The interviewer checks low-overhead sampling, symbolization at scale, aggregation across hosts and builds, and how results drive action.
What the Interviewer Expects
- Choose a sampling mechanism and overhead budget
- Handle native, JIT, and interpreted stacks
- Aggregate stacks efficiently across hosts and time
- Symbolize without shipping symbols to every host
- Support diff views between builds and regression alerts
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How do you profile PHP or Python code running in an interpreter or JIT?
- How much data does each host send and how do you shrink it?
- How do you attribute CPU to a product feature or endpoint?
- How would you detect a 1% regression introduced by one commit?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Functional: sample on-CPU stacks on all hosts; query flame graphs by service, host group, build, time range; compare two builds; alert on functions whose CPU share jumps.
Non-functional: over...
High-Level Design
- Host agent uses a kernel-level sampler (perf events with eBPF) at a low rate such as 19 Hz per CPU, capturing kernel and user stacks as raw addresses. For runtimes like HHVM or Python, it reads ...