adriangb commented on code in PR #24093:
URL: https://github.com/apache/datafusion/pull/24093#discussion_r4255625414


##########
benchmarks/src/util/simulated_object_store.rs:
##########
@@ -0,0 +1,506 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! An [`ObjectStore`] that makes a local filesystem behave like S3 or GCS.
+//!
+//! Each request costs:
+//!
+//! 1. a connection from a pool of [`MAX_CONNECTIONS`],
+//! 2. a time to first byte, drawn at random from a latency distribution,
+//! 3. a transfer time at [`BYTES_PER_SECOND`] for each response body.
+//!
+//! The store does not override [`ObjectStore::get_ranges`]. `AmazonS3` and
+//! `GoogleCloudStorage` do not override it either. The trait default merges
+//! ranges that are less than 1MiB apart and sends each merged range as a
+//! separate GET. Thus the simulated request count is the same as on S3. A
+//! wrapper that overrides `get_ranges` charges one request where S3 charges
+//! several.
+//!
+//! The store does not model request failures, retries or a shared network
+//! limit.
+
+use std::fmt;
+use std::sync::Arc;
+use std::time::Duration;
+
+use async_trait::async_trait;
+use futures::StreamExt;
+use futures::stream::BoxStream;
+use object_store::path::Path;
+use object_store::{
+    CopyOptions, GetOptions, GetResult, GetResultPayload, ListResult, 
MultipartUpload,
+    ObjectMeta, ObjectStore, PutMultipartOptions, PutOptions, PutPayload, 
PutResult,
+    Result,
+};
+use rand::Rng;
+use tokio::sync::{OwnedSemaphorePermit, Semaphore};
+use tokio::time::Instant;
+
+/// GET time to first byte, inspired by S3 latencies.
+/// Sorted: 25,25,28,28,30,30,30,30,32,32,35, 70,85,100,100,110, 130,150, 
180,200
+/// P50≈32ms, P90≈110ms, P99≈200ms
+const GET_TTFB_MS: &[u64] = &[

Review Comment:
   No, but I agree we should. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to