-
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
System.Collections.Immutable performance impact on Actor create / terminate #1766
Comments
The impact of this is pretty visible on PRs like #1765; calling the correct shutdown method was going to add overhead no matter what (which is what that PR was for) but the 26% decrease in throughput for adding and terminating children is going to sting. We can either just "eat" the overhead and accept that shutdowns and creating lots of siblings under one actor are going to be more expensive on average... Or we can revert back to the previous hand-rolled immutable collections for the In general I think it makes a lot of sense to keep a reference to System.Collections.Immutable within the root project - tons of other modules take it as a dependency and it's useful in defining messages with immutable collections on them anyway. But there's definitely a real performance cost beyond what we had before with the hand-rolled My vote, for what it's worth: we should pick a different strategy than the built-in System.Collections.Immutable. It's performance is unwieldy even at relatively small numbers of siblings (tens of thousands.) We should be able to support an order of magnitude more than that. |
@Aaronontheweb I think the problem is here
The parent is calling GetChildren() for each of its child when it is in the terminating state. I think the SupervisorStrategy should not be called when the parent is terminating, what do you think? |
Updated numbers from #1778 Akka.Tests.Performance.Actor.ActorMemoryFootprintSpec+ReceiveActor_memory_footprintMeasures the amount of memory used by 10,000 ReceiveActors System InfoNBench=NBench, Version=0.1.5.0, Culture=neutral, PublicKeyToken=null
OS=Microsoft Windows NT 6.2.9200.0
ProcessorCount=4
CLR=4.0.30319.42000,IsMono=False,MaxGcGeneration=2
WorkerThreads=32767, IOThreads=4 NBench SettingsRunMode=Iterations, TestMode=Measurement
NumberOfIterations=13, MaximumRunTime=00:00:01 DataTotals
Per-second Totals
Raw DataTotalBytesAllocated
[Counter] ActorCreateThroughput
|
My take: the changes in #1772 don't impact the throughput of creating children very much, but they have a huge impact on the time it takes to shut them down. Shaved a solid 8 minutes off of the benchmark run time - most of that time doesn't get counted inside the benchmarks themselves because it occurs during the cleanup phase. |
Issue #1766 - Lazy evaluation of ChildrenContainer.Children and ChildrenContainer.Stats
I had actually implemented a red-black tree just prior to picking this issue up (straight out of intro to algorithms). Whilst its tested it has no performance tests. Moreover I think the problem here is likely to be the builder pattern the collections.immutable uses. I think building some tests that compare the collections in isolation would be a good starting point? The old avl looked quite cannonical |
@MrTortoise We found out that the real issue was that the tree was copied to a List each time ChildrenContainer.Children was accessed. PR #1772 fixed that and the ImmutableDictionary doesn't seem to be a performance bottleneck anymore. |
So the PRs implemented to resolve #1676 appear to have had a negative performance impact, as measured by NBench.
Before
Akka.Tests.Performance.Actor.ActorMemoryFootprintSpec+ReceiveActorMemoryFootprint
Measures the amount of memory used by 10,000 ReceiveActors
2/18/2016 7:31:02 PM
System Info
NBench Settings
Data
Totals
Per-second Totals
Raw Data
TotalBytesAllocated
[Counter] ActorCreateThroughput
After
Akka.Tests.Performance.Actor.ActorMemoryFootprintSpec+ReceiveActor_memory_footprint
Measures the amount of memory used by 10,000 ReceiveActors
3/8/2016 8:24:26 PM
System Info
NBench Settings
Data
Totals
Per-second Totals
Raw Data
TotalBytesAllocated
[Counter] ActorCreateThroughput
The text was updated successfully, but these errors were encountered: