Skip to content

Commit

Permalink
Merge branch 'dev' into circuit-breaker-wait
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaronontheweb authored Oct 31, 2022
2 parents d9a288f + cdc2b85 commit 96d228b
Show file tree
Hide file tree
Showing 25 changed files with 268 additions and 403 deletions.
24 changes: 24 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
#### 1.5.0-alpha2 October 17th 2022 ####
Akka.NET v1.5.0-alpha2 is a maintenance release for Akka.NET v1.5 that contains numerous performance improvements in critical areas, including core actor message processing and Akka.Remote.

**Performance Fixes**

* [remove delegate allocation from `ForkJoinDispatcher` and `DedicatedThreadPool`](https://github.com/akkadotnet/akka.net/pull/6162)
* [eliminate `Mailbox` delegate allocations](https://github.com/akkadotnet/akka.net/pull/6162)
* [Reduce `FSM<TState, TData>` allocations](https://github.com/akkadotnet/akka.net/pull/6162)
* [removed boxing allocations inside `FSM.State.Equals`](https://github.com/akkadotnet/akka.net/pull/6196)
* [Eliminate `DefaultLogMessageFormatter` allocations](https://github.com/akkadotnet/akka.net/pull/6166)

In sum you should expect to see total memory consumption, garbage collection, and throughput improve when you upgrade to Akka.NET v1.5.0-alpha2.

**Other Features and Improvements**

* [DData: Suppress gossip message from showing up in debug log unless verbose debug logging is turned on](https://github.com/akkadotnet/akka.net/pull/6089)
* [TestKit: TestKit automatically injects the default TestKit default configuration if an ActorSystem is passed into its constructor](https://github.com/akkadotnet/akka.net/pull/6092)
* [Sharding: Added a new `GetEntityLocation` query message to retrieve an entity address location in the shard region](https://github.com/akkadotnet/akka.net/pull/6107)
* [Sharding: Fixed `GetEntityLocation` uses wrong actor path](https://github.com/akkadotnet/akka.net/pull/6121)
* [Akka.Cluster and Akka.Cluster.Sharding: should throw human-friendly exception when accessing cluster / sharding plugins when clustering is not running](https://github.com/akkadotnet/akka.net/pull/6169)
* [Akka.Cluster.Sharding: Add `HashCodeMessageExtractor` factory](https://github.com/akkadotnet/akka.net/pull/6173)
* [Akka.Persistence.Sql.Common: Fix `DbCommand.CommandTimeout` in `BatchingSqlJournal`](https://github.com/akkadotnet/akka.net/pull/6175)


#### 1.5.0-alpha1 August 22 2022 ####
Akka.NET v1.5.0-alpha1 is a major release that contains a lot of code improvement and rewrites/refactors. **Major upgrades to Akka.Cluster.Sharding in particular**.

Expand Down
13 changes: 7 additions & 6 deletions docs/articles/actors/testing-actor-systems.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,13 @@ It should be noted that if the last message-receiving assertion of the block is

```csharp
var worker = ActorOf<Worker>();
Within(200.Milliseconds()) {
worker.Tell("some work");
ExpectMsg("Some Result");
ExpectNoMsg(); //will block for the rest of the 200ms
Thead.Sleep(300); //will NOT make this block fail
}
Within(200.Milliseconds(), () =>
{
worker.Tell("some work");
ExpectMsg("Some Result");
ExpectNoMsg(); //will block for the rest of the 200ms
Thead.Sleep(300); //will NOT make this block fail
});
```

## Accounting for Slow Test System
Expand Down
15 changes: 15 additions & 0 deletions src/Akka.sln
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleDestination", "exampl
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleSender", "examples\Cluster\PublishSubscribe\SampleSender\SampleSender.csproj", "{A5392607-15B8-4869-BB20-FAAD4D09E08B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PersistenceExample", "examples\PersistenceExample\PersistenceExample.csproj", "{4022147A-4F95-4A04-BE09-01B7952BBDD9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1261,6 +1263,18 @@ Global
{A5392607-15B8-4869-BB20-FAAD4D09E08B}.Release|x64.Build.0 = Release|Any CPU
{A5392607-15B8-4869-BB20-FAAD4D09E08B}.Release|x86.ActiveCfg = Release|Any CPU
{A5392607-15B8-4869-BB20-FAAD4D09E08B}.Release|x86.Build.0 = Release|Any CPU
{4022147A-4F95-4A04-BE09-01B7952BBDD9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4022147A-4F95-4A04-BE09-01B7952BBDD9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4022147A-4F95-4A04-BE09-01B7952BBDD9}.Debug|x64.ActiveCfg = Debug|Any CPU
{4022147A-4F95-4A04-BE09-01B7952BBDD9}.Debug|x64.Build.0 = Debug|Any CPU
{4022147A-4F95-4A04-BE09-01B7952BBDD9}.Debug|x86.ActiveCfg = Debug|Any CPU
{4022147A-4F95-4A04-BE09-01B7952BBDD9}.Debug|x86.Build.0 = Debug|Any CPU
{4022147A-4F95-4A04-BE09-01B7952BBDD9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4022147A-4F95-4A04-BE09-01B7952BBDD9}.Release|Any CPU.Build.0 = Release|Any CPU
{4022147A-4F95-4A04-BE09-01B7952BBDD9}.Release|x64.ActiveCfg = Release|Any CPU
{4022147A-4F95-4A04-BE09-01B7952BBDD9}.Release|x64.Build.0 = Release|Any CPU
{4022147A-4F95-4A04-BE09-01B7952BBDD9}.Release|x86.ActiveCfg = Release|Any CPU
{4022147A-4F95-4A04-BE09-01B7952BBDD9}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1381,6 +1395,7 @@ Global
{3AF9CF2D-6C20-4CFE-BC0A-CA48F60E2724} = {51C887A7-7A69-43E2-9BE2-17016E2D8476}
{09CFD060-C7DC-49CC-A6C6-D3FE341A7320} = {51C887A7-7A69-43E2-9BE2-17016E2D8476}
{A5392607-15B8-4869-BB20-FAAD4D09E08B} = {51C887A7-7A69-43E2-9BE2-17016E2D8476}
{4022147A-4F95-4A04-BE09-01B7952BBDD9} = {A640E39E-F45C-4AE9-AABF-7F1432D357DA}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {03AD8E21-7507-4E68-A4E9-F4A7E7273164}
Expand Down
2 changes: 1 addition & 1 deletion src/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<HyperionVersion>0.12.2</HyperionVersion>
<NewtonsoftJsonVersion>[12.0.3,)</NewtonsoftJsonVersion>
<NBenchVersion>2.0.1</NBenchVersion>
<ProtobufVersion>3.21.7</ProtobufVersion>
<ProtobufVersion>3.21.9</ProtobufVersion>
<BenchmarkDotNetVersion>0.13.2</BenchmarkDotNetVersion>
<NetCoreTestVersion>netcoreapp3.1</NetCoreTestVersion>
<NetTestVersion>net6.0</NetTestVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,19 +192,19 @@ public DistributedPubSubMediator(DistributedPubSubSettings settings)
new Router(_settings.RoutingLogic, routees.ToArray()).Route(
Internal.Utils.WrapIfNeeded(send.Message), Sender);
else
IgnoreOrSendToDeadLetters(send.Message);
IgnoreOrSendToDeadLetters(send);
});
Receive<SendToAll>(sendToAll =>
{
PublishMessage(sendToAll.Path, sendToAll.Message, sendToAll.ExcludeSelf);
PublishMessage(sendToAll.Path, sendToAll, sendToAll.ExcludeSelf);
});
Receive<Publish>(publish =>
{
string path = Internal.Utils.MakeKey(Self.Path / Internal.Utils.EncodeName(publish.Topic));
if (publish.SendOneMessageToEachGroup)
PublishToEachGroup(path, publish.Message);
PublishToEachGroup(path, publish);
else
PublishMessage(path, publish.Message);
PublishMessage(path, publish);
});
Receive<Put>(put =>
{
Expand Down Expand Up @@ -500,7 +500,7 @@ private void IgnoreOrSendToDeadLetters(object message)
Context.System.DeadLetters.Tell(new DeadLetter(message, Sender, Context.Self));
}

private void PublishMessage(string path, object message, bool allButSelf = false)
private void PublishMessage(string path, IWrappedMessage publish, bool allButSelf = false)
{
IEnumerable<IActorRef> Refs()
{
Expand All @@ -521,24 +521,24 @@ IEnumerable<IActorRef> Refs()
foreach (var r in Refs())
{
if (r == null) continue;
r.Forward(message);
r.Forward(publish.Message);
counter++;
}

if (counter == 0) IgnoreOrSendToDeadLetters(message);
if (counter == 0) IgnoreOrSendToDeadLetters(publish);
}

private void PublishToEachGroup(string path, object message)
private void PublishToEachGroup(string path, Publish publish)
{
var prefix = path + "/";
var lastKey = path + "0"; // '0' is the next char of '/'

var groups = ExtractGroups(prefix, lastKey).GroupBy(kv => kv.Key).ToList();
var wrappedMessage = new SendToOneSubscriber(message);
var wrappedMessage = new SendToOneSubscriber(publish.Message);

if (groups.Count == 0)
{
IgnoreOrSendToDeadLetters(message);
IgnoreOrSendToDeadLetters(publish);
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions src/core/Akka.API.Tests/Akka.API.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
<PackageReference Include="xunit" Version="$(XunitVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
<PackageReference Include="PublicApiGenerator" Version="9.3.0" />
<PackageReference Include="Verify.Xunit" Version="17.10.2" />
<PackageReference Include="Verify.DiffPlex" Version="1.3.0" />
<PackageReference Include="Verify.Xunit" Version="18.1.1" />
<PackageReference Include="Verify.DiffPlex" Version="2.0.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2206,7 +2206,7 @@ namespace Akka.Configuration
public ConfigurationException(string message) { }
public ConfigurationException(string message, System.Exception exception) { }
protected ConfigurationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public static Akka.Configuration.ConfigurationException NullOrEmptyConfig<T>(string path = null, string reason = null) { }
public static Akka.Configuration.ConfigurationException NullOrEmptyConfig<T>(string path = null) { }
}
public class ConfigurationFactory
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2208,7 +2208,7 @@ namespace Akka.Configuration
public ConfigurationException(string message) { }
public ConfigurationException(string message, System.Exception exception) { }
protected ConfigurationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public static Akka.Configuration.ConfigurationException NullOrEmptyConfig<T>(string path = null, string reason = null) { }
public static Akka.Configuration.ConfigurationException NullOrEmptyConfig<T>(string path = null) { }
}
public class ConfigurationFactory
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2206,7 +2206,7 @@ namespace Akka.Configuration
public ConfigurationException(string message) { }
public ConfigurationException(string message, System.Exception exception) { }
protected ConfigurationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public static Akka.Configuration.ConfigurationException NullOrEmptyConfig<T>(string path = null, string reason = null) { }
public static Akka.Configuration.ConfigurationException NullOrEmptyConfig<T>(string path = null) { }
}
public class ConfigurationFactory
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2239,7 +2239,7 @@ namespace Akka.Configuration
public ConfigurationException(string message) { }
public ConfigurationException(string message, System.Exception exception) { }
protected ConfigurationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public static Akka.Configuration.ConfigurationException NullOrEmptyConfig<T>(string path = null, string reason = null) { }
public static Akka.Configuration.ConfigurationException NullOrEmptyConfig<T>(string path = null) { }
}
public class ConfigurationFactory
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.Cluster/ClusterSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public ClusterSettings(Config config, string systemName)
//TODO: Requiring!
var clusterConfig = config.GetConfig("akka.cluster");
if (clusterConfig?.GetConfig("failure-detector") == null)
throw ConfigurationException.NullOrEmptyConfig<ClusterSettings>("akka.cluster", "Did you forgot to set the 'akka.cluster.provider' HOCON property to 'cluster'?");
throw new ConfigurationException($"Failed to instantiate {nameof(ClusterSettings)}: Configuration does not contain `akka.cluster` node. Did you forgot to set the 'akka.cluster.provider' HOCON property to 'cluster'?");

LogInfoVerbose = clusterConfig.GetBoolean("log-info-verbose", false);
LogInfo = LogInfoVerbose || clusterConfig.GetBoolean("log-info", false);
Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.Streams/ActorMaterializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ public override bool Equals(object obj)
s.SyncProcessingLimit == SyncProcessingLimit &&
s.IsFuzzingMode == IsFuzzingMode &&
s.IsAutoFusing == IsAutoFusing &&
s.SubscriptionTimeoutSettings == SubscriptionTimeoutSettings &&
s.MaxFixedBufferSize == MaxFixedBufferSize &&
s.StreamRefSettings == StreamRefSettings;
}

Expand Down
6 changes: 4 additions & 2 deletions src/core/Akka/Actor/FSM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1262,12 +1262,14 @@ private void MakeTransition(State<TState, TData> nextState)
{
Sender.Tell(nextState.Replies[i]);
}
if (!_currentState.StateName.Equals(nextState.StateName) || nextState.Notifies)

// avoid boxing
if (!EqualityComparer<TState>.Default.Equals(_currentState.StateName, nextState.StateName) || nextState.Notifies)
{
_nextState = nextState;
HandleTransition(_currentState.StateName, nextState.StateName);
Listeners.Gossip(new Transition<TState>(Self, _currentState.StateName, nextState.StateName));
_nextState = default(State<TState, TData>);
_nextState = default;
}
_currentState = nextState;

Expand Down
6 changes: 3 additions & 3 deletions src/core/Akka/Configuration/ConfigurationException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ namespace Akka.Configuration
/// </summary>
public class ConfigurationException : AkkaException
{
public static ConfigurationException NullOrEmptyConfig<T>(string path = null, string reason = null)
public static ConfigurationException NullOrEmptyConfig<T>(string path = null)
{
if (!string.IsNullOrWhiteSpace(path))
return new ConfigurationException($"Failed to instantiate {typeof(T).Name}: Configuration does not contain `{path}` node{(reason != null ? $". {reason}" : "")}");
return new ConfigurationException($"Failed to instantiate {typeof(T).Name}: Configuration is null or empty{(reason != null ? $". {reason}" : "")}");
return new ConfigurationException($"Failed to instantiate {typeof(T).Name}: Configuration does not contain `{path}` node");
return new ConfigurationException($"Failed to instantiate {typeof(T).Name}: Configuration is null or empty");
}

/// <summary>
Expand Down
21 changes: 13 additions & 8 deletions src/examples/AspNetCore/Samples.Akka.AspNetCore/app.conf
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
akka {
actor {
deployment{
/hasher {
router = random-pool
nr-of-instances = 10
akka
{
actor
{
deployment
{
/hasher
{
router = random-pool
nr-of-instances = 10
}
}
}
}
}
}
6 changes: 0 additions & 6 deletions src/examples/PersistenceExample/App.config

This file was deleted.

Loading

0 comments on commit 96d228b

Please sign in to comment.