Skip to content

Commit

Permalink
Enhanced DPR (#521)
Browse files Browse the repository at this point in the history
* [C#] Expand async session-free API sample in playground (#452)

* added sample
* cleaned up async stress
* Fix memory leak + add serialized wrapper sample
* added testcases for concurrency within session in async.
* clean up LMD

* YCSB improvements to test incr-snapshot (#454)

* [C#] minor cleanup

* [C#] remote update to latest IFunctions

* Update 01-quick-start-guide.md

* Update home.md

* [C#] update docs

* fix(docs): corrects typo in project documentation (#456)

* Initial checkin of test suite for remote

* updated configs.

* validate incoming payload before resuming epoch. (#459)

* [C#] Test suite for remote FASTER (#458)

* Initial checkin of test suite for remote

* updated configs.

* fix sln

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update 50-remote-basics.md

* Update 50-remote-basics.md

* [C#] Remote tests disposal (#460)

* Initial checkin of test suite for remote

* updated configs.

* fix sln

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Ensure correct disposals of server and client.

* rename testcase

* Update 50-remote-basics.md

* Update 50-remote-basics.md

* Enable SourceLink integration (#457)

* clean sln

* update docs

* update docs

* [C#] update remote testcases to cover varlen

* Update 96-slides-videos.md

* [C#] Fix double dispose in CompletePendingWithOutputs (#465)

* [C#] Fix double dispose in CompletePendingWithOutputs
* Update MultiReadSpanByteKey.cs
* Cleaned up testcase, merged with other SpanByte test.

Co-authored-by: Tim Coleman <timothy.coleman@gmail.com>

* [C#] [FasterLog] Create AsyncPool objects on demand (instead of prepopulating) (#455)

* don't pre-create 120 read and 120 write file handles.

* fix asyncpool semaphore sizing.

allow control over LocalStorageNamedDeviceFactory's Device.ThrottleLimit

* dispose off the semaphore in AsyncPool.Dispose()

* minor fixes to AsyncPool.

* Speed up async pool.

* Fix ordering of GetOrAdd and wait.

Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>

* [C#] Updated SpanByte sample with RMW for ASCII number sums (#462)

* Updated SpanByte sample with RMW for ASCII number sums
* Sample refactoring as class per sub-sample

* Update 20-fasterkv-basics.md

* Update 20-fasterkv-basics.md

* Update 20-fasterkv-basics.md

* Update home.md

* [C#] update csproj

* Update home.md

* Fix typo (#468)

* Update 25-fasterkv-recovery.md

* Update 23-fasterkv-tuning.md

* Update 23-fasterkv-tuning.md

* Fix docs typo (#470)

* [C#] Support reducing memory footprint of pages in log (#467)

* [C#] Support reducing memory footprint of base hlog circular buffer.

* Update 23-fasterkv-tuning.md

* updates

* cleanup

* Add Log API to set page count with option to wait for address shift to complete.

* [C#] Add testcase: resume iterator with async enumerable (#471)

* [C#] Fix timing issue in testcase

* Update 23-fasterkv-tuning.md

* [C#] benchmark tuning for IOPS

* [C#] WaitAsync should return false if iterator has reached end of scan range.

* Fix azure blob list contents logic

* [C#] Fixes and refactoring of FASTERAsync (#480)

* Fix to move await of flushtask to Slow*Async

* Fix setting of RecordInfo in ReadAsync

* FASTERAsync: do not use CompleteAsync.GetAwaiter() in Complete()

* fix asyncOp and asyncOperation usage

* Add XML comment for throttleLimit param

* Change flushTask to a SemaphoreSlim to avoid GetAwaiter().GetResult() in the sync case

* Add AsyncPool.Get() for sync paths and change MLSD to use it instead of GetAwaiter().GetResult()

* Add ConfigureAwait(false) to all awaits

* Break FASTERAsync out to separate files

* Prep for RMW refactor

* Rename UpdelAsync -> UpdateAsync

* Refactor RMWAsync to use UpdateAsync

* Add GetAwaiter().GetResult in one void-returning function where it can't be avoided,

* Update AsyncStress to include options for rmw-only, upsert-only, large vs. small memory log, and whether to use Value, Reference, or Span data types

* Remove obsolete RecordAccessor.cs

* Make IHeapContainer implement IDisposable

* Fix the TakeFullCheckpoint overload without CheckpointType to call through to the overload with it

* Update session.XxxAsync() doc comments for clarity and to emphasize the need to complete operations to avoid leaks

* add raw stddev %s to output

* Add -NoLock option to compare_runs

* Add comments to IUpdateAsyncOperation; fix comment on ccompare_runs

Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com>

* Update home.md

* [C#] Fix read cache boundary condition bug (#483)

* [C++] Fix epoch scan range (#484)

* [C++] Fix epoch scan range

* updates

* fix testcase

* Update home.md

* add FASTER.benchmark cmdline options: --sd --sm --noaff --chkptms --dumpdist (#485)

* LogCommitFile is obsolete - commit file naming is handled automatically by default commit manager. (#494)

* Update 40-fasterlog-basics.md

* [C#] Update to C#9 (#486)

* Add <LangVersion>latest to csprojs to pick up C#9; remove "is {}" in favor of "is not null";  use "Type x = new()", which is particularly useful for field definitions
* Add net5.0 framework to core component builds; add "|| NET" to "#if NETSTANDARD" where necessary; switch samples to net5.0; add Debug builds to Linux
* Update azure-pipelines.yml
* Move C# Windows tasks to dotnet; add build/test tasks for Remote to C# pipelines
* search for all *.test.csproj in build/test tasks
* Restrict Linux to netcoreapp3.1 and net5.0
* remove duplicate langversion

Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>

* [C#] Add infrastructure to support more wire protocols (#496)

* Add BackendProvider concept to support backend other than FasterKV. Add protocol byte to binary protocol to enable support for more protocols in the future.

* Fix some typos and add some comments

* add .idea to gitignore

* Add constructor overload to avoid API change, tweaks to serialization performance.

* remove unused import

* Cleanup & minor perf improvements

Co-authored-by: Tianyu Li <t-litianyu@microsoft.com>
Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>

* [C#] Remote provider enhancements (#503)

* Refactor remote provider

* Cleanup and speedup

* cleanup and updates

* Add a link to the DPR branch (#506)

Co-authored-by: Tianyu Li <t-litianyu@microsoft.com>

* [C#] Recovery testcase fixing (#513)

* make error more detailed

* try sorting by creation time for linux compat

* change test to use specific token, as workaround for linux timestamp sorting granularity issue.

* Ignore socket disposal exception in RecvEventArg_Completed

* Restore full Azure pipeline

* Add dependency bytes parameter to state objects

* Partial implementation with new DprFinder

* Failure-free coordinator code path

* checkpoint

* Various client/server side changes to make enhanced DPR work

* Remaining Enhanced DPR artifacts

* Repurposed DPR finder benchmark for the new implementations

* [C#] Add Output to RMW (#515)

* Add Output to RMW:
- ** BREAKING CHANGE ** I(Advanced)Functions.CopyUpdater, InitialUpdater, InPlaceUpdater, and RMWCompletionCallback now have a ref Output parameter
- ** BREAKING CHANGE ** RmwAsyncResult.Complete now returns a (Status, Output) tuple

* Fix Remote IFunctions implementations to new RMW signatures

* Change RMW callback signature (move Output to end)

* Update Remote to new RMW Output signature; add $ReadPercentages to run_benchmark

* Add Output to NeedCopyUpdate as well

* Propagate RMW Output throughout Remote (ICallbackFunctions etc.); update docs for RMW Output

* basic test and some fixes

* [C#] SpanByteFasterKVProvider (#520)

* Added SpanByteFasterKVProvider, and changed SpanByteSerializer to SpanByteServerSerializer and SpanByteClientSerializer

* Removed unnecessary functions / debugs

* fixed nit

* [C#] Support FasterLog commit dir specification in settings (#519)

* Support log commit path specification to FasterLog.

* updates

* Convert serialized SpanByte into its non-serialized form (safe to heap-copy as long as underlying payload is fixed)

* minor updates.

* minor

* Fixes and Refactors

* Code cleanup for EnhancedDprFinder backend

* DprFinder benchmark + some fixes for enhanced DPR finder

* add no delay

* fix race

* Code cleanup

Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
Co-authored-by: Jeffrey <61218880+plan-do-break-fix@users.noreply.github.com>
Co-authored-by: hiteshmadan <hitesh.madan@microsoft.com>
Co-authored-by: Tim Coleman <timothy.coleman@gmail.com>
Co-authored-by: David Nepožitek <david@nepozitek.cz>
Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com>
Co-authored-by: Tianyu Li <t-litianyu@microsoft.com>
Co-authored-by: rohankadekodi-msr <69916400+rohankadekodi-msr@users.noreply.github.com>
  • Loading branch information
9 people committed Jul 13, 2021
1 parent 117eb74 commit ffe5dc1
Show file tree
Hide file tree
Showing 264 changed files with 8,756 additions and 3,653 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,8 @@ nativebin/
.idea/



# JetBrains
cs/.idea/
cs/remote/.idea
cs/libdpr/.idea
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ workloads. Start learning about FASTER, its unique capabilities, and how to get

[aka.ms/FASTER](https://aka.ms/FASTER)

For a preview of our new distributed recovery algorithm of DPR, please take a look at [the DPR development branch](https://github.com/microsoft/FASTER/tree/dpr)


# Contributing

Expand Down
102 changes: 34 additions & 68 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
variables:
solution: 'cs/FASTER.sln'
solutionRemote: 'cs/remote/FASTER.remote.sln'
RunAzureTests: 'yes'

jobs:
Expand All @@ -26,18 +27,6 @@ jobs:
buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'

- task: VSBuild@1
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'

- powershell: 'Invoke-WebRequest -OutFile azure-storage-emulator.msi -Uri "https://go.microsoft.com/fwlink/?LinkId=717179&clcid=0x409"'
displayName: 'Download Azure Storage Emulator'

Expand All @@ -50,43 +39,22 @@ jobs:
- script: '"C:\storage-emulator\root\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe" start'
displayName: 'Start Storage Emulator'

- task: VSTest@2
inputs:
testAssemblyVer2: |
**\$(BuildConfiguration)\net46*\*test.dll
**\$(BuildConfiguration)\**\net46*\*test.dll
!**\*Microsoft.VisualStudio.TestPlatform*
!**\obj\**
!**\*TestAdapter.dll
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
otherConsoleOptions: '/Framework:.NETFramework,Version=v4.0'

- task: VSTest@2
inputs:
testAssemblyVer2: |
**\$(BuildConfiguration)\netcoreapp2*\*test.dll
**\$(BuildConfiguration)\**\netcoreapp2*\*test.dll
!**\*Microsoft.VisualStudio.TestPlatform*
!**\obj\**
!**\*TestAdapter.dll
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
otherConsoleOptions: '/Framework:.NETCoreApp,Version=v2.2'

- task: VSTest@2
- task: DotNetCoreCLI@2
displayName: 'dotnet build $(buildConfiguration)'
inputs:
testAssemblyVer2: |
**\$(BuildConfiguration)\netcoreapp3*\*test.dll
**\$(BuildConfiguration)\**\netcoreapp3*\*test.dll
!**\*Microsoft.VisualStudio.TestPlatform*
!**\obj\**
!**\*TestAdapter.dll
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
otherConsoleOptions: '/Framework:.NETCoreApp,Version=v3.1'
command: 'build'
projects: '**/*.test.csproj'
arguments: '--configuration $(buildConfiguration)'

- task: DotNetCoreCLI@2
displayName: 'dotnet test $(buildConfiguration)'
inputs:
command: test
projects: '**/*.test.csproj'
arguments: '--configuration $(buildConfiguration) -l "console;verbosity=detailed"'

- task: PublishTestResults@2
displayName: 'Publish Test Results'
inputs:
testRunner: VSTest
testResultsFiles: '**/*.trx'
Expand Down Expand Up @@ -126,7 +94,7 @@ jobs:

- job: 'cppLinux'
pool:
vmImage: ubuntu-16.04
vmImage: ubuntu-18.04
displayName: 'C++ (Linux)'

steps:
Expand Down Expand Up @@ -155,35 +123,33 @@ jobs:
- job: 'csharpLinux'
pool:
vmImage: ubuntu-16.04
vmImage: ubuntu-18.04
displayName: 'C# (Linux)'

steps:
- task: NuGetToolInstaller@1
inputs:
versionSpec: '5.5.0'

- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
strategy:
maxParallel: 2
matrix:
AnyCPU-Debug:
buildPlatform: 'Any CPU'
buildConfiguration: 'Debug'
AnyCPU-Release:
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'

- task: UseDotNet@2
steps:
- task: DotNetCoreCLI@2
displayName: 'dotnet build $(buildConfiguration)'
inputs:
packageType: 'sdk'
version: '3.1.201'

- script: |
mono --version
msbuild /version
msbuild /t:restore $(solution)
msbuild /p:Configuration=Release $(solution)
displayName: 'Build'
command: 'build'
projects: '**/*.test.csproj'
arguments: '--configuration $(buildConfiguration)'

- task: DotNetCoreCLI@2
displayName: 'dotnet test $(buildConfiguration)'
inputs:
command: test
projects: '**/test/*.csproj'
arguments: '--configuration $(buildConfiguration) --framework netcoreapp3.1 -l "console;verbosity=detailed"'
projects: '**/*.test.csproj'
arguments: '--configuration $(buildConfiguration) -l "console;verbosity=detailed"'

- task: PublishTestResults@2
displayName: 'Publish Test Results'
Expand Down
21 changes: 8 additions & 13 deletions cc/src/core/light_epoch.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ class LightEpoch {
static constexpr uint32_t kDrainListSize = 256;
/// Epoch table
Entry* table_;
/// Number of entries in epoch table.
uint32_t num_entries_;

/// List of action, epoch pairs containing actions to performed when an epoch becomes
/// safe to reclaim.
Expand All @@ -137,25 +135,23 @@ class LightEpoch {
/// Cached value of epoch that is safe to reclaim
std::atomic<uint64_t> safe_to_reclaim_epoch;

LightEpoch(uint32_t size = kTableSize)
LightEpoch()
: table_{ nullptr }
, num_entries_{ 0 }
, drain_count_{ 0 }
, drain_list_{} {
Initialize(size);
Initialize();
}

~LightEpoch() {
Uninitialize();
}

private:
void Initialize(uint32_t size) {
num_entries_ = size;
void Initialize() {
// do cache-line alignment
table_ = reinterpret_cast<Entry*>(aligned_alloc(Constants::kCacheLineBytes,
(size + 2) * sizeof(Entry)));
new(table_) Entry[size + 2];
(kTableSize + 2) * sizeof(Entry)));
new(table_) Entry[kTableSize + 2];
current_epoch = 1;
safe_to_reclaim_epoch = 0;
for(uint32_t idx = 0; idx < kDrainListSize; ++idx) {
Expand All @@ -167,7 +163,6 @@ class LightEpoch {
void Uninitialize() {
aligned_free(table_);
table_ = nullptr;
num_entries_ = 0;
current_epoch = 1;
safe_to_reclaim_epoch = 0;
}
Expand Down Expand Up @@ -272,7 +267,7 @@ class LightEpoch {
/// Compute latest epoch that is safe to reclaim, by scanning the epoch table
uint64_t ComputeNewSafeToReclaimEpoch(uint64_t current_epoch_) {
uint64_t oldest_ongoing_call = current_epoch_;
for(uint32_t index = 1; index <= num_entries_; ++index) {
for(uint32_t index = 0; index < kTableSize; ++index) {
uint64_t entry_epoch = table_[index].local_current_epoch;
if(entry_epoch != kUnprotected && entry_epoch < oldest_ongoing_call) {
oldest_ongoing_call = entry_epoch;
Expand All @@ -294,7 +289,7 @@ class LightEpoch {

/// CPR checkpoint functions.
inline void ResetPhaseFinished() {
for(uint32_t idx = 1; idx <= num_entries_; ++idx) {
for(uint32_t idx = 0; idx < kTableSize; ++idx) {
assert(table_[idx].phase_finished.load() == Phase::REST ||
table_[idx].phase_finished.load() == Phase::INDEX_CHKPT ||
table_[idx].phase_finished.load() == Phase::PERSISTENCE_CALLBACK ||
Expand All @@ -308,7 +303,7 @@ class LightEpoch {
uint32_t entry = Thread::id();
table_[entry].phase_finished = phase;
// Check if other threads have reported complete.
for(uint32_t idx = 1; idx <= num_entries_; ++idx) {
for(uint32_t idx = 0; idx < kTableSize; ++idx) {
Phase entry_phase = table_[idx].phase_finished.load();
uint64_t entry_epoch = table_[idx].local_current_epoch;
if(entry_epoch != 0 && entry_phase != phase) {
Expand Down
6 changes: 6 additions & 0 deletions cc/test/paging_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,9 @@ TEST(CLASS, UpsertRead_Concurrent) {
ASSERT_TRUE(result);
ASSERT_EQ(kNumRecords, records_read.load());

// Stop session as we are going to wait for threads
store.StopSession();

//// Update.
num_writes = 0;
threads.clear();
Expand All @@ -550,6 +553,9 @@ TEST(CLASS, UpsertRead_Concurrent) {

ASSERT_EQ(kNumRecords, num_writes.load());

// Restart session
store.StartSession();

// Delete some old copies of records (160 MB) that we no longer need.
static constexpr uint64_t kNewBeginAddress{ 167772160L };
static std::atomic<bool> truncated{ false };
Expand Down
4 changes: 4 additions & 0 deletions cs/FASTER.sln
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{C60F148B-2
..\docs\_docs\02-faqs.md = ..\docs\_docs\02-faqs.md
..\docs\_docs\20-fasterkv-basics.md = ..\docs\_docs\20-fasterkv-basics.md
..\docs\_docs\23-fasterkv-tuning.md = ..\docs\_docs\23-fasterkv-tuning.md
..\docs\_docs\25-fasterkv-recovery.md = ..\docs\_docs\25-fasterkv-recovery.md
..\docs\_docs\26-fasterkv-samples.md = ..\docs\_docs\26-fasterkv-samples.md
..\docs\_docs\29-fasterkv-cpp.md = ..\docs\_docs\29-fasterkv-cpp.md
..\docs\_docs\40-fasterlog-basics.md = ..\docs\_docs\40-fasterlog-basics.md
Expand All @@ -81,6 +82,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{C60F148B-2
..\docs\_docs\90-td-introduction.md = ..\docs\_docs\90-td-introduction.md
..\docs\_docs\95-research-papers.md = ..\docs\_docs\95-research-papers.md
..\docs\_docs\96-slides-videos.md = ..\docs\_docs\96-slides-videos.md
..\docs\_config.yml = ..\docs\_config.yml
..\docs\_pages\home.md = ..\docs\_pages\home.md
..\docs\_data\navigation.yml = ..\docs\_data\navigation.yml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TstRunner", "playground\TstRunner\TstRunner.csproj", "{A265D9D2-3FEA-48BB-B1CC-273ECFEA0611}"
Expand Down

0 comments on commit ffe5dc1

Please sign in to comment.