Home / Companies / Datadog / Blog / Post Details
Content Deep Dive

How we improved APM Java startup by encoding a prefix trie as a JVM constant

Blog post from Datadog

Post Details
Company
Date Published
Author
Stuart McCulloch
Word Count
2,681
Company Posts That Month
26
Language
English
Hacker News Points
-
Post removed?
No
Summary

Datadog’s Java APM agent improves application observability by instrumenting selected classes during JVM startup, but this requires efficient class matching because broad instrumentation can slow startup and increase overhead. To filter large numbers of uninteresting classes before more expensive structural and hierarchy checks, the team replaced a difficult-to-maintain code-based prefix matcher with ClassNameTrie, a compact prefix trie encoded directly as a JVM string constant. This design avoids resource loading and I/O during the constrained premain phase, when Java 8 lacks JIT compilation and loading certain classes can create unwanted application side effects. The encoded trie stores branches, matching outcomes, inline segments, and jump offsets in character values, enabling fast binary-search-based matching with favorable cache locality. Cold-start benchmarks found it nearly five times faster than the prior matcher on Java 8 and faster than a conventional radix trie, while production Spring Boot tests showed that class-name filtering reduced instrumented startup time by 20%, with ClassNameTrie and a related known-types index contributing additional savings for total improvements exceeding 24%. Originally developed for instrumentation filtering, the approach is now also used by Datadog’s Live Debugger and CI Visibility features, illustrating how carefully encoded data can outperform executable code during early JVM startup.

Trends Found in this Post
Trend Post Mentions Total Month Mentions Posts Companies MoM
Observability 3 3,175 737 186 -24%
Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.