Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions cicada/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ REL := ../common/
include $(REL)Makefile
CICADA_ALLSRC = $(CICADA_SRCS1) $(wildcard include/*.hh)

KEY_SIZE=8
VAL_SIZE=4
ADD_ANALYSIS=1
BACK_OFF=0
INLINE_VERSION_PROMOTION=1
INLINE_VERSION_OPT=1
INLINE_VERSION_PROMOTION=1
MASSTREE_USE=1
PARTITION_TABLE=1
PARTITION_TABLE=0
REUSE_VERSION=1
SINGLE_EXEC=0
KEY_SIZE=8
VAL_SIZE=4
WRITE_LATEST_ONLY=0
WORKER1_INSERT_DELAY_RPHASE=1

CC = g++
CFLAGS = -c -pipe -g -O3 -std=c++17 -march=native \
Expand All @@ -33,6 +34,7 @@ CFLAGS = -c -pipe -g -O3 -std=c++17 -march=native \
-DREUSE_VERSION=$(REUSE_VERSION) \
-DSINGLE_EXEC=$(SINGLE_EXEC) \
-DWRITE_LATEST_ONLY=$(WRITE_LATEST_ONLY) \
-DWORKER1_INSERT_DELAY_RPHASE=$(WORKER1_INSERT_DELAY_RPHASE) \

# WRITE_LATEST_ONLY : for all write.
# original model adapt write-latest-only-rule for RMW
Expand Down
16 changes: 16 additions & 0 deletions cicada/cicada.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "../include/compiler.hh"
#include "../include/cpu.hh"
#include "../include/debug.hh"
#include "../include/delay.hh"
#include "../include/int64byte.hh"
#include "../include/procedure.hh"
#include "../include/random.hh"
Expand Down Expand Up @@ -98,10 +99,20 @@ void worker(size_t thid, char& ready, const bool& start, const bool& quit,

if (trans.status_ == TransactionStatus::abort) {
trans.earlyAbort();
#if SINGLE_EXEC
#else
trans.mainte();
#endif
goto RETRY;
}
}

#if WORKER1_INSERT_DELAY_RPHASE
if (unlikely(thid == 1) && WORKER1_INSERT_DELAY_RPHASE_US != 0) {
clock_delay(WORKER1_INSERT_DELAY_RPHASE_US * CLOCKS_PER_US);
}
#endif

// read only tx doesn't collect read set and doesn't validate.
// write phase execute logging and commit pending versions, but r-only tx
// can skip it.
Expand All @@ -111,6 +122,10 @@ void worker(size_t thid, char& ready, const bool& start, const bool& quit,
// Validation phase
if (!trans.validation()) {
trans.abort();
#if SINGLE_EXEC
#else
trans.mainte();
#endif
goto RETRY;
}

Expand Down Expand Up @@ -156,6 +171,7 @@ int main(int argc, char* argv[]) try {
for (unsigned int i = 0; i < THREAD_NUM; ++i) {
res[0].addLocalAllResult(res[i]);
}
ShowOptParameters();
res[0].displayAllResult(CLOCKS_PER_US, EXTIME, THREAD_NUM);
deleteDB();

Expand Down
4 changes: 4 additions & 0 deletions cicada/include/common.hh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ GLOBAL size_t IO_TIME_NS; // nano second
GLOBAL size_t GROUP_COMMIT_TIMEOUT_US; // micro seconds
GLOBAL size_t GC_INTER_US; // garbage collection interval
GLOBAL size_t PRE_RESERVE_VERSION;
/**
* worker 1 insert delay in the end of read phase[us].
*/
GLOBAL size_t WORKER1_INSERT_DELAY_RPHASE_US;
GLOBAL size_t EXTIME;

alignas(CACHE_LINE_SIZE) GLOBAL uint64_t_64byte *ThreadWtsArray;
Expand Down
3 changes: 3 additions & 0 deletions cicada/include/transaction.hh
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ class TxExecutor {
#if INLINE_VERSION_OPT
if (tuple->getInlineVersionRight()) {
tuple->inline_ver_.set(0, this->wts_.ts_);
#if ADD_ANALYSIS
++cres_->local_version_reuse_;
#endif
return &(tuple->inline_ver_);
}
#endif // if INLINE_VERSION_OPT
Expand Down
12 changes: 7 additions & 5 deletions cicada/include/util.hh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

extern void chkArg(const int argc, char *argv[]);

extern void deleteDB();

extern void displayDB();

extern void displayMinRts();
Expand All @@ -18,12 +20,12 @@ extern void displayThreadRtsArray();

extern void displaySLogSet();

extern void partTableInit([[maybe_unused]] size_t thid, uint64_t initts, uint64_t start, uint64_t end);
extern void leaderWork([[maybe_unused]] Backoff &backoff, [[maybe_unused]] std::vector<Result> &res);

extern void partTableDelete([[maybe_unused]] size_t thid, uint64_t start, uint64_t end);
extern void makeDB(uint64_t *initial_wts);

extern void deleteDB();
extern void partTableDelete([[maybe_unused]] size_t thid, uint64_t start, uint64_t end);

extern void makeDB(uint64_t *initial_wts);
extern void partTableInit([[maybe_unused]] size_t thid, uint64_t initts, uint64_t start, uint64_t end);

extern void leaderWork([[maybe_unused]] Backoff &backoff, [[maybe_unused]] std::vector<Result> &res);
extern void ShowOptParameters();
28 changes: 16 additions & 12 deletions cicada/script/ycsb-xgci.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ycsb-xrs.sh(cicada)
tuple=100000000
tuple=1000000
maxope=10
rratioary=(50 95 100)
rratioary=(50)
rmw=off
skew=0
ycsb=on
Expand All @@ -10,10 +10,11 @@ group_commit=off
cpu_mhz=2100
io_time_ns=5
group_commit_timeout_us=2
gci=10
gci=1
prv=0
extime=3
epoch=3
w1idr=10000 # worker 1 insert delay in the end of read phase[us]
extime=5
epoch=5

host=`hostname`
chris41="chris41.omni.hpcc.jp"
Expand All @@ -26,13 +27,13 @@ if test $host = $dbs11 ; then
fi

cd ../
make clean; make -j KEY_SIZE=8 VAL_SIZE=4
make clean; make -j
cd script/

for rratio in "${rratioary[@]}"
do
if test $rratio = 50 ; then
result=result_cicada-part_ycsbA_tuple100m_gci10us_224th.dat
result=result_cicada_ycsbA_tuple1m_w1idr10ms_gci1us-1s.dat
elif test $rratio = 95 ; then
result=result_cicada-part_ycsbB_tuple100m_gci10us_224th.dat
elif test $rratio = 100 ; then
Expand All @@ -44,11 +45,14 @@ do
rm $result

echo "#tuple num, avg-tps, min-tps, max-tps, avg-ar, min-ar, max-ar, avg-camiss, min-camiss, max-camiss, avg-make_procedure_latency_rate, avg-read_latency_rate, avg-write_latency_rate, avg-vali_latency_rate, avg-gc_latency_rate avg-other_work_latency_rate avg-maxrss version_malloc version_reuse" >> $result
echo "#sudo perf stat -e cache-misses,cache-references -o ana.txt numactl --interleave=all ../cicada.exe $tuple $maxope $thread $rratio $rmw $skew $ycsb $wal $group_commit $cpu_mhz $io_time_ns $group_commit_timeout_us $gci $prv $extime" >> $result
echo "#sudo perf stat -e cache-misses,cache-references -o ana.txt numactl --interleave=all ../cicada.exe $tuple $maxope $thread $rratio $rmw $skew $ycsb $wal $group_commit $cpu_mhz $io_time_ns $group_commit_timeout_us $gci $prv $w1idr $extime" >> $result
../cicada.exe > exp.txt
tmpStr=`grep ShowOptParameters ./exp.txt`
echo "#$tmpStr" >> $result

for ((gci=10; gci<=10; gci*=10))
for ((gci=1; gci<=1000000; gci*=10))
do
echo "sudo perf stat -e cache-misses,cache-references -o ana.txt numactl --interleave=all ../cicada.exe $tuple $maxope $thread $rratio $rmw $skew $ycsb $wal $group_commit $cpu_mhz $io_time_ns $group_commit_timeout_us $gci $prv $extime"
echo "sudo perf stat -e cache-misses,cache-references -o ana.txt numactl --interleave=all ../cicada.exe $tuple $maxope $thread $rratio $rmw $skew $ycsb $wal $group_commit $cpu_mhz $io_time_ns $group_commit_timeout_us $gci $prv $w1idr $extime"
echo "Thread number $thread"

sumTH=0
Expand All @@ -72,10 +76,10 @@ do
for ((i = 1; i <= epoch; ++i))
do
if test $host = $dbs11 ; then
sudo perf stat -e cache-misses,cache-references -o ana.txt numactl --interleave=all ../cicada.exe $tuple $maxope $thread $rratio $rmw $skew $ycsb $wal $group_commit $cpu_mhz $io_time_ns $group_commit_timeout_us $gci $prv $extime > exp.txt
sudo perf stat -e cache-misses,cache-references -o ana.txt numactl --interleave=all ../cicada.exe $tuple $maxope $thread $rratio $rmw $skew $ycsb $wal $group_commit $cpu_mhz $io_time_ns $group_commit_timeout_us $gci $prv $w1idr $extime > exp.txt
fi
if test $host = $chris41 ; then
perf stat -e cache-misses,cache-references -o ana.txt numactl --interleave=all ../cicada.exe $tuple $maxope $thread $rratio $rmw $skew $ycsb $wal $group_commit $cpu_mhz $io_time_ns $group_commit_timeout_us $gci $prv $extime > exp.txt
perf stat -e cache-misses,cache-references -o ana.txt numactl --interleave=all ../cicada.exe $tuple $maxope $thread $rratio $rmw $skew $ycsb $wal $group_commit $cpu_mhz $io_time_ns $group_commit_timeout_us $gci $prv $w1idr $extime > exp.txt
fi

tmpTH=`grep throughput ./exp.txt | awk '{print $2}'`
Expand Down
5 changes: 3 additions & 2 deletions cicada/transaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -597,8 +597,9 @@ void TxExecutor::mainte() {
}

this->gcstop_ = rdtscp();
if (chkClkSpan(this->gcstart_, this->gcstop_, GC_INTER_US * CLOCKS_PER_US)) {
__atomic_store_n(&(GCFlag[thid_].obj_), 1, __ATOMIC_RELEASE);
if (chkClkSpan(this->gcstart_, this->gcstop_, GC_INTER_US * CLOCKS_PER_US)
&& (loadAcquire(GCFlag[thid_].obj_) == 0)) {
storeRelease(GCFlag[thid_].obj_, 1);
this->gcstart_ = this->gcstop_;
}
//-----
Expand Down
44 changes: 25 additions & 19 deletions cicada/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@
#include "include/time_stamp.hh"
#include "include/transaction.hh"
#include "include/tuple.hh"
#include "include/util.hh"

using std::cout, std::endl;

void chkArg(const int argc, char *argv[]) {
if (argc != 16) {
if (argc != 17) {
cout << "usage: ./cicada.exe TUPLE_NUM MAX_OPE THREAD_NUM RRATIO RMW "
"ZIPF_SKEW YCSB WAL GROUP_COMMIT CPU_MHZ IO_TIME_NS "
"GROUP_COMMIT_TIMEOUT_US GC_INTER_US PRE_RESERVE_VERSION EXTIME"
Expand Down Expand Up @@ -62,24 +63,9 @@ void chkArg(const int argc, char *argv[]) {
cout << "GC_INTER_US: garbage collection interval [usec]" << endl;
cout << "PRE_RESERVE_VERSION: pre-prepare memory for version generation."
<< endl;
cout << "WORKER1_INSERT_DELAY_RPHASE_US : worker 1 insert delay in the end of read phase[us]." << endl;
cout << "EXTIME: execution time [sec]" << endl << endl;

cout << "Tuple " << sizeof(Tuple) << endl;
cout << "Version " << sizeof(Version) << endl;
cout << "TimeStamp " << sizeof(TimeStamp) << endl;
cout << "Procedure " << sizeof(Procedure) << endl;
cout << "KEY_SIZE : " << KEY_SIZE << endl;
cout << "VAL_SIZE : " << VAL_SIZE << endl;
cout << "CACHE_LINE_SIZE - ((17 + KEY_SIZE + sizeof(Version)) % "
"(CACHE_LINE_SIZE)) : "
<< CACHE_LINE_SIZE -
((17 + KEY_SIZE + sizeof(Version)) % (CACHE_LINE_SIZE))
<< endl;
cout << "CACHE_LINE_SIZE - ((25 + VAL_SIZE) % (CACHE_LINE_SIZE)) : "
<< CACHE_LINE_SIZE - ((25 + VAL_SIZE) % (CACHE_LINE_SIZE)) << endl;
cout << "MASSTREE_USE : " << MASSTREE_USE << endl;
cout << "Result:\t" << sizeof(Result) << endl;
cout << "uint64_t_64byte: " << sizeof(uint64_t_64byte) << endl;
ShowOptParameters();
exit(0);
}

Expand Down Expand Up @@ -108,7 +94,8 @@ void chkArg(const int argc, char *argv[]) {
GROUP_COMMIT_TIMEOUT_US = atoi(argv[12]);
GC_INTER_US = atoi(argv[13]);
PRE_RESERVE_VERSION = atoi(argv[14]);
EXTIME = atoi(argv[15]);
WORKER1_INSERT_DELAY_RPHASE_US = atoi(argv[15]);
EXTIME = atoi(argv[16]);

if (RRATIO > 100) {
cout << "rratio [%%] must be 0 ~ 100)" << endl;
Expand Down Expand Up @@ -436,3 +423,22 @@ void leaderWork([[maybe_unused]] Backoff &backoff,
leaderBackoffWork(backoff, res);
#endif
}

void
ShowOptParameters()
{
cout << "ShowOptParameters()"
<< ": ADD_ANALYSIS " << ADD_ANALYSIS
<< ": BACK_OFF " << BACK_OFF
<< ": INLINE_VERSION_OPT " << INLINE_VERSION_OPT
<< ": INLINE_VERSION_PROMOTION " << INLINE_VERSION_PROMOTION
<< ": MASSTREE_USE " << MASSTREE_USE
<< ": PARTITION_TABLE " << PARTITION_TABLE
<< ": REUSE_VERSION " << REUSE_VERSION
<< ": SINGLE_EXEC " << SINGLE_EXEC
<< ": KEY_SIZE " << KEY_SIZE
<< ": VAL_SIZE " << VAL_SIZE
<< ": WRITE_LATEST_ONLY " << WRITE_LATEST_ONLY
<< ": WORKER1_INSERT_DELAY_RPHASE " << WORKER1_INSERT_DELAY_RPHASE
<< endl;
}
1 change: 0 additions & 1 deletion common/result.cc
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ void Result::displayValidationFailureByWritelockRate() {
}

void Result::displayVersionMalloc() {
if (total_version_malloc_)
cout << "version_malloc:\t" << total_version_malloc_ << endl;
}

Expand Down
24 changes: 24 additions & 0 deletions include/delay.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#pragma once

#include <x86intrin.h>

#include <iostream>

#include "tsc.hh"

using namespace std;

[[maybe_unused]] static void
clock_delay(size_t clocks)
{
std::size_t start(rdtscp()), stop;

for (;;) {
stop = rdtscp();
if (stop - start > clocks) {
break;
} else {
_mm_pause();
}
}
}
12 changes: 9 additions & 3 deletions include/tsc.hh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

#include <stdint.h>

[[maybe_unused]] static uint64_t rdtsc() {
[[maybe_unused]] static uint64_t
rdtsc()
{
uint64_t rax;
uint64_t rdx;

Expand All @@ -14,7 +16,9 @@
return (rdx << 32) | rax;
}

[[maybe_unused]] static uint64_t rdtsc_serial() {
[[maybe_unused]] static uint64_t
rdtsc_serial()
{
uint64_t rax;
uint64_t rdx;

Expand All @@ -24,7 +28,9 @@
return (rdx << 32) | rax;
}

[[maybe_unused]] static uint64_t rdtscp() {
[[maybe_unused]] static uint64_t
rdtscp()
{
uint64_t rax;
uint64_t rdx;
uint32_t aux;
Expand Down
6 changes: 2 additions & 4 deletions silo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ MASSTREE_USE=1
NO_WAIT_LOCKING_IN_VALIDATION=1
PARTITION_TABLE=0
PROCEDURE_SORT=0
WAL=1

SLEEP_READ_PHASE=0 # # of tics
WAL=0
SLEEP_READ_PHASE=0 # of tics
# end of initialization

CC = g++
Expand All @@ -40,7 +39,6 @@ CFLAGS = -c -pipe -g -O3 -std=c++17 -march=native \
LDFLAGS = -L../third_party/mimalloc/out/release -L../third_party/mimalloc/out/debug -L/user/lib
INCLUDE = -I/usr/include

#LDLIBS = -lpthread -lmimalloc
LDLIBS = -lpthread -lboost_filesystem -lboost_system

OBJS1 = $(SILO_SRCS1:.cc=.o)
Expand Down
2 changes: 2 additions & 0 deletions silo/include/util.hh
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ extern void leaderWork(uint64_t &epoch_timer_start, uint64_t &epoch_timer_stop);
extern void makeDB();

extern void partTableInit([[maybe_unused]] size_t thid, uint64_t start, uint64_t end);

extern void ShowOptParameters();
6 changes: 3 additions & 3 deletions silo/replayTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ int main() {
for (unsigned int i = 0; i < loadhd.logRecNum_; ++i) {
loadfile.read((void *)&logrec, sizeof(LogRecord));
chkSum_ += logrec.computeChkSum();
// cout << "tid : " << logrec.tid << endl;
// cout << "key : " << logrec.key << endl;
// cout << "val : " << logrec.val << endl << endl;
cout << "tid : " << logrec.tid_ << endl;
cout << "key : " << logrec.key_ << endl;
cout << "val : " << logrec.val_ << endl << endl;
}

cout << "computed chkSum_ : " << chkSum_ << endl;
Expand Down
Loading