-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DedicatedThreadPool Performance Optimization #4537
Comments
I got already an issue with it #4636 @Aaronontheweb could u try my commit https://github.com/Zetanova/akka.net/tree/helios-idle-cpu |
WorkaroundIf you're running into CPU consumption issues today, you can always disable the akka.actor.internal-dispatcher{
type = "Dispatcher"
executor = "default-executor"
} This will have it run on the built-in .NET |
#7074 It is a PR to improve the default-executor and channel-executor |
Kind of solved this in v1.5.18 by just not using the |
Version: 1.4.9
Prior to merging in #4511 , which moves all
/system
actors on aForkJoinDispatcher
, we need to go about improving the structure of theDedicatedThreadPool
class (used by theForkJoinDispatcher
), which is sourced originally to this repository:https://github.com/helios-io/DedicatedThreadPool
But that source code is referenced as a file directly into our project here:
https://github.com/akkadotnet/akka.net/blob/dev/src/core/Akka/Helios.Concurrency.DedicatedThreadPool.cs
The two code bases don't diverge much and that can easily be remedied. The last real change we made to the
DedicatedThreadPool
class was in 2017: #2714Problems that #4511 May Introduce: Rise in Idle CPU Consumption
Running all of the
/system
actors on theForkJoinDispatcher
will help improve performance in really busy systems - it will allow workloads for Akka.Persistence, Akka.Cluster, etc independently from the primary .NETThreadPool
since the/system
actors have to operate under real-time constraints. The only point of contention will be the OS thread scheduler, rather than the length of the work queue inside the sharedThreadPool
. We've used this strategy successfully for years with Akka.Remote.The problem is: what happens with
ActorSytem
instances that make virtually zero use of/system
actors, such as theActorSystem
s that are used inside stand-alone plugins like https://github.com/petabridge/Petabridge.Tracing.Zipkin ? The answer is we may start seeing increases in background CPU consumption as worker threads spin / wait / sleep for work, such as what we can observe with theHashedWheelTimerScheduler
here: #4031We need to avoid that to the extent that it's possible by freeing threads that don't have enough work do to and by adding new threads gradually as total demand increases. Spinning threads up and down is expensive, but having idle threads continuously sleeping and checking for work is also very expensive. We need to reach a happy medium.
Existing Issues with
DedicatedThreadPool
Other issues that the
DedicatedThreadPool
has currently:ThreadPool
and possibly moreso now since the DTP hasn't benefited from any of the performance improvements introduced during subsequent versions of .NET Core. Finding ways to improve this through the queuing mechanism, thread activation, and work distribution would be a huge plus.DedicatedThreadPool
can use, by default theDedicatedThreadPool
should be able to dynamically adjust its thread count based on both demand and the number of virtual CPUs the machine has.Constraints
DedicatedThreadPool
need to have their own independent benchmarks, so it's probably best if we direct that work to the https://github.com/helios-io/DedicatedThreadPool repository (or fork it into this organization) and avoid running the giant Akka.NET test suite every time we make changes.The text was updated successfully, but these errors were encountered: