Skip to content

Commit b8e74e0

Browse files
Auto-tuning DotNetty batching + removing scheduler from batching system (#4685)
* implement FlushConsolidationHandler * removed previous BatchWriter settings + handle * removed unused batching settings from Akka.Remote
1 parent 67c6b32 commit b8e74e0

File tree

7 files changed

+204
-238
lines changed

7 files changed

+204
-238
lines changed

src/common.props

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<Copyright>Copyright © 2013-2020 Akka.NET Team</Copyright>
44
<Authors>Akka.NET Team</Authors>
5-
<VersionPrefix>1.4.13</VersionPrefix>
5+
<VersionPrefix>1.4.14</VersionPrefix>
66
<PackageIconUrl>https://getakka.net/images/akkalogo.png</PackageIconUrl>
77
<PackageProjectUrl>https://github.com/akkadotnet/akka.net</PackageProjectUrl>
88
<PackageLicenseUrl>https://github.com/akkadotnet/akka.net/blob/master/LICENSE</PackageLicenseUrl>
@@ -28,33 +28,7 @@
2828
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
2929
</PropertyGroup>
3030
<PropertyGroup>
31-
<PackageReleaseNotes>Maintenance Release for Akka.NET 1.4**
32-
Akka.NET v1.4.13 includes a number of bug fixes and enhancements:
33-
`AppVersion` now uses Assembly Version by Default**
34-
The new `AppVersion` setting, which is used to communicate application version numbers throughout Akka.Cluster and is used in scenarios such as Akka.Cluster.Sharding to help determine which nodes receive new shard allocations and which ones do not, now uses the following default HOCON setting:
35-
```
36-
akka.cluster.app-version = assembly-version
37-
```
38-
By default now the `AppVersion` communicated inside Akka.Cluster `Member` events uses the `Major.Minor.BuildNumber` from the `Assembly.GetEntryssembly()` or `Assembly.GetExecutingAssembly()` (in case the `EntryAssembly` is `null`). That way any updates made to your executable's (i.e. the .dll that hosts `Program.cs`) version number will be automatically reflected in the cluster now without Akka.NET developers having to set an additional configuration value during deployments.
39-
Other bug fixes and improvements:
40-
[Akka.IO: UdpExt.Manager: OverflowException when sending UDP packets to terminated clients](https://github.com/akkadotnet/akka.net/issues/4641)
41-
[Akka.Configuration / Akka.Streams: Memory Leak when using many short lived instances of ActorMaterializer](https://github.com/akkadotnet/akka.net/issues/4659)
42-
[Akka: Deprecate `PatternMatch`](https://github.com/akkadotnet/akka.net/issues/4658)
43-
[Akka: FSM: exception in LogTermination changes stopEvent.Reason to Shutdown](https://github.com/akkadotnet/akka.net/issues/3723)
44-
[Akka.Cluster.Tools: ClusterSingleton - Ignore possible state change in start](https://github.com/akkadotnet/akka.net/pull/4646)
45-
[Akka.Cluster.Tools: DistributedPubSub - new setting and small fixes](https://github.com/akkadotnet/akka.net/pull/4649)
46-
[Akka.DistributedData: `KeyNotFoundException` thrown periodically](https://github.com/akkadotnet/akka.net/issues/4639)
47-
To see the [full set of fixes in Akka.NET v1.4.13, please see the milestone on Github](https://github.com/akkadotnet/akka.net/milestone/44).
48-
| COMMITS | LOC+ | LOC- | AUTHOR |
49-
| --- | --- | --- | --- |
50-
| 5 | 316 | 29 | Aaron Stannard |
51-
| 2 | 53 | 8 | Gregorius Soedharmo |
52-
| 2 | 223 | 197 | zbynek001 |
53-
| 2 | 2 | 2 | dependabot-preview[bot] |
54-
| 2 | 11 | 3 | Ebere Abanonu |
55-
| 1 | 37 | 27 | Razvan Goga |
56-
| 1 | 217 | 11 | motmot80 |
57-
| 1 | 2 | 0 | Ismael Hamed |</PackageReleaseNotes>
31+
<PackageReleaseNotes>Placeholder for nightlies**</PackageReleaseNotes>
5832
</PropertyGroup>
5933
<!-- SourceLink support for all Akka.NET projects -->
6034
<ItemGroup>

src/core/Akka.Remote.Tests/RemoteConfigSpec.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,7 @@ public void Remoting_should_contain_correct_BatchWriter_settings_in_ReferenceCon
174174
var s = DotNettyTransportSettings.Create(c);
175175

176176
s.BatchWriterSettings.EnableBatching.Should().BeTrue();
177-
s.BatchWriterSettings.FlushInterval.Should().Be(BatchWriterSettings.DefaultFlushInterval);
178-
s.BatchWriterSettings.MaxPendingBytes.Should().Be(BatchWriterSettings.DefaultMaxPendingBytes);
179-
s.BatchWriterSettings.MaxPendingWrites.Should().Be(BatchWriterSettings.DefaultMaxPendingWrites);
177+
s.BatchWriterSettings.MaxExplicitFlushes.Should().Be(BatchWriterSettings.DefaultMaxPendingWrites);
180178
}
181179
}
182180
}

src/core/Akka.Remote.Tests/Transport/DotNettyBatchWriterSpecs.cs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,13 @@ public void Bugfix4434_should_overwrite_default_BatchWriterSettings()
6666
batching{
6767
enabled = false
6868
max-pending-writes = 50
69-
max-pending-bytes = 32k
70-
flush-interval = 10ms
7169
}
7270
}
7371
";
7472
var s = DotNettyTransportSettings.Create(c.GetConfig("akka.remote.dot-netty.tcp"));
7573

7674
s.BatchWriterSettings.EnableBatching.Should().BeFalse();
77-
s.BatchWriterSettings.FlushInterval.Should().NotBe(BatchWriterSettings.DefaultFlushInterval);
78-
s.BatchWriterSettings.MaxPendingBytes.Should().NotBe(BatchWriterSettings.DefaultMaxPendingBytes);
79-
s.BatchWriterSettings.MaxPendingWrites.Should().NotBe(BatchWriterSettings.DefaultMaxPendingWrites);
75+
s.BatchWriterSettings.MaxExplicitFlushes.Should().NotBe(BatchWriterSettings.DefaultMaxPendingWrites);
8076
}
8177

8278
/// <summary>
@@ -85,7 +81,7 @@ public void Bugfix4434_should_overwrite_default_BatchWriterSettings()
8581
[Fact]
8682
public async Task BatchWriter_should_succeed_with_timer()
8783
{
88-
var writer = new BatchWriter(new BatchWriterSettings(), Sys.Scheduler);
84+
var writer = new FlushConsolidationHandler();
8985
var ch = new EmbeddedChannel(Flush, writer);
9086

9187
await Flush.Activated;
@@ -98,14 +94,13 @@ public async Task BatchWriter_should_succeed_with_timer()
9894
var ints = Enumerable.Range(0, 4).ToArray();
9995
foreach (var i in ints)
10096
{
101-
_ = ch.WriteAsync(Unpooled.Buffer(1).WriteInt(i));
97+
_ = ch.WriteAndFlushAsync(Unpooled.Buffer(1).WriteInt(i));
10298
}
10399

104100
// force write tasks to run
105101
ch.RunPendingTasks();
106102

107-
ch.Unsafe.OutboundBuffer.TotalPendingWriteBytes().Should().Be(ints.Length * 4);
108-
ch.OutboundMessages.Count.Should().Be(0);
103+
ch.OutboundMessages.Count.Should().Be(ints.Length);
109104

110105
await AwaitAssertAsync(() =>
111106
{
@@ -124,7 +119,7 @@ await AwaitAssertAsync(() =>
124119
[Fact]
125120
public async Task BatchWriter_should_flush_messages_during_shutdown()
126121
{
127-
var writer = new BatchWriter(new BatchWriterSettings(), Sys.Scheduler);
122+
var writer = new FlushConsolidationHandler();
128123
var ch = new EmbeddedChannel(Flush, writer);
129124

130125
await Flush.Activated;
@@ -136,14 +131,13 @@ public async Task BatchWriter_should_flush_messages_during_shutdown()
136131
var ints = Enumerable.Range(0, 10).ToArray();
137132
foreach (var i in ints)
138133
{
139-
_ = ch.WriteAsync(Unpooled.Buffer(1).WriteInt(i));
134+
_ = ch.WriteAndFlushAsync(Unpooled.Buffer(1).WriteInt(i));
140135
}
141136

142137
// force write tasks to run
143138
ch.RunPendingTasks();
144139

145-
ch.Unsafe.OutboundBuffer.TotalPendingWriteBytes().Should().Be(ints.Length * 4);
146-
ch.OutboundMessages.Count.Should().Be(0);
140+
ch.OutboundMessages.Count.Should().Be(ints.Length);
147141

148142
// close channels
149143
_ = ch.CloseAsync();

src/core/Akka.Remote/Configuration/Remote.conf

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -444,28 +444,9 @@ akka {
444444
# fast (< 40ms) acknowledgement for all periodic messages.
445445
enabled = true
446446

447-
# The max write threshold based on the number of logical messages regardless of their size.
448-
# This is a safe default value - decrease it if you have a small number of remote actors
449-
# who engage in frequent request->response communication which requires low latency (< 40ms).
447+
# The maximum number of explicit flushes that will be allowed before being batched.
448+
# Batching normally happens when the channel switches from writes to reads and self-tunes automatically.
450449
max-pending-writes = 30
451-
452-
# The max write threshold based on the byte size of all buffered messages. If there are 4 messages
453-
# waiting to be written (with batching.max-pending-writes = 30) but their total size is greater than
454-
# batching.max-pending-bytes, a flush will be triggered immediately.
455-
#
456-
# Increase this value is you have larger message sizes and watch to take advantage of batching, but
457-
# otherwise leave it as-is.
458-
#
459-
# NOTE: this value should always be smaller than dot-netty.tcp.maximum-frame-size.
460-
max-pending-bytes = 16k
461-
462-
# In the event that neither the batching.max-pending-writes or batching.max-pending-bytes
463-
# is hit we guarantee that all pending writes will be flushed within this interval.
464-
#
465-
# This setting, realistically, can't be enforced any lower than the OS' clock resolution (~20ms).
466-
# If you have a very low-traffic system, either disable pooling altogether or lower the batching.max-pending-writes
467-
# threshold to maximize throughput. Otherwise, leave this setting as-is.
468-
flush-interval = 40ms
469450
}
470451

471452
# If set to "<id.of.dispatcher>" then the specified dispatcher

0 commit comments

Comments
 (0)