1. Continuous profiling #
Seeing where time is spent.
The principle #
Good to know : Dynatrace SaaS, third-generation platform (Grail, AppEngine). The apps mentioned are in the app launcher; some depend on the licence (Dynatrace Platform Subscription).
OneAgent continuously samples process call stacks (Java, .NET, Node.js, Go, PHP… depending on technology). The Profiling & Optimization app aggregates these samples: you see which methods consume CPU, where memory is allocated and what threads are doing, in production, without restarting the application.
The analyses #
| Analysis | Answers |
|---|---|
| CPU | which methods consume the processor? |
| Memory (allocations) | which code allocates most, and why is the garbage collector working so hard? |
| Threads | are threads waiting on a lock, an I/O, a pool? |
| Service hotspots | in a slow request, which share goes to code, database, external calls? |
2. Reading a flame graph #
Width = time, height = depth.
Reading rules #
- Each rectangle is a method; its width is the share of samples where it was present.
- The stack reads bottom to top: caller at the bottom, callee at the top.
- Look for wide plateaus at the top of the stack: that is “self time”, where optimizing pays off.
- Filter by service, process or period (before and after a release) to compare.
Best practice : Libraries (JSON serialization, regular expressions, logging) often show up on top: an overly verbose log level or a regex recompiled on each call are easy wins.
3. The method #
Measure, fix, compare.
Steps #
- Start from a measured symptom: high CPU, rising p95 latency, garbage collection pause time, infrastructure cost.
- Identify the most expensive process (query below), then open its profile.
- Spot the hotspots and form a hypothesis (algorithm, allocation, contention).
- Fix, deploy, then compare profiles and metrics before and after on comparable traffic.
// Most CPU-hungry processes over 1 h: where to start
timeseries cpu = avg(dt.process.cpu.usage), by: { dt.entity.process_group_instance }, from: now() - 1h
| fieldsAdd average = arrayAvg(cpu)
| sort average desc
| limit 10Good to know : Check in the metrics browser the exact name of the process CPU metric in your environment.
4. Common cases #
What the profile reveals.
Symptoms and causes #
| Symptom | What you see in the profile | Lead |
|---|---|---|
| CPU at 100% with no traffic increase | a loop or regex dominates | algorithm, cache, precompiled regex |
| Frequent GC pauses | massive temporary object allocations | reuse, reduce copies, tune the heap |
| High latency, low CPU | threads waiting (lock, connection pool) | pool size, contention, external calls |
| High cloud cost | expensive serialization and logging | formats, log levels, sampling |
Commands to know #
Commands to know
timeseries avg(dt.process.cpu.usage), by: { dt.entity.process_group_instance }: CPU per processtimeseries avg(dt.host.cpu.usage), by: { dt.entity.host }: CPU per hostProfiling & Optimization › CPU / Memory / Threads: open an analysis
Sources #
Based on the official Dynatrace documentation checked in November 2026: platform apps change every month, check labels, permissions and field names in your environment before relying on a detail.
