Skip to content

Commit 503eeb4

Browse files
pbhandar2meta-codesync[bot]
authored andcommitted
update the cachebench and hw eval with build instructions
Summary: update cachebench and hardware eval docs with getdeps Reviewed By: AlnisM Differential Revision: D102863335 fbshipit-source-id: 1185e186296764f7ce15a08cb07e90169fd4c59e
1 parent c4daab4 commit 503eeb4

2 files changed

Lines changed: 40 additions & 114 deletions

File tree

website/docs/Cache_Library_User_Guides/Cachebench_FB_HW_eval.md

Lines changed: 31 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -29,112 +29,34 @@ mdadm --create /dev/md0 --force --raid-devices=2 --level=0 --chunk=256 /dev/nvme
2929

3030
## Installing cachebench
3131

32-
1. If you have not already, clone the cachelib repository from github.com:
32+
1. Clone the CacheLib repository and build:
3333

34-
```sh
35-
git clone https://github.com/facebook/CacheLib.git
36-
```
37-
38-
2. Build cachelib and `cachebench`:
3934
```sh
35+
git clone https://github.com/facebook/CacheLib
4036
cd CacheLib
41-
./contrib/build.sh -j
37+
sudo python3 ./build/fbcode_builder/getdeps.py install-system-deps --recursive cachelib
38+
python3 ./build/fbcode_builder/getdeps.py --allow-system-packages build cachelib
4239
```
43-
Notes:
44-
* It will take several minutes to build and install all dependencies.
45-
* Remove `-j` flag to build using only a single CPU (build will take longer)
46-
* The script will automatically use `sudo` to install several OS packages (using `apt`, `dnf`, etc.)
47-
* The build script has been tested to work on stable Debian, Ubuntu, CentOS, RockyLinux.
48-
Other systems are possible but not officially supported.
49-
50-
3. The resulting binaries and libraries will be in `./opt/cachelib`:
51-
```sh
52-
./opt/cachelib/bin/cachebench --help
53-
```
54-
or
40+
41+
Note: it will take several minutes to build and install all dependencies.
42+
43+
2. Locate the install directory and verify `cachebench` works:
44+
5545
```sh
56-
cd ./opt/cachelib/bin/
57-
./cachebench --help
46+
INST_DIR=$(python3 ./build/fbcode_builder/getdeps.py show-inst-dir cachelib)
47+
$INST_DIR/bin/cachebench --help
5848
```
5949

60-
4. Sample test configurations are provided in `./opt/cachelib/test_configs/`.
50+
3. Sample test configurations are provided in the install directory.
6151
Example:
6252

6353
```sh
64-
cd ./opt/cachelib
65-
./bin/cachebench --json_test_config ./test_configs/simple_test.json
54+
$INST_DIR/bin/cachebench --json_test_config $INST_DIR/test_configs/simple_test.json
6655
```
6756

68-
<details>
69-
<summary>Expected Output of test run</summary>
70-
71-
$ cd ./opt/cachelib
72-
$ ./bin/cachebench --json_test_config ./test_configs/simple_test.json
73-
===JSON Config===
74-
// @nolint instantiates a small cache and runs a quick run of basic operations.
75-
{
76-
"cache_config" : {
77-
"cacheSizeMB" : 512,
78-
"poolRebalanceIntervalSec" : 1,
79-
"moveOnSlabRelease" : false,
80-
81-
"numPools" : 2,
82-
"poolSizes" : [0.3, 0.7]
83-
},
84-
"test_config" : {
85-
86-
"numOps" : 100000,
87-
"numThreads" : 32,
88-
"numKeys" : 1000000,
89-
90-
"keySizeRange" : [1, 8, 64],
91-
"keySizeRangeProbability" : [0.3, 0.7],
92-
93-
"valSizeRange" : [1, 32, 10240, 409200],
94-
"valSizeRangeProbability" : [0.1, 0.2, 0.7],
95-
96-
"getRatio" : 0.15,
97-
"setRatio" : 0.8,
98-
"delRatio" : 0.05,
99-
"keyPoolDistribution": [0.4, 0.6],
100-
"opPoolDistribution" : [0.5, 0.5]
101-
}
102-
}
103-
104-
Welcome to OSS version of cachebench
105-
Created 897,355 keys in 0.00 mins
106-
Generating 1.60M sampled accesses
107-
Generating 1.60M sampled accesses
108-
Generated access patterns in 0.00 mins
109-
Total 3.20M ops to be run
110-
12:07:12 0.00M ops completed
111-
== Test Results ==
112-
== Allocator Stats ==
113-
Items in RAM : 96,995
114-
Items in NVM : 0
115-
Alloc Attempts: 2,559,176 Success: 100.00%
116-
RAM Evictions : 2,163,672
117-
Cache Gets : 480,592
118-
Hit Ratio : 10.97%
119-
NVM Gets : 0, Coalesced : 100.00%
120-
NVM Puts : 0, Success : 0.00%, Clean : 100.00%, AbortsFromDel : 0, AbortsFromGet : 0
121-
NVM Evicts : 0, Clean : 100.00%, Unclean : 0, Double : 0
122-
NVM Deletes : 0 Skipped Deletes: 100.00%
123-
Released 21 slabs
124-
Moves : attempts: 0, success: 100.00%
125-
Evictions : attempts: 3,040, success: 99.57%
126-
127-
== Throughput for ==
128-
Total Ops : 3.20 million
129-
Total sets: 2,559,176
130-
get : 49,453/s, success : 10.97%
131-
set : 263,344/s, success : 100.00%
132-
del : 16,488/s, found : 10.83%
133-
134-
</details>
135-
136-
137-
5. If fio is not installed, build it with:
57+
See [Installation](/docs/installation) for full build details and [Locating build output](/docs/installation#locating-build-output) for more on finding artifacts.
58+
59+
4. If fio is not installed, build it with:
13860
```sh
13961
git clone https://github.com/axboe/fio.git
14062
cd fio
@@ -143,39 +65,37 @@ mdadm --create /dev/md0 --force --raid-devices=2 --level=0 --chunk=256 /dev/nvme
14365
make install
14466
```
14567

146-
See [build and installation](/docs/installation) for further details.
147-
14868
## Running the benchmark for SSD perf testing
14969

15070
Cachebench has three configs packaged for SSD validation. These are under `test_configs/ssd_perf/<service-domain>`. Currently, we have "graph_cache_leader", "kvcache_reg", and "kvcache_wc" which represent three distinct cache workloads from Facebook. Below, we show how the benchmarks can be run for two of these workloads. It is important to trim the ssds between the runs to ensure any interference is avoided.
15171

15272

153-
1. Change to the path where you previously copied cachebench to.
73+
1. Set the install directory path:
15474
```sh
155-
cd <your path>
75+
INST_DIR=$(python3 ./build/fbcode_builder/getdeps.py show-inst-dir cachelib)
15676
```
157-
2. If `/dev/md0` is not being used, edit workload files appropiately.
77+
2. If `/dev/md0` is not being used, edit workload files appropriately.
15878
Change all instances of `/dev/md0` to raw path of data SSD(s):
15979
```sh
160-
vi ./test_configs/ssd_perf/graph_cache_leader/config.json
161-
vi ./test_configs/ssd_perf/kvcache_l2_wc/config.json
80+
vi $INST_DIR/test_configs/ssd_perf/graph_cache_leader/config.json
81+
vi $INST_DIR/test_configs/ssd_perf/kvcache_l2_wc/config.json
16282
```
163-
See [configuring storage path](Configuring_cachebench_parameters#storage-filedevicedirectory-path-info) for more details on how to configure the storage path.
83+
See [configuring storage path](Configuring_cachebench_parameters#storage-filedevicedirectory-path-info) for more details on how to configure the storage path.
16484
3. Before each benchmark run, fully trim the drive with fio:
16585
```sh
166-
fio --name=trim --filename=/dev/md0 --rw=trim --bs=3G
86+
fio --name=trim --filename=/dev/md0 --rw=trim --bs=3G
16787
```
168-
3. Execute social graph leader cache workload:
88+
4. Execute social graph leader cache workload:
16989
```sh
170-
./cachebench -json_test_config test_configs/ssd_perf/graph_cache_leader/config.json --progress_stats_file=/tmp/graph_cache_leader.log
90+
$INST_DIR/bin/cachebench -json_test_config $INST_DIR/test_configs/ssd_perf/graph_cache_leader/config.json --progress_stats_file=/tmp/graph_cache_leader.log
17191
```
172-
4. Fully trim the drive with fio again:
92+
5. Fully trim the drive with fio again:
17393
```sh
174-
fio --name=trim --filename=/dev/md0 --rw=trim --bs=3G
175-
```
176-
5. Execute the `kvcache` workload:
94+
fio --name=trim --filename=/dev/md0 --rw=trim --bs=3G
95+
```
96+
6. Execute the `kvcache` workload:
17797
```sh
178-
./cachebench -json_test_config test_configs/ssd_perf/kvcache_l2_wc/config.json progress_stats_file=/tmp/mc-l2-wc.log
98+
$INST_DIR/bin/cachebench -json_test_config $INST_DIR/test_configs/ssd_perf/kvcache_l2_wc/config.json --progress_stats_file=/tmp/mc-l2-wc.log
17999
```
180100

181101
### Tuning the workload and cache parameters
@@ -220,7 +140,7 @@ Meta is sharing anonymized traces captured from large scale production cache ser
220140

221141
4. Execute the trace workload
222142
```sh
223-
./cachebench -json_test_config ./config_kvcache.json progress_stats_file=/tmp/kvcache-trace.log
143+
$INST_DIR/bin/cachebench -json_test_config ./config_kvcache.json --progress_stats_file=/tmp/kvcache-trace.log
224144
```
225145

226146
### List of traces

website/docs/Cache_Library_User_Guides/Cachebench_Overview.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,14 @@ developer's need. The following are few examples.
5151
this can be enabled. All code changes and new features to CacheLib from
5252
Facebook go through correctness stress tests with CacheBench.
5353

54-
## Building cachebench
54+
## Building cachebench
5555

5656
Follow instructions in [Installation](/docs/installation) to build
57-
cachebench. This should install cachebench in your local machine under
58-
```opt/cachelib/bin/cachebench```
57+
CacheLib and cachebench. After building, locate the `cachebench` binary using:
58+
59+
```sh
60+
INST_DIR=$(python3 ./build/fbcode_builder/getdeps.py show-inst-dir cachelib)
61+
$INST_DIR/bin/cachebench --help
62+
```
63+
64+
See [Locating build output](/docs/installation#locating-build-output) for more details.

0 commit comments

Comments
 (0)