---
title: "How we optimized our Akka application using Datadog’s Continuous Profiler"
description: "An auxiliary LatencyReportActor running on Akka's default ForkJoinPool-based dispatcher burned 20-30% of a log-processing service's CPU."
url: "https://swe.quest/articles/how-we-optimized-our-akka-application-using-datadog-s-continuous-profiler-62651456f4353472"
canonical: "https://www.datadoghq.com/blog/engineering/how-we-optimized-our-akka-application-using-datadogs-continuous-profiler/"
source: "Datadog Engineering"
published: "2021-09-30"
difficulty: "medium"
kind: "Case study"
reading_minutes: 6
tags: ["performance","jvm","concurrency","debugging"]
---

# How we optimized our Akka application using Datadog’s Continuous Profiler

A post on [Datadog Engineering](https://swe.quest/sources/datadog.md), published 2021-09-30, 6 min read, Case study. Original: [https://www.datadoghq.com/blog/engineering/how-we-optimized-our-akka-application-using-datadogs-continuous-profiler/](https://www.datadoghq.com/blog/engineering/how-we-optimized-our-akka-application-using-datadogs-continuous-profiler/)

## Summary

An auxiliary LatencyReportActor running on Akka's default ForkJoinPool-based dispatcher burned 20-30% of a log-processing service's CPU. Its bursty workload woke all 32 threads every second and then parked them again, so time went into ForkJoinPool.scan() and Unsafe.park()/unpark() native calls. Flame graphs and per-thread CPU breakdowns in a continuous profiler traced the cost to the default dispatcher. A one-line config change moving the actor onto the steadily loaded work dispatcher cut CPU by about 30% and shrank the default pool from 32 to 2 threads. The general advice is to watch scan() time (over 10-15% is a red flag) and keep active thread counts stable by limiting actor instances or pool size, consolidating pools, or queueing bursty tasks.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Java & JVM](https://swe.quest/tags/jvm.md) (Languages)
- [Concurrency](https://swe.quest/tags/concurrency.md) (Compilers & runtimes)
- [Debugging](https://swe.quest/tags/debugging.md) (Engineering practices)

## Prerequisites

- Java thread pools ([easy posts on Java & JVM](https://swe.quest/tags/jvm.md?difficulty=easy))
- Akka actors and dispatchers
- Flame graphs

## Keywords

Akka, ForkJoinPool, Datadog Continuous Profiler, Unsafe.park, Scala

## Related posts

- [Thundering herd of circuit breakers](https://swe.quest/articles/thundering-herd-of-circuit-breakers-b2ab1d42eebffb68.md): Zalando Engineering · 2026-10-07 · Medium · 9 min read · Resilience, Incidents & postmortems, Observability, Kubernetes, Capacity planning
  A client's circuit breaker stayed open for hours because its half-open probes hit a service that the HPA had scaled down to three pods.
- [Leveraging Go Worker Pools to Scale Server-side Data Sharing](https://swe.quest/articles/leveraging-go-worker-pools-to-scale-server-side-data-sharing-5ace4b0b544c8996.md): Shopify Engineering · 2022-09-09 · Medium · 7 min read · Go, Concurrency, Performance engineering, Queues & messaging, Scaling
  Shopify's Server Pixels service, a Go pipeline that consumes over a billion customer events per day from Kafka, fell behind on consumer lag because it spawned an unbounded number of goroutines to process and produce event batches.
- [.NET Continuous Profiler: Exception and lock contention](https://swe.quest/articles/net-continuous-profiler-exception-and-lock-contention-93247ad1a6e667eb.md): Datadog Engineering · 2024-04-04 · Hard · 8 min read · .NET, Performance engineering, Observability, Concurrency, Runtimes & VMs
  Datadog's .NET continuous profiler captures thrown exceptions through ICorProfilerCallback::ExceptionThrown and reads each exception's \_message field by resolving System.Exception's ClassID from CoreLib metadata and computing the field offset with GetClassLayout.
- [How we wrote a Python profiler](https://swe.quest/articles/how-we-wrote-a-python-profiler-397d52e3f1db71ec.md): Datadog Engineering · 2020-10-07 · Medium · 7 min read · Python, Performance engineering, Observability
  Datadog built an always-on statistical profiler for Python because deterministic profilers like cProfile can add 2-3x overhead, too much for production.
- [Unbiased Java CPU profiling with JFR in JDK 25](https://swe.quest/articles/unbiased-java-cpu-profiling-with-jfr-in-jdk-25-9bdec8ca98b4801c.md): Datadog Engineering · 2026-07-22 · Medium · 10 min read · Java & JVM, Performance engineering, Observability, Runtimes & VMs
  JDK 25 adds an experimental JFR CPU-time sampling event (CPUTimeSample) that gives unbiased CPU profiles without relying on the unsupported HotSpot AsyncGetCallTrace API.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
