Skip to content

Commit

Permalink
increase s3 client max connections from default 50
Browse files Browse the repository at this point in the history
  • Loading branch information
jhua-vmware committed Sep 18, 2024
1 parent 045fdb5 commit 4e3cf0a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2019-2023 VMware, Inc.
* Copyright 2019-2024 VMware, Inc.
* SPDX-License-Identifier: EPL-2.0
*/
package com.vmware.vip.messages.data.conf;
Expand All @@ -12,6 +12,7 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

import com.amazonaws.ClientConfiguration;
import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
Expand Down Expand Up @@ -112,8 +113,9 @@ private synchronized AmazonS3 getAmazonS3() {
sessionCreds.getAccessKeyId(),
sessionCreds.getSecretAccessKey(),
sessionCreds.getSessionToken());
ClientConfiguration clientConfiguration = new ClientConfiguration().withMaxErrorRetry(5).withMaxConnections(config.getS3ClientMaxConnections());
return AmazonS3ClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(sessionCredentials))
.withRegion(config.getS3Region()).enablePathStyleAccess().build();
.withRegion(config.getS3Region()).withClientConfiguration(clientConfiguration).enablePathStyleAccess().build();
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;

/**
* Copyright 2019-2024 VMware, Inc.
* SPDX-License-Identifier: EPL-2.0
*/
/**
* the configuration of the S3 client
*/
Expand Down Expand Up @@ -80,7 +84,8 @@ public class S3Config {
@Value("${allow.list.path.bucketName:}")
private String allowListBucketName;


@Value("${s3.client.max.connections:500}")
private int s3ClientMaxConnections;

public String getAccessKey() {
if (this.encryption) {
Expand Down Expand Up @@ -159,6 +164,10 @@ public String getRoleArn() {
return roleArn;
}

public int getS3ClientMaxConnections() {
return s3ClientMaxConnections;
}

public String getAllowListBucketName() {
if (this.allowListBucketName != null && (!this.allowListBucketName.isBlank())){
return this.allowListBucketName;
Expand Down

0 comments on commit 4e3cf0a

Please sign in to comment.