Sync: upload/delete S3 files concurrently, not one directory call#3650
Open
reakaleek wants to merge 3 commits into
Conversation
S3 sync is network-bound, not CPU-bound, so uploads and deletes now run in parallel per-file/per-batch (configurable via DOCS_SYNC_UPLOAD_CONCURRENCY and DOCS_SYNC_DELETE_CONCURRENCY) instead of copying every file to a temp directory and issuing a single directory upload sized to CPU count. Failures are now reported per-file/per-batch via the diagnostics collector instead of aborting the whole sync, and Apply returns false if any file failed. The S3 client also configures SDK-level retry (standard mode) to absorb throttling under the higher concurrency. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…sync-w/o-bound-not-cpu-bound-opportunity-most-systems-ca
Mpdreamz
approved these changes
Jul 13, 2026
Mpdreamz
left a comment
Member
There was a problem hiding this comment.
LGTM, let's make sure we isolate this in a release (EMG a release only containing this change before releasing.
That way we can isolate the change and see it on edge and staging and rollback roll forward.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
S3 sync during deploy is network-bound, not CPU-bound: the old apply strategy copied every file to a temp directory and issued a single
TransferUtilityUploadDirectoryRequest, whose concurrency was tied to CPU count viaTransferUtilityConfig.ConcurrentServiceRequests. For a docs-site sync with many small files, that under-utilizes available network concurrency and wastes a full local read+write pass per file just to stage a directory that already matched the S3 key layout. A single failed upload/delete could also abort the whole batch.What
Uploads and deletes now run per-file/per-batch in parallel via
Parallel.ForEachAsync, with concurrency configurable throughDOCS_SYNC_UPLOAD_CONCURRENCY(default 32, max 128) andDOCS_SYNC_DELETE_CONCURRENCY(default 4, max 16). Each file is uploaded directly from its original path with an explicit S3 key — no temp-directory staging. Failures are now isolated and reported per-file/per-batch through the diagnostics collector instead of aborting the whole sync, andAwsS3SyncApplyStrategy.Applyreturnsfalseif any file failed (previously the caller always reported success). The defaultAmazonS3Clientalso now configures SDK-level retry (RequestRetryMode.Standard,MaxErrorRetry = 5) to absorb throttling under the higher concurrency.Test plan
dotnet buildsucceedsDocsSyncTests,IncrementalDeployRoundTripTests), including new tests covering delete-batch chunking and upload-failure propagation