Git Product home page Git Product logo

cavalia's Introduction

Cavalia

A transactional main-memory database system on multicores.

Features

Cavalia is a main-memory database system specifically designed for modern multicore architectures. It aims at providing a generalized framework for comparing different concurrency-control mechanisms. A highlight in Cavalia is that new hardware features (e.g., NUMA, HTM) are judiciously leveraged for achieving higher level of concurrency when processing massive volume of transactions.

Disclaimers

Our project aims at faithfully implementing all kinds of concurrency-control and failure-recovery schemes in the same database framework. Currently, this project is still under instensive development. Please feel free to contact us if you find any bugs or errors in our implementation. Thanks!

Ubuntu 16.04 Installation

git clone https://github.com/google/cityhash.git
cd cityhash
./configure && make -j4 && make install
sudo apt-get install libpapi-dev liblz4-dev libboost-all-dev libjemalloc-dev
git clone https://github.com/Cavalia/Cavalia.git
cd Cavalia
mkdir build
cmake .. && make -j4
  • Please note that the project requires g++ 4.8 with C++11 enabled.

Examples

Run TPC-C Benchmark

  1. Populate tables. The warehouse is set to 10 and the scalefactor is set to 100 (inversely propotional to table size).
./tpcc_benchmark -a0 -sf10 -sf100
  1. Execute transactions. The core count is set to 1, and the number of transactions to be executed is set to 10000.
./tpcc_benchmark -a2 -sf10 -sf100 -c1 -t10000

Run Micro Benchmark

  1. Populate tables. The scalefactor is set to 1 (propotional to table size).
./micro_benchmark -a0 -sf1
  1. Execute transactions. The skewness is set to 0.1, the core count is set to 1, and the number of transactions to be executed is set to 10000. Note that the skewness parameter is required.
./micro_benchmark -a2 -sf1 -sf0.1 -c1 -t10000

Run Smallbank Benchmark

  1. Populate tables. The scalefactor is set to 1 (propotional to table size).
./smallbank_benchmark -a0 -sf1
  1. Execute transactions. The skewness is set to 0.1, the core count is set to 1, and the number of transactions to be executed is set to 10000. Note that the skewness parameter is required.
./smallbank_benchmark -a2 -sf1 -sf0.1 -c1 -t10000

Compile Options

Concurrency control

  • SILOCK: locking-based snapshot isolation with no-wait strategy [BBG+95].
  • SIOCC: optimistic snapshot isolation [BBG+95].
  • MVTO: multi-version timestamp ordering [BHG87, CM86, YBP+14].
  • MVLOCK_WAIT: multi-version two-phase locking with wait-die strategy [CM86].
  • MVLOCK: multi-version two-phase locking with no-wait strategy [CM86].
  • TVLOCK: two-version two-phase locking with no-wait strategy [CM86].
  • MVOCC: multi-version optimistic concurrency control [CM86].
  • TO: timestamp ordering [BHG87, YBP+14].
  • LOCK_WAIT: two-phase locking with wait-die strategy [BHG87, YBP+14].
  • LOCK: two-phase locking with no-wait strategy [BHG87, YBP+14].
  • OCC: optimistic concurrency control [BHG87, YBP+14].
  • SILO: an implementation following silo's design [TZK+13].
  • DBX: an implementation following DBX's design [WQLC14].
  • ST: disable concurrency control. must be turned on when performing log replay [MWMS14, ZTKL14].

Index

Logging

  • VALUE_LOGGING: enable value logging [ZTKL14].
  • COMMAND_LOGGING: enable command logging [MWMS14].
  • COMPRESSION: enable log compression.

Timestamp allocation

  • BATCH_TIMESTAMP: allocate timestamp in batch.
  • SCALABLE_TIMESTAMP: allocate timestamp in Silo's style [TZK+13,].

Profiler

  • MUTE: mute profiling.
  • PRECISE_TIMER: use rdtsc timer.
  • PROFILE_PHASE: profile execution time of each transaction phase (insert, select, and commit).
  • PROFILE_EXECUTION: profile execution time of each stored procedure.
  • PROFILE_CC_WAIT: measure wait time on each table.
  • PROFILE_CC_ABORT_COUNT: count number of aborts on each table.
  • PROFILE_CC_ABORT_TIME: measure abort time.
  • PROFILE_CC_TS_ALLOC: measure timestamp allocation time.
  • PROFILE_CC_MEM_ALLOC: measure memory allocation time.
  • PROFILE_CC_EXECUTION_TIME: measure time breakdown of the current concurrency control algorithm.
  • PROFILE_CC_EXECUTION_COUNT: measure statistics of the current concurrency control algorithm.

Hardware architecture

  • PTHREAD_LOCK: use pthread_spin_lock.
  • BUILTIN_LOCK: use __sync_lock_test_and_set.

Notes

  • please turn off all the cc-related options when testing transaction replays.
  • the memory allocated for storage manager, including indexes and records, goes unmanaged -- we do not reclaim them throughout the lifetime.

References

  • [BBG+95] Hal Berenson, Phil Bernstein, Jim Gray, Jim Melton, Elizabeth O’Neil, and Patrick O’Neil. A Critique of ANSI SQL Isolation Levels. In SIGMOD, 1995.
  • [BHG87] Philip A Bernstein, Vassos Hadzilacos, and Nathan Goodman. Concurrency Control and Recovery in Database Systems. 1987.
  • [CM86] Michael J Carey and Waleed A Muhanna. The Performance of Multiversion Concurrency Control Algorithms. TOCS, 1986.
  • [MWMS14] Nirmesh Malviya, Ariel Weisberg, Samuel Madden, and Michael Stonebraker. Rethinking Main Memory OLTP Recovery. In ICDE, 2014.
  • [TZK+13] Stephen Tu, Wenting Zheng, Eddie Kohler, Barbara Liskov, and Samuel Madden. Speedy Transactions in Multicore In-memory Databases. In SOSP, 2013.
  • [WQLC14] Zhaoguo Wang, Hao Qian, Jinyang Li, and Haibo Chen. Using Restricted Transactional Memory to Build a Scalable In-Memory Database. In EuroSys, 2014.
  • [YBP+14] Xiangyao Yu, George Bezerra, Andrew Pavlo, Srinivas Devadas, and Michael Stonebraker. Staring into the Abyss: An Evaluation of Concurrency Control with One Thousand Cores. In VLDB, 2014.
  • [ZTKL14] Wenting Zheng, Stephen Tu, Eddie Kohler, and Barbara Liskov. Fast Databases with Fast Durability and Recovery Through Multicore Parallelism. In OSDI, 2014.

Licence

Copyright (C) 2015-16, School of Computing, National University of Singapore

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

cavalia's People

Contributors

guowentian avatar yingjunwu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cavalia's Issues

CommandLogger: Assertion `tlb_ptr->last_epoch_ + 1 == epoch' failed

I built a debug build of Cavalia with -DPTHREAD_LOCK and -DCOMMAND_LOGGING set. I get the following failure when I run the TPC-C benchmark on an Ubuntu 18.04.3 machine with 40 logical cores.

root@/fastdisk/Cavalia-install/bin# LD_LIBRARY_PATH=. ./tpcc_benchmark -a0 -sf15 -sf1 
directory name: .
populate elapsed time=31180ms
table_id=0: 100000
table_id=1: 1500000
table_id=2: 15
table_id=3: 150
table_id=4: 150
table_id=5: 135000
table_id=6: 450000
table_id=7: 4501387
table_id=8: 450000
table_id=9: 5706
database size=1.237439 GB

/fastdisk/Cavalia-install/bin# LD_LIBRARY_PATH=. ./tpcc_benchmark -a2 -sf15 -sf1 -t1000000 -c35
directory name: .
source elapsed time=602ms
table_id=0: 100000
table_id=1: 1500000
table_id=2: 15
table_id=3: 150
table_id=4: 150
table_id=5: 135000
table_id=6: 450000
table_id=7: 4501387
table_id=8: 450000
table_id=9: 5706
database size=1.237439 GB

start processing...
tpcc_benchmark: /fastdisk/Cavalia/Database/Logger/CommandLogger.h:105: virtual void Cavalia::Database::CommandLogger::CommitTransaction(const size_t&, const uint64_t&, const uint64_t&, const size_t&, Cavalia::Database::TxnParam*): Assertion `tlb_ptr->last_epoch_ + 1 == epoch' failed.
Aborted

When I also enable -DVALUE_LOGGING, I get the following failure -

root@/fastdisk/Cavalia-install/bin# LD_LIBRARY_PATH=. ./tpcc_benchmark -a0 -sf15 -sf1 
directory name: .
populate elapsed time=28381ms
table_id=0: 100000
table_id=1: 1500000
table_id=2: 15
table_id=3: 150
table_id=4: 150
table_id=5: 135000
table_id=6: 450000
table_id=7: 4497685
table_id=8: 450000
table_id=9: 5595
database size=1.237170 GB

finished everything...
root@/fastdisk/Cavalia-install/bin# LD_LIBRARY_PATH=. ./tpcc_benchmark -a2 -sf15 -sf1 -t1000000 -c35
directory name: .
source elapsed time=439ms
table_id=0: 100000
table_id=1: 1500000
table_id=2: 15
table_id=3: 150
table_id=4: 150
table_id=5: 135000
table_id=6: 450000
table_id=7: 4497685
table_id=8: 450000
table_id=9: 5595
database size=1.237170 GB

start processing...
tpcc_benchmark: /fastdisk/Cavalia/Database/Logger/ValueLogger.h:22: virtual void Cavalia::Database::ValueLogger::CommitTransaction(const size_t&, const uint64_t&, const uint64_t&, Cavalia::Database::AccessList<256>&): Assertion `tlb_ptr->last_epoch_ + 1 == epoch' failed.
tpcc_benchmark: /fastdisk/Cavalia/Database/Logger/ValueLogger.h:22: virtual void Cavalia::Database::ValueLogger::CommitTransaction(const size_t&, const uint64_t&, const uint64_t&, Cavalia::Database::AccessList<256>&): Assertion `tlb_ptr->last_epoch_ + 1 == epoch' failed.
Aborted

Building Transaction/TxnManagerOcc.cpp.o fails

OS: Ubuntu 18.04
g++ version: 4.8

Error snippet -

[ 30%] Building CXX object Database/CMakeFiles/database_static.dir/Transaction/TxnManagerOcc.cpp.o
cd /fastdisk/Cavalia/build/Database && /usr/bin/g++-4.8   -I/fastdisk/Cavalia/Common -I/fastdisk/Cavalia/Database  -std=c++11 -Wno-deprecated-declarations -DOCC -O0 -g   -o CMakeFiles/database_static.dir/Transaction/TxnManagerOcc.cpp.o -c /fastdisk/Cavalia/Database/Transaction/TxnManagerOcc.cpp
In file included from /fastdisk/Cavalia/Common/RWLock.h:6:0,
                 from /fastdisk/Cavalia/Database/Transaction/../Logger/../Transaction/../Storage/../Content/LockContent.h:6,
                 from /fastdisk/Cavalia/Database/Transaction/../Logger/../Transaction/../Storage/TableRecord.h:10,
                 from /fastdisk/Cavalia/Database/Transaction/../Logger/../Transaction/TxnAccess.h:9,
                 from /fastdisk/Cavalia/Database/Transaction/../Logger/BaseLogger.h:17,
                 from /fastdisk/Cavalia/Database/Transaction/../Logger/ValueLogger.h:5,
                 from /fastdisk/Cavalia/Database/Transaction/TransactionManager.h:9,
                 from /fastdisk/Cavalia/Database/Transaction/TxnManagerOcc.cpp:2:
/fastdisk/Cavalia/Common/SpinLock.h: In member function ‘bool SpinLock::IsLocked() const’:
/fastdisk/Cavalia/Common/SpinLock.h:67:23: error: no match for ‘operator==’ (operand types are ‘const std::atomic_flag’ and ‘int’)
   return spinlock_.v_ == 1;
                       ^

Complete error trace -
cavalia make.log

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.