This is an automated email from the ASF dual-hosted git repository.

morrysnow pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.1 by this push:
     new d1cbff1c4ca branch-3.1: [opt](recycler) Avoid doing many 
`Aws::Internal::GetEC2MetadataClient` http call #55546 (#55682)
d1cbff1c4ca is described below

commit d1cbff1c4ca519d3cbe87a999e4010a87a2f74c5
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Sep 5 18:23:16 2025 +0800

    branch-3.1: [opt](recycler) Avoid doing many 
`Aws::Internal::GetEC2MetadataClient` http call #55546 (#55682)
    
    Cherry-picked from #55546
    
    Co-authored-by: Lei Zhang <[email protected]>
---
 cloud/src/recycler/s3_accessor.cpp |  5 +++--
 cloud/src/recycler/s3_accessor.h   | 10 ++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/cloud/src/recycler/s3_accessor.cpp 
b/cloud/src/recycler/s3_accessor.cpp
index 3de8edfd048..9f8f1ed205e 100644
--- a/cloud/src/recycler/s3_accessor.cpp
+++ b/cloud/src/recycler/s3_accessor.cpp
@@ -292,7 +292,8 @@ std::shared_ptr<Aws::Auth::AWSCredentialsProvider> 
S3Accessor::get_aws_credentia
             return 
std::make_shared<Aws::Auth::InstanceProfileCredentialsProvider>();
         }
 
-        Aws::Client::ClientConfiguration clientConfiguration;
+        Aws::Client::ClientConfiguration clientConfiguration =
+                S3Environment::getClientConfiguration();
         if (_ca_cert_file_path.empty()) {
             _ca_cert_file_path =
                     
get_valid_ca_cert_path(doris::cloud::split(config::ca_cert_file_paths, ';'));
@@ -363,7 +364,7 @@ int S3Accessor::init() {
         uri_ = normalize_http_uri(uri_);
 
         // S3Conf::S3
-        Aws::Client::ClientConfiguration aws_config;
+        Aws::Client::ClientConfiguration aws_config = 
S3Environment::getClientConfiguration();
         aws_config.endpointOverride = conf_.endpoint;
         aws_config.region = conf_.region;
         // Aws::Http::CurlHandleContainer::AcquireCurlHandle() may be blocked 
if the connecitons are bottleneck
diff --git a/cloud/src/recycler/s3_accessor.h b/cloud/src/recycler/s3_accessor.h
index dd93e83d963..ee72b81e983 100644
--- a/cloud/src/recycler/s3_accessor.h
+++ b/cloud/src/recycler/s3_accessor.h
@@ -60,6 +60,16 @@ public:
 
     static S3Environment& getInstance();
 
+    static Aws::Client::ClientConfiguration& getClientConfiguration() {
+        // The default constructor of ClientConfiguration will do some http 
call
+        // such as Aws::Internal::GetEC2MetadataClient and other init 
operation,
+        // which is unnecessary.
+        // So here we use a static instance, and deep copy every time
+        // to avoid unnecessary operations.
+        static Aws::Client::ClientConfiguration instance;
+        return instance;
+    }
+
     ~S3Environment();
 
 private:


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

Reply via email to