-
Notifications
You must be signed in to change notification settings - Fork 543
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add StoreFunctions and Allocator wrapper to TsavoriteKV (#542)
* WIP StoreFunctions and allocator wrapper * More WIP on StoreFunctions and Allocator wrapper * Still more WIP on StoreFunctions and Allocator wrapper * More test-conversion WIP for StoreFunctions * More StoreFunctions test-conversion WIP * More StoreFunctions test-conversion WIP * Test conversion to StoreFunctions complete; BasicTests run * Fix StoreFunctions serializers * Most tests succeed * All tests pass * Ensure kvSettings sizes are 'long' * AggressiveInline GetTailAddress() * Fix YCSB hash table size setting and add more AggressiveInlining * Convert Garnet to use StoreFunctions * formatting nits * update new ListOpsMultiple routine to StoreFunctions * Convert ISessionFunctions.Dispose* to StoreFunctions.DisposeRecord Add StoreFunctions.OnCheckpointComplete Fix allocator on UT * Streamline TAllocator in *AllocatorImpl; add some AggressiveInlining * Update StoreFunctions doc Add BDN.Benchmark RespGetSetStress Move ReadCacheSettings to its own file * Add a BDN.benchmark to Tsavorite; so far only for InliningDiagnoser tests Rename Tsavorite.benchmark.exe to YCSB.benchmark.exe and move this to be with BDN.benchmark under the benchmark directory Add some AggressiveInlining for some things shown by the diagnoser * More cleanup suggested by InliningDiagnoser: convert some set_<Property> to Set/Clear pairs, add some AggressiveInlining, and move clientSession.InPlaceUpdater into SessionFunctionsWrapper.InPlaceUpdater as it was only called once. Rename TsavoriteKVSettings to KVSettings for brevity * YCSB - fix Uniform initialization for small-data out-of-range key handling * Rename to BDN-Tsavorite.benchmark as BDN requires unique project names * Ensure BlittableAllocator k,v types are blittable * dotnet format cleanup * Modify BDN RespTsavoriteStress to be batched and avoid "fixed" * Add 'using' for MainStoreAllocator for symmetry
- Loading branch information
Showing
257 changed files
with
8,985 additions
and
7,604 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 |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
using System.Runtime.CompilerServices; | ||
using BenchmarkDotNet.Attributes; | ||
using Embedded.perftest; | ||
using Garnet.server; | ||
|
||
namespace BDN.benchmark.Resp | ||
{ | ||
public unsafe class RespTsavoriteStress | ||
{ | ||
EmbeddedRespServer server; | ||
RespServerSession session; | ||
|
||
const int batchSize = 128; | ||
|
||
static ReadOnlySpan<byte> GET => "*2\r\n$3\r\nGET\r\n$1\r\nx\r\n"u8; | ||
byte[] getRequestBuffer; | ||
byte* getRequestBufferPointer; | ||
|
||
static ReadOnlySpan<byte> SET => "*3\r\n$3\r\nSET\r\n$1\r\nx\r\n$1\r\n1\r\n"u8; | ||
byte[] setRequestBuffer; | ||
byte* setRequestBufferPointer; | ||
|
||
static ReadOnlySpan<byte> INCR => "*2\r\n$4\r\nINCR\r\n$1\r\nx\r\n"u8; | ||
byte[] incrRequestBuffer; | ||
byte* incrRequestBufferPointer; | ||
|
||
[GlobalSetup] | ||
public void GlobalSetup() | ||
{ | ||
var opt = new GarnetServerOptions | ||
{ | ||
QuietMode = true | ||
}; | ||
server = new EmbeddedRespServer(opt); | ||
session = server.GetRespSession(); | ||
|
||
CreateBuffer(GET, out getRequestBuffer, out getRequestBufferPointer); | ||
CreateBuffer(SET, out setRequestBuffer, out setRequestBufferPointer); | ||
CreateBuffer(INCR, out incrRequestBuffer, out incrRequestBufferPointer); | ||
|
||
// Set the initial value (needed for GET) | ||
_ = session.TryConsumeMessages(setRequestBufferPointer, setRequestBuffer.Length); | ||
} | ||
|
||
unsafe void CreateBuffer(ReadOnlySpan<byte> cmd, out byte[] buffer, out byte* bufferPointer) | ||
{ | ||
buffer = GC.AllocateArray<byte>(cmd.Length * batchSize, pinned: true); | ||
bufferPointer = (byte*)Unsafe.AsPointer(ref buffer[0]); | ||
for (int i = 0; i < batchSize; i++) | ||
cmd.CopyTo(new Span<byte>(buffer).Slice(i * cmd.Length)); | ||
} | ||
|
||
[GlobalCleanup] | ||
public void GlobalCleanup() | ||
{ | ||
session.Dispose(); | ||
server.Dispose(); | ||
} | ||
|
||
[Benchmark] | ||
public void Get() | ||
{ | ||
_ = session.TryConsumeMessages(getRequestBufferPointer, getRequestBuffer.Length); | ||
} | ||
|
||
[Benchmark] | ||
public void Set() | ||
{ | ||
_ = session.TryConsumeMessages(setRequestBufferPointer, setRequestBuffer.Length); | ||
} | ||
|
||
[Benchmark] | ||
public void Incr() | ||
{ | ||
_ = session.TryConsumeMessages(incrRequestBufferPointer, incrRequestBuffer.Length); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.