Skip to content

Sync: upload/delete S3 files concurrently, not one directory call#3650

Open
reakaleek wants to merge 3 commits into
mainfrom
aws-s3-sync-concurrency-analysis-how-aws-s3-sync-w/o-bound-not-cpu-bound-opportunity-most-systems-ca
Open

Sync: upload/delete S3 files concurrently, not one directory call#3650
reakaleek wants to merge 3 commits into
mainfrom
aws-s3-sync-concurrency-analysis-how-aws-s3-sync-w/o-bound-not-cpu-bound-opportunity-most-systems-ca

Conversation

@reakaleek

Copy link
Copy Markdown
Member

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 via TransferUtilityConfig.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 through DOCS_SYNC_UPLOAD_CONCURRENCY (default 32, max 128) and DOCS_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, and AwsS3SyncApplyStrategy.Apply returns false if any file failed (previously the caller always reported success). The default AmazonS3Client also now configures SDK-level retry (RequestRetryMode.Standard, MaxErrorRetry = 5) to absorb throttling under the higher concurrency.

Test plan

  • dotnet build succeeds
  • Integration tests pass (DocsSyncTests, IncrementalDeployRoundTripTests), including new tests covering delete-batch chunking and upload-failure propagation

reakaleek and others added 2 commits July 13, 2026 18:12
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 Mpdreamz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants