Skip to content

Commit

Permalink
feat(object_store): use http1 by default (#5204)
Browse files Browse the repository at this point in the history
* feat: use http1 by default

* add note to GCS docs

* fix docs

* simplify changes

* bring back option
  • Loading branch information
wjones127 authored Dec 12, 2023
1 parent 8aa55dd commit 2a84e85
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
16 changes: 15 additions & 1 deletion object_store/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,10 @@ impl Default for ClientOptions {
http2_keep_alive_interval: None,
http2_keep_alive_timeout: None,
http2_keep_alive_while_idle: Default::default(),
http1_only: Default::default(),
// HTTP2 is known to be significantly slower than HTTP1, so we default
// to HTTP1 for now.
// https://github.com/apache/arrow-rs/issues/5194
http1_only: true.into(),
http2_only: Default::default(),
}
}
Expand Down Expand Up @@ -350,17 +353,28 @@ impl ClientOptions {
}

/// Only use http1 connections
///
/// This is on by default, since http2 is known to be significantly slower than http1.
pub fn with_http1_only(mut self) -> Self {
self.http2_only = false.into();
self.http1_only = true.into();
self
}

/// Only use http2 connections
pub fn with_http2_only(mut self) -> Self {
self.http1_only = false.into();
self.http2_only = true.into();
self
}

/// Use http2 if supported, otherwise use http1.
pub fn with_allow_http2(mut self) -> Self {
self.http1_only = false.into();
self.http2_only = false.into();
self
}

/// Set a proxy URL to use for requests
pub fn with_proxy_url(mut self, proxy_url: impl Into<String>) -> Self {
self.proxy_url = Some(proxy_url.into());
Expand Down
7 changes: 7 additions & 0 deletions object_store/src/gcp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@
//! to abort the upload and drop those unneeded parts. In addition, you may wish to
//! consider implementing automatic clean up of unused parts that are older than one
//! week.
//!
//! ## Using HTTP/2
//!
//! Google Cloud Storage supports both HTTP/2 and HTTP/1. HTTP/1 is used by default
//! because it allows much higher throughput in our benchmarks (see
//! [#5194](https://github.com/apache/arrow-rs/issues/5194)). HTTP/2 can be
//! enabled by setting [crate::ClientConfigKey::Http1Only] to false.
use std::sync::Arc;

use crate::client::CredentialProvider;
Expand Down

0 comments on commit 2a84e85

Please sign in to comment.