├── .gitmodules
├── CMakeLists.txt
├── README.md
├── cmake
├── Dependencies.cmake
├── rocc.cmake
└── tpce.cmake
├── docs
└── rnic.md
├── scripts
├── aws-config.py
├── awsrun.sh
├── cmd.py
├── config.xml
├── count_line.sh
├── hosts.xml
├── module_test.py
├── run-aws.py
├── run2.py
├── run_batch_aws.py
├── run_test3.py
├── run_util.py
├── runner.py
├── sync_to_aws.sh
└── sync_to_server.sh
├── src
├── all.h
├── app
│ ├── README
│ ├── graph
│ │ ├── base_distribution.hpp
│ │ ├── grap_main.cc
│ │ ├── graph.h
│ │ ├── graph_constants.h
│ │ ├── graph_scheme.h
│ │ ├── graph_util.hpp
│ │ └── real_distribution.hpp
│ ├── micro
│ │ ├── micro.cc
│ │ ├── micro_rdma.cc
│ │ ├── micro_rpc.cc
│ │ └── micro_worker.h
│ ├── smallbank
│ │ ├── bank_main.cc
│ │ ├── bank_schema.h
│ │ ├── bank_worker.cc
│ │ ├── bank_worker.h
│ │ └── bank_worker_new.cc
│ ├── tpcc
│ │ ├── tpcc_cache.cc
│ │ ├── tpcc_loader.cc
│ │ ├── tpcc_main.cc
│ │ ├── tpcc_mixin.h
│ │ ├── tpcc_schema.h
│ │ ├── tpcc_worker.cc
│ │ ├── tpcc_worker.h
│ │ └── tpcc_worker_new.cc
│ └── tpce
│ │ ├── egen
│ │ ├── AddressTable.cpp
│ │ ├── AddressTable.h
│ │ ├── BaseLoader.h
│ │ ├── BaseLoaderFactory.h
│ │ ├── BaseLogFormatter.h
│ │ ├── BaseLogger.cpp
│ │ ├── BaseLogger.h
│ │ ├── BigMath.h
│ │ ├── Brokers.h
│ │ ├── CE.cpp
│ │ ├── CE.h
│ │ ├── CESUTInterface.h
│ │ ├── CETxnInputGenerator.cpp
│ │ ├── CETxnInputGenerator.h
│ │ ├── CETxnMixGenerator.cpp
│ │ ├── CETxnMixGenerator.h
│ │ ├── ChargeTable.h
│ │ ├── CommissionRateTable.h
│ │ ├── CompanyCompetitorFile.h
│ │ ├── CompanyCompetitorTable.h
│ │ ├── CompanyFile.h
│ │ ├── CompanyTable.h
│ │ ├── CustomerAccountsAndPermissionsTable.h
│ │ ├── CustomerSelection.cpp
│ │ ├── CustomerSelection.h
│ │ ├── CustomerTable.cpp
│ │ ├── CustomerTable.h
│ │ ├── CustomerTaxratesTable.h
│ │ ├── DM.cpp
│ │ ├── DM.h
│ │ ├── DMSUTInterface.h
│ │ ├── DailyMarketTable.h
│ │ ├── DateTime.cpp
│ │ ├── DateTime.h
│ │ ├── DriverParamSettings.h
│ │ ├── DriverTypes.h
│ │ ├── EGenBaseLoader_stdafx.h
│ │ ├── EGenError.h
│ │ ├── EGenGenerateAndLoad.cpp
│ │ ├── EGenGenerateAndLoad.h
│ │ ├── EGenGenerateAndLoadBaseOutput.h
│ │ ├── EGenGenerateAndLoadStandardOutput.h
│ │ ├── EGenGenerateAndLoad_stdafx.h
│ │ ├── EGenLoader.cxx
│ │ ├── EGenLoader_stdafx.h
│ │ ├── EGenLogFormatterTab.cpp
│ │ ├── EGenLogFormatterTab.h
│ │ ├── EGenLogger.h
│ │ ├── EGenNullLoader_stdafx.h
│ │ ├── EGenStandardTypes.h
│ │ ├── EGenTables_common.h
│ │ ├── EGenTables_stdafx.h
│ │ ├── EGenUtilities_stdafx.h
│ │ ├── EGenValidate.cxx
│ │ ├── EGenVersion.cpp
│ │ ├── EGenVersion.h
│ │ ├── ExchangeTable.h
│ │ ├── FinalTransform.h
│ │ ├── FinancialTable.h
│ │ ├── FixedArray.h
│ │ ├── FixedMap.h
│ │ ├── FlatAccountPermissionLoad.h
│ │ ├── FlatAddressLoad.h
│ │ ├── FlatBrokerLoad.h
│ │ ├── FlatCashTransactionLoad.h
│ │ ├── FlatChargeLoad.h
│ │ ├── FlatCommissionRateLoad.h
│ │ ├── FlatCompanyCompetitorLoad.h
│ │ ├── FlatCompanyLoad.h
│ │ ├── FlatCustomerAccountLoad.h
│ │ ├── FlatCustomerLoad.h
│ │ ├── FlatCustomerTaxrateLoad.h
│ │ ├── FlatDailyMarketLoad.h
│ │ ├── FlatExchangeLoad.h
│ │ ├── FlatFile.h
│ │ ├── FlatFileLoad_common.h
│ │ ├── FlatFileLoad_stdafx.h
│ │ ├── FlatFileLoader.cpp
│ │ ├── FlatFileLoader.h
│ │ ├── FlatFinancialLoad.h
│ │ ├── FlatHoldingHistoryLoad.h
│ │ ├── FlatHoldingLoad.h
│ │ ├── FlatHoldingSummaryLoad.h
│ │ ├── FlatIndustryLoad.h
│ │ ├── FlatLastTradeLoad.h
│ │ ├── FlatLoaderFactory.h
│ │ ├── FlatNewsItemLoad.h
│ │ ├── FlatNewsXRefLoad.h
│ │ ├── FlatSectorLoad.h
│ │ ├── FlatSecurityLoad.h
│ │ ├── FlatSettlementLoad.h
│ │ ├── FlatStatusTypeLoad.h
│ │ ├── FlatTaxrateLoad.h
│ │ ├── FlatTradeHistoryLoad.h
│ │ ├── FlatTradeLoad.h
│ │ ├── FlatTradeRequestLoad.h
│ │ ├── FlatTradeTypeLoad.h
│ │ ├── FlatWatchItemLoad.h
│ │ ├── FlatWatchListLoad.h
│ │ ├── FlatZipCodeLoad.h
│ │ ├── HoldingsAndTradesTable.h
│ │ ├── IndustryTable.h
│ │ ├── InputFile.h
│ │ ├── InputFileNoWeight.h
│ │ ├── InputFlatFilesDeclarations.h
│ │ ├── InputFlatFilesStructure.cpp
│ │ ├── InputFlatFilesStructure.h
│ │ ├── LastTradeTable.h
│ │ ├── MEE.cxx
│ │ ├── MEE.h
│ │ ├── MEEPriceBoard.cpp
│ │ ├── MEEPriceBoard.h
│ │ ├── MEESUTInterface.h
│ │ ├── MEESecurity.cpp
│ │ ├── MEESecurity.h
│ │ ├── MEETickerTape.cpp
│ │ ├── MEETickerTape.h
│ │ ├── MEETradeRequestActions.h
│ │ ├── MEETradingFloor.cpp
│ │ ├── MEETradingFloor.h
│ │ ├── MiscConsts.h
│ │ ├── Money.cpp
│ │ ├── Money.h
│ │ ├── NewsItemAndXRefTable.h
│ │ ├── NullLoad_stdafx.h
│ │ ├── NullLoader.h
│ │ ├── NullLoaderFactory.h
│ │ ├── Person.cpp
│ │ ├── Person.h
│ │ ├── RNGSeeds.h
│ │ ├── Random.cpp
│ │ ├── Random.h
│ │ ├── ReadRowFunctions.cpp
│ │ ├── ReadRowFunctions_istream.cpp
│ │ ├── ReadRowFunctions_sscanf.cpp
│ │ ├── SectorTable.h
│ │ ├── SecurityFile.h
│ │ ├── SecurityPriceRange.h
│ │ ├── SecurityTable.h
│ │ ├── StatusTypeTable.h
│ │ ├── SyncLockInterface.h
│ │ ├── TableConsts.h
│ │ ├── TableTemplate.h
│ │ ├── Table_Defs.h
│ │ ├── TaxrateTable.h
│ │ ├── TimerWheel.h
│ │ ├── TimerWheelTimer.h
│ │ ├── TradeGen.cpp
│ │ ├── TradeGen.h
│ │ ├── TradeTypeIDs.h
│ │ ├── TradeTypeTable.h
│ │ ├── TxnHarnessBrokerVolume.h
│ │ ├── TxnHarnessCustomerPosition.h
│ │ ├── TxnHarnessDBInterface.h
│ │ ├── TxnHarnessDataMaintenance.h
│ │ ├── TxnHarnessMarketFeed.h
│ │ ├── TxnHarnessMarketWatch.h
│ │ ├── TxnHarnessSecurityDetail.h
│ │ ├── TxnHarnessSendToMarketInterface.h
│ │ ├── TxnHarnessStructs.h
│ │ ├── TxnHarnessTradeCleanup.h
│ │ ├── TxnHarnessTradeLookup.h
│ │ ├── TxnHarnessTradeOrder.h
│ │ ├── TxnHarnessTradeResult.h
│ │ ├── TxnHarnessTradeStatus.h
│ │ ├── TxnHarnessTradeUpdate.h
│ │ ├── WatchListsAndItemsTable.h
│ │ ├── Wheel.h
│ │ ├── WheelTime.cpp
│ │ ├── WheelTime.h
│ │ ├── ZipCodeTable.h
│ │ ├── bucketsimulator.cpp
│ │ ├── bucketsimulator.h
│ │ ├── error.cpp
│ │ ├── error.h
│ │ ├── flat
│ │ │ └── egen_flat_in
│ │ │ │ ├── AreaCode.txt
│ │ │ │ ├── Charge.txt
│ │ │ │ ├── CommissionRate.txt
│ │ │ │ ├── Company.txt
│ │ │ │ ├── CompanyCompetitor.txt
│ │ │ │ ├── CompanySPRate.txt
│ │ │ │ ├── Exchange.txt
│ │ │ │ ├── FemaleFirstName.txt
│ │ │ │ ├── Industry.txt
│ │ │ │ ├── LastName.txt
│ │ │ │ ├── MaleFirstName.txt
│ │ │ │ ├── NonTaxableAccountName.txt
│ │ │ │ ├── Sector.txt
│ │ │ │ ├── Security.txt
│ │ │ │ ├── StatusType.txt
│ │ │ │ ├── StreetName.txt
│ │ │ │ ├── StreetSuffix.txt
│ │ │ │ ├── TaxRatesCountry.txt
│ │ │ │ ├── TaxRatesDivision.txt
│ │ │ │ ├── TaxableAccountName.txt
│ │ │ │ ├── TradeType.txt
│ │ │ │ └── ZipCode.txt
│ │ ├── locking.cpp
│ │ ├── locking.h
│ │ ├── progressmeter.cpp
│ │ ├── progressmeter.h
│ │ ├── progressmeterinterface.cpp
│ │ ├── progressmeterinterface.h
│ │ ├── shore_tpce_egen.h
│ │ ├── strutil.cpp
│ │ ├── strutil.h
│ │ ├── threading.cpp
│ │ ├── threading.h
│ │ ├── threading_pthread.h
│ │ ├── threading_single.h
│ │ ├── unusedflag.h
│ │ └── user_time.h
│ │ ├── tpce_constants.h
│ │ ├── tpce_loader.cc
│ │ ├── tpce_loader_factory.h
│ │ ├── tpce_main.cc
│ │ ├── tpce_mixin.h
│ │ ├── tpce_schema.h
│ │ ├── tpce_worker.cc
│ │ ├── tpce_worker.h
│ │ └── tpce_worker_new.cc
├── core
│ ├── common.h
│ ├── commun_queue.hpp
│ ├── config.hpp
│ ├── logging.cc
│ ├── logging.h
│ ├── rdma_sched.cc
│ ├── rdma_sched.h
│ ├── routine.cc
│ ├── routine.h
│ ├── rpc_buf_allocator.hpp
│ ├── rrpc.cc
│ ├── rrpc.h
│ ├── rworker.cc
│ ├── rworker.h
│ ├── rworker_yield_impl.hpp
│ ├── tcp_adapter.cc
│ ├── tcp_adapter.hpp
│ └── utils
│ │ ├── amd64.h
│ │ ├── count_vector.hpp
│ │ ├── latency_profier.h
│ │ ├── macros.h
│ │ ├── ndb_type_traits.h
│ │ ├── records_buffer.hpp
│ │ ├── scopedperf.hh
│ │ ├── serializer.h
│ │ ├── small_vector.h
│ │ ├── spinbarrier.h
│ │ ├── thread.cc
│ │ ├── thread.h
│ │ ├── util.h
│ │ ├── varint.cc
│ │ └── varint.h
├── framework
│ ├── bench_listener.h
│ ├── bench_listener2.cc
│ ├── bench_reporter.cc
│ ├── bench_reporter.h
│ ├── bench_runner.cc
│ ├── bench_runner.h
│ ├── bench_worker.cc
│ ├── bench_worker.h
│ ├── config.cc
│ ├── config.h
│ ├── main.cc
│ ├── req_buf_allocator.h
│ ├── tpc_msg.h
│ ├── utils
│ │ ├── abstract_db.h
│ │ ├── amd64.h
│ │ ├── encoder.h
│ │ ├── inline_str.h
│ │ ├── macros.h
│ │ ├── ndb_type_traits.h
│ │ ├── scopedperf.hh
│ │ ├── serializer.h
│ │ ├── small_vector.h
│ │ ├── spinbarrier.h
│ │ ├── thread.cc
│ │ ├── thread.h
│ │ ├── util.h
│ │ ├── varint.cc
│ │ └── varint.h
│ ├── view_manager.cc
│ └── view_manager.h
├── memstore
│ ├── cluster_chaining.hpp
│ ├── cluster_chaining_remote_op.hpp
│ ├── memdb.cc
│ ├── memdb.h
│ ├── memstore.cc
│ ├── memstore.h
│ ├── memstore_bplustree.cc
│ ├── memstore_bplustree.h
│ ├── memstore_hash.cc
│ ├── memstore_hash.h
│ ├── memstore_uint64bplustree.cc
│ ├── memstore_uint64bplustree.h
│ ├── rdma_chainhash.h
│ ├── rdma_cuckoohash.h
│ ├── rdma_hash.hpp
│ ├── rdma_hashext.h
│ └── simple_cache.hpp
├── port
│ ├── README
│ ├── atomic-template.h
│ ├── atomic.h
│ ├── atomic_pointer.h
│ ├── port.h
│ ├── port_example.h
│ ├── port_posix.cc
│ ├── port_posix.h
│ ├── thread_annotations.h
│ └── win
│ │ └── stdint.h
├── rocc_config.h.in
├── rtx
│ ├── batch_op_impl.hpp
│ ├── checker.hpp
│ ├── default_log_cleaner_impl.hpp
│ ├── global_vars.cc
│ ├── global_vars.h
│ ├── local_op_impl.hpp
│ ├── log_cleaner.hpp
│ ├── log_mem_manager.hpp
│ ├── log_store_manager.hpp
│ ├── logger.hpp
│ ├── logger_test.cxx
│ ├── msg_format.hpp
│ ├── occ.cc
│ ├── occ.h
│ ├── occ_inline.hpp
│ ├── occ_internal_structure.h
│ ├── occ_iterator.hpp
│ ├── occ_rdma.cc
│ ├── occ_rdma.h
│ ├── occ_statistics.h
│ ├── occ_variants.hpp
│ ├── op_test.cxx
│ ├── qp_selection_helper.h
│ ├── rdma_logger_impl.hpp
│ ├── rdma_op_impl.hpp
│ ├── rdma_req_helper.hpp
│ ├── rpc_logger_impl.hpp
│ ├── tx_operator.hpp
│ ├── view.cc
│ └── view.h
├── tx_config.h.in
└── util
│ ├── Makefile
│ ├── mapped_log.cc
│ ├── mapped_log.h
│ ├── msg_buf_allocator.h
│ ├── mutexlock.h
│ ├── random.h
│ ├── rdtsc_converter.cxx
│ ├── rtm.cc
│ ├── rtm.h
│ ├── simple_logger.h
│ ├── spinlock.h
│ ├── temp_log.h
│ ├── timer.h
│ ├── txprofile.h
│ ├── util.cc
│ └── util.h
└── third_party
└── micautil
├── city.h
├── city_mod.cc
├── citycrc.h
├── citycrc_mod.h
├── hash.h
├── rte_memcpy.h
├── rte_memcpy_mod.h
└── table
├── fixedtable.h
├── fixedtable_impl
├── bucket.h
├── del.h
├── get.h
├── info.h
├── init.h
├── item.h
├── lock.h
├── lock_bkt.h
├── lock_bkt_and_get.h
├── lock_bkt_for_ins.h
├── prefetch.h
├── set.h
├── set_spinlock.h
└── unlock_bkt.h
├── ltable.h
├── ltable_impl
├── bucket.h
├── del.h
├── get.h
├── increment.h
├── info.h
├── init.h
├── item.h
├── lock.h
├── move_to_head.h
├── prefetch.h
├── set.h
├── specialization.h
└── test.h
├── table.h
└── types.h
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "third_party/rdma_lib"]
2 | path = third_party/rdma_lib
3 | url = http://ipads.se.sjtu.edu.cn:1312/Windybeing/rdma_lib.git
4 | [submodule "third_party/cpuinfo"]
5 | path = third_party/cpuinfo
6 | url = https://github.com/pytorch/cpuinfo.git
7 | [submodule "third_party/rlib"]
8 | path = third_party/rlib
9 | url = https://github.com/wxdwfc/rlib.git
10 |
--------------------------------------------------------------------------------
/cmake/rocc.cmake:
--------------------------------------------------------------------------------
1 | function(load_global_config)
2 | configure_file("src/rocc_config.h.in" "src/rocc_config.h")
3 | endfunction()
4 |
5 | function(load_tx_config)
6 |
7 | if(TX_LOG_STYLE)
8 | else()
9 | set(TX_LOG_STYLE 1) ## default uses RPC as logging
10 | endif()
11 |
12 | if(PA)
13 | else()
14 | set(PA NULL) ## default uses RPC as logging
15 | endif()
16 |
17 | ## whether to record staleness counter for timestamp based methods
18 | if(RECORD_STALE)
19 | else()
20 | set(RECORD_STALE NULL) ## default uses RPC as logging
21 | endif()
22 |
23 |
24 | if(TX_BACKUP_STORE)
25 | else()
26 | set(TX_BACKUP_STORE 1)
27 | endif()
28 |
29 |
30 | if(ONE_SIDED_READ)
31 | else()
32 | set(ONE_SIDED_READ NULL)
33 | endif()
34 |
35 | if(USE_RDMA_COMMIT)
36 | else()
37 | set(USE_RDMA_COMMIT NULL)
38 | endif()
39 |
40 | if(RDMA_CACHE)
41 | else()
42 | set(RDMA_CACHE 0)
43 | endif()
44 |
45 | if(RDMA_STORE_SIZE)
46 | else()
47 | if(ONE_SIDED_READ)
48 | set(RDMA_STORE_SIZE 0)
49 | else()
50 | set(RDMA_STORE_SIZE 8)
51 | endif()
52 | endif()
53 |
54 |
55 | configure_file("src/tx_config.h.in" "src/tx_config.h")
56 | endfunction()
--------------------------------------------------------------------------------
/cmake/tpce.cmake:
--------------------------------------------------------------------------------
1 | ## TPC-E related configurations
2 | ## current it's not well since not all file in *egen* is necessary
3 | set(EGEN_PREFIX src/app/tpce/egen/)
4 | file(GLOB TPCE_SOURCES
5 | "${EGEN_PREFIX}DateTime.cpp" "${EGEN_PREFIX}error.cpp"
6 | "${EGEN_PREFIX}Random.cpp" "${EGEN_PREFIX}Money.cpp"
7 | "${EGEN_PREFIX}EGenVersion.cpp" "${EGEN_PREFIX}locking.cpp"
8 | "${EGEN_PREFIX}threading.cpp" "${EGEN_PREFIX}BaseLogger.cpp" "${EGEN_PREFIX}EGenLogFormatterTab.cpp"
9 | "${EGEN_PREFIX}MEEPriceBoard.cpp" "${EGEN_PREFIX}MEESecurity.cpp" "${EGEN_PREFIX}MEETickerTape.cpp"
10 | "${EGEN_PREFIX}MEETradingFloor.cpp" "${EGEN_PREFIX}WheelTime.cpp" "${EGEN_PREFIX}AddressTable.cpp"
11 | "${EGEN_PREFIX}CustomerSelection.cpp" "${EGEN_PREFIX}CustomerTable.cpp" "${EGEN_PREFIX}InputFlatFilesStructure.cpp"
12 | "${EGEN_PREFIX}Person.cpp" "${EGEN_PREFIX}ReadRowFunctions.cpp"
13 | "${EGEN_PREFIX}TradeGen.cpp" "${EGEN_PREFIX}FlatFileLoader.cpp" "${EGEN_PREFIX}CE.cpp" "${EGEN_PREFIX}CETxnInputGenerator.cpp"
14 | "${EGEN_PREFIX}CETxnMixGenerator.cpp" "${EGEN_PREFIX}DM.cpp" "${EGEN_PREFIX}EGenGenerateAndLoad.cpp" "${EGEN_PREFIX}strutil.cpp"
15 | "${EGEN_PREFIX}progressmeter.cpp" "${EGEN_PREFIX}progressmeterinterface.cpp" "${EGEN_PREFIX}bucketsimulator.cpp")
16 |
--------------------------------------------------------------------------------
/docs/rnic.md:
--------------------------------------------------------------------------------
1 | Since this project uses new advanced hardware features like RDMA, we briefly describe the hardware setting which is suitable here.
2 |
3 | ## RDMA-enabled network card
4 |
5 | **ROCC** can run most Mellanox RNICs (We say most because we have not tested on all of them yet :) ). It has been tested on `ConnctX-3`, `ConnectX-4`,`ConnectX-5`,
6 | both VPI and ROCE.
7 |
8 | Yet, we strongly suggest not to use `ConnectX-3 RNIC`, because its one-sided primitive requires
9 | *very very careful setting and tuning* to achieve a reasonable performance on **ROCC**.
10 | Later generations of RNICs (Like `ConnectX-4`) works well on **ROCC**.
11 | This is because `ConnectX-3 RNIC` has limited hardware resources such as the cache on the NIC.
12 |
13 |
14 | ## CPU
15 |
16 | **DrTM+H** requires Intel's restricted transactional memory~(RTM) for its concurrently data stores.
17 | It can call illegal instructions fault on CPU without this support on some workloads. Yet, **ROCC** does not depends on RTM.
18 |
--------------------------------------------------------------------------------
/scripts/awsrun.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | aws ec2 run-instances \
4 | --image-id "ami-41695a24" \
5 | --instance-type "r4.2xlarge" \
6 | --key-name "tp" \
7 | --monitoring '{"Enabled":false}' \
8 | --security-group-ids "sg-2131064a" \
9 | --instance-initiated-shutdown-behavior "stop" \
10 | --subnet-id "subnet-fec85696" \
11 | --count 5
12 |
--------------------------------------------------------------------------------
/scripts/cmd.py:
--------------------------------------------------------------------------------
1 | ###
2 | ## This file provides wrapper to help execute command at remote servers
3 | ###
4 |
5 | from subprocess import Popen, PIPE
6 | import subprocess # execute commands
7 | import os # change dir
8 |
9 | import paramiko
10 | import getpass
11 |
12 | FNULL = open(os.devnull, 'w')
13 |
14 | class ConnectProxy:
15 | def __init__(self,mac,user=""):
16 | if user == "":
17 | user = getpass.getuser()
18 | self.ssh = paramiko.SSHClient()
19 |
20 | self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
21 | self.user = user
22 | self.mac = mac
23 | self.sftp = None
24 |
25 | def connect(self,pwd):
26 | self.ssh.connect(hostname = self.mac,username = self.user, password = pwd)
27 |
28 | def execute(self,cmd,pty=False):
29 | return self.ssh.exec_command(cmd,get_pty=pty)
30 |
31 | def copy_file(self,f,dst_dir = ""):
32 | if self.sftp == None:
33 | self.sftp = paramiko.SFTPClient.from_transport(self.ssh.get_transport())
34 | self.sftp.put(f, dst_dir + f)
35 |
36 | def get_file(self,remote_path,f):
37 | if self.sftp == None:
38 | self.sftp = paramiko.SFTPClient.from_transport(self.ssh.get_transport())
39 | self.sftp.get(remote_path + "/" + f,f)
40 |
41 | def close(self):
42 | if self.sftp != None:
43 | self.sftp.close()
44 | self.ssh.close()
45 |
46 | def execute_at(mac,cmd):
47 | subprocess.call(["ssh", "-n","-f", mac, cmd])
48 |
49 | def slient_execute_at(mac,cmd):
50 | subprocess.call(["ssh", "-n","-f", mac, cmd],stdout=FNULL,stderr=subprocess.STDOUT)
51 |
52 | def get_w_execute(mac,cmd,timeout = 2):
53 | stdout, stderr = Popen(['ssh',"-o","ConnectTimeout=" + int(timeout),mac,cmd],
54 | stdout=PIPE).communicate()
55 | return stdout,stderr
56 |
57 | def get_w_execute_aws(mac,cmd,timeout = 2,pem = "../aws/tp.pem"):
58 | stdout, stderr = Popen(['ssh',"-i",pem,"-o","ConnectTimeout=" + str(timeout),mac,cmd],
59 | stdout=PIPE).communicate()
60 | return stdout,stderr
61 |
62 | def execute_at_aws(mac,cmd,pem = "../aws/tp.pem"):
63 | ssh_base = ["ssh","-i",pem,"-o","StrictHostKeyChecking=no","-n","-f"]
64 | subprocess.call(ssh_base + [mac,cmd])
65 |
66 | def copy_to(f,mac,dst="~"):
67 | subprocess.call(["scp",f,"%s:%s" % (mac,dst)],stdout=FNULL, stderr=subprocess.STDOUT)
68 |
69 | def copy_to_aws(f,mac,dst = "~",pem = "../aws/tp.pem"):
70 | subprocess.call(["scp","-i",pem,f,"%s:%s" % (mac,dst)],stdout=FNULL, stderr=subprocess.STDOUT)
71 |
--------------------------------------------------------------------------------
/scripts/config.xml:
--------------------------------------------------------------------------------
1 |
2 | 1
3 | 0
4 | 2
5 |
6 | 25
7 | 15
8 | 15
9 | 15
10 | 15
11 | 15
12 |
13 |
14 |
15 | 100
16 | 0
17 | 0
18 | 0
19 | 0
20 |
21 |
22 |
--------------------------------------------------------------------------------
/scripts/count_line.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | find "../src" -path '../' \
3 | -prune -o -path '../src/app/tpce/egen' \
4 | -prune -o -path '../src/port' \
5 | -prune -o -path '../src/tests' \
6 | -prune -o -path '../src/app' \
7 | -prune -o -print \
8 | | egrep '\.php|\.as|\.sql|\.css|\.js|\.cc|\.h|.cpp|.c ' \
9 | | grep -v '\.svn' | xargs cat | sed '/^\s*$/d' \
10 | | wc -l
11 |
--------------------------------------------------------------------------------
/scripts/hosts.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | val01
5 | val02
6 | val03
7 | val04
8 | val05
9 | val06
10 | val08
11 | val09
12 | val10
13 | val11
14 | val12
15 | val13
16 | val14
17 | val15
18 | val07
19 | val00
20 |
21 |
22 | val02
23 |
24 |
25 | 123
26 |
27 |
--------------------------------------------------------------------------------
/scripts/module_test.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | from run_test3 import calculate_results
5 | import sys
6 |
7 |
8 | if __name__ == "__main__":
9 | assert(len(sys.argv) > 1)
10 | log_file_name = sys.argv[1]
11 |
12 | print(calculate_results(log_file_name))
13 |
--------------------------------------------------------------------------------
/scripts/run_util.py:
--------------------------------------------------------------------------------
1 | ## helper functions for various script
2 |
3 | import os # for chdir
4 |
5 | ## print with color helper class
6 | class bcolors:
7 | HEADER = '\033[5;%s;2m'
8 | OKBLUE = '34'
9 | OKRED = '31'
10 | OKGREEN = '\033[92m'
11 | WARNING = '\033[93m'
12 | FAIL = '\033[91m'
13 | ENDC = '\033[0m'
14 | BOLD = '\033[1m'
15 | UNDERLINE = '\033[4m'
16 |
17 | @staticmethod
18 | def wrap_text_with_color(txt,c):
19 | return ("%s%s%s" % ((bcolors.HEADER % c),txt,bcolors.ENDC))
20 |
21 | def print_with_tag(tag,s):
22 | tag = bcolors.wrap_text_with_color(tag,bcolors.OKRED)
23 | print "[%s] %s" % (tag,s)
24 |
25 |
26 | class PrintTee(object):
27 | def __init__(self,*files):
28 | self.files = files
29 |
30 | def write(self, obj):
31 | for f in self.files:
32 | f.write(obj)
33 |
34 | ## end class bcolors
35 |
36 | def change_to_parent():
37 | os.chdir("..")
38 | return
39 |
--------------------------------------------------------------------------------
/scripts/sync_to_aws.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | target="$1"
4 | ## this script will sync the project to the remote server
5 | #rsync -i -rtuv $PWD/../ $target:~/nocc --exclude ./pre-data/
6 | rsync -e "ssh -i ../aws/tp.pem" -rtuv $PWD/../ ubuntu@$target:~/nocc --exclude ./pre-data/ --exclude .git
7 |
--------------------------------------------------------------------------------
/scripts/sync_to_server.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | target="$1"
4 | ## this script will sync the project to the remote server
5 | rsync -i -rtuv $PWD/../ $target:~/projects/nocc --exclude ./pre-data/
6 | #rsync -e "ssh -i ../aws/tp.pem" -rtuv $PWD/../ $target:~/nocc --exclude ./pre-data/
7 |
--------------------------------------------------------------------------------
/src/all.h:
--------------------------------------------------------------------------------
1 | /* This file contains constants used in the framework. ************************/
2 |
3 | #ifndef _ALL
4 | #define _ALL
5 |
6 | /* Coroutine related staff */
7 | /* Using boost coroutine */
8 | #include
9 |
10 | typedef boost::coroutines::symmetric_coroutine::call_type coroutine_func_t;
11 | typedef boost::coroutines::symmetric_coroutine::yield_type yield_func_t;
12 |
13 | namespace nocc {
14 |
15 | /***** hardware parameters ********/
16 | #define CACHE_LINE_SZ 64 // cacheline size of x86 platform
17 | //#define MAX_MSG_SIZE 25600 // max msg size used
18 | #define MAX_MSG_SIZE 4096
19 | //#define MAX_MSG_SIZE 512
20 |
21 | #define HUGE_PAGE_SZ (2 * 1024 * 1024) // huge page size supported
22 |
23 | #define MAX_SERVERS 32 // maxium number of machines in the cluster
24 | #define MAX_SERVER_TO_SENT MAX_SERVERS // maxium broadcast number of one msg
25 |
26 | #define NOCC_BENCH_MAX_TX 16
27 |
28 | /**********************************/
29 |
30 |
31 | /* some usefull macros ******************************************************/
32 | #define unlikely(x) __builtin_expect(!!(x), 0)
33 | #define likely(x) __builtin_expect(!!(x), 1)
34 |
35 | #define NOCC_NOT_IMPLEMENT(fnc) { fprintf(stderr,"[NOCC] %s function not implemented.\n",fnc);assert(false); }
36 | }
37 |
38 | #endif
39 |
--------------------------------------------------------------------------------
/src/app/README:
--------------------------------------------------------------------------------
1 | This file mainly contains our benchmark code.
2 | TPCC's main TX's implementations are in tpcc/tpcc_worker_new.cc, while Smallbank's implementations are in smallbank/bank_worker_new.cc .
--------------------------------------------------------------------------------
/src/app/graph/grap_main.cc:
--------------------------------------------------------------------------------
1 | #include "graph_constants.h"
2 | #include "graph.h"
3 | #include "graph_util.hpp"
4 | #include "real_distribution.hpp"
5 |
6 | #include "framework/bench_runner.h"
7 |
8 | #include "util/util.h"
9 |
10 | // for log normal distribution
11 | #include
12 | #include
13 |
14 | using namespace nocc::util;
15 |
16 | namespace nocc {
17 | namespace oltp {
18 | namespace link { // link benchmark
19 |
20 | class GraphLoader : public BenchLoader {
21 | MemDB *store_;
22 | uint64_t start_id_; uint64_t end_id_;
23 | double medium_data_size_;
24 | public:
25 | GraphLoader(uint64_t start_id,uint64_t end_id,double mdz,
26 | uint64_t seed,int partition,MemDB *store,bool is_primary)
27 | : start_id_(start_id), end_id_(end_id), medium_data_size_(mdz),
28 | BenchLoader(seed)
29 | {
30 | };
31 | virtual void load();
32 | };
33 |
34 | class GraphRunner : public BenchRunner {
35 | public:
36 | GraphRunner(std::string &config_file) {
37 |
38 | }
39 |
40 | virtual std::vector make_loaders(int partition, MemDB* store = NULL);
41 | virtual std::vector make_workers();
42 | virtual void init_store(MemDB* &store) { }
43 | virtual void init_backup_store(MemDB* &store) { }
44 | virtual void populate_cache() { }
45 |
46 | virtual void bootstrap_with_rdma(RdmaCtrl *r) {
47 | }
48 |
49 | virtual void warmup_buffer(char *buffer) {
50 | }
51 | };
52 |
53 | void GraphTest(int argc,char **argv) {
54 | auto test = RealDistribution();
55 | df_t res;
56 |
57 | std::ifstream ifs("../data/Distribution.dat", std::ifstream::in);
58 | auto title = test.get_cdf(res,ifs);
59 | pdf_t pdf;
60 | test.get_pdf(res,pdf);
61 | for(uint i = 0;i < 12;++i) {
62 |
63 | }
64 | //test.get_cdf(res,ifs);
65 |
66 | return;
67 | }
68 |
69 | std::vector GraphRunner::make_loaders(int partition, MemDB* store) {
70 | std::vector res;
71 | return res;
72 | }
73 |
74 | std::vector GraphRunner::make_workers() {
75 | std::vector res;
76 | return res;
77 | }
78 |
79 | void GraphLoader::load() {
80 |
81 | }
82 |
83 |
84 | }; // end namespace link
85 | }; // end namespace oltp
86 | }; // end namespace nocc
87 |
--------------------------------------------------------------------------------
/src/app/graph/graph.h:
--------------------------------------------------------------------------------
1 | #ifndef NOCC_APP_GRAPH_
2 | #define NOCC_APP_GRAPH_
3 |
4 | #include "all.h"
5 | #include "tx_config.h"
6 |
7 | namespace nocc {
8 | namespace oltp {
9 | namespace link {
10 |
11 | void GraphTest(int argc,char **argv); // main hook function
12 |
13 | }; // end namespace link
14 | }; // end namespace oltp
15 | };
16 |
17 | #endif
18 |
--------------------------------------------------------------------------------
/src/app/graph/graph_constants.h:
--------------------------------------------------------------------------------
1 | namespace nocc {
2 |
3 | namespace oltp {
4 | namespace link {
5 | int DEFAULT_LINK_TYPE = 123456789;
6 | int DEFAULT_NODE_TYPE = 2048;
7 | bool VISIBILITY_HIDDEN = 0;
8 | bool VISIBILITY_DEFAULT = 1;
9 | int DEFAULT_LIMIT = 10000;
10 | int MAX_LINK_DATA = 255;
11 | int DEFAULT_LIMI = 10000;
12 |
13 | double LINK_DATASIZE_SIGMA = 1.0;
14 | double NODE_DATASIZE_SIGMA = 1.0;
15 | };
16 | };
17 | };
18 |
--------------------------------------------------------------------------------
/src/app/graph/graph_scheme.h:
--------------------------------------------------------------------------------
1 | #ifndef NOCC_APP_GRAPH_SCHEME_
2 | #define NOCC_APP_GRAPH_SCHEME_
3 |
4 | #include "all.h"
5 |
6 | namespace nocc {
7 | namespace oltp {
8 | namespace link {
9 |
10 | struct Node {
11 | uint64_t id;
12 | int type;
13 | uint64_t version;
14 | uint64_t time;
15 | char data[CACHE_LINE_SZ];
16 | };
17 |
18 | class Edge {
19 | int type;
20 | bool visiblilty;
21 | uint64_t version;
22 | char data[CACHE_LINE_SZ];
23 | };
24 |
25 | inline ALWAYS_INLINE
26 | uint64_t makeEdgeKey(uint64_t id0,uint64_t id1,uint64_t time) {
27 | uint64_t *sec = new uint64_t[3];
28 | sec[0] = id0; sec[1] = id1;sec[2] = time;
29 | return (uint64_t )sec;
30 | }
31 |
32 | } // end namespace link
33 | }
34 | }
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/src/app/graph/graph_util.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // for std random generators
4 | #include
5 | #include
6 | #include // for logs
7 |
8 | namespace nocc {
9 |
10 | namespace oltp {
11 |
12 | namespace link {
13 |
14 | class LogNormalDistWrapper {
15 |
16 | std::mt19937 gen_;
17 | std::lognormal_distribution<> rng_;
18 | int min_;
19 | int max_;
20 | double mu_;
21 | double sigma_;
22 |
23 | public:
24 | LogNormalDistWrapper(int min,int max,int medium, double sigma,uint64_t seed)
25 | :gen_(seed),
26 | rng_(),
27 | min_(min),
28 | max_(max),
29 | sigma_(sigma),
30 | mu_(std::log(medium))
31 | {
32 | }
33 |
34 | int choose() {
35 | double next_guassian = rng_(gen_);
36 | assert(0 <= next_guassian && next_guassian <= 1);
37 | double content = next_guassian * sigma_ + mu_;
38 | int choice = (int)(std::round(std::exp(content)));
39 | if(choice < min_) return min_;
40 | if(choice > max_) return max_ - 1;
41 | return choice;
42 | }
43 | }; // end class log normal wrapper
44 | };
45 | };
46 |
47 | };
48 |
--------------------------------------------------------------------------------
/src/app/graph/real_distribution.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include "util/util.h"
6 | using namespace nocc::util;
7 |
8 | #include "base_distribution.hpp"
9 |
10 | namespace nocc {
11 |
12 | namespace oltp {
13 |
14 | namespace link {
15 |
16 | class RealDistribution : public BaseDistribution {
17 | // constants
18 | static const uint64_t NLINKS_SHUFFLER_SEED = 20343988438726021L;
19 | static const int NLINKS_SHUFFLER_GROUPS = 1024;
20 | static const uint64_t UNCORR_SHUFFLER_SEED = 53238253823453L;
21 | static const int UNCORR_SHUFFLER_GROUPS = 1024;
22 | static const uint64_t WRITE_CORR_SHUFFLER_SEED = NLINKS_SHUFFLER_SEED;
23 | static const int WRITE_CORR_SHUFFLER_GROUPS = NLINKS_SHUFFLER_GROUPS;
24 |
25 | static const uint64_t WRITE_UNCORR_SHUFFLER_SEED = UNCORR_SHUFFLER_SEED;
26 | static const int WRITE_UNCORR_SHUFFLER_GROUPS = UNCORR_SHUFFLER_GROUPS;
27 |
28 | static const uint64_t READ_UNCORR_SHUFFLER_SEED = UNCORR_SHUFFLER_SEED;
29 | static const int READ_UNCORR_SHUFFLER_GROUPS = UNCORR_SHUFFLER_GROUPS;
30 |
31 | static const uint64_t NODE_READ_SHUFFLER_SEED = 4766565305853767165L;
32 | static const int NODE_READ_SHUFFLER_GROUPS = 1024;
33 | static const uint64_t NODE_UPDATE_SHUFFLER_SEED = NODE_READ_SHUFFLER_SEED;
34 | static const int NODE_UPDATE_SHUFFLER_GROUPS = NODE_READ_SHUFFLER_GROUPS;
35 |
36 | static const uint64_t NODE_DELETE_SHUFFLER_SEED = NODE_READ_SHUFFLER_SEED;
37 | static const int NODE_DELETE_SHUFFLER_GROUPS = NODE_READ_SHUFFLER_GROUPS;
38 |
39 | enum TYPE { // types of distributions for different operation
40 | LINKS, // distribution for links
41 | LINKS_READ,
42 | LINKS_WRITE,
43 | NODE_READ,
44 | NODE_WRITE
45 | };
46 |
47 | void init_link() {
48 |
49 | }
50 |
51 | uint64_t getNLinks(uint64_t id1,uint64_t start_id,uint64_t end_id) {
52 | return (uint64_t) expected_count(start_id,end_id,id1,nlinks_cdf_);
53 | }
54 |
55 | private:
56 | df_t nlinks_cdf_;
57 | }; // end class real
58 |
59 | }; // end class link
60 | };
61 |
62 | };
63 |
--------------------------------------------------------------------------------
/src/app/micro/micro_rpc.cc:
--------------------------------------------------------------------------------
1 | #include "tx_config.h"
2 | #include "micro_worker.h"
3 |
4 | extern size_t distributed_ratio; // used for some app defined parameters
5 | extern size_t total_partition;
6 |
7 | namespace nocc {
8 | namespace oltp {
9 |
10 | extern __thread util::fast_random *random_generator;
11 |
12 | namespace micro {
13 |
14 | struct Req {
15 | uint8_t size = 0;
16 | };
17 |
18 | // RPC IDs
19 | enum {
20 | REQ_ID = 0
21 | };
22 |
23 | extern uint64_t working_space;
24 | txn_result_t MicroWorker::micro_rpc(yield_func_t &yield) {
25 |
26 | static const int num_nodes = total_partition;
27 |
28 | auto size = distributed_ratio;
29 | assert(size > 0 && size <= MAX_MSG_SIZE);
30 |
31 | int window_size = 10;
32 | ASSERT(window_size < 64) << "window size shall be smaller than 64";
33 | static __thread char *req_buf = rpc_->get_static_buf(4096);
34 | static __thread char *reply_buf = (char *)malloc(1024);
35 |
36 | char *req_ptr = req_buf;
37 | ASSERT(size <= 4096);
38 |
39 | #if 1
40 | #if !PA
41 | rpc_->prepare_multi_req(reply_buf, window_size,cor_id_);
42 | #endif
43 |
44 | for (uint i = 0; i < window_size; ++i) {
45 |
46 | int pid = random_generator[cor_id_].next() % num_nodes;
47 |
48 | // prepare an RPC header
49 | Req *req = (Req *)(req_ptr);
50 | req->size = size;
51 | #if 1
52 | rpc_->append_pending_req((char *)req,REQ_ID,sizeof(Req),cor_id_,RRpc::REQ,pid);
53 | #else
54 | rpc_->append_req((char *)req_buf,REQ_ID,sizeof(Req),cor_id_,RRpc::REQ,pid);
55 | #endif
56 | }
57 | rpc_->flush_pending();
58 | #endif
59 |
60 | #if !PA
61 | indirect_yield(yield);
62 | #endif
63 | ntxn_commits_ += (window_size - 1);
64 |
65 | return txn_result_t(true,1);
66 | }
67 |
68 | /**
69 | * RPC handlers
70 | */
71 |
72 | void MicroWorker::register_callbacks() {
73 | ROCC_BIND_STUB(rpc_,&MicroWorker::nop_rpc_handler,this,REQ_ID);
74 | }
75 |
76 | void MicroWorker::nop_rpc_handler(int id,int cid,char *msg, void *arg) {
77 | char *reply_msg = rpc_->get_reply_buf();
78 | Req *req = (Req *)msg;
79 | ASSERT(req->size <= ::rdmaio::UDRecvManager::MAX_PACKET_SIZE)
80 | << "req size "<< (int)(req->size) << " " << ::rdmaio::UDRecvManager::MAX_PACKET_SIZE;
81 | rpc_->send_reply(reply_msg,req->size,id,worker_id_,cid); // a dummy notification
82 | }
83 |
84 | } // end micro
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/src/app/micro/micro_worker.h:
--------------------------------------------------------------------------------
1 | #ifndef APP_MICRO
2 | #define APP_MICRO
3 |
4 | #include "tx_config.h"
5 | #include "framework/bench_worker.h"
6 |
7 | namespace nocc {
8 | namespace oltp {
9 |
10 | namespace micro {
11 |
12 | enum MICRO_TYPE {
13 | RPC = 0,
14 | RDMA_READ = 1,
15 | RDMA_WRITE = 15,
16 | RDMA_CAS = 3
17 | };
18 |
19 | void MicroTest(int argc,char **argv); // main hook function
20 |
21 | class MicroWorker : public BenchWorker {
22 | public:
23 | MicroWorker(unsigned int worker_id,unsigned long seed,int micro_type,MemDB *store,
24 | uint64_t total_ops, spin_barrier *a,spin_barrier *b,BenchRunner *c);
25 |
26 | void register_callbacks();
27 | void thread_local_init();
28 |
29 | workload_desc_vec_t get_workload() const ;
30 |
31 | void workload_report() {
32 | REPORT(post);
33 | }
34 |
35 | /**
36 | * real worker function body
37 | */
38 | txn_result_t micro_rpc(yield_func_t &yield);
39 | txn_result_t micro_rdma_read(yield_func_t &yield);
40 | txn_result_t micro_rdma_write(yield_func_t &yield);
41 | txn_result_t micro_rdma_atomic(yield_func_t &yield);
42 | //
43 |
44 | /**
45 | * RPC handlers
46 | */
47 | void nop_rpc_handler(int id,int cid,char *msg,void *arg);
48 | //
49 |
50 | private:
51 | static workload_desc_vec_t _get_workload();
52 |
53 | static txn_result_t MicroRpc(BenchWorker *w,yield_func_t &yield) {
54 | return static_cast(w)->micro_rpc(yield);
55 | }
56 |
57 | static txn_result_t MicroRdmaRead(BenchWorker *w,yield_func_t &yield) {
58 | return static_cast(w)->micro_rdma_read(yield);
59 | }
60 |
61 | static txn_result_t MicroRdmaWrite(BenchWorker *w,yield_func_t &yield) {
62 | return static_cast(w)->micro_rdma_write(yield);
63 | }
64 |
65 | static txn_result_t MicroRdmaAtomic(BenchWorker *w,yield_func_t &yield) {
66 | return static_cast(w)->micro_rdma_atomic(yield);
67 | }
68 |
69 | std::vector qp_vec_;
70 |
71 | // some performance counters
72 | LAT_VARS(post);
73 | }; // end class micro rpc
74 |
75 | }
76 |
77 | } //
78 | }
79 |
80 | #endif
81 |
--------------------------------------------------------------------------------
/src/app/smallbank/bank_schema.h:
--------------------------------------------------------------------------------
1 | #ifndef NOCC_FRAMEWORK_BANK_SCHEMA_H
2 | #define NOCC_FRAMEWORK_BANK_SCHEMA_H
3 |
4 | #include "framework/utils/encoder.h"
5 | #include "framework/utils/inline_str.h"
6 | #include "framework/utils/macros.h"
7 |
8 | #define ACCT 0
9 | #define SAV 1
10 | #define CHECK 2
11 |
12 | #define MIN_BALANCE 10000
13 | #define MAX_BALANCE 50000
14 |
15 |
16 | //#define BANK_NUM_ACCOUNTS 100000
17 | //define BANK_NUM_ACCOUNTS
18 | // 25% perct of the accounts are hot
19 | //#define BANK_NUM_HOT 4000
20 |
21 | //#ifdef BANK_NORMAL
22 |
23 | //#define BANK_NUM_HOT 0
24 | //#define BANK_NUM_HOT 25000
25 | //#define BANK_HOT_PECT 0
26 | //#else
27 |
28 | //#define BANK_NUM_HOT 2000
29 | //#define BANK_HOT_PECT 2
30 | //#define BANK_NUM_HOT 1000
31 | //#define BANK_HOT_PECT 1
32 | //#endif
33 |
34 | #define BANK_MIN_BALANCE 10000
35 | #define BANK_MAX_BALANCE 50000
36 |
37 | //#ifdef BANK_NORMAL
38 | //#define BANK_TX_HOT 0
39 | //#else
40 | // This number is defined in the original small bank paper
41 | //#define BANK_TX_HOT 90
42 | //#endif
43 | //#define BANK_TX_HOT 0
44 |
45 |
46 | /* table accounts */
47 |
48 | #define ACCOUNTS_KEY_FIELDS(x,y) \
49 | x(uint64_t,a_custid)
50 |
51 | //
52 | #define ACCOUNTS_VALUE_FIELDS(x,y)\
53 | x(inline_str_16<64>,a_name)
54 | DO_STRUCT(account,ACCOUNTS_KEY_FIELDS,ACCOUNTS_VALUE_FIELDS)
55 |
56 | /* ------- */
57 |
58 | /* table savings */
59 |
60 | #define SAVINGS_KEY_FIELDS(x,y) \
61 | x(uint64_t,s_cusitid)
62 |
63 | #define SAVINGS_VALUE_FIELDS(x,y) \
64 | x(float,s_balance)
65 | DO_STRUCT(savings,SAVINGS_KEY_FIELDS,SAVINGS_VALUE_FIELDS)
66 |
67 | /* ------- */
68 |
69 |
70 | /* table checking */
71 |
72 | #define CHECKING_KEY_FIELDS(x,y) \
73 | x(uint64_t ,c_custid)
74 |
75 | #define CHECKING_VALUE_FIELDS(x,y) \
76 | x(float,c_balance)
77 | DO_STRUCT(checking,CHECKING_KEY_FIELDS,CHECKING_VALUE_FIELDS)
78 |
79 | /* ------- */
80 |
81 | #endif
82 |
--------------------------------------------------------------------------------
/src/app/tpcc/tpcc_cache.cc:
--------------------------------------------------------------------------------
1 | #include "tpcc_worker.h"
2 | #include "tpcc_schema.h"
3 | #include "tpcc_mixin.h"
4 |
5 | #include "memstore/memdb.h"
6 |
7 | #include "core/logging.h"
8 |
9 | using namespace rdmaio;
10 |
11 |
12 | extern size_t current_partition;
13 | extern size_t nthreads;
14 |
15 | namespace nocc {
16 |
17 | extern RdmaCtrl *cm; // global RDMA handler
18 |
19 | namespace oltp {
20 | namespace tpcc {
21 |
22 | void populate_ware(MemDB *db) {
23 | char *temp = (char *)Rmalloc(256);
24 | for(uint wid = 1; wid <= NumWarehouses();++wid) {
25 | int pid;
26 | if( (pid = WarehouseToPartition(wid)) != current_partition) {
27 | // fetch it
28 | auto off = db->stores_[WARE]->RemoteTraverse(wid,cm->get_rc_qp(create_rc_idx(pid,nthreads + nthreads + 1)),temp);
29 | assert(off != 0);
30 |
31 | } // end fetch
32 | PrintProgress((double)wid / NumWarehouses());
33 | } // end iterating all warehouses
34 | Rfree(temp);
35 | }
36 |
37 | void populate_dist(MemDB *db) {
38 | int pid;
39 | char *temp = (char *)Rmalloc(256);
40 | for(uint wid = 1;wid <= NumWarehouses();++wid) {
41 | for(uint d = 1; d <= NumDistrictsPerWarehouse();++d) {
42 | if( (pid = WarehouseToPartition(wid)) == current_partition)
43 | continue;
44 | uint64_t key = makeDistrictKey(wid,d);
45 | auto off = db->stores_[DIST]->RemoteTraverse(key,cm->get_rc_qp(create_rc_idx(pid,nthreads + nthreads + 1)),temp);
46 | assert(off != 0);
47 | } // iterating all districts
48 | }
49 | Rfree(temp);
50 | }
51 |
52 | void populate_stock(MemDB *db) {
53 |
54 | char *temp = (char *)Rmalloc(256);
55 | int pid;
56 | for(uint wid = 1;wid <= NumWarehouses();++wid) {
57 |
58 | const size_t batchsize = NumItems() ;
59 | const size_t nbatches = (batchsize > NumItems()) ? 1 : (NumItems() / batchsize);
60 |
61 | for (uint b = 0; b < nbatches;) {
62 | const size_t iend = std::min((b + 1) * batchsize + 1, NumItems());
63 | for (uint i = (b * batchsize + 1); i <= iend; i++) {
64 |
65 | uint64_t key = makeStockKey(wid,i);
66 | if((pid = WarehouseToPartition(wid)) == current_partition)
67 | continue;
68 | auto off = db->stores_[STOC]->RemoteTraverse(key,cm->get_rc_qp(create_rc_idx(pid,nthreads + nthreads + 1)),temp);
69 | assert(off != 0);
70 | }
71 | b++;
72 | } // end iterating all stocks
73 | PrintProgress((double)wid / NumWarehouses());
74 | }
75 | Rfree(temp);
76 | LOG(2) << "total " << (NumWarehouses() * NumItems()) << " cache entries loaded.";
77 | }
78 |
79 | }; // namespace tpcc
80 | }; // namespace oltp
81 |
82 | }; // namespace nocc
83 |
--------------------------------------------------------------------------------
/src/app/tpce/egen/DriverTypes.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Legal Notice
3 | *
4 | * This document and associated source code (the "Work") is a part of a
5 | * benchmark specification maintained by the TPC.
6 | *
7 | * The TPC reserves all right, title, and interest to the Work as provided
8 | * under U.S. and international laws, including without limitation all patent
9 | * and trademark rights therein.
10 | *
11 | * No Warranty
12 | *
13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
23 | * WITH REGARD TO THE WORK.
24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
32 | *
33 | * Contributors
34 | * - Matt Emmerton
35 | */
36 |
37 | /******************************************************************************
38 | * Description: Driver types and names
39 | ******************************************************************************/
40 |
41 | #ifndef DRIVER_TYPES_H
42 | #define DRIVER_TYPES_H
43 |
44 | namespace TPCE
45 | {
46 |
47 | enum eDriverType
48 | {
49 | eDriverEGenLoader,
50 | eDriverAll,
51 | eDriverCE,
52 | eDriverMEE,
53 | eDriverDM,
54 | eDriverMax
55 | };
56 |
57 | extern char szDriverTypeNames[eDriverMax][14];
58 | } // namespace TPCE
59 |
60 |
61 | #endif // DRIVER_TYPES_H
62 |
--------------------------------------------------------------------------------
/src/app/tpce/egen/EGenBaseLoader_stdafx.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Legal Notice
3 | *
4 | * This document and associated source code (the "Work") is a part of a
5 | * benchmark specification maintained by the TPC.
6 | *
7 | * The TPC reserves all right, title, and interest to the Work as provided
8 | * under U.S. and international laws, including without limitation all patent
9 | * and trademark rights therein.
10 | *
11 | * No Warranty
12 | *
13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
23 | * WITH REGARD TO THE WORK.
24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
32 | *
33 | * Contributors
34 | * - Sergey Vasilevskiy
35 | */
36 |
37 | #ifndef EGEN_BASELOADER_STDAFX_H
38 | #define EGEN_BASELOADER_STDAFX_H
39 |
40 | #include "BaseLoader.h"
41 | #include "BaseLoaderFactory.h"
42 |
43 | #endif // #ifndef EGEN_BASELOADER_STDAFX_H
44 |
--------------------------------------------------------------------------------
/src/app/tpce/egen/EGenGenerateAndLoad_stdafx.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Legal Notice
3 | *
4 | * This document and associated source code (the "Work") is a part of a
5 | * benchmark specification maintained by the TPC.
6 | *
7 | * The TPC reserves all right, title, and interest to the Work as provided
8 | * under U.S. and international laws, including without limitation all patent
9 | * and trademark rights therein.
10 | *
11 | * No Warranty
12 | *
13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
23 | * WITH REGARD TO THE WORK.
24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
32 | *
33 | * Contributors
34 | * - Sergey Vasilevskiy
35 | */
36 |
37 | #ifndef EGEN_GENERATE_AND_LOAD_STDAFX_H
38 | #define EGEN_GENERATE_AND_LOAD_STDAFX_H
39 |
40 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
41 | #include
42 | #include
43 | #include
44 | #include
45 | #include