Skip to main content
← PROBLEMS / ARCHITECTURE
An end-to-end domain learning journey

Design a Fleet-Wide Continuous CPU &
Allocation Profiler at <1% Overhead.

Deploy eBPF DaemonSets that upload raw (Build-ID, stack_addrs, count) tuples once every 10s, deduplicate ELF debuginfo in S3 by Build-ID, and store dictionary-encoded Parquet/Pprof blocks for <500 ms diff flame graphs.
Start the journey5 stages· Last modified Nov 28, 2026
FIRST PRINCIPLES. PRODUCTION SCALE.
The idea to keep with you

When designing a fleet continuous profiler, normalize ASLR offsets on-node, deduplicate ELF debuginfo by Build-ID, and store dictionary-encoded Parquet blocks.

TL;DR30-second simplified summary
▾

Sending (build_id, offset, count) tuples shrinks ingestion from 26 TB/day to 345 GB/day in dictionary Parquet, while normalized v2% - v1% diffs catch canary regressions in <500 ms.

Before you begin · Building blocksAlready know these? Jump to Stage 01 ↓
eBPF Continuous Profiling
Know 19 Hz in-kernel stack_id aggregation, .eh_frame unwinding, and Build-ID symbolization.
Columnar Storage & Dictionary Encoding
Understand how separating repeated function-name strings from numeric sample counts shrinks storage by 20x+.
Full walkthrough · 5 stages
01
L4 · FUNDAMENTALS

R & E · Requirements, Fleet Bandwidth & Storage Sizing.

10,000 nodes sending raw 15 KB unsymbolized profiles every 10s = 10,000 * 1.5 KB/s = 15 MB/s cluster-wide!

Illustrative Sizing: Compare that against naive stringified profiles (~300 KB/10s/node = 300 MB/s = 26 TB/day!). With Build-ID deduplication + Zstd columnar blocks, 15 MB/s raw drops to ~4 MB/s compressed = 345 GB/day = ~10.3 TB for 30-day retention in S3.

Fleet Ingestion Scale

Stringified Profiles (26 TB/day) vs. Build-ID + Dictionary Parquet (345 GB/day)

Before · Node-Side Symbolized Strings
  • 300 MB/s repeated string uploads
  • 26 TB/day uncompressed churn
  • High CPU/RAM on node agents
After · Build-ID + Columnar Dict
  • 15 MB/s compact offset tuples
  • Debuginfo uploaded once/Build-ID
  • 345 GB/day compressed in S3
02
L4 · FUNDAMENTALS

S · Storage: Symbol Dictionary + Prefix-Tree Parquet Blocks.

Across a 10-second window on 1,000 pods of checkout-svc, 99% of stack frames repeat the exact same call paths (main -> handleHTTP -> parseJSON).

Ingestion interns every (function_name, file, line) into a per-block Symbol Dictionary (uint32 sym_id), encodes each unique stack as a Prefix Tree / LOUDS array (parent_node_id, sym_id), and writes only (stack_node_id, self_value, total_value) columns into Zstd Parquet files.

Columnar Profile Block

Symbol Dict (uint32) -> Prefix Tree Nodes -> Sample Values (Zstd Parquet)

03
L5 · APPLIED DESIGN

H & A · DaemonSet Agent, Debuginfo Cache & Query Fan-Out.

Each Kubernetes node runs a single privileged eBPF DaemonSet pod with CAP_BPF and CAP_PERFMON—zero sidecars or app restarts needed.

Every 10s, the DaemonSet reads aggregated maps, maps RIP virtual addresses to (build_id, file_offset) using /proc/<pid>/maps, and pushes the compact batch to Ingestion Gateways. When a new build_id appears, the agent checks EXISTS /debuginfo/{build_id} and uploads stripped symbols once (CI/CD can also push debuginfo directly at build time).

Zero-Duplication Pipeline

eBPF Agent -> Build-ID Check -> Ingest Parquet -> Diff Flamegraph

eBPF DaemonSetDebuginfo CacheIngest / ParquetDiff Query Engine1. HEAD /debuginfo/{build_id}(upload if 404)2. Push (build_id, offsets, count)every 10s3. Symbolize & flush Zstd Parquet block4. Merge v1 vs v2 trees (<500 ms)
04
L5 · APPLIED DESIGN

D · Detailed Design: Differential Flame Graphs & Span Correlation.

Comparing raw sample counts between v1 (100 pods) and v2 (10 canary pods) is misleading because v1 has 10x more total samples!

A Differential Flame Graph normalizes both trees to percentage of total samples (pct_v1, pct_v2) and computes delta = pct_v2 - pct_v1 at every (parent_path, func_name) node. Nodes where delta > 0 glow red (regression); nodes where delta < 0 glow blue (speedup).

Debuginfo Resolution

New Build-ID -> Check S3 Cache -> Upload Once (or CI Push) -> Symbolized

new deployhas .symtabstripped binaryBuild-ID CachedCache Miss (404)Upload .symtabOnceStripped / NoDebuginfo
Engineering Decision Framework
Problem
How to symbolize and store profiles across 10,000 nodes without wasting bandwidth or miscomparing canary deployments.
Naive Solution
Symbolize strings on every node and compare raw sample counts between v1 and v2.
Why It Fails
Node-side symbolization wastes 26 TB/day and crashes agents on large ELF files; raw counts falsely flag 100-pod v1 as slower than 10-pod v2.
Alternatives
Node-side symbolization vs. Build-ID deduplicated server symbolization + normalized diff trees.
Engineering Decision
Deduplicate debuginfo by Build-ID in S3, store dictionary-encoded Parquet blocks, and normalize differential flame graphs by percentage share.
Trade-Offs
Requires CI/CD or agent debuginfo upload for stripped binaries in exchange for 20x–75x lower storage and <500 ms diff queries.
Decision Exercise · Make the Call

You deploy v2 to 5% canary pods (10 pods) alongside v1 (190 pods). On a raw-count differential flame graph, every function in v2 looks 19x smaller (bright blue) even though v2 actually introduced an O(N^2) CPU regression. What bug caused this?

05
L6 · SCALE & TRADE-OFFS

E & D · Evaluation, Assumptions, Limitations & Glossary.

Translating ASLR-randomized runtime addresses requires subtracting the binary's base_load_addr from /proc/<pid>/maps so all pods share identical relative file offsets.

Assumptions & Limitations: Sizing assumes 10,000 nodes at 19 Hz (~15 MB/s raw, ~345 GB/day Zstd Parquet) and Linux kernels >=5.8 with CAP_BPF/CAP_PERFMON. In multi-tenant serverless sandboxes (e.g., Firecracker or gVisor) where host eBPF cannot inspect guest internals or lacks CAP_BPF, use in-process pprof/JFR HTTP scraping instead.

Fleet Profiling Architecture

eBPF DaemonSets -> Build-ID S3 Cache -> Dict Parquet -> Diff Query Engine

10K eBPF DaemonSetsingressBuild-ID DebuginfoS3controlIngest + SymbolizecomputeDict Parquet + DiffUIstorageupload debuginfo 1x15 MB/s offset tuples<500 ms diff queries
Practice · Explain the consequences

Practice: Make the trade-off yourself.

Question 1 of 3
Score: 0/3

Why must eBPF agents subtract the binary's ASLR `base_load_addr` (from `/proc/<pid>/maps`) before sending stack addresses to the backend?

Recommended Learning Flow