Skip to content

Instantly share code, notes, and snippets.

@ayende
Created August 29, 2018 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayende/785cfa6107332a8c9c2b203d30bf8e7e to your computer and use it in GitHub Desktop.
Save ayende/785cfa6107332a8c9c2b203d30bf8e7e to your computer and use it in GitHub Desktop.
cs/benchmark/FasterYcsbBenchmark.cs | 33 ++++++++++++++++++++-------------
1 file changed, 20 insertions(+), 13 deletions(-)
diff --git a/cs/benchmark/FasterYcsbBenchmark.cs b/cs/benchmark/FasterYcsbBenchmark.cs
index 5f489e5..d0f0b1e 100644
--- a/cs/benchmark/FasterYcsbBenchmark.cs
+++ b/cs/benchmark/FasterYcsbBenchmark.cs
@@ -8,6 +8,7 @@
using FASTER.core;
using System;
+using System.Collections.Concurrent;
using System.Diagnostics;
using System.IO;
using System.Net;
@@ -65,6 +66,8 @@ namespace FASTER.benchmark
volatile bool done = false;
+ public ConcurrentDictionary<Key, Value> _dic = new ConcurrentDictionary<Key, Value>();
+
public FASTER_YcsbBenchmark(int threadCount_, int numaStyle_, string distribution_, int readPercent_)
{
threadCount = threadCount_;
@@ -132,6 +135,7 @@ namespace FASTER.benchmark
Key key = init_keys_[idx];
store.Upsert(&key, &value, null, 1);
+ _dic[key] = value;
}
#if DASHBOARD
count += (int)kChunkSize;
@@ -203,26 +207,28 @@ namespace FASTER.benchmark
if (idx % 256 == 0)
{
- store.Refresh();
+ //store.Refresh();
- if (idx % 65536 == 0)
- {
- store.CompletePending(false);
- }
+ //if (idx % 65536 == 0)
+ //{
+ // store.CompletePending(false);
+ //}
}
switch (op)
{
case Op.Upsert:
{
- store.Upsert(local_txn_keys_ptr, &value, null, 1);
+ _dic[*local_txn_keys_ptr] = value;
+ //store.Upsert(local_txn_keys_ptr, &value, null, 1);
++writes_done;
break;
}
case Op.Read:
{
- Status result = store.Read(local_txn_keys_ptr, null, (Output*)&value, null, 1);
- if (result == Status.OK)
+ _dic.TryGetValue(*local_txn_keys_ptr, out value);
+ //Status result = store.Read(local_txn_keys_ptr, null, (Output*)&value, null, 1);
+ //if (result == Status.OK)
{
++reads_done;
}
@@ -230,11 +236,12 @@ namespace FASTER.benchmark
}
case Op.ReadModifyWrite:
{
- Status result = store.RMW(local_txn_keys_ptr, input_ptr + (idx & 0x7), null, 1);
- if (result == Status.OK)
- {
- ++writes_done;
- }
+ Console.WriteLine("....");
+ //Status result = store.RMW(local_txn_keys_ptr, input_ptr + (idx & 0x7), null, 1);
+ //if (result == Status.OK)
+ //{
+ // ++writes_done;
+ //}
break;
}
default:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment