Skip to content

Commit 3a8c110

Browse files
authored
Add compile-time flag to stub FS read handler for performance testing (#1330)
This change adds an environment variable that allows Mountpoint to return zeroed bytes when reading instead of going to S3. This is useful for determining the maximum throughput possible between the client application and Mountpoint's filesystem handlers, omitting major components like file handles, prefetcher, and network calls to S3. ### Does this change impact existing behavior? No existing behavior change. ### Does this change need a changelog entry? Does it require a version change? No, benchmarking change only. --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and I agree to the terms of the [Developer Certificate of Origin (DCO)](https://developercertificate.org/). Signed-off-by: Daniel Carl Jones <[email protected]>
1 parent 02b21c7 commit 3a8c110

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

benchmark/benchmark.py

+11
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,17 @@ def _mount_mp(
128128
if cfg['mountpoint_congestion_threshold'] is not None:
129129
subprocess_env["UNSTABLE_MOUNTPOINT_CONGESTION_THRESHOLD"] = str(cfg["mountpoint_congestion_threshold"])
130130

131+
stub_mode = str(cfg["stub_mode"]).lower()
132+
if stub_mode != "off" and cfg["mountpoint_binary"] is not None:
133+
raise ValueError("Cannot use `stub_mode` with `mountpoint_binary`, `stub_mode` requires recompilation")
134+
match stub_mode:
135+
case "off":
136+
pass
137+
case "fs_handler":
138+
subprocess_env["MOUNTPOINT_BUILD_STUB_FS_HANDLER"] = "1"
139+
case _:
140+
raise ValueError(f"Unknown stub_mode: {stub_mode}")
141+
131142
log.info(f"Mounting S3 bucket {bucket} with args: %s; env: %s", subprocess_args, subprocess_env)
132143
try:
133144
output = subprocess.check_output(subprocess_args, env=subprocess_env)

benchmark/conf/config.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ mountpoint_congestion_threshold: !!null
3636
# For monitoring network bandwidth
3737
with_bwm: false
3838

39+
# Works automatically ONLY where this script manages compilation. It has no effect if `mountpoint_binary` is set.
40+
stub_mode: "off" # fs_handler
41+
3942
iterations: 1
4043

4144
# Define defaults for these columns, but script will run as MULTIRUN by default

mountpoint-s3-fs/src/fs.rs

+7
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,13 @@ where
452452
size
453453
);
454454

455+
if option_env!("MOUNTPOINT_BUILD_STUB_FS_HANDLER").is_some() {
456+
// This compile-time configuration allows us to return simply zeroes to FUSE,
457+
// allowing us to remove Mountpoint's logic from the loop and compare performance
458+
// with and without the rest of Mountpoint's logic (such as file handle interaction, prefetcher, etc.).
459+
return Ok(vec![0u8; size as usize].into());
460+
}
461+
455462
let handle = {
456463
let file_handles = self.file_handles.read().await;
457464
match file_handles.get(&fh) {

0 commit comments

Comments
 (0)