Skip to content

Commit d972225

Browse files
authored
chore(object store): change streaming write buffer size to 16MB for gcs (risingwavelabs#12150)
1 parent 8bd524b commit d972225

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/object_store/src/object/opendal_engine/gcs.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ use opendal::Operator;
1818

1919
use super::{EngineType, OpendalObjectStore};
2020
use crate::object::ObjectResult;
21+
22+
/// The fixed number of bytes that is buffered before they are uploaded as a part, will be used in
23+
/// streaing upload.
24+
///
25+
/// Reference: <https://cloud.google.com/storage/docs/streaming-uploads>
26+
const GCS_PART_SIZE: usize = 16 * 1024 * 1024;
27+
2128
impl OpendalObjectStore {
2229
/// create opendal gcs engine.
2330
pub fn new_gcs_engine(bucket: String, root: String) -> ObjectResult<Self> {
@@ -28,6 +35,8 @@ impl OpendalObjectStore {
2835

2936
builder.root(&root);
3037

38+
builder.write_fixed_size(GCS_PART_SIZE);
39+
3140
// if credential env is set, use it. Otherwise, ADC will be used.
3241
let cred = std::env::var("GOOGLE_APPLICATION_CREDENTIALS");
3342
if let Ok(cred) = cred {

src/object_store/src/object/opendal_engine/oss.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ use opendal::Operator;
1818

1919
use super::{EngineType, OpendalObjectStore};
2020
use crate::object::ObjectResult;
21+
22+
/// The minimum number of bytes that is buffered before they are uploaded as a part, , will be used
23+
/// in streaing upload.
24+
///
25+
/// Reference: <https://www.alibabacloud.com/help/en/oss/user-guide/multipart-upload-12>
26+
const OSS_PART_SIZE: usize = 16 * 1024 * 1024;
27+
2128
impl OpendalObjectStore {
2229
/// create opendal oss engine.
2330
pub fn new_oss_engine(bucket: String, root: String) -> ObjectResult<Self> {
@@ -26,6 +33,8 @@ impl OpendalObjectStore {
2633

2734
builder.bucket(&bucket);
2835

36+
builder.write_min_size(OSS_PART_SIZE);
37+
2938
builder.root(&root);
3039

3140
let endpoint = std::env::var("OSS_ENDPOINT")

0 commit comments

Comments
 (0)