Skip to content
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

Added Dispatcher Benchmarks #6140

Merged
merged 2 commits into from Oct 5, 2022

Conversation

Aaronontheweb
Copy link
Member

Changes

Added Benchmark.NET ports of our old NBench benchmarks in order to measure memory allocation and throughput for various benchmark configurations.

Checklist

For significant changes, please ensure that the following have been completed (delete if not relevant):

Latest v1.4 Benchmarks

.NET 6

BenchmarkDotNet=v0.13.1, OS=Windows 10.0.19044.2006 (21H2)
AMD Ryzen 7 1700, 1 CPU, 16 logical and 8 physical cores
.NET SDK=6.0.201
  [Host]     : .NET 6.0.3 (6.0.322.12309), X64 RyuJIT
  DefaultJob : .NET 6.0.3 (6.0.322.12309), X64 RyuJIT

Method TaskCount Configurator Mean Error StdDev Gen 0 Allocated
RunDispatcher 1000000 ChannelD 2,422.2 ms 17.45 ms 16.32 ms 161000.0000 641 MB
RunDispatcher 1000000 DefaultThreadPool 1,156.6 ms 43.33 ms 127.75 ms 15000.0000 61 MB
RunDispatcher 1000000 ForkJoin(remote) 658.4 ms 10.47 ms 9.79 ms 23000.0000 92 MB
RunDispatcher 1000000 ForkJoin(sys) 649.2 ms 6.33 ms 5.29 ms 23000.0000 92 MB
RunDispatcher 1000000 TaskD 1,204.3 ms 8.15 ms 7.62 ms 23000.0000 92 MB

.NET Core 3.1

BenchmarkDotNet=v0.13.1, OS=Windows 10.0.19044.2006 (21H2)
AMD Ryzen 7 1700, 1 CPU, 16 logical and 8 physical cores
.NET SDK=6.0.201
  [Host]     : .NET Core 3.1.23 (CoreCLR 4.700.22.11601, CoreFX 4.700.22.12208), X64 RyuJIT
  DefaultJob : .NET Core 3.1.23 (CoreCLR 4.700.22.11601, CoreFX 4.700.22.12208), X64 RyuJIT

Method TaskCount Configurator Mean Error StdDev Median Gen 0 Allocated
RunDispatcher 1000000 ChannelD 2,792.1 ms 10.40 ms 8.12 ms 2,790.2 ms 161000.0000 641 MB
RunDispatcher 1000000 DefaultThreadPool 1,266.9 ms 25.25 ms 71.63 ms 1,290.7 ms 15000.0000 61 MB
RunDispatcher 1000000 ForkJoin(remote) 699.4 ms 6.21 ms 5.81 ms 700.3 ms 23000.0000 92 MB
RunDispatcher 1000000 ForkJoin(sys) 696.7 ms 7.25 ms 6.78 ms 696.9 ms 23000.0000 92 MB
RunDispatcher 1000000 TaskD 1,346.5 ms 3.24 ms 3.03 ms 1,346.3 ms 23000.0000 92 MB

@Aaronontheweb Aaronontheweb added akka.net v1.4 Issues affecting Akka.NET v1.4 perf labels Oct 5, 2022
@Aaronontheweb
Copy link
Member Author

Lots of delegate allocation in all of the dispatchers - especially the ChannelDispatcher.

@Aaronontheweb
Copy link
Member Author

Some of it might also be just items being added to the work queue - not necessarily delegate allocation. Could also be some boxing allocation involved too.

@Aaronontheweb Aaronontheweb mentioned this pull request Oct 5, 2022
3 tasks
Copy link
Member Author

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed my own PR


public IEnumerable<DispatcherConfig> AllConfigurators()
{
yield return new DispatcherConfig(DefaultConfig.GetConfig("akka.actor.default-dispatcher"), "DefaultThreadPool");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pulls out default Akka.NET dispatcher configurations, where available

{
if (Interlocked.Increment(ref _counter) >= _target)
{
_tcs.TrySetResult(_counter);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to force all operations to complete before allowing each benchmark iteration to exit

@Aaronontheweb Aaronontheweb enabled auto-merge (squash) October 5, 2022 18:51
@Aaronontheweb Aaronontheweb merged commit 77d92fe into akkadotnet:v1.4 Oct 5, 2022
@Aaronontheweb Aaronontheweb deleted the dispatcher-benchmarks branch October 5, 2022 19:53
Aaronontheweb added a commit to Aaronontheweb/akka.net that referenced this pull request Oct 8, 2022
* added parameterized Dispatcher benchmarks

* fixed naming - also, pull all config from Akka defaults
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
akka.net v1.4 Issues affecting Akka.NET v1.4 perf
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant