Skip to content

Tune cold-cache tile bootstrap for faster initial map loads#215

Merged
stef-k merged 2 commits intomainfrom
feature/tune-cold-cache-bootstrap
Mar 27, 2026
Merged

Tune cold-cache tile bootstrap for faster initial map loads#215
stef-k merged 2 commits intomainfrom
feature/tune-cold-cache-bootstrap

Conversation

@stef-k
Copy link
Copy Markdown
Owner

@stef-k stef-k commented Mar 27, 2026

Summary

  • BurstCapacity 10 → 12: 2 more tiles through on initial burst before sustained 2/sec rate
  • AcquireTimeout 3.0s → 3.5s: 1 extra token per wave from replenishment, reducing false 503s
  • Client pool 60% → 75% of burst (6 → 9 concurrent fetches): more tiles queue server-side instead of waiting client-side
  • BudgetRetryAfterSeconds 5 → 6: aligned with new burst refill time (12/2=6s)
  • Part D (pre-warming adjacent zoom levels) deferred with TODO — requires priority-aware token bucket

Net effect: ~19 tiles served per wave on cold-cache zoom 17 (up from ~16). OSM compliance unchanged (sustained rate 2/sec, MaxConnectionsPerServer=2).

Closes #214

Test plan

  • All 1407 tests pass (dotnet test)
  • Cold-cache map load: verify up to 9 concurrent tile fetches in Network tab
  • Verify 503 responses include Retry-After: 6
  • Verify window.wayfarerTileConfig shows burstCapacity: 12, retryAfterSeconds: 6
  • Verify slow retry polls at ~18s intervals
  • Multi-user cold-cache test: confirm 503+retry handles contention gracefully

- Raise OutboundBudget.BurstCapacity from 10 to 12
- Raise OutboundBudget.AcquireTimeout from 3.0s to 3.5s
- Raise client concurrency pool multiplier from 0.6 to 0.75 (6 → 9 slots)
- Align BudgetRetryAfterSeconds from 5 to 6 (12 tokens / 2 per sec)
- Update client fallback values and comments
- Add TODO #214-D for deferred pre-warming investigation
@stef-k
Copy link
Copy Markdown
Owner Author

stef-k commented Mar 27, 2026

Code review

Found 1 issue:

  1. Stale comment: line 82 still says "Falls back to 5s if config unavailable" but the fallback on line 83 was changed to 6. CLAUDE.md says "All code new and old must be documented so everytime you edit code and does not contain documentation you will have to add it."

// replenishment cycle). Slow retry uses 3x that interval to give the per-IP sliding window
// time to decay between attempts. Falls back to 5s if config unavailable.
const _retryAfterSeconds = _config.retryAfterSeconds || 6;
const _defaultSlowRetryDelayMs = _retryAfterSeconds * 3 * 1000;

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

@stef-k stef-k merged commit 06dfd71 into main Mar 27, 2026
1 check passed
@stef-k stef-k deleted the feature/tune-cold-cache-bootstrap branch March 27, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tune cold-cache tile bootstrap for faster initial map loads

1 participant