Skip to content

Commit 1756fe4

Browse files
adriangbclaude
andcommitted
bench: use the simulated remote store for --simulate-latency
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent dd68db9 commit 1756fe4

4 files changed

Lines changed: 16 additions & 174 deletions

File tree

‎benchmarks/bench.sh‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ CARGO_COMMAND command that runs the benchmark binary
188188
DATAFUSION_DIR directory to use (default $DATAFUSION_DIR)
189189
RESULTS_NAME folder where the benchmark files are stored
190190
PREFER_HASH_JOIN Prefer hash join algorithm (default true)
191-
SIMULATE_LATENCY Simulate object store latency to mimic S3 (default false)
191+
SIMULATE_LATENCY Serve local files as if they were remote object storage: per-request
192+
latency, per-connection bandwidth and paginated LIST (default false)
192193
DATAFUSION_* Set the given datafusion configuration
193194
"
194195
exit 1

‎benchmarks/src/util/latency_object_store.rs‎

Lines changed: 0 additions & 163 deletions
This file was deleted.

‎benchmarks/src/util/mod.rs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
// under the License.
1717

1818
//! Shared benchmark utilities
19-
pub mod latency_object_store;
2019
mod memory;
2120
mod options;
2221
mod run;

‎benchmarks/src/util/options.rs‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ use datafusion::{
3333
use datafusion_common::{DataFusionError, Result};
3434
use object_store::local::LocalFileSystem;
3535

36-
use super::latency_object_store::LatencyObjectStore;
36+
use super::simulated_object_store::{
37+
BYTES_PER_SECOND, MAX_CONNECTIONS, SimulatedObjectStore,
38+
};
3739

3840
// Common benchmark options (don't use doc comments otherwise this doc
3941
// shows up in help files)
@@ -69,8 +71,10 @@ pub struct CommonOpt {
6971
#[arg(short, long, env)]
7072
pub debug: bool,
7173

72-
/// Simulate object store latency to mimic remote storage (e.g. S3).
73-
/// Adds random latency in the range 20-200ms to each object store operation.
74+
/// Serve the local filesystem as if it were remote object storage (e.g. S3
75+
/// or GCS): per-request latency, per-connection bandwidth, a bounded
76+
/// connection pool, and paginated LIST. See
77+
/// [`crate::util::simulated_object_store`].
7478
#[arg(long = "simulate-latency", env)]
7579
pub simulate_latency: bool,
7680
}
@@ -138,17 +142,18 @@ impl CommonOpt {
138142
Ok(rt_builder)
139143
}
140144

141-
/// Build the runtime environment, optionally wrapping the local filesystem
142-
/// with a throttled object store to simulate remote storage latency.
145+
/// Build the runtime environment, optionally presenting the local
146+
/// filesystem as remote object storage.
143147
pub fn build_runtime(&self) -> Result<Arc<RuntimeEnv>> {
144148
let rt = self.runtime_env_builder()?.build_arc()?;
145149
if self.simulate_latency {
146-
let store: Arc<dyn object_store::ObjectStore> =
147-
Arc::new(LatencyObjectStore::new(LocalFileSystem::new()));
150+
let store = SimulatedObjectStore::new(LocalFileSystem::new());
148151
let url = ObjectStoreUrl::parse("file:///")?;
149-
rt.register_object_store(url.as_ref(), store);
152+
rt.register_object_store(url.as_ref(), Arc::new(store));
150153
println!(
151-
"Simulating S3-like object store latency (get: 25-200ms, list: 40-400ms)"
154+
"Simulating remote object storage (get TTFB: 25-200ms, list TTFB: \
155+
40-400ms/page, {} MB/s per connection, {MAX_CONNECTIONS} connections)",
156+
BYTES_PER_SECOND / (1024 * 1024),
152157
);
153158
}
154159
Ok(rt)

0 commit comments

Comments
 (0)