Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

Commit

Permalink
Merge pull request #15 from Dtronix/setup-interfaces
Browse files Browse the repository at this point in the history
Setup interfaces
  • Loading branch information
DJGosnell authored Sep 19, 2016
2 parents 72d4067 + 3b30967 commit 4a36f9a
Show file tree
Hide file tree
Showing 33 changed files with 339 additions and 458 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ Sample performance tests. Numbers are averages from 5 loops of the performance
| Release | 100,000 | 2,000 | 638 | 156,744 | 313.49 |
| Release | 10,000 | 60,048 | 1,868 | 5,352 | 321.40 |

[Laptop Intel i7-6500U 16GB](docs/performance-results/i7-6500U-16GB.md)
[Laptop Intel i7-6500U 16GB](docs/performance-results/i7-6500U-16GB-16KB.md)

[Desktop Intel i5-3470 8GB 8KB Buffer](docs/performance-results/i5-3470-8GB-8KB.md)

[Desktop Intel i5-3470 8GB 16KB Buffer](docs/performance-results/i5-3470-8GB-16KB.md)

[Desktop Intel i7-6700K 32GB 8KB Buffer](docs/performance-results/i7-6700K-32GB.md)
[Desktop Intel i7-6700K 32GB 8KB Buffer](docs/performance-results/i7-6700K-32GB-16KB.md)

#### DtronixMessageQueue.Rpc

Expand Down
32 changes: 32 additions & 0 deletions docs/performance-results/i7-6500U-16GB-16KB.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz with 16 GB of RAM installed.
DMQPerf.exe mq single-process 1 100000 4 50 10
Running MQ performance tests.

FrameBufferSize: 16381; SendAndReceiveBufferSize: 16384

| Build | Messages | Msg Bytes | Milliseconds | Msg/sec | MBps |
|---------|------------|-----------|--------------|------------|----------|
| Release | 1,000,000 | 200 | 1,662 | 601,684 | 120.34 |
| Release | 1,000,000 | 200 | 1,624 | 615,763 | 123.15 |
| Release | 1,000,000 | 200 | 1,652 | 605,326 | 121.07 |
| Release | 1,000,000 | 200 | 1,639 | 610,128 | 122.03 |
| Release | 1,000,000 | 200 | 1,657 | 603,500 | 120.70 |
| | | AVERAGES | 1,647 | 607,280 | 121.46 |

| Build | Messages | Msg Bytes | Milliseconds | Msg/sec | MBps |
|---------|------------|-----------|--------------|------------|----------|
| Release | 100,000 | 2,000 | 657 | 152,207 | 304.41 |
| Release | 100,000 | 2,000 | 650 | 153,846 | 307.69 |
| Release | 100,000 | 2,000 | 652 | 153,374 | 306.75 |
| Release | 100,000 | 2,000 | 657 | 152,207 | 304.41 |
| Release | 100,000 | 2,000 | 650 | 153,846 | 307.69 |
| | | AVERAGES | 653 | 153,096 | 306.19 |

| Build | Messages | Msg Bytes | Milliseconds | Msg/sec | MBps |
|---------|------------|-----------|--------------|------------|----------|
| Release | 10,000 | 60,048 | 1,746 | 5,727 | 343.92 |
| Release | 10,000 | 60,048 | 1,740 | 5,747 | 345.10 |
| Release | 10,000 | 60,048 | 1,736 | 5,760 | 345.90 |
| Release | 10,000 | 60,048 | 1,756 | 5,694 | 341.96 |
| Release | 10,000 | 60,048 | 1,722 | 5,807 | 348.71 |
| | | AVERAGES | 1,740 | 5,747 | 345.12 |
30 changes: 0 additions & 30 deletions docs/performance-results/i7-6500U-16GB.md

This file was deleted.

32 changes: 32 additions & 0 deletions docs/performance-results/i7-6700K-32GB-16KB.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz with 32 GB of RAM installed.
DMQPerf.exe mq single-process 1 100000 4 50 10
Running MQ performance tests.

FrameBufferSize: 16381; SendAndReceiveBufferSize: 16384

| Build | Messages | Msg Bytes | Milliseconds | Msg/sec | MBps |
|---------|------------|-----------|--------------|------------|----------|
| Release | 1,000,000 | 200 | 821 | 1,218,026 | 243.61 |
| Release | 1,000,000 | 200 | 775 | 1,290,322 | 258.06 |
| Release | 1,000,000 | 200 | 780 | 1,282,051 | 256.41 |
| Release | 1,000,000 | 200 | 786 | 1,272,264 | 254.45 |
| Release | 1,000,000 | 200 | 783 | 1,277,139 | 255.43 |
| | | AVERAGES | 789 | 1,267,960 | 253.59 |

| Build | Messages | Msg Bytes | Milliseconds | Msg/sec | MBps |
|---------|------------|-----------|--------------|------------|----------|
| Release | 100,000 | 2,000 | 315 | 317,460 | 634.92 |
| Release | 100,000 | 2,000 | 296 | 337,837 | 675.68 |
| Release | 100,000 | 2,000 | 296 | 337,837 | 675.68 |
| Release | 100,000 | 2,000 | 297 | 336,700 | 673.40 |
| Release | 100,000 | 2,000 | 305 | 327,868 | 655.74 |
| | | AVERAGES | 302 | 331,540 | 663.08 |

| Build | Messages | Msg Bytes | Milliseconds | Msg/sec | MBps |
|---------|------------|-----------|--------------|------------|----------|
| Release | 10,000 | 60,048 | 814 | 12,285 | 737.69 |
| Release | 10,000 | 60,048 | 836 | 11,961 | 718.28 |
| Release | 10,000 | 60,048 | 832 | 12,019 | 721.73 |
| Release | 10,000 | 60,048 | 814 | 12,285 | 737.69 |
| Release | 10,000 | 60,048 | 828 | 12,077 | 725.22 |
| | | AVERAGES | 825 | 12,125 | 728.12 |
30 changes: 0 additions & 30 deletions docs/performance-results/i7-6700K-32GB.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public MqPerformanceTest(string[] args) {


} else if (mode == "client") {
WriteSysInfo();
Console.WriteLine("| Messages | Msg Bytes | Milliseconds | Msg/sec | MBps |");
Console.WriteLine("|------------|-----------|--------------|------------|----------|");

Expand All @@ -57,10 +56,7 @@ public MqPerformanceTest(string[] args) {
StartServer(total_messages, total_clients);

} else if (mode == "single-process") {
using (var cc = new ConsoleCopy("MessageQueuePerformanceTest.txt")) {
WriteSysInfo();
MqInProcessTest();
}
MqInProcessTest();

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static void WriteSysInfo() {

long mem_kb;
GetPhysicallyInstalledSystemMemory(out mem_kb);
Console.WriteLine(" with " + (mem_kb / 1024 / 1024) + " GB of RAM installed.\r\n");
Console.WriteLine(" with " + (mem_kb / 1024 / 1024) + " GB of RAM installed.");
}


Expand Down
28 changes: 18 additions & 10 deletions src/DtronixMessageQueue.Tests.Performance/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Linq;
using System.Management;
using System.Reflection;
using System.Runtime.InteropServices;
Expand All @@ -15,16 +16,23 @@ class Program {

static void Main(string[] args) {
var mode = args.Length == 0 ? null : args[0];
switch (mode) {
case "mq":
Console.WriteLine("Running MQ performance tests.\r\n");
new MqPerformanceTest(args);
break;

default:
Console.WriteLine("Running RPC performance tests.\r\n");
new RpcPerformanceTest(args);
break;
var file_name = string.Join("-", args);
using (var cc = new ConsoleCopy($"MessageQueuePerformanceTest-{file_name}.txt")) {
PerformanceTestBase.WriteSysInfo();

Console.WriteLine($"DMQPerf.exe {string.Join(" ", args)}");

switch (mode) {
case "mq":
Console.WriteLine("Running MQ performance tests.\r\n");
new MqPerformanceTest(args);
break;

default:
Console.WriteLine("Running RPC performance tests.\r\n");
new RpcPerformanceTest(args);
break;
}
}

Console.ReadLine();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public RpcPerformanceTest(string[] args) {
Port = 2828
};

RpcSingleProcessTest(100000, 4, config, RpcTestType.NoRetrun);
RpcSingleProcessTest(200000, 4, config, RpcTestType.NoRetrun);

RpcSingleProcessTest(10000, 4, config, RpcTestType.Return);

Expand All @@ -35,7 +35,7 @@ private void RpcSingleProcessTest(int runs, int loops, RpcConfig config, RpcTest
var complete_test = new AutoResetEvent(false);
var client = new RpcClient<SimpleRpcSession, RpcConfig>(config);

server.Connected += (sender, args) => {
server.SessionSetup += (sender, args) => {
test_service = new TestService();
args.Session.AddService(test_service);

Expand Down Expand Up @@ -100,6 +100,7 @@ private void RpcSingleProcessTest(int runs, int loops, RpcConfig config, RpcTest


client.Connected += (sender, args) => {
Thread.Sleep(300);
args.Session.AddProxy<ITestService>(new TestService());
var service = client.Session.GetProxy<ITestService>();
service.TestSetup(runs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@
<Compile Include="Utilities.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="NLog.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/DtronixMessageQueue.Tests/Mq/MqTestsBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class MqTestsBase : IDisposable {

public Exception LastException { get; set; }

public TimeSpan TestTimeout { get; set; } = new TimeSpan(0, 0, 0, 0, 60000);
public TimeSpan TestTimeout { get; set; } = new TimeSpan(0, 0, 0, 0, 2000);

public ManualResetEventSlim TestStatus { get; set; } = new ManualResetEventSlim(false);

Expand Down
46 changes: 0 additions & 46 deletions src/DtronixMessageQueue.Tests/NLog.config

This file was deleted.

3 changes: 2 additions & 1 deletion src/DtronixMessageQueue/DtronixMessageQueue.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,15 @@
<Compile Include="Rpc\RpcSession.cs" />
<Compile Include="Rpc\SerializationStore.cs" />
<Compile Include="Socket\BufferManager.cs" />
<Compile Include="Socket\ISetupSocketSession.cs" />
<Compile Include="Socket\SessionEventArgs.cs" />
<Compile Include="Socket\SessionClosedEventArgs.cs" />
<Compile Include="Socket\SocketAsyncEventArgsPool.cs" />
<Compile Include="Socket\SocketBase.cs" />
<Compile Include="Socket\SocketClient.cs" />
<Compile Include="Socket\SocketCloseReason.cs" />
<Compile Include="Socket\SocketConfig.cs" />
<Compile Include="Socket\SocketMode.cs" />
<Compile Include="Socket\SocketServer.cs" />
<Compile Include="Socket\SocketSession.cs" />
<Compile Include="Utilities.cs" />
Expand All @@ -82,7 +84,6 @@
</Content>
<None Include="packages.config" />
<Compile Include="MqFrameBuilder.cs" />
<Compile Include="MqPostmaster.cs" />
<Compile Include="IncomingMessageEventArgs.cs" />
<Compile Include="MqClient.cs" />
<Compile Include="MqFrame.cs" />
Expand Down
25 changes: 6 additions & 19 deletions src/DtronixMessageQueue/MqClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ public class MqClient<TSession, TConfig> : SocketClient<TSession, TConfig>
where TSession : MqSession<TSession, TConfig>, new()
where TConfig : MqConfig {

/// <summary>
/// Internal postmaster.
/// </summary>
private readonly MqPostmaster<TSession, TConfig> postmaster;

/// <summary>
/// Event fired when a new message arrives at the mailbox.
/// </summary>
Expand All @@ -37,10 +32,8 @@ public MqClient(TConfig config) : base(config) {

// Override the default connection limit and read/write workers.
config.MaxConnections = 1;
config.MaxReadWriteWorkers = 4;
config.MaxWorkingThreads = 2;
timeout_timer = new Timer(TimeoutCallback);
postmaster = new MqPostmaster<TSession, TConfig>(config);

Setup();
}

Expand Down Expand Up @@ -80,9 +73,8 @@ private void OnIncomingMessage(object sender, IncomingMessageEventArgs<TSession,
IncomingMessage?.Invoke(sender, e);
}

protected override TSession CreateSession(System.Net.Sockets.Socket socket) {
var session = base.CreateSession(socket);
session.Postmaster = postmaster;
protected override TSession CreateSession() {
var session = base.CreateSession();
session.IncomingMessage += OnIncomingMessage;
session.BaseSocket = this;
return session;
Expand All @@ -102,12 +94,8 @@ public void Send(MqFrame frame) {
/// </summary>
/// <param name="message">Message to send.</param>
public void Send(MqMessage message) {
if (message.Count == 0) {
return;
}

// Enqueue the outgoing message to be processed by the postmaster.
Session.EnqueueOutgoingMessage(message);
// Send the outgoing message to the session to be processed by the postmaster.
Session.Send(message);
}

public void Close() {
Expand All @@ -120,9 +108,8 @@ public void Close() {
/// Disposes of all resources associated with this client.
/// </summary>
public void Dispose() {
postmaster.Dispose();
timeout_timer.Dispose();

Session.Dispose();
}

}
Expand Down
Loading

0 comments on commit 4a36f9a

Please sign in to comment.