From 64fe2a57f376ab3649f8984171fa6eb9c0be12c5 Mon Sep 17 00:00:00 2001 From: neuecc Date: Fri, 8 Apr 2022 07:52:00 +0900 Subject: [PATCH] bench --- sandbox/NatsBenchmark/Program.cs | 44 +++++++++++++++++--------------- tools/nats-bench.bat | 1 + 2 files changed, 24 insertions(+), 21 deletions(-) create mode 100644 tools/nats-bench.bat diff --git a/sandbox/NatsBenchmark/Program.cs b/sandbox/NatsBenchmark/Program.cs index d19d4c1ca..9e32dadc3 100644 --- a/sandbox/NatsBenchmark/Program.cs +++ b/sandbox/NatsBenchmark/Program.cs @@ -81,6 +81,8 @@ void RunPubSubAlterNats(string testName, long testCount, long testSize, bool dis pubConn.ConnectAsync().AsTask().Wait(); subConn.ConnectAsync().AsTask().Wait(); + + var key = new NatsKey(subject); var d = subConn.SubscribeAsync(subject, _ => @@ -479,31 +481,31 @@ void runSuite() GC.WaitForPendingFinalizers(); GC.Collect(); - //runPubSubVector3("PubSubVector3", 10000000); - //runPubSub("PubSubNo", 10000000, 0); - //runPubSub("PubSub8b", 10000000, 8); - //runPubSub("PubSub32b", 10000000, 32); - //runPubSub("PubSub100b", 10000000, 100); - //runPubSub("PubSub256b", 10000000, 256); - //runPubSub("PubSub512b", 500000, 512); - //runPubSub("PubSub1k", 500000, 1024); - //runPubSub("PubSub4k", 500000, 1024 * 4); - //runPubSub("PubSub8k", 100000, 1024 * 8); + runPubSubVector3("PubSubVector3", 10000000); + runPubSub("PubSubNo", 10000000, 0); + runPubSub("PubSub8b", 10000000, 8); + runPubSub("PubSub32b", 10000000, 32); + runPubSub("PubSub100b", 10000000, 100); + runPubSub("PubSub256b", 10000000, 256); + runPubSub("PubSub512b", 500000, 512); + runPubSub("PubSub1k", 500000, 1024); + runPubSub("PubSub4k", 500000, 1024 * 4); + runPubSub("PubSub8k", 100000, 1024 * 8); - //RunPubSubAlterNatsVector3("AlterNatsV3", 10000000); - //RunPubSubAlterNats("AlterNatsNo", 10000000, 0); + RunPubSubAlterNatsVector3("AlterNatsV3", 10000000); + RunPubSubAlterNats("AlterNatsNo", 10000000, 0); RunPubSubAlterNats("AlterNats8b", 10000000, 8); - // RunPubSubAlterNatsPubSub2("AlterNats8b 2", 10000000, 8); - - //RunPubSubAlterNats("AlterNats32b", 10000000, 32); - //RunPubSubAlterNats("AlterNats100b", 10000000, 100); - //RunPubSubAlterNats("AlterNats256b", 10000000, 256); - //RunPubSubAlterNats("AlterNats512b", 500000, 512); - //RunPubSubAlterNats("AlterNats1k", 500000, 1024); - //RunPubSubAlterNats("AlterNats4k", 500000, 1024 * 4); - //RunPubSubAlterNats("AlterNats8k", 100000, 1024 * 8); + //RunPubSubAlterNatsPubSub2("AlterNats8b 2", 10000000, 8); + + RunPubSubAlterNats("AlterNats32b", 10000000, 32); + RunPubSubAlterNats("AlterNats100b", 10000000, 100); + RunPubSubAlterNats("AlterNats256b", 10000000, 256); + RunPubSubAlterNats("AlterNats512b", 500000, 512); + RunPubSubAlterNats("AlterNats1k", 500000, 1024); + RunPubSubAlterNats("AlterNats4k", 500000, 1024 * 4); + RunPubSubAlterNats("AlterNats8k", 100000, 1024 * 8); // Redis? // RunPubSubRedis("StackExchange.Redis", 10000000, 8); diff --git a/tools/nats-bench.bat b/tools/nats-bench.bat new file mode 100644 index 000000000..9b465dfbd --- /dev/null +++ b/tools/nats-bench.bat @@ -0,0 +1 @@ +nats.exe bench foo --pub 1 --sub 1 --size 8 --msgs 10000000 \ No newline at end of file