|
| 1 | +# OLTP Benchmark Testing |
| 2 | +This folder include the necessary files for running oltpbench testings. |
| 3 | + |
| 4 | +## Table of contents |
| 5 | +- [OLTP benchmark types](https://github.com/cmu-db/noisepage/blob/master/script/testing/oltpbench#oltp-benchmark-types) |
| 6 | +- [How to run it?](https://github.com/cmu-db/noisepage/blob/master/script/testing/oltpbench#how-to-run-it) |
| 7 | +- [Test workflow](https://github.com/cmu-db/noisepage/blob/master/script/testing/oltpbench#test-workflow) |
| 8 | +- [Dependencies](https://github.com/cmu-db/noisepage/blob/master/script/testing/oltpbench#dependencies) |
| 9 | +- [File structures](https://github.com/cmu-db/noisepage/blob/master/script/testing/oltpbench#file-structures) |
| 10 | +- [Config files](https://github.com/cmu-db/noisepage/blob/master/script/testing/oltpbench#config-files) |
| 11 | + |
| 12 | +## OLTP benchmark types |
| 13 | +Currently we run the following OLTP benchmarks |
| 14 | +- TATP |
| 15 | +- TPCC |
| 16 | +- NOOP |
| 17 | +- YCSB |
| 18 | +- Smallbank |
| 19 | + |
| 20 | +## How to run it? |
| 21 | + |
| 22 | +### TL;DR |
| 23 | +```bash |
| 24 | +# This command is sufficient for you to run the OLTP benchmark testing based on your configuration |
| 25 | +python3 run_oltpbench.py --config-file=<your-config-file-path>.json |
| 26 | +``` |
| 27 | + |
| 28 | +### Examples |
| 29 | +Currently there are 3 types of the OLTP benchmark testing |
| 30 | +- End-to-end debug |
| 31 | + ```bash |
| 32 | + cd noisepage/script/testing/oltpbench |
| 33 | + # To run the TPCC oltpbench test for end-to-end debug on debug version |
| 34 | + python3 run_oltpbench.py \ |
| 35 | + --config-file=configs/end_to_end_debug/tpcc.json \ |
| 36 | + --build-type=debug |
| 37 | + ``` |
| 38 | +- End-to-end performance |
| 39 | + ```bash |
| 40 | + cd noisepage/script/testing/oltpbench |
| 41 | + # To run the TPCC oltpbench test for end-to-end performance with wal to be stored in ramdisk on release version |
| 42 | + python3 run_oltpbench.py \ |
| 43 | + --config-file=configs/end_to_end_performance/tpcc_wal_ramdisk.json \ |
| 44 | + --build-type=release |
| 45 | + ``` |
| 46 | +- Nightly performance |
| 47 | + ```bash |
| 48 | + cd noisepage/script/testing/oltpbench |
| 49 | + # To run all the oltpbench test case for nightly performance with wal disabled on release version |
| 50 | + python3 run_oltpbench.py \ |
| 51 | + --config-file=configs/nightly/nightly_wal_disabled.json \ |
| 52 | + --build-type=release |
| 53 | + ``` |
| 54 | + |
| 55 | +### OLTPBench test options |
| 56 | +For more configurations, there are 2 ways |
| 57 | +- Via config files |
| 58 | + - You can refer to the [config files](https://github.com/cmu-db/noisepage/blob/master/script/testing/oltpbench#config-files) section below for more details |
| 59 | +- Via command line options |
| 60 | +comments - You can use `-h` or `--help` command line option for more details |
| 61 | + |
| 62 | +## Test workflow |
| 63 | +Preparation steps of the test |
| 64 | +- Start by invoking `run_oltpbench.py` |
| 65 | + - Load the config file passed in and start an instance of the database with any server_args specified in the config |
| 66 | + - Create a test suite for the whole config file and runs the test suite |
| 67 | + - Create a `TestOLTPBench` object for the test execution, since the `TestOLTPBench` is a subclass of the `TestServer` class, it will conduct a list of tasks as the preparation for the actual test, the most important two of which are as follow |
| 68 | + - Pass command line options and configs in to the constructor |
| 69 | + - Try to locate the NoisePage binary |
| 70 | + - Run the test suite by calling `.run()` function of `TestOLTPBench` |
| 71 | + |
| 72 | +The actual test workflow |
| 73 | +- Run pre suite tasks: `.run_pre_suite()` function of `TestOLTPBench` |
| 74 | + - Clean the possible residual local [oltpbench](https://github.com/oltpbenchmark/oltpbench) workspace |
| 75 | + - Download and install the [oltpbench](https://github.com/oltpbenchmark/oltpbench) from GitHub |
| 76 | +- Iterate through all the test cases |
| 77 | + - (Re)start the NoisePage DB process as a Python subprocess |
| 78 | + - Start the DB if its not running |
| 79 | + - *Kill all the lingering processes on the NoisePage port before starting the NoisePage DB process* |
| 80 | + - Restart it if `db_restart` was passed into the test_case config |
| 81 | + - Otherwise, leave it running |
| 82 | + - Run pre test case tasks: `.run_pre_test()` function of `TestCaseOLTPBench` |
| 83 | + - Create the database and tables for the OLTP benchmark specified |
| 84 | + - Load the data to tables |
| 85 | + - Run the test case command as a subprocess |
| 86 | + - Collect the memory info by using the [PeriodicTask](https://github.com/cmu-db/noisepage/blob/master/script/testing/util/periodic_task.py) in a separate thread |
| 87 | + - Collect `RSS` and `VMS` by default |
| 88 | + - Collect every `5` seconds by default |
| 89 | + - The memory info is stored in a Python dictionary in memory in runtime |
| 90 | + - Run post test case tasks: `.run_post_test()` function of `TestCaseOLTPBench` |
| 91 | + - If `publish-results`, `publish-username`, and `publish-password` arguments are supplied, the result results should be stored |
| 92 | + - Parse the testing results files by [oltpbench](https://github.com/oltpbenchmark/oltpbench) and format them in JSON |
| 93 | + - Add the memory info to `incremental_metrics` and compute the average metrics to add to the `metrics` in JSON payload |
| 94 | + - Send a POST request to the Django API |
| 95 | +- Run post suite tasks: `.run_post_suite()` function of `TestOLTPBench` |
| 96 | + |
| 97 | +## Dependencies |
| 98 | + |
| 99 | +### External dependencies |
| 100 | +- [oltpbench](https://github.com/oltpbenchmark/oltpbench): for executing the OLTP benchmark of your choice |
| 101 | +- [NoisePage Stats](https://github.com/cmu-db/noisepage-stats): for the result reporting API and storage |
| 102 | + |
| 103 | +### Internal dependencies |
| 104 | +Let the base directory be `noisepage/script/testing` |
| 105 | +- `util/`: provides base classes/functions/constants to construct the `TestOLTPBench` class |
| 106 | + - `test_server.py` |
| 107 | + - Contains the base `TestServer` class to manage the lifecycle of a test suite for a certain OLTP benchmark type |
| 108 | + - `test_case.py` |
| 109 | + - Contains the base `TestCase` class to manage the lifecycle of a test case |
| 110 | + - `common.py` |
| 111 | + - Contains common utility helper functions |
| 112 | + - `constants.py` |
| 113 | + - Contains general constants, like `ErrorCode` |
| 114 | +- `reporting/`: provide functions to report testing results to Django API |
| 115 | + |
| 116 | +## File structures |
| 117 | +Let the base directory be `noisepage/script/testing/oltpbench` |
| 118 | +- `configs/`: contains the JSON config files for Jenkins to run OLTPBench tests for |
| 119 | + - End-to-end debugging |
| 120 | + - End-to-end performance |
| 121 | + - Nightly |
| 122 | + |
| 123 | + For more details, check the [config files](https://github.com/cmu-db/noisepage/blob/master/script/testing/oltpbench#config-files) section below for more details |
| 124 | +- `run_oltpbench.py`: entry point to run the OLTP bench tests |
| 125 | +- `test_oltpbench.py`: defines the `TestOLTPBench` class which manage the lifecycle of a test suite |
| 126 | +- `test_case_oltp.py`: defines the `TestOLTPBench` class which manage the lifecycle of a test case |
| 127 | +- `utils.py`: defines a list of utility functions specifically used by OLTP bench tests |
| 128 | + |
| 129 | +## Config files |
| 130 | +A config file is necessary to specify a test for OLTP Benchmark. |
| 131 | + |
| 132 | +### Fields |
| 133 | +In the configuration file, those information are required: |
| 134 | +- A list of test cases in `testcases` |
| 135 | +- The benchmarks and options in each test case, required by the oltpbench's workload descriptor file |
| 136 | + - The `run_oltpbench` script will run all test cases in the configuration file sequentially. |
| 137 | + - The `loop` key in the configuration file is used to duplicate the test case with different options. |
| 138 | + - The `server_args` object in the configuration specifies the command line arguments passed to the server when running the binary. |
| 139 | + |
| 140 | +### Example: |
| 141 | +The following example shows a oltpbenchmark test with 4 testcases |
| 142 | +- The first testcase has the base testcase of terminal `1` but it will be looped for different configurations of the terminals from `1` to `2` to `4` |
| 143 | +- The second testcase only has the base testcase whose terminal configuration is `8` |
| 144 | + |
| 145 | +```json |
| 146 | +{ |
| 147 | + "type": "oltpbenchmark", |
| 148 | + "server_args":{ |
| 149 | + "connection_thread_count": 32, |
| 150 | + "wal_file_path": "/mnt/ramdisk/wal.log" |
| 151 | + }, |
| 152 | + "testcases": [ |
| 153 | + { |
| 154 | + "base": { |
| 155 | + "benchmark": "tatp", |
| 156 | + "weights": "2,35,10,35,2,14,2", |
| 157 | + "query_mode": "extended", |
| 158 | + "scale_factor": 1, |
| 159 | + "terminals": 1, |
| 160 | + "loader_threads": 4, |
| 161 | + "client_time": 60 |
| 162 | + }, |
| 163 | + "loop": [ |
| 164 | + {"terminals":1, "db_create":true,"db_load":true}, |
| 165 | + {"terminals":2, "db_restart":false,"db_create":false,"db_load":false}, |
| 166 | + {"terminals":4, "db_restart":false,"db_create":false,"db_load":false}, |
| 167 | + ] |
| 168 | + }, |
| 169 | + { |
| 170 | + "base": { |
| 171 | + "benchmark": "tatp", |
| 172 | + "weights": "2,35,10,35,2,14,2", |
| 173 | + "query_mode": "extended", |
| 174 | + "terminals": 8, |
| 175 | + "loader_threads": 4, |
| 176 | + "client_time": 600 |
| 177 | + } |
| 178 | + } |
| 179 | + ] |
| 180 | +} |
| 181 | +``` |
0 commit comments