forked from microsoft/garnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enforce memory size constraint during recovery (microsoft#276)
* Initial draft. * Additiional changes. * Fixed setting head address. * Cleanup. * Updates to free previously allocated pages that could violate size constraint. Added a wait for page flush before reading into the same slot. * Moved to a batch read approach. * Added logger to test instance of GarnetServer. * Cleanup. * Fix read page range up to snapshotendpage. * Resolved PR comments. * Added benchmark. Resolved PR comments. * Initial draft. * Additiional changes. * Fixed setting head address. * Cleanup. * Updates to free previously allocated pages that could violate size constraint. Added a wait for page flush before reading into the same slot. * Moved to a batch read approach. * Added logger to test instance of GarnetServer. * Cleanup. * Fix read page range up to snapshotendpage. * Resolved PR comments. * Added benchmark. Resolved PR comments. * Fixed formatting. * Opt out of test logger by default --------- Co-authored-by: Yoganand Rajasekaran <yrajas@ntdev.microsoft.com> Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
- Loading branch information
1 parent
dc7b517
commit 41e9ebd
Showing
10 changed files
with
360 additions
and
84 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
using BenchmarkDotNet.Attributes; | ||
using BenchmarkDotNet.Columns; | ||
using BenchmarkDotNet.Configs; | ||
using Embedded.perftest; | ||
using Garnet.server; | ||
|
||
namespace BDN.benchmark | ||
{ | ||
public class CustomConfig : ManualConfig | ||
{ | ||
public CustomConfig() | ||
{ | ||
AddColumn(StatisticColumn.Mean); | ||
AddColumn(StatisticColumn.StdDev); | ||
AddColumn(StatisticColumn.Median); | ||
AddColumn(StatisticColumn.P90); | ||
AddColumn(StatisticColumn.P95); | ||
} | ||
} | ||
|
||
[Config(typeof(CustomConfig))] | ||
public class RecoveryBenchmark | ||
{ | ||
[ParamsSource(nameof(CommandLineArgsProvider))] | ||
public string LogDir { get; set; } | ||
|
||
public IEnumerable<string> CommandLineArgsProvider() | ||
{ | ||
// Return the command line arguments as an enumerable | ||
return Environment.GetCommandLineArgs().Skip(1); | ||
} | ||
|
||
[Params("100m")] | ||
public string MemorySize { get; set; } | ||
|
||
EmbeddedRespServer server; | ||
|
||
[IterationSetup] | ||
public void Setup() | ||
{ | ||
Console.WriteLine($"LogDir: {LogDir}"); | ||
server = new EmbeddedRespServer(new GarnetServerOptions() | ||
{ | ||
EnableStorageTier = true, | ||
LogDir = LogDir, | ||
CheckpointDir = LogDir, | ||
IndexSize = "1m", | ||
DisableObjects = true, | ||
MemorySize = MemorySize, | ||
PageSize = "32k", | ||
}); | ||
} | ||
|
||
[IterationCleanup] | ||
public void Cleanup() | ||
{ | ||
server.Dispose(); | ||
} | ||
|
||
[Benchmark] | ||
public void Recover() | ||
{ | ||
server.StoreWrapper.RecoverCheckpoint(); | ||
} | ||
} | ||
} |
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
207 changes: 127 additions & 80 deletions
207
libs/storage/Tsavorite/cs/src/core/Index/Recovery/Recovery.cs
Large diffs are not rendered by default.
Oops, something went wrong.
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