diff --git a/src/Akka.sln b/src/Akka.sln index 20adb3e365d..50ff1995a45 100644 --- a/src/Akka.sln +++ b/src/Akka.sln @@ -70,8 +70,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Akka.Persistence.Sql.Common EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Akka.Cluster.Tests.MultiNode", "core\Akka.Cluster.Tests.MultiNode\Akka.Cluster.Tests.MultiNode.csproj", "{F0781BEA-5BA0-4AF0-BB15-E3F209B681F5}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PersistenceBenchmark", "benchmark\PersistenceBenchmark\PersistenceBenchmark.csproj", "{39E6F51F-FA1E-4C62-B8F8-19065DE6D55D}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A59BAE84-70E2-46A0-9E26-7413C103E2D7}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig @@ -435,14 +433,6 @@ Global {F0781BEA-5BA0-4AF0-BB15-E3F209B681F5}.Release|Any CPU.Build.0 = Release|Any CPU {F0781BEA-5BA0-4AF0-BB15-E3F209B681F5}.Release|x64.ActiveCfg = Release|Any CPU {F0781BEA-5BA0-4AF0-BB15-E3F209B681F5}.Release|x86.ActiveCfg = Release|Any CPU - {39E6F51F-FA1E-4C62-B8F8-19065DE6D55D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {39E6F51F-FA1E-4C62-B8F8-19065DE6D55D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {39E6F51F-FA1E-4C62-B8F8-19065DE6D55D}.Debug|x64.ActiveCfg = Debug|Any CPU - {39E6F51F-FA1E-4C62-B8F8-19065DE6D55D}.Debug|x86.ActiveCfg = Debug|Any CPU - {39E6F51F-FA1E-4C62-B8F8-19065DE6D55D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {39E6F51F-FA1E-4C62-B8F8-19065DE6D55D}.Release|Any CPU.Build.0 = Release|Any CPU - {39E6F51F-FA1E-4C62-B8F8-19065DE6D55D}.Release|x64.ActiveCfg = Release|Any CPU - {39E6F51F-FA1E-4C62-B8F8-19065DE6D55D}.Release|x86.ActiveCfg = Release|Any CPU {C9105C76-B084-4DA1-9348-1C74A8F22F6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C9105C76-B084-4DA1-9348-1C74A8F22F6B}.Debug|Any CPU.Build.0 = Debug|Any CPU {C9105C76-B084-4DA1-9348-1C74A8F22F6B}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -1301,7 +1291,6 @@ Global {7DBD5C17-5E9D-40C4-9201-D092751532A7} = {7625FD95-4B2C-4A5B-BDD5-94B1493FAC8E} {3B9E6211-9488-4DB5-B714-24248693B38F} = {264C22A4-CAFC-41F6-B82C-4DDC5C196767} {F0781BEA-5BA0-4AF0-BB15-E3F209B681F5} = {01167D3C-49C4-4CDE-9787-C176D139ACDD} - {39E6F51F-FA1E-4C62-B8F8-19065DE6D55D} = {73108242-625A-4D7B-AA09-63375DBAE464} {C9105C76-B084-4DA1-9348-1C74A8F22F6B} = {01167D3C-49C4-4CDE-9787-C176D139ACDD} {453EFD22-7C53-4887-9DBF-FCFC9172E909} = {264C22A4-CAFC-41F6-B82C-4DDC5C196767} {7A832BBF-053E-4E9F-BD83-D988A0130CC8} = {264C22A4-CAFC-41F6-B82C-4DDC5C196767} diff --git a/src/benchmark/PersistenceBenchmark/App.config b/src/benchmark/PersistenceBenchmark/App.config deleted file mode 100644 index bc48eba3eaa..00000000000 --- a/src/benchmark/PersistenceBenchmark/App.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/benchmark/PersistenceBenchmark/Messages.cs b/src/benchmark/PersistenceBenchmark/Messages.cs deleted file mode 100644 index ccd69e2b2a5..00000000000 --- a/src/benchmark/PersistenceBenchmark/Messages.cs +++ /dev/null @@ -1,94 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2022 Lightbend Inc. -// Copyright (C) 2013-2022 .NET Foundation -// -//----------------------------------------------------------------------- - -using System; -using System.Runtime.Serialization; - -namespace PersistenceBenchmark -{ - [Serializable] - public sealed class StopMeasure - { - public static readonly StopMeasure Instance = new StopMeasure(); - - private StopMeasure() - { - } - } - - [Serializable] - public sealed class FailAt - { - public readonly long SequenceNr; - - public FailAt(long sequenceNr) - { - SequenceNr = sequenceNr; - } - } - - [Serializable] - public sealed class Measure - { - public readonly int MessagesCount; - - public Measure(int messagesCount) - { - MessagesCount = messagesCount; - } - - public DateTime StartedAt { get; private set; } - public DateTime StoppedAt { get; private set; } - - public void StartMeasure() - { - StartedAt = DateTime.Now; - } - - public double StopMeasure() - { - StoppedAt = DateTime.Now; - return MessagesCount/(StoppedAt - StartedAt).TotalSeconds; - } - } - - public class PerformanceTestException : Exception - { - /// - /// Initializes a new instance of the class. - /// - public PerformanceTestException() - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The message that describes the error. - public PerformanceTestException(string message) : base(message) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The message that describes the error. - /// The exception that is the cause of the current exception. - public PerformanceTestException(string message, Exception innerException) : base(message, innerException) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The that holds the serialized object data about the exception being thrown. - /// The that contains contextual information about the source or destination. - protected PerformanceTestException(SerializationInfo info, StreamingContext context) : base(info, context) - { - } - } -} diff --git a/src/benchmark/PersistenceBenchmark/PerformanceActors.cs b/src/benchmark/PersistenceBenchmark/PerformanceActors.cs deleted file mode 100644 index 5b046d7103f..00000000000 --- a/src/benchmark/PersistenceBenchmark/PerformanceActors.cs +++ /dev/null @@ -1,105 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2022 Lightbend Inc. -// Copyright (C) 2013-2022 .NET Foundation -// -//----------------------------------------------------------------------- - -using System; -using Akka; -using Akka.Persistence; -using Akka.Actor; - -namespace PersistenceBenchmark -{ - public sealed class Init - { - public static readonly Init Instance = new Init(); - private Init() { } - } - - public sealed class Finish - { - public static readonly Finish Instance = new Finish(); - private Finish() { } - } - public sealed class Done - { - public static readonly Done Instance = new Done(); - private Done() { } - } - public sealed class Finished - { - public readonly long State; - - public Finished(long state) - { - State = state; - } - } - - public sealed class Store - { - public readonly int Value; - - public Store(int value) - { - Value = value; - } - } - - public sealed class Stored - { - public readonly int Value; - - public Stored(int value) - { - Value = value; - } - } - - public class PerformanceTestActor : PersistentActor - { - private long state = 0L; - public PerformanceTestActor(string persistenceId) - { - PersistenceId = persistenceId; - } - - public sealed override string PersistenceId { get; } - - protected override bool ReceiveRecover(object message) - { - if (message is Stored s) - { - state += s.Value; - return true; - } - return false; - } - - protected override bool ReceiveCommand(object message) - { - switch (message) - { - case Store store: - Persist(new Stored(store.Value), s => { state += s.Value; }); - return true; - case Init _: - var sender = Sender; - Persist(new Stored(0), s => - { - state += s.Value; - sender.Tell(Done.Instance); - }); - return true; - case Finish _: - Sender.Tell(new Finished(state)); - return true; - default: - return false; - } - } - } - -} diff --git a/src/benchmark/PersistenceBenchmark/PersistenceBenchmark.csproj b/src/benchmark/PersistenceBenchmark/PersistenceBenchmark.csproj deleted file mode 100644 index e0fb6df0799..00000000000 --- a/src/benchmark/PersistenceBenchmark/PersistenceBenchmark.csproj +++ /dev/null @@ -1,28 +0,0 @@ - - - - - Exe - $(NetFrameworkTestVersion) - true - win7-x64 - - - - - - - - - - - - - $(DefineConstants);THREADS - - - - $(DefineConstants);RELEASE - - - \ No newline at end of file diff --git a/src/benchmark/PersistenceBenchmark/Program.cs b/src/benchmark/PersistenceBenchmark/Program.cs deleted file mode 100644 index 440a44d1a38..00000000000 --- a/src/benchmark/PersistenceBenchmark/Program.cs +++ /dev/null @@ -1,91 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2022 Lightbend Inc. -// Copyright (C) 2013-2022 .NET Foundation -// -//----------------------------------------------------------------------- - -using System; -using System.Diagnostics; -using System.Linq; -using System.Threading.Tasks; -using Akka.Actor; -using Akka.Configuration; -using Akka.Pattern; -using ConfigurationFactory = Akka.Configuration.ConfigurationFactory; - -namespace PersistenceBenchmark -{ - class Program - { - // if you want to benchmark your persistent storage provides, paste the configuration in string below - // by default we're checking against in-memory journal - private static Config config = ConfigurationFactory.ParseString(@" - akka { - suppress-json-serializer-warning = true - persistence.journal { - plugin = ""akka.persistence.journal.sqlite"" - sqlite { - class = ""Akka.Persistence.Sqlite.Journal.BatchingSqliteJournal, Akka.Persistence.Sqlite"" - plugin-dispatcher = ""akka.actor.default-dispatcher"" - table-name = event_journal - metadata-table-name = journal_metadata - auto-initialize = on - connection-string = ""Datasource=memdb-journal.db;Mode=Memory;Cache=Shared"" - } - } - }"); - - public const int ActorCount = 1000; - public const int MessagesPerActor = 100; - - static void Main(string[] args) - { - using (var system = ActorSystem.Create("persistent-benchmark", config.WithFallback(ConfigurationFactory.Default()))) - { - Console.WriteLine("Performance benchmark starting..."); - - var actors = new IActorRef[ActorCount]; - for (int i = 0; i < ActorCount; i++) - { - var pid = "a-" + i; - actors[i] = system.ActorOf(Props.Create(() => new PerformanceTestActor(pid))); - } - - Task.WaitAll(actors.Select(a => a.Ask(Init.Instance)).Cast().ToArray()); - - Console.WriteLine("All actors have been initialized..."); - - var stopwatch = new Stopwatch(); - stopwatch.Start(); - - for (int i = 0; i < MessagesPerActor; i++) - for (int j = 0; j < ActorCount; j++) - { - actors[j].Tell(new Store(1)); - } - - var finished = new Task[ActorCount]; - for (int i = 0; i < ActorCount; i++) - { - finished[i] = actors[i].Ask(Finish.Instance); - } - - Task.WaitAll(finished); - - var elapsed = stopwatch.ElapsedMilliseconds; - - Console.WriteLine($"{ActorCount} actors stored {MessagesPerActor} events each in {elapsed/1000.0} sec. Average: {ActorCount*MessagesPerActor*1000.0/elapsed} events/sec"); - - foreach (Task task in finished) - { - if (!task.IsCompleted || task.Result.State != MessagesPerActor) - throw new IllegalStateException("Actor's state was invalid"); - } - } - - Console.ReadLine(); - } - - } -}