Skip to content

fix: reliable and accurate uploads (HTTP/3 first, HTTP/2 fallback), static /ping - #105

Merged
ajithakdev merged 12 commits into
mainfrom
feat/static-test-files
Nov 24, 2026
Merged

ajithakdev merged 12 commits into
mainfrom
feat/static-test-files

Conversation

@ajithakdev

@ajithakdev ajithakdev commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Uploads on Jio failed or read far too low, and pings were spending Worker requests from the free quota. This branch fixes both, moves the default test server to meterx-api.ajithakdev.com, and keeps HTTP/3 for uploads where it works.

Changes

  • /ping is a static asset on the worker (services/worker/public/). Cloudflare does not bill static assets against the 100,000 requests a day, and ping times stayed the same in a production A/B.
  • Upload bodies start at 256 KB on every stream and resize from how long that stream's last request took, aiming at about 1 s (nextUploadChunk in measure.ts). The old first body was sized from the download speed, so on a 124 down / 4 up line it never finished and the test said "No data reached the server".
  • The default server is now https://meterx-api.ajithakdev.com. HTTP/3 is off for the ajithakdev.com zone, because Chrome uploads over QUIC stalled on Jio and a Worker cannot remove the alt-svc header itself. WORKER_URL, the manifest's host_permissions and the site CSP changed together. The old workers.dev URL keeps working for installed versions.
  • Uploads go to the workers.dev address first, over HTTP/3. Chrome sends uploads over HTTP/2 slowly: on BSNL FTTH 60/60 they read 14 to 29 Mbps against curl's 55 to 66, while HTTP/3 read 53 to 66. If an upload request there fails or stays open over 3 s, as on Jio, the upload phase starts again on meterx-api. Fixes Upload reads about half of the real speed on fast lines #104 for the default server.

Testing

  • Jio (124 down, about 4 up), Node A/B of runTest: main failed 2 of 3 runs, the branch read 3.1 to 3.6 Mbps against curl's 3.6 to 4.2.
  • Chromium with the built extension and QUIC allowed, after HTTP/3 was turned off: 3 of 3 tests finished with no errors.
  • BSNL FTTH 60/60, headless Chromium, QUIC allowed: uploads read 65.9, 57.9, 52.6 Mbps (curl 55 to 66), about 70 requests per test, no 429s.
  • Same line with every workers.dev upload forced to hang: 3 of 3 tests fell back to meterx-api after 3 s and finished.
  • Before the HTTP/3-first change, alternating hosts in one browser: meterx-api (HTTP/2) median 20.4 Mbps, workers.dev (HTTP/3) median 53.7.

Nothing deploys on merge. The worker, site and store packages go out with the Sunday release.

…equests

About 35 of a test's 150 requests are pings. Static assets are free and
unlimited on the Workers free plan, and an A/B test against production
showed the same ping times. Downloads stay on the Worker: served as
static assets they added about 180 ms to each request's first byte.

STATE records the request budget, the next step (bigger upload chunks)
and the backends that were researched and rejected.
Bodies aim at about 1 s per request instead of 0.25 s, so a test makes
about 24 upload requests instead of about 96. Each step grows at most 4x,
so a slow uplink behind a fast downlink still completes bodies (#60).
The first upload body was sized from the download speed. On a line with
124 Mbps down and about 4 Mbps up it could not finish inside the 8 s
window, so upload read about 1.3 Mbps or failed with 'No data reached the
server'. Every stream now starts at 256 KB and grows from its own last
request. Node A/B of runTest on that line: main failed 2 of 3 runs, the
branch read 3.1 to 3.6 Mbps (curl: 3.6 to 4.2).
…t HTTP/3

Chrome uploads over HTTP/3 (QUIC) to workers.dev stalled on Jio until the
test gave up. workers.dev always advertises HTTP/3 and a Worker cannot
clear Alt-Svc, so the worker now also answers on a custom domain in the
ajithakdev.com zone, which has HTTP/3 off. In Chromium on that line with
QUIC disabled, uploads read 3.0 to 3.8 Mbps (curl 3.6 to 4.2).
workers.dev stays on for older versions.
@ajithakdev

ajithakdev commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner Author

Pre-merge checklist

Addressed

  • Uploads on lopsided lines: every stream starts at 256 KB and resizes from its own last request (nextUploadChunk)
  • Upload stalls in Chrome on Jio: HTTP/3 is off for the ajithakdev.com zone, and curl -sI https://meterx-api.ajithakdev.com/ip no longer returns alt-svc (checked 3 times)
  • /ping served as a static asset, so pings use no Worker requests
  • Fast-line upload under-read (Upload reads about half of the real speed on fast lines #104): uploads go to WORKER_H3_URL over HTTP/3 first, fall back to meterx-api (HTTP/2) on a failed or 3 s request
  • WORKER_URL, manifest host_permissions and the site CSP all point at meterx-api.ajithakdev.com

Tested

  • npm test: all workspace and script suites pass
  • npm run lint: 0 errors (6 warnings, unchanged)
  • npm run build: extension, site and server build
  • Built extension in Chromium, QUIC allowed: 3 of 3 tests finished, no "No data reached the server"
  • BSNL 60/60, headless Chromium, QUIC allowed: upload 65.9, 57.9, 52.6 Mbps against curl 55 to 66
  • Fallback: workers.dev uploads forced to hang, 3 of 3 tests switched to meterx-api after 3 s and finished
  • Requests per test counted: about 70 (1 /ip, about 37 pings, 5 to 6 downloads, about 27 uploads), no 429s over 3 back-to-back tests
  • The user reloads apps/extension/dist in their own Chrome and runs tests on BSNL
  • A real Jio test of the fallback (only simulated so far)
  • Custom servers and the fallback path still upload over HTTP/2 and can read low (Upload reads about half of the real speed on fast lines #104 stays open for that)

CI and release

  • check workflow green on the head of this branch
  • /health returns ok on both meterx-api.ajithakdev.com and the workers.dev URL (production still runs 2027.0.2)
  • Production worker not deployed yet; it goes out with the Sunday release

Docs

  • CHANGELOG Unreleased lists all four changes
  • RESOURCES-AND-GUIDE, STORE-CHECKLIST and STORE-LISTINGS use the new server URL
  • STATE.md, KNOWN-ISSUES.md (Upload reads about half of the real speed on fast lines #104 row), CLAUDE.md gotcha, STORE-LISTINGS host permission text and RESOURCES-AND-GUIDE links updated

After merge

Sunday release 2027.0.3: tag, wrangler deploy for the worker, site deploy, then store uploads of the new zips. Chrome Web Store too, once the developer account is registered.

@ajithakdev ajithakdev changed the title fix: uploads on lopsided lines, static /ping, and a test server without HTTP/3 fix: reliable and accurate uploads (HTTP/3 first, HTTP/2 fallback), static /ping Nov 21, 2026
…allback, and test it

A single slow request later in the phase (a Wi-Fi dip on a fast line) used to
throw away the HTTP/3 run and restart on HTTP/2, the path that under-reads.
runner.test.ts covers stall, error, slow-later-request and cancel with a fake
clock and fetch; the slow-later-request case fails on the old rule.
@ajithakdev

Copy link
Copy Markdown
Owner Author

Pre-merge checklist

Addressed

  • Review: one slow upload request mid-phase threw away the HTTP/3 run. Now only a stream's first body has the 3 s limit (f018ce8)
  • Review: the fallback had no test. runner.test.ts adds 4 (first body stalls, HTTP/3 answers 429, a later request is slow, cancel during HTTP/3)
  • Review: site CSP no longer lists workers.dev. Not a problem: the site demo answers startTest with sample data (apps/site/src/demo-shim.ts:79) and never runs runTest
  • Accepted as is: static /ping sends Access-Control-Allow-Origin: * (constant body, no data); the self-host server keeps its rate-limited /ping

Tested

  • npm run lint, npm run build, npm test: extension 50 tests (was 46), worker 13, all workspaces pass
  • The "later request is slow" test fails with the old rule and passes with the new one
  • A real Jio test of the fallback (still simulated only)
  • After deploy: curl -sI https://meterx-api.ajithakdev.com/ping shows Access-Control-Allow-Origin and Timing-Allow-Origin

CI and release

  • check green on f018ce8
  • Worker deploy and store uploads on the Sunday release (2027.1.0)

Docs

  • CHANGELOG and RESOURCES-AND-GUIDE describe the first-body rule

After merge: rebase #101 on main, rerun tests, then release 2027.1.0 on Sunday.

# Conflicts:
#	CHANGELOG.md
#	RESOURCES-AND-GUIDE.md
@ajithakdev
ajithakdev merged commit 665510e into main Nov 24, 2026
1 check passed
@ajithakdev
ajithakdev deleted the feat/static-test-files branch November 24, 2026 20:25
ajithakdev added a commit that referenced this pull request Nov 24, 2026
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.

Upload reads about half of the real speed on fast lines

1 participant