diff --git a/object_store/src/client/mod.rs b/object_store/src/client/mod.rs index ae092edac095..2baf586127c6 100644 --- a/object_store/src/client/mod.rs +++ b/object_store/src/client/mod.rs @@ -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(), } } @@ -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) -> Self { self.proxy_url = Some(proxy_url.into()); diff --git a/object_store/src/gcp/mod.rs b/object_store/src/gcp/mod.rs index 11fa68310a2e..8633abbfb4dc 100644 --- a/object_store/src/gcp/mod.rs +++ b/object_store/src/gcp/mod.rs @@ -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;