0

let's assume that I have a large system which uses Scala Global Execution Context in many places to execute different Futures. And one day in this system occurred the performance problem (Memory dump analysis pointed out that the reason was too many Futures in GEC). I found the reason quickly because I was lucky, but this caused that I started to think about possibilities to monitor the execution contexts state.

It's not easy and I can't find articles about that topic. I hacked GEC and now it exposes few parameters via JMX (QueuedSubmissionCount, QueuedCount etc), but it is still not enough to tell which class caused the leak.

I thought about a custom wrapper for Execution Context, which will take an additional identifier (class name or something) and counts the number of futures per identifier. But I believe that many programmers have the same problem and maybe you have some better idea?

Passarinho
  • 109
  • 1
  • 2
  • 15
  • 1
    Some tools like [kamon.io](https://kamon.io/documentation/1.x/instrumentation/executor-service/) provide instrumentation on `ExecutionContext` and `Future`. You could look if it solves your use case – vdebergue Oct 22 '18 at 12:05
  • Yup, kamon is a nice try. I found Lightbend Telemetry, but all of them has very poor support for monitoring just raw Scala Futures. They are written to be used with Akka.. – Passarinho Oct 23 '18 at 21:31

0 Answers0