Skip to content

Commit 7c44c03

Browse files
YifanYuan3meta-codesync[bot]
authored andcommitted
add prod-focused configruations (#302)
Summary: Pull Request resolved: #302 This diff adds: (1) one new microbenchmark (glibc `memcmp`) (2) configurations of running all microbenchmarks so that they focus on the most relevant and representative operations (3) a new benchpress job and run script for (2) (4) some affiliated things like parsers. Scoring (e.g. how to interpret the results) as well as sizing (e.g. dataset size) will come in the next diff Reviewed By: charles-typ Differential Revision: D85820722 fbshipit-source-id: 7ef69914b05fa3d5e3c7089da0ab693ce5229108
1 parent af23b6a commit 7c44c03

File tree

6 files changed

+290
-20
lines changed

6 files changed

+290
-20
lines changed

benchpress/config/jobs_wdl.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,26 @@
175175
after:
176176
- 'benchmarks/wdl_bench/wdl_bench_results.txt'
177177
- 'benchmarks/wdl_bench/out_*.json'
178+
179+
- name: prod_set
180+
benchmark: wdl_bench
181+
description: >
182+
a set of most popular and ubiquitous WDLs across Meta's fleet, with configs close to real production.
183+
args:
184+
- '--type {type}'
185+
- '--output {output}'
186+
vars:
187+
- 'type=prod'
188+
- 'output=wdl_bench_results.txt'
189+
hooks:
190+
- hook: cpu-mpstat
191+
options:
192+
args:
193+
- '-u' # utilization
194+
- '1' # second interval
195+
- hook: copymove
196+
options:
197+
is_move: true
198+
after:
199+
- 'benchmarks/wdl_bench/wdl_bench_results.txt'
200+
- 'benchmarks/wdl_bench/out_*.json'

packages/wdl_bench/convert.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,20 @@
1616

1717

1818
with open(input_file_name) as f:
19-
if sys.argv[1] == "concurrent_hash_map_benchmark":
19+
if sys.argv[1] == "concurrency_concurrent_hash_map_benchmark":
2020
parse_line.parse_line_chm(f, sum_c)
2121
elif sys.argv[1] == "lzbench":
2222
parse_line.parse_line_lzbench(f, sum_c)
2323
elif sys.argv[1] == "openssl":
2424
parse_line.parse_line_openssl(f, sum_c)
2525
elif sys.argv[1] == "vdso_bench":
2626
parse_line.parse_line_vdso_bench(f, sum_c)
27+
elif sys.argv[1] == "libaegis_benchmark":
28+
parse_line.parse_line_libaegis_benchmark(f, sum_c)
29+
elif sys.argv[1] == "xxhash_benchmark":
30+
parse_line.parse_line_xxhash_benchmark(f, sum_c)
31+
elif sys.argv[1] == "container_hash_maps_bench":
32+
parse_line.parse_line_container_hash_maps_bench(f, sum_c)
2733
else:
2834
parse_line.parse_line(f, sum_c)
2935

packages/wdl_bench/install_wdl_bench.sh

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
# LICENSE file in the root directory of this source tree.
66
set -Eeuo pipefail
77

8+
GLIBC_VERSION=$(getconf GNU_LIBC_VERSION | cut -f 2 -d\ )
9+
810
##################### BENCHMARK CONFIG #########################
911

1012
declare -A REPOS=(
@@ -15,16 +17,18 @@ declare -A REPOS=(
1517
['vdso']='https://github.com/leitao/debug.git'
1618
['libaegis']='https://github.com/aegis-aead/libaegis.git'
1719
['xxhash']='https://github.com/Cyan4973/xxHash.git'
20+
['glibc']='https://sourceware.org/git/glibc.git'
1821
)
1922

2023
declare -A TAGS=(
21-
['folly']='v2025.11.03.00'
22-
['fbthrift']='v2025.11.03.00'
24+
['folly']='v2025.11.17.00'
25+
['fbthrift']='v2025.11.17.00'
2326
['lzbench']='v2.2'
2427
['openssl']='openssl-3.6.0'
2528
['vdso']='a90085a8e4e1e07a93cc45a68da246fa98a9f831'
2629
['libaegis']='0.4.2'
2730
['xxhash']='136cc1f8fe4d5ea62a7c16c8424d4fa5158f6d68'
31+
['glibc']="glibc-${GLIBC_VERSION}"
2832
)
2933

3034
declare -A DATASETS=(
@@ -48,12 +52,12 @@ LINUX_DIST_ID="$(awk -F "=" '/^ID=/ {print $2}' /etc/os-release | tr -d '"')"
4852
if [ "$LINUX_DIST_ID" = "ubuntu" ]; then
4953
apt install -y cmake autoconf automake flex bison \
5054
nasm clang patch git libssl-dev \
51-
tar unzip perl openssl python3-dev
55+
tar unzip perl openssl python3-dev gawk
5256

5357
elif [ "$LINUX_DIST_ID" = "centos" ]; then
5458
dnf install -y cmake autoconf automake flex bison \
5559
meson nasm clang patch \
56-
git tar unzip perl openssl-devel python3-devel
60+
git tar unzip perl openssl-devel python3-devel gawk
5761
fi
5862

5963

@@ -67,6 +71,11 @@ fi
6771

6872
##################### BUILD AND INSTALL FUNCTIONS #########################
6973

74+
folly_benchmark_list="concurrency_concurrent_hash_map_bench hash_hash_benchmark container_hash_maps_bench stats_digest_builder_benchmark fibers_fibers_benchmark crypto_lt_hash_benchmark memcpy_benchmark memset_benchmark io_async_event_base_benchmark io_iobuf_benchmark function_benchmark random_benchmark synchronization_small_locks_benchmark synchronization_lifo_sem_bench range_find_benchmark"
75+
76+
fbthrift_benchmark_list="ProtocolBench VarintUtilsBench"
77+
78+
7079
clone()
7180
{
7281
lib=$1
@@ -104,6 +113,10 @@ build_folly()
104113

105114
python3 ./build/fbcode_builder/getdeps.py --allow-system-packages build --scratch-path "${WDL_BUILD}"
106115

116+
for benchmark in $folly_benchmark_list; do
117+
cp "$WDL_BUILD/build/folly/$benchmark" "$WDL_ROOT/$benchmark"
118+
done
119+
107120
popd || exit
108121
}
109122

@@ -119,6 +132,10 @@ build_fbthrift()
119132

120133
python3 ./build/fbcode_builder/getdeps.py --allow-system-packages build fbthrift --scratch-path "${WDL_BUILD}" --extra-cmake-defines='{"enable_tests": "1"}'
121134

135+
for benchmark in $fbthrift_benchmark_list; do
136+
cp "$WDL_BUILD/build/fbthrift/bin/$benchmark" "$WDL_ROOT/$benchmark"
137+
done
138+
122139
popd || exit
123140
}
124141

@@ -198,7 +215,22 @@ build_xxhash()
198215
clone $lib || echo "Failed to clone $lib"
199216
cd "$lib" || exit
200217
make -C ./tests/bench/ -j
201-
cp ./test/bench/benchHash "${WDL_ROOT}/xxhash_benchmark" || exit
218+
cp ./tests/bench/benchHash "${WDL_ROOT}/xxhash_benchmark" || exit
219+
220+
popd || exit
221+
}
222+
223+
build_glibc()
224+
{
225+
lib='glibc'
226+
pushd "${WDL_SOURCE}"
227+
clone $lib || echo "Failed to clone $lib"
228+
cd "$lib" || exit
229+
mkdir build && cd build
230+
../configure --prefix="${WDL_SOURCE}/glibc/build"
231+
make -j
232+
make bench
233+
cp "${WDL_SOURCE}/glibc/build/benchtests/bench-memcmp" "${WDL_ROOT}/" || exit
202234

203235
popd || exit
204236
}
@@ -215,21 +247,10 @@ build_openssl
215247
build_vdso
216248
build_libaegis
217249
build_xxhash
218-
219-
folly_benchmark_list="concurrency_concurrent_hash_map_bench hash_hash_benchmark container_hash_maps_bench stats_digest_builder_benchmark fibers_fibers_benchmark crypto_lt_hash_benchmark memcpy_benchmark memset_benchmark io_async_event_base_benchmark io_iobuf_benchmark function_benchmark random_benchmark synchronization_small_locks_benchmark range_find_benchmark"
220-
221-
fbthrift_benchmark_list="ProtocolBench"
222-
223-
for benchmark in $folly_benchmark_list; do
224-
cp "$WDL_BUILD/build/folly/$benchmark" "$WDL_ROOT/$benchmark"
225-
done
226-
227-
for benchmark in $fbthrift_benchmark_list; do
228-
cp "$WDL_BUILD/build/fbthrift/bin/$benchmark" "$WDL_ROOT/$benchmark"
229-
done
230-
250+
build_glibc
231251

232252
cp "${BPKGS_WDL_ROOT}/run.sh" ./
253+
cp "${BPKGS_WDL_ROOT}/run_prod.sh" ./
233254
cp "${BPKGS_WDL_ROOT}/convert.py" ./
234255
cp "${BPKGS_WDL_ROOT}/aggregate_result.py" ./
235256
cp "${BPKGS_WDL_ROOT}/parse_line.py" ./

packages/wdl_bench/parse_line.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# LICENSE file in the root directory of this source tree.
55

66

7+
import json
78
import re
89

910

@@ -130,3 +131,62 @@ def parse_line_vdso_bench(f, sum_c):
130131
name = elements[4]
131132
value = float(elements[7])
132133
sum_c[name + ": M/s"] = value
134+
135+
136+
def parse_line_libaegis_benchmark(f, sum_c):
137+
for line in f:
138+
elements = line.split()
139+
if re.search("128L", elements[0]):
140+
name = "".join(elements[:-3])
141+
value = float(elements[-2])
142+
sum_c[name + ": Mb/s"] = value
143+
144+
145+
def parse_line_xxhash_benchmark(f, sum_c):
146+
for line in f:
147+
line = line.strip()
148+
if not line:
149+
continue
150+
151+
# Detect section headers
152+
if "benchmarking large inputs" in line.lower():
153+
current_section = "large_inputs"
154+
sum_c[current_section] = {}
155+
elif "throughput small inputs of fixed size" in line.lower():
156+
current_section = "throughput_small_fixed"
157+
sum_c[current_section] = {}
158+
elif "benchmarking random size inputs" in line.lower():
159+
current_section = "random_size_inputs"
160+
sum_c[current_section] = {}
161+
elif "latency for small inputs of fixed size" in line.lower():
162+
current_section = "latency_small_fixed"
163+
sum_c[current_section] = {}
164+
elif "latency for small inputs of random size" in line.lower():
165+
current_section = "latency_small_random"
166+
sum_c[current_section] = {}
167+
# Parse data lines (format: "xxh3 , value1, value2, ...")
168+
elif "," in line and current_section:
169+
parts = [p.strip() for p in line.split(",")]
170+
if len(parts) > 1:
171+
hash_name = parts[0]
172+
values = [int(v) for v in parts[1:] if v]
173+
174+
# Create input size keys based on section and position
175+
data = {}
176+
for i, value in enumerate(values):
177+
if current_section == "large_inputs":
178+
# log9 to log27 (512 bytes to 128 MB)
179+
input_size = f"log{9+i}"
180+
else:
181+
# 1 to N bytes
182+
input_size = f"{i+1}_bytes"
183+
data[input_size] = value
184+
185+
sum_c[current_section][hash_name] = data
186+
187+
188+
def parse_line_container_hash_maps_bench(f, sum_c):
189+
data = json.load(f)
190+
for k, v in data.items():
191+
if re.search("^(Find)|(Insert)|(InsertSqBr)|(Erase)|(Iter)", k):
192+
sum_c[k] = v

packages/wdl_bench/run.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ main() {
120120
done
121121

122122

123-
123+
if [ "$run_type" = "prod" ]; then
124+
bash "${WDL_ROOT}/run_prod.sh"
125+
fi
124126

125127
set -u # Enable unbound variables check from here onwards
126128
benchreps_tell_state "working on config"

0 commit comments

Comments
 (0)