Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Datadog Engineering 10 min read Deep dive mediumAdept

Unbiased Java CPU profiling with JFR in JDK 25

JDK 25 adds an experimental JFR CPU-time sampling event (CPUTimeSample) that gives unbiased CPU profiles without relying on the unsupported HotSpot AsyncGetCallTrace API. The existing ExecutionSample event samples a rotating subset of threads rather than in proportion to CPU time, which can underreport hotspots, notably in reactive workloads. Profilers such as Datadog's therefore combined JFR with SIGPROF-driven AsyncGetCallTrace and vmstructs walking, trading stability for accuracy. After the AsyncGetStackTrace JEP stalled, Oracle, SAP, Amazon and Datadog engineers built on cooperative stack walking, which records lightweight execution points and unwinds only at safepoints. Native frame support and safe on-demand stack capture are next.

Assumes: JVM basicssampling profilerssafepoints

Related posts

  • .NET Continuous Profiler: CPU and wall time profiling

    Datadog Engineering hardMaster

    Datadog's .NET continuous profiler samples managed threads every 10 ms instead of relying on ETW, perf or enter/leave hooks, which cost too much for 24/7 production use. CPU samples are taken only from runnable threads, with CPU time read via NtQueryInformationThread or /proc. Wall time samples add extra threads tied to trace spans for Code Hotspots. Stack walking uses signal handlers plus libunwind on Linux, and on Windows uses thread suspension with DoStackSnapshot (32-bit) or RtlVirtualUnwind (64-bit), with a watcher thread and LD_PRELOAD trampolines to avoid deadlocks. Profiling the profiler showed std::ifstream reads of /proc allocating 8 KB per sample; switching to low-level C reads cut CPU and removed the allocations.

  • Android profiling now uses Perfetto via ProfilingManager

    Sentry mediumAdept

    Sentry Android SDK 8.51.0 switches profiling on Android 15+ (API 35+) from in-process Debug.startMethodTracing to Perfetto-based stack sampling via the system ProfilingManager API, while older devices fall back to the legacy profiler. Running out of process avoids an ART tracer crash triggered by native threads that exit without detaching, shifts most CPU and memory overhead into a system process, and yields more representative profiles. Android rate-limits profiling requests, so even a 1.0 session sample rate won't capture every session; an adb device_config flag disables the limit for local testing, and a new enableLegacyProfiling option can be set to false to avoid the legacy tracer entirely.

  • How we wrote a Python profiler

    Datadog Engineering mediumAdept

    Datadog built an always-on statistical profiler for Python because deterministic profilers like cProfile can add 2-3x overhead, too much for production. The design borrows from JDK Flight Recorder and splits into recorder, collectors, exporter and scheduler. A Cython-based stack collector samples every thread's stack 100 times per second and lowers its polling rate under heavy load to cap overhead. Memory and lock collectors add allocation and lock-contention data, and profiles are aggregated into compact pprof (protobuf) files uploaded every minute through the Datadog Agent.

  • Strobelight: A profiling service built on open source technology

    Meta Engineering mediumAdept

    Strobelight is Meta's fleet-wide profiling orchestrator, running 42 profilers (mostly eBPF-based, plus ad-hoc bpftrace scripts) on every production host with safeguards against PMU counter conflicts, concurrency limits and queuing. Default continuous profiling uses dynamic sampling that retunes run probability daily per service to hit target sample counts, with sample weights normalizing data for cross-host and cross-service comparison. LBR data feeds Meta's FDO pipeline (CSSPGO and BOLT), cutting CPU cycles up to 20% for top services, and one efficiency win alone saved an estimated 15,000 servers annually. Stack Schemas and thread-local Strobemeta enrich stacks with tags and request metadata, while a centralized symbolization service built on DWARF, gsym and blazesym avoids on-host debug-info parsing, relying on frame pointers in all user-space binaries.

  • Boosting the performance of virtual machines with Jump-Start

    Meta Engineering easyNovice

    Jump-Start cuts JIT warm-up overhead in HHVM by having a small slice of the fleet collect profiling data during Facebook's phased rollout. That data is shared with the remaining servers, so they skip the profiling compile-and-run step. Profile data from the ~2% of servers restarted in phase C2 is reused by the servers restarted in phase C3. Deployed across Facebook's data centers, it reduces HHVM warm-up overhead by 54.9% and, because the profiling can be more thorough, also improves steady-state performance by 5.4%.

The quest for software engineering knowledge.

Look:
Layout: