perf(s3): LIST-based existence + parallel tile upload (MAPCO-11322) - #257
Open
shimoncohen wants to merge 2 commits into
Open
perf(s3): LIST-based existence + parallel tile upload (MAPCO-11322)#257shimoncohen wants to merge 2 commits into
shimoncohen wants to merge 2 commits into
Conversation
Scoped I/O wins for the S3 path (full end-to-end async deferred to its own change). - S3Client.GetTileKey: existence/key lookup did a full GetObjectAsync, which downloads the whole object body just to read its key. Use a single prefixed ListObjectsV2 (MaxKeys=1) instead — no body transfer. - S3.InternalUpdateTiles: upload the batch's tiles with Parallel.ForEach instead of one blocking PutObject at a time. Tiles are materialized first so the single-threaded grid/origin projection runs before the uploads fan out; the S3 client and PutObject are independent per tile. - Raise ServicePointManager.DefaultConnectionLimit (default 2) so parallel PUTs are not serialized on the connection pool. TileExists client test now drives ListObjectsV2; the S3 UpdateTiles data-type test no longer sequences UpdateTile (uploads are unordered) but still asserts one upload per tile. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ServicePointManager.DefaultConnectionLimit governs the legacy HttpWebRequest stack; on net6 the AWS SDK's HttpClient/SocketsHttpHandler ignores it, so the line never capped anything. Drop it and its misleading comment — pure dead-code removal, no behavior change. Bounding the S3 upload fan-out (config-driven MaxDegreeOfParallelism + AmazonS3Config.MaxConnectionsPerServer, value from a load test) is deferred to MAPCO-11364 (P15). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
shimoncohen
force-pushed
the
logic-3-io-async
branch
from
August 5, 2026 09:00
063e1a1 to
655c4e3
Compare
shimoncohen
marked this pull request as ready for review
August 5, 2026 09:53
shimoncohen
requested review from
CL-SHLOMIKONCHA,
almog8k,
asafmas-rnd,
razbroc and
syncush
August 5, 2026 09:53
syncush
approved these changes
Aug 5, 2026
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.
LOGIC-3 of MAPCO-11317. Scoped S3 I/O wins.
Scope decision
"Async end-to-end" taken literally would convert the whole tile pipeline (
IDataUtils/IData/ITileMerger/Process/TaskExecutor) to async — a large rewrite that collides with SVC-1 and the other PRs. This PR delivers the self-contained I/O wins and leaves full pipeline-async as a follow-up.Changes
S3Client.GetTileKey(used byTileExists) did a fullGetObjectAsync, downloading the entire object body just to read its.Key. Now a single prefixedListObjectsV2withMaxKeys=1— existence + real extension, no body transfer.S3.InternalUpdateTilesuploaded tiles one blockingPutObjectat a time. NowParallel.ForEach, materializing tiles first so the single-threaded grid/origin projection completes before uploads fan out. (chore: update logs + add parallel.for when putting updating tiles to S3 #112 attempted this viaTask.Run(...).Wait(), which isn't actually parallel; this supersedes it.)ServicePointManager.DefaultConnectionLimitline that was added alongside the parallel upload.ServicePointManagergoverns the legacyHttpWebRequeststack; on net6 the AWS SDK'sHttpClient/SocketsHttpHandlerignores it, so it never capped anything. Pure dead-code removal.Deferred (follow-ups) — tracked in MAPCO-11364
.Result).GetTilestill probes Jpeg-then-Png (up to 2 full GETs/tile); the speculative probe was not dropped. (OnlyGetTileKey/TileExistsmoved to LIST here.)FolderExistsloop 0..24) to discover the zoom set → singleListObjectsV2withDelimiter="/".Parallel.ForEachhas no deliberate ceiling: concurrency tracks ThreadPool sizing (blockingPutObjectbodies) and socket count is unbounded (SocketsHttpHandler.MaxConnectionsPerServerdefault =int.MaxValue). Follow-up adds a config-drivenMaxDegreeOfParallelismpaired withAmazonS3Config.MaxConnectionsPerServer(the real net6 lever), value from a load test.Note: parent ticket P5 specified HEAD (
GetObjectMetadataAsync) for existence; this PR chose LIST instead. HEAD-vs-LIST to be settled consistently in MAPCO-11364.Testing
Full suite: 1141 passed, 0 failed.
TileExistsclient test drivesListObjectsV2; the S3UpdateTilesdata-type test no longer sequencesUpdateTile(uploads are unordered) but still asserts one upload per tile.Supersedes / relates
🤖 Generated with Claude Code