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 80314f1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@ -80,7 +80,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 +160,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 80314f1

Please sign in to comment.