Akka thread pool metrics

280 views
Skip to first unread message

nil...@gmail.com

unread,
Mar 30, 2015, 4:57:10 AM3/30/15
to akka...@googlegroups.com
Are there some integration points within the Akka framework where it is possible to get information about individual thread pool usage?

Regards,

Nils-Helge Garli Hegvik

Richard Bradley

unread,
Mar 31, 2015, 5:21:45 AM3/31/15
to akka...@googlegroups.com
I haven't found anything great along these lines, and I'd also be interested in an "official" answer.

Akka in its default configuration will use a single ForkJoinPool for the ActorSystem. If you can get a direct reference to the underlying ForkJoinPool, it has a handful of methods which can give diagnostic information.

  forkJoinPool.getPoolSize
forkJoinPool.getParallelism
forkJoinPool.getActiveThreadCount
forkJoinPool.getRunningThreadCount
forkJoinPool.getQueuedSubmissionCount
forkJoinPool.getQueuedTaskCount

We are currently using code a bit like the following to extract the underlying ForkJoinPool from ActorSystem.dispatcher:


  private def getExecutorServiceViaReflection(dispatcher: Dispatcher): Try[ExecutorServiceDelegate] = Try {
val executorServiceMethod: Method = classOf[Dispatcher].getDeclaredMethod("executorService")

executorServiceMethod
.invoke(dispatcher)
.asInstanceOf[ExecutorServiceDelegate]
}

  getExecutorServiceViaReflection(system.dispatcher).get.executor.asInstanceOf[AkkaForkJoinPool]


This won't work if you have configured anything other than the default dispatcher. Your question about "individual thread pool usage" suggests that perhaps you have, so maybe you'll need to do something more complicated.

Hope this helps,


Rich

Akka Team

unread,
Apr 3, 2015, 12:22:28 PM4/3/15
to Akka User List
Hi guys,
we currently do not provide such tools.
Since threadpools are just a plain JVM thing, you can use any kind of JVM level monitoring tool you like.

For example we see projects using newrelic, appdynamics or kamon for these kinds of tools.
When developing you can simply use tools like VisualVM and MissionControl etc.

-- Konrad

--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.



--
Akka Team
Typesafe - Reactive apps on the JVM
Blog: letitcrash.com
Twitter: @akkateam

nil...@gmail.com

unread,
Apr 3, 2015, 7:24:26 PM4/3/15
to akka...@googlegroups.com
Thank you for the answers. I have been looking into Kamon, which provides metrics for this. It seems to work, but I'm uncertain of the implications of the AspectJ weaving within the Actor system. Using VisualVM etc unfortunately does not provide any insights, since thread pool metrics are not exposed through platform provided JMX Beans.

Regards,

Nils-Helge Garli Hegvik
Reply all
Reply to author
Forward
0 new messages