Repository navigation
Show 95th percentile load times and load player assets from R2 - #236
Merged
Merged
Conversation
The admin load time chart, tile, daily table and CSV, and the project diagnostics card, now show the 95th percentile instead of the mean, so a single load left in a background tab no longer swamps a day. Loads that spent any time hidden no longer report a duration at all. Assets are named by their content, so a cached copy is now used without revalidating it. Repeat visits skip the network for every asset instead of sending an API request, a redirect and a 304 per asset after five minutes. When the API offers an asset mirror, players fetch assets straight from it and fall back to the API only for assets the mirror does not have yet. That halves the requests for a cold load and takes them off the API server.
Embeds opened with ?mw=<id> now carry the asset mirror too. The parent page bridge compares origins and folder paths instead of string prefixes, and only caches md5-named files as immutable. Detaching a workspace also clears the mirror parameter, and the project diagnostics card shows how many loads were timed.
A player asking the parent page for a URL it will not serve now gets an empty reply straight away instead of waiting a minute for the bridge timeout. Both the bridge and direct asset loads use one isContentAddressedFile check to decide when a cached file never needs revalidating.
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.
Summary
assetsMirrorBase, from Report 95th percentile load times and let players fetch assets from R2 api#90), players fetch assets from R2 directly. They fall back to the API for any asset R2 doesn't have yet. This covers the project page bridge,?mw=public embeds and the editor.Deploy MistWarp/api#90 first. This chart reads
p95LoadMsByDay, and the mirror only switches on once the API sendsassetsMirrorBase.Measurements
The Super Mario Bros. project (461 assets, 16 MB), loaded headless from this box:
On a link throttled to 20 Mbps, cold loads are limited by download speed, so the mirror saves only about 0.3 s there. The biggest remaining cold-load cost is the player's 3.9 MB of JavaScript (one 10 MB shared chunk). That's a separate piece of work.
Screenshots
All four admin screenshots use the same 30 days of synthetic samples, served by a local API.
Before: the average chart is dominated by single slow loads.

After: the 95th percentile chart in Chromium (dark theme).

After: the same chart in Firefox (light theme).

The load-time tile before and after.

Firefox: the project page player after loading all 461 assets from R2.

No recording, since nothing here moves differently.
Verification
deps:check, 4,283 unit tests,build:deployandvalidate-deploy.?mw=and plain embeds with the mirror, a mirror that returns 404 for everything (falls back to the API), and no mirror. All loaded every asset.Preview
Super Mario Bros. on the branch preview. Until MistWarp/api#90 is deployed, the preview talks to an API without the mirror, so assets still go through the redirect there.