diff --git a/projects/Benchmarks/Benchmarks.csproj b/projects/Benchmarks/Benchmarks.csproj index deae254f2..63b607ad3 100644 --- a/projects/Benchmarks/Benchmarks.csproj +++ b/projects/Benchmarks/Benchmarks.csproj @@ -20,7 +20,8 @@ - + + diff --git a/projects/Benchmarks/Networking/Networking_BasicDeliver_ConnectionChurn.cs b/projects/Benchmarks/Networking/Networking_BasicDeliver_ConnectionChurn.cs index a2542b903..5130da505 100644 --- a/projects/Benchmarks/Networking/Networking_BasicDeliver_ConnectionChurn.cs +++ b/projects/Benchmarks/Networking/Networking_BasicDeliver_ConnectionChurn.cs @@ -1,5 +1,4 @@ -using System; -using System.Text; +using System.Text; using System.Threading.Tasks; using BenchmarkDotNet.Attributes; using RabbitMQ.Client; @@ -11,21 +10,8 @@ public class Networking_BasicDeliver { private const int messageCount = 10000; - private IDisposable _container; private static byte[] _body = Encoding.UTF8.GetBytes("hello world"); - [GlobalSetup] - public void GlobalSetup() - { - _container = RabbitMQBroker.Start(); - } - - [GlobalCleanup] - public void GlobalCleanup() - { - _container.Dispose(); - } - [Benchmark(Baseline = true)] public async Task Publish_Hello_World() { diff --git a/projects/Benchmarks/Networking/Networking_BasicDeliver_LongLivedConnection.cs b/projects/Benchmarks/Networking/Networking_BasicDeliver_LongLivedConnection.cs index 0e5d34d61..8b0737f1f 100644 --- a/projects/Benchmarks/Networking/Networking_BasicDeliver_LongLivedConnection.cs +++ b/projects/Benchmarks/Networking/Networking_BasicDeliver_LongLivedConnection.cs @@ -1,5 +1,4 @@ -using System; -using System.Text; +using System.Text; using System.Threading.Tasks; using BenchmarkDotNet.Attributes; using RabbitMQ.Client; @@ -9,7 +8,6 @@ namespace Benchmarks.Networking [MemoryDiagnoser] public class Networking_BasicDeliver_LongLivedConnection { - private IDisposable _container; private IConnection _connection; private const int messageCount = 10000; @@ -18,8 +16,6 @@ public class Networking_BasicDeliver_LongLivedConnection [GlobalSetup] public void GlobalSetup() { - _container = RabbitMQBroker.Start(); - var cf = new ConnectionFactory { ConsumerDispatchConcurrency = 2 }; // NOTE: https://github.com/dotnet/BenchmarkDotNet/issues/1738 _connection = EnsureCompleted(cf.CreateConnectionAsync()); @@ -29,7 +25,6 @@ public void GlobalSetup() public void GlobalCleanup() { _connection.Dispose(); - _container.Dispose(); } [Benchmark(Baseline = true)] diff --git a/projects/Benchmarks/Networking/RabbitMqBroker.cs b/projects/Benchmarks/Networking/RabbitMqBroker.cs deleted file mode 100644 index 48934afef..000000000 --- a/projects/Benchmarks/Networking/RabbitMqBroker.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using System.Threading; - -using Ductus.FluentDocker.Builders; -using Ductus.FluentDocker.Services; -using Ductus.FluentDocker.Services.Extensions; - -namespace Benchmarks.Networking -{ - public class RabbitMQBroker : IDisposable - { - private readonly IContainerService _service; - - public static IDisposable Start() - { - var broker = new Builder().UseContainer() - .UseImage("rabbitmq") - .ExposePort(5672, 5672) - .WaitForPort("5672/tcp", 40000 /*40s*/) - .ReuseIfExists() - .WithName("rabbitmq") - .WithEnvironment("NODENAME=rabbit1") - .Build() - .Start(); - - for (int i = 0; i < 10; i++) - { - var response = broker.Execute("rabbitmqctl --node rabbit1 await_startup"); - if (response.Success) - { - break; - } - - Thread.Sleep(1000); - } - - return new RabbitMQBroker(broker); - } - - public RabbitMQBroker(IContainerService service) - { - _service = service; - } - - public void Dispose() - { - _service?.Dispose(); - } - } -} diff --git a/projects/Directory.Packages.props b/projects/Directory.Packages.props index 22f9950be..cf53e6134 100644 --- a/projects/Directory.Packages.props +++ b/projects/Directory.Packages.props @@ -3,13 +3,13 @@ true - - + - + +