Skip to content

SingleUploadThreshold config paramter is introduced.#66

Merged
johha merged 3 commits intocloudfoundry:mainfrom
sap-contributions:feature/single-upload-for-aws
Mar 12, 2026
Merged

SingleUploadThreshold config paramter is introduced.#66
johha merged 3 commits intocloudfoundry:mainfrom
sap-contributions:feature/single-upload-for-aws

Conversation

@serdarozerr
Copy link
Contributor

Context

The S3 client's multipart_upload boolean flag did not give users control over when to use single vs. multipart upload. Additionally, the BOSH HTTP client was using CreateDefaultClient, which doesn't reuse TCP connections, resulting in higher latency under concurrent upload/download workloads.

Solution

Single upload threshold:

Replaced the multipart_upload flag with a new single_upload_threshold config parameter (bytes). Files at or below this size use a single PutObject call; larger files use multipart upload. The value is capped at 5GB to respect the AWS S3 hard limit. For GCS, which requires single put for all uploads but has no size limit, the threshold is automatically set to [math.MaxInt64]

Keep-alive HTTP client:

Replaced CreateDefaultClient with CreateKeepAliveDefaultClient. Benchmark tests showed this reduces response time for concurrent uploads/downloads by reusing existing TCP connections.

- This parameter controls the upload strategy. File's with size smaller or equel then this value will be uploaded with single put, bigger file will be uploaded with multipart. However this parameter can't be bigger than 5GB since AWS S3 has hard limit on single put. But there is a exception with GCS, it don't have such hard limit and it don't support multipart upload. So we set this parameter to a big number to not block file larger than 5GB to upload into GCS.

- CreateDefaultClient replaced with CreateKeepAliveDefaultClient for boshttp client. After conduction some benchmark tests, we observe that using keep alive with concurrenct upload/download decreases response time.
Comment on lines 98 to 108
uploadInput := &s3.PutObjectInput{
Body: src,
Bucket: aws.String(cfg.BucketName),
Key: b.key(dest),
}
if cfg.ServerSideEncryption != "" {
uploadInput.ServerSideEncryption = types.ServerSideEncryption(cfg.ServerSideEncryption)
}
if cfg.SSEKMSKeyID != "" {
uploadInput.SSEKMSKeyId = aws.String(cfg.SSEKMSKeyID)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as line 132++ -> could be moved to a helper

@aramprice aramprice requested review from a team, evanfarrar and peanball and removed request for a team March 12, 2026 15:57
@aramprice aramprice moved this from Inbox to Pending Review | Discussion in Foundational Infrastructure Working Group Mar 12, 2026
@github-project-automation github-project-automation bot moved this from Pending Review | Discussion to Pending Merge | Prioritized in Foundational Infrastructure Working Group Mar 12, 2026
@johha johha merged commit 81ce721 into cloudfoundry:main Mar 12, 2026
8 checks passed
@github-project-automation github-project-automation bot moved this from Pending Merge | Prioritized to Done in Foundational Infrastructure Working Group Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants