Skip to content

Commit 21fedad

Browse files
committed
Add fs-api layer benchmark
Signed-off-by: Christian Hagemeier <[email protected]>
1 parent 2a9a494 commit 21fedad

File tree

5 files changed

+581
-52
lines changed

5 files changed

+581
-52
lines changed

benchmark/benchmark.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from benchmarks.client_benchmark import ClientBenchmark
1919
from benchmarks.crt_benchmark import CrtBenchmark
2020
from benchmarks.fio_benchmark import FioBenchmark
21+
from benchmarks.filesystem_api_benchmark import FilesystemApiBenchmark
2122
from benchmarks.prefetch_benchmark import PrefetchBenchmark
2223

2324
logging.basicConfig(level=os.environ.get('LOGLEVEL', 'INFO').upper())
@@ -225,6 +226,8 @@ def run_experiment(cfg: DictConfig) -> None:
225226
benchmark = ClientBenchmark(cfg, metadata)
226227
elif benchmark_type == "client-bp":
227228
benchmark = ClientBenchmark(cfg, metadata, backpressure=True)
229+
elif benchmark_type == "filesystem_api":
230+
benchmark = FilesystemApiBenchmark(cfg, metadata)
228231
else:
229232
raise ValueError(f"Unsupported benchmark type: {benchmark_type}")
230233

benchmark/benchmarks/benchmark_config_parser.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,13 @@ def get_client_config(self) -> Dict[str, Any]:
8484
return {
8585
'read_window_size': getattr(client_cfg, 'read_window_size', 2147483648), # Reaslitic default value 8M/2G?
8686
}
87+
88+
def get_filesystem_api_config(self) -> Dict[str, Any]:
89+
filesystem_api_cfg = self.cfg.benchmarks.filesystem_api
90+
return {
91+
'max_memory_target': getattr(filesystem_api_cfg, 'max_memory_target', None),
92+
'crt_memory_limit_gib': getattr(filesystem_api_cfg, 'crt_memory_limit_gib', None),
93+
'threads_per_file': getattr(filesystem_api_cfg, 'threads_per_file', 1),
94+
'iterations': getattr(filesystem_api_cfg, 'iterations', None),
95+
'mock_client': getattr(filesystem_api_cfg, 'mock_client', False),
96+
}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
import logging
2+
import os
3+
import subprocess
4+
from typing import Dict, Any
5+
6+
from benchmarks.base_benchmark import BaseBenchmark
7+
from omegaconf import DictConfig
8+
9+
from benchmarks.benchmark_config_parser import BenchmarkConfigParser
10+
11+
log = logging.getLogger(__name__)
12+
13+
14+
class FilesystemApiBenchmark(BaseBenchmark):
15+
def __init__(self, cfg: DictConfig, metadata: Dict[str, Any]):
16+
self.config_parser = BenchmarkConfigParser(cfg)
17+
self.common_config = self.config_parser.get_common_config()
18+
self.filesystem_api_config = self.config_parser.get_filesystem_api_config()
19+
self.mountpoint_config = self.config_parser.get_mountpoint_config()
20+
21+
def setup(self) -> None:
22+
pass
23+
24+
def run_benchmark(self) -> None:
25+
subprocess_args = [
26+
"cargo",
27+
"run",
28+
"--example",
29+
"filesystem_api_benchmark",
30+
self.common_config['s3_bucket'],
31+
]
32+
33+
object_size = self.common_config['object_size_in_gib']
34+
size_gib = str(object_size)
35+
app_workers = self.common_config['application_workers']
36+
37+
# Check if objects are specified or if we have to fall back to objects
38+
# generated by fio.
39+
objects = self.common_config['s3_keys']
40+
if not objects:
41+
objects = self.config_parser.default_object_keys(app_workers, size_gib)
42+
43+
if len(objects) >= app_workers:
44+
for i in range(app_workers):
45+
subprocess_args.append(objects[i])
46+
else:
47+
raise ValueError("Seeing fewer objects than app workers. So cannot proceed with the run.")
48+
49+
region = self.common_config["region"]
50+
subprocess_args.extend(["--region", region])
51+
52+
if (max_throughput := self.common_config['max_throughput_gbps']) is not None:
53+
subprocess_args.extend(["--maximum-throughput-gbps", str(max_throughput)])
54+
55+
if (max_memory_target := self.filesystem_api_config['max_memory_target']) is not None:
56+
subprocess_args.extend(["--max-memory-target", str(max_memory_target)])
57+
58+
if (crt_memory_limit_gib := self.filesystem_api_config['crt_memory_limit_gib']) is not None:
59+
subprocess_args.extend(["--crt-memory-limit-gib", str(crt_memory_limit_gib)])
60+
61+
if (read_part_size := self.common_config['read_part_size']) is not None:
62+
subprocess_args.extend(["--part-size", str(read_part_size)])
63+
64+
read_size = self.common_config['read_size']
65+
subprocess_args.extend(["--read-size", str(read_size)])
66+
67+
threads_per_file = self.filesystem_api_config['threads_per_file']
68+
subprocess_args.extend(["--threads-per-file", str(threads_per_file)])
69+
70+
if (iterations := self.filesystem_api_config['iterations']) is not None:
71+
subprocess_args.extend(["--iterations", str(iterations)])
72+
73+
if self.filesystem_api_config.get('mock_client', False) or self.mountpoint_config.get('stub_mode') == 's3_client':
74+
subprocess_args.append("--mock-client")
75+
76+
for interface in self.common_config['network_interfaces']:
77+
subprocess_args.extend(["--bind", interface])
78+
79+
if (run_time := self.common_config['run_time']) is not None:
80+
subprocess_args.extend(["--max-duration", str(run_time)])
81+
82+
subprocess_args.extend(["--output-file", "filesystem-api-output.json"])
83+
84+
log.info("Running filesystem API benchmark with args: %s", subprocess_args)
85+
86+
# Set up environment variables
87+
env = os.environ.copy()
88+
if self.mountpoint_config.get('use_download_checksums', True) is False:
89+
env["MOUNTPOINT_EXPERIMENTAL_DISABLE_CHECKSUMS"] = "1"
90+
91+
subprocess.run(subprocess_args, check=True, capture_output=True, text=True, env=env)
92+
log.info("Filesystem API benchmark completed successfully.")
93+
94+
def post_process(self) -> None:
95+
pass

benchmark/conf/config.yaml

Lines changed: 58 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,80 +2,86 @@
22
# as well as some which will be 'swept' over for experiments.
33

44
defaults:
5-
- _self_
5+
- _self_
66

77
# ===== Common parameters for all benchmarks =====
88
s3_bucket: ???
99
s3_result_bucket: !!null
1010
application_workers: 1
1111
iteration: 0
1212
iterations: 1
13-
run_time: 30 # Default run time in seconds
13+
run_time: 30 # Default run time in seconds
1414
read_size: 262144 # Defaults to 256KiB, can go up to 1MiB.
1515
read_part_size: !!null
1616
region: "us-east-1"
17-
write_part_size: 16777216 # 16 MiB, to allow for uploads of large files
18-
object_size_in_gib: 100 # Size of the object to benchmark
17+
write_part_size: 16777216 # 16 MiB, to allow for uploads of large files
18+
object_size_in_gib: 100 # Size of the object to benchmark
1919
benchmark_type: "fio" # fio, prefetch, client, client-bp, crt
20-
s3_keys: !!null
20+
s3_keys: !!null # Network configuration
2121

22-
# Network configuration
2322
network:
24-
interface_names: []
25-
maximum_throughput_gbps: !!null
23+
interface_names: []
24+
maximum_throughput_gbps:
25+
!!null # Monitoring options (common to all benchmarks)
2626

27-
# Monitoring options (common to all benchmarks)
2827
monitoring:
29-
with_bwm: false
30-
with_perf_stat: false
28+
with_bwm: false
29+
with_perf_stat: false
3130

3231
# ===== Mountpoint configuration =====
3332
mountpoint:
34-
fuse_threads: !!null
35-
prefix: !!null
36-
metadata_ttl: "indefinite"
37-
mountpoint_max_background: !!null
38-
mountpoint_congestion_threshold: !!null
39-
mountpoint_binary: !!null
40-
upload_checksums: !!null
41-
stub_mode: "off" # Options: "off", "fs_handler", "s3_client"
42-
mountpoint_debug: false
43-
mountpoint_debug_crt: false
33+
fuse_threads: !!null
34+
prefix: !!null
35+
metadata_ttl: "indefinite"
36+
mountpoint_max_background: !!null
37+
mountpoint_congestion_threshold: !!null
38+
mountpoint_binary: !!null
39+
upload_checksums: !!null
40+
stub_mode: "off" # Options: "off", "fs_handler", "s3_client"
41+
mountpoint_debug: false
42+
mountpoint_debug_crt: false
4443

4544
# ===== Benchmark-specific configurations =====
4645
benchmarks:
47-
fio:
48-
direct_io: false
49-
fio_benchmarks:
50-
- sequential_read
51-
fio_benchmark: "${benchmarks.fio.fio_benchmarks[0]}"
52-
fio_io_engine: "psync"
53-
54-
prefetch:
55-
max_memory_target: !!null
56-
57-
crt:
58-
crt_benchmarks_path: !!null
46+
fio:
47+
direct_io: false
48+
fio_benchmarks:
49+
- sequential_read
50+
fio_benchmark: "${benchmarks.fio.fio_benchmarks[0]}"
51+
fio_io_engine: "psync"
5952

60-
client:
61-
# None
53+
prefetch:
54+
max_memory_target: !!null
55+
56+
crt:
57+
crt_benchmarks_path: !!null
58+
59+
client:
60+
# None
61+
filesystem_api:
62+
max_memory_target: !!null
63+
crt_memory_limit_gib: !!null
64+
threads_per_file: 1
65+
iterations: !!null
66+
mock_client: false
67+
68+
client_backpressure:
69+
read_window_size: !!null #2147483648
6270

63-
client_backpressure:
64-
read_window_size: !!null #2147483648
6571

6672
hydra:
67-
help:
68-
app_name: "Mountpoint benchmark runner"
69-
mode: MULTIRUN
70-
job:
71-
chdir: true
72-
sweeper:
73-
# Global sweeper params - use this for common parameters across all benchmarks
74-
# For specific parameter use sweep params under the specific benchmark type config
75-
params:
76-
'application_workers': 1, 4, 16, 64, 128
77-
'iteration': "range(${iterations})"
78-
'mountpoint.fuse_threads': 1, 16, 64
79-
'benchmarks.fio.direct_io': false, true
80-
# 'benchmarks.prefetch.max_memory_target': !!null, 1073741824, 2147483648 # null, 1GB, 2GB
81-
#'benchmarks.client_backpressure.read_window_size': 8388608, 2147483648
73+
help:
74+
app_name: "Mountpoint benchmark runner"
75+
mode: MULTIRUN
76+
job:
77+
chdir: true
78+
sweeper:
79+
# Global sweeper params - use this for common parameters across all benchmarks
80+
# For specific parameter use sweep params under the specific benchmark type config
81+
params:
82+
"application_workers": 1, 4, 16, 64, 128
83+
"iteration": "range(${iterations})"
84+
"mountpoint.fuse_threads": 1, 16, 64
85+
"benchmarks.fio.direct_io": false, true
86+
# 'benchmarks.prefetch.max_memory_target': !!null, 1073741824, 2147483648 # null, 1GB, 2GB
87+
#'benchmarks.client_backpressure.read_window_size': 8388608, 2147483648

0 commit comments

Comments
 (0)