-
Notifications
You must be signed in to change notification settings - Fork 545
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into talzacc/bdn_module
- Loading branch information
Showing
42 changed files
with
3,563 additions
and
463 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<Project> | ||
<!-- Versioning property for builds and packages --> | ||
<PropertyGroup> | ||
<VersionPrefix>1.0.50</VersionPrefix> | ||
<VersionPrefix>1.0.51</VersionPrefix> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,38 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
using BenchmarkDotNet.Code; | ||
using Garnet.server; | ||
|
||
namespace BDN.benchmark.Lua | ||
{ | ||
/// <summary> | ||
/// Cluster parameters | ||
/// Lua parameters | ||
/// </summary> | ||
public struct LuaParams | ||
public readonly struct LuaParams | ||
{ | ||
public readonly LuaMemoryManagementMode Mode { get; } | ||
public readonly bool MemoryLimit { get; } | ||
|
||
/// <summary> | ||
/// Constructor | ||
/// </summary> | ||
public LuaParams() | ||
public LuaParams(LuaMemoryManagementMode mode, bool memoryLimit) | ||
{ | ||
Mode = mode; | ||
MemoryLimit = memoryLimit; | ||
} | ||
|
||
/// <summary> | ||
/// Get the equivalent <see cref="LuaOptions"/>. | ||
/// </summary> | ||
public LuaOptions CreateOptions() | ||
=> new(Mode, MemoryLimit ? "2m" : ""); | ||
|
||
/// <summary> | ||
/// String representation | ||
/// </summary> | ||
public override string ToString() | ||
{ | ||
return "None"; | ||
} | ||
=> $"{Mode},{(MemoryLimit ? "Limit" : "None")}"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
using BenchmarkDotNet.Attributes; | ||
using Embedded.server; | ||
using Garnet.server; | ||
|
||
namespace BDN.benchmark.Operations | ||
{ | ||
/// <summary> | ||
/// Benchmark for PubSubOperations | ||
/// </summary> | ||
[MemoryDiagnoser] | ||
public unsafe class PubSubOperations : OperationsBase | ||
{ | ||
static ReadOnlySpan<byte> PUBLISH => "*3\r\n$7\r\nPUBLISH\r\n$7\r\nchannel\r\n$7\r\nmessage\r\n"u8; | ||
Request publish; | ||
|
||
static ReadOnlySpan<byte> SUBSCRIBE => "*2\r\n$9\r\nSUBSCRIBE\r\n$7\r\nchannel\r\n"u8; | ||
Request subscribe; | ||
|
||
public override void GlobalSetup() | ||
{ | ||
var opts = new GarnetServerOptions | ||
{ | ||
QuietMode = true, | ||
DisablePubSub = false, | ||
}; | ||
|
||
server = new EmbeddedRespServer(opts, null, new GarnetServerEmbedded()); | ||
session = server.GetRespSession(); | ||
subscribeSession = server.GetRespSession(); | ||
|
||
SetupOperation(ref publish, PUBLISH); | ||
SetupOperation(ref subscribe, SUBSCRIBE); | ||
|
||
// Subscribe to secondary session | ||
_ = subscribeSession.TryConsumeMessages(subscribe.bufferPtr, subscribe.buffer.Length); | ||
|
||
// Warm up | ||
SlowConsumeMessage(new Span<byte>(publish.bufferPtr, publish.buffer.Length)); | ||
SlowConsumeMessage(new Span<byte>(publish.bufferPtr, publish.buffer.Length)); | ||
SlowConsumeMessage(new Span<byte>(publish.bufferPtr, publish.buffer.Length)); | ||
SlowConsumeMessage(new Span<byte>(publish.bufferPtr, publish.buffer.Length)); | ||
SlowConsumeMessage(new Span<byte>(publish.bufferPtr, publish.buffer.Length)); | ||
SlowConsumeMessage(new Span<byte>(publish.bufferPtr, publish.buffer.Length)); | ||
} | ||
|
||
[Benchmark] | ||
public void Publish() | ||
{ | ||
Send(publish); | ||
} | ||
} | ||
} |
Oops, something went wrong.