main
ply4 git calls37 ms42 KiB2 cachedprotocol v2
72 lines3.0 KiBRaw
1// ply limits ply-web sets: the /v1 API (src/index.js), the mirror cron (src/mirror.ts), and GitCache's pack
2// verification (src/gitcache.ts). The viewer's caps are src/viewer/limits.ts. Every number in these objects has a
3// provenance entry in scripts/calibrate/thresholds.json (a cited distribution, or `PRIOR (uncalibrated)`);
4// test/calibrate-provenance.test.ts fails on a cap without one, and on an entry whose value no longer matches.
5//
6// API_CAPS:
7// A Worker isolate has 128 MiB. A buffered pack holds the wire bytes and every inflated object,
8// including delta results resolvePack allocates on top of the instructions (ply #9). Four
9// maximum-sized objects cover a merge-base triple plus the commit that names them, and
10// wire + inflated stays under the isolate. The blob itself is streamed and is not in this total.
11//
12// Time (ply #255/#258): requestTimeoutMs is ply's opt-in cap on one whole HTTP exchange, body included; ply's default is
13// 0 (no total cap), with firstByteTimeoutMs and idleTimeoutMs (60 s each) bounding stalls. Every limit set here and in
14// src/viewer/limits.ts names its requestTimeoutMs, so no ply-web exchange runs on ply's default: the API keeps #124's
15// 10 s, the mirror and pack verification 30 s, the viewer 12 s. Under those totals the 60 s stall timers never fire first.
16import { withLimits } from 'ply'
18const KIB = 1024
19const MIB = KIB * KIB
20const API_INFLATED_OBJECTS = 4
22export const API_CAPS = Object.freeze({
23 maxObjectSize: 16 * MIB,
24 maxPackBytes: 32 * MIB,
25 maxHarvestBytes: 16 * MIB,
26 maxInflatedTotal: 16 * MIB * API_INFLATED_OBJECTS,
27 // ply's buffered-pack object ceiling. The inflated-byte cap above is the memory bound.
28 maxPackObjects: 100_000,
29 // One ref listing is buffered, so it shares the pack byte cap.
30 maxLsRefsBytes: 32 * MIB,
31 requestTimeoutMs: 10_000,
32 /** A JSON request body (src/index.js readJson). */
33 maxBodyBytes: MIB,
34})
36export const API_LIMITS = withLimits({
37 maxPackBytes: API_CAPS.maxPackBytes,
38 maxObjectSize: API_CAPS.maxObjectSize,
39 maxHarvestBytes: API_CAPS.maxHarvestBytes,
40 maxInflatedTotal: API_CAPS.maxInflatedTotal,
41 maxPackObjects: API_CAPS.maxPackObjects,
42 maxLsRefsBytes: API_CAPS.maxLsRefsBytes,
43 requestTimeoutMs: API_CAPS.requestTimeoutMs,
44})
46/**
47 * The mirror cron (src/mirror.ts). An update larger than maxPackBytes is refused and logged; publish it with
48 * scripts/publish.mjs instead.
49 */
50export const MIRROR_CAPS = Object.freeze({
51 maxPackBytes: 32 * MIB,
52 maxObjectSize: 16 * MIB,
53 maxInflatedTotal: 96 * MIB,
54 maxHarvestBytes: 16 * MIB,
55 maxPackObjects: 50_000,
56 requestTimeoutMs: 30_000,
57})
59export const MIRROR_LIMITS = withLimits(MIRROR_CAPS)
61/** A pack is stored only after GitCache has verified it, and it buffers the pack to do so; bigger ones pass through unstored. */
62export const VERIFY_CAPS = Object.freeze({
63 maxPackBytes: 16 * MIB,
64 maxObjectSize: 16 * MIB,
65 maxInflatedTotal: 4 * 16 * MIB,
66 maxHarvestBytes: 16 * MIB,
67 maxPackObjects: 100_000,
68 maxTreeEntries: 1_000_000,
69 requestTimeoutMs: 30_000,
70})
72export const VERIFY_LIMITS = withLimits(VERIFY_CAPS)
Diagnostics4 git calls · 37 ms
CallStatusSizeTime037 ms
discover200152 B3 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=3
git.response.bytes=152
git.server.agent=gitty/1.0
git.server.object_format=sha1
git.server.caps=agent ls-refs fetch object-format
git.server.fetch=shallow filter sideband-all
git.protocol.version=2
git.pkt.frames=8
git.pkt.data=6
git.pkt.flush=2
git.pkt.delim=0
git.pkt.bytes=152
git.pkt.payload.max=34
ls-refs200145 B3 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=3
git.response.bytes=145
git.response.cache=UPDATING
git.response.duration_ms=3
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=145
git.pkt.payload.max=76
git.ls_refs.count=2
git.ls_refs.head=refs/heads/main
fetchblob:none · deepen 1020040 KiB · hit3 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
git.response.bytes=41349
git.response.cache=HIT
git.response.duration_ms=3
git.fetch.filter=blob:none
git.fetch.filter.requested=tree:0
git.fetch.filter.fallback=blob:none
git.fetch.filter.learned=false
git.fetch.wants=526b305930b8ef382f2d7a1f9c0238730a585921
git.fetch.haves.count=0
git.fetch.deepen=10
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=6
git.pkt.data=4
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=41349
git.pkt.payload.max=41254
git.sideband.band1.bytes=41253
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=61
git.pack.bytes=41253
git.pack.ofs_delta=0
git.pack.ref_delta=0
git.pack.chain.max=0
git.pack.trailer=ab60efef4b7243678c75de64a4386986ee885c1c
git.pack.full=61
Open pack map
fetch2001.3 KiB · hit31 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=31
git.response.bytes=1338
git.response.cache=HIT
git.response.duration_ms=31
git.fetch.wants=7a6deb9466585dcd11a6783c6ec67bb39161a171
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=1338
git.pkt.payload.max=1317
git.sideband.band1.bytes=1316
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0

Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.

Remote
https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/ply-web.git
Ref
refs/heads/main
Commit
526b305930b8ef382f2d7a1f9c0238730a585921
cf-ray
a5e2b2e049fe994c
Request
9d0ee836…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format