Demos

Stream inspector

Your own stream, live: what the hub sends this tab, what zstd makes of it, and what the memory budget gave its encoder.

The demo

live

Your stream

connecting quiet for 0 s 0 frames a second

…

Setting from the budget
waiting
Reserved for your encoder
waiting

The last frame, events to wire

On the wire, frame by frame

Events sent
On the wire
Ratio so far
Heartbeats

The site

0 streams open on this site

nothing reserved of a limit of : this process has no memory limit, so the budget only counts

The payload

Size
Churn

256 rows, 1,536 cells. Every 250 ms 8 cells change.

nodereq/sp50 msp99 mscpu %heap MiBerrors
node-0014,3262.458112110
node-0021,8752.224883110
node-0035,3682.67018900
node-0043,2214.3113413670
node-0051,3962.470914060
node-0064,5920.83214590
node-0071,5210.7105172460
node-0082,7773.256771240
node-0091,2231.635891982
node-0101,8581.3107601060
node-0112,5203.754381320
node-0124,8823.1138773000
node-0133,6551.2110412220
node-0143,6223.9137353580
node-0152,1633.050422700
node-0163,4394.575463520
node-0173,9853.5113512507
node-0181,6162.589351670
node-0191,6232.74793680
node-0203,0552.211701880
node-0213211.76410825
node-0224,0643.012352790
node-0233,4573.975653240
node-0245661.645233150
node-0252,2893.647104000
node-0263,6142.37321530
node-0273,0971.141372470
node-0281,5522.92965970
node-0291,8194.485453850
node-0303,5163.442464220
node-0312,0043.372261960
node-0322,6192.853183090
node-0334,4101.350562140
node-0341,3741.811323020
node-0355143.445403980
node-0362,7882.059321740
node-0374,1754.342652420
node-0381,1381.355633943
node-0393,1923.67915590
node-0402,6634.265692080
node-0413131.514293020
node-0423,5311.586832270
node-0434,6192.0143363180
node-0441,0993.43623693
node-0454,4633.45434590
node-0462,8993.6133471260
node-0475613.3130304190
node-0483,7672.238734360
node-0495744.256683126
node-0502,0062.289651310
node-0514,2191.753791621
node-0525,5252.422402067
node-0534,7371.435363170
node-0542,8052.160333900
node-0552,3521.222542520
node-0562,6011.765142990
node-0572,3632.67713610
node-0583,2030.665174510
node-0592,5031.061201810
node-0602,2833.38279670
node-0613,1090.89535850
node-0622,0093.386923240
node-0631,2441.529494370
node-0641,0062.289313770
node-0654,8922.060234160
node-0663,6802.41916722
node-0672,2462.418192361
node-0682,1903.018162646
node-0693,7543.567322920
node-0702,1833.390491560
node-0713,6731.0852900
node-0724,2151.054613250
node-0736051.8116121176
node-0743,5182.635562320
node-0753563.085693820
node-0764,9873.414211110
node-0777333.338652950
node-0783,8680.755734160
node-0792,8831.230172540
node-0808562.261523320
node-0814,9603.857931420
node-0821,3962.8735740
node-0834,3503.249772230
node-0843,7233.92470700
node-0853,8434.149772870
node-0864361.4105462820
node-0872,3253.57558561
node-0887421.632442150
node-0893,1962.29361230
node-0902,8712.494361730
node-0913,9173.348543740
node-0921,2033.270711680
node-0933,5182.723374380
node-0944563.76778450
node-0954,7292.038642270
node-0961,2962.533522320
node-0978151.579171930
node-0982,4862.136451530
node-0991,6843.290352000
node-1001,5181.052803624
node-1013,7983.124284340
node-1023,1963.469444100
node-1033,7480.914279519
node-1042,6141.13345460
node-1055312.355961946
node-1069663.7127592960
node-1071,1332.0119421693
node-1088163.874101702
node-1093,9742.460472250
node-1104,5604.211211663
node-1115,1740.947402541
node-1124,5351.020393630
node-1131,9552.757581670
node-1143,2252.334252740
node-1153,5901.891832400
node-1162,7694.19985530
node-1173,9141.44536841
node-1184,4242.589163460
node-1192,6672.17083610
node-1203,3553.9101241150
node-1213,5804.19270450
node-1224612.156811390
node-1231,7542.164461580
node-1241,0471.762503787
node-1252,3313.825584150
node-1263,9064.234432480
node-1279451.282581980
node-1281,7581.8109283596
node-1293,7221.733171530
node-1303,8660.858211640
node-1315,2520.923631350
node-1322,8143.153382834
node-1334,6773.140331360
node-1342,7992.421303530
node-1351,0314.39137974
node-1363,9101.434362390
node-1374,3281.14682175
node-1383,4732.24967770
node-1391,4992.066584300
node-1401,9083.467254320
node-1411,6461.742782500
node-1427033.04668954
node-1431,4321.047373540
node-1444262.02761490
node-1452,5123.155291600
node-1461,3811.36045600
node-1474,0691.332183504
node-1483,4103.889263500
node-1492,0054.519682392
node-1501,3503.230531490
node-1514,4070.870612760
node-1521,4613.414953830
node-1533,9322.08741690
node-1546133.014533440
node-1552,8591.193822546
node-1562,5093.259452000
node-1571,2241.048952590
node-1583,3823.3108464000
node-1591,1281.554642530
node-1603,7591.679372030
node-1613,5033.529691250
node-1623,6352.719743320
node-1631,5151.082792600
node-1644,5781.210442940
node-1654,2493.3102262300
node-1662,3910.667492820
node-1674,2311.5124891554
node-1682,7953.844462220
node-1692,8213.010585860
node-1702,3263.822132830
node-1713681.83926970
node-1725,1941.160821681
node-1732,4371.2113233530
node-1745623.07651790
node-1753,4270.895564490
node-1761,4743.287551770
node-1773921.746662340
node-1782,3252.211363739
node-1795,0362.661171257
node-1802,3412.835501770
node-1811,5283.33627638
node-1823643.8112611445
node-1832,8761.059772720
node-1844,3604.03742948
node-1852,2103.79812350
node-1863,4771.18644100
node-1877222.339221540
node-1884,0662.647101440
node-1894,0671.929292740
node-1901,8741.254392380
node-1912,5062.660782340
node-1922,5494.0103814070
node-1934,7542.08980878
node-1944,3502.198492806
node-1951,4613.68059650
node-1963,8471.4136871270
node-1971,1520.84588540
node-1982,2312.969882550
node-1992,4462.123111980
node-2004,1294.267301560
node-2013,2962.3139171090
node-2022,2602.57394150
node-2033,8061.026333860
node-2043,3291.3112792770
node-2059301.636594200
node-2063,6783.649233500
node-2073172.180612650
node-2082,5993.738593090
node-2093,8614.110910622
node-2103,3712.078291339
node-2113,6992.277132830
node-2129674.410729710
node-2133853.764773000
node-2143,2903.085233720
node-2152,4710.9103442290
node-2163,1761.477401228
node-2171,9351.95418741
node-2184,4411.4128292000
node-2192,2853.415103190
node-2201,3051.122723480
node-2217183.790822940
node-2221,8772.843191290
node-2233,2701.988454430
node-2242,7151.911267890
node-2253,9142.4126811141
node-2262,7721.9117603950
node-2272,2053.039213046
node-2288451.820743950
node-2291,5402.545753850
node-2306082.059932470
node-2313,2852.372683630
node-2325462.563772570
node-2332,7262.266311800
node-2342,1350.63773840
node-2353,3064.085353250
node-2363,3901.256902673
node-2373,3124.357193630
node-2385922.757111610
node-2393,9771.4144542020
node-2402,9971.857121130
node-2413,3382.148883340
node-2422,1802.232301040
node-2433,7270.978651130
node-2441,1721.261563630
node-2455,0252.38953683
node-2463,6332.488331120
node-2472,5023.39631670
node-2483,6642.1114501360
node-2491,6653.15843795
node-2504,0230.580352530
node-2518501.76784560
node-2528232.829163060
node-2531,3711.536322940
node-2543,8331.473813236
node-2557843.468632419
node-2561,3831.762472390
How it works

The report

The numbers ride on your stream itself. The report view renders a probe, one value for every tab, and the site's frame writer keeps your stream's probe from then on. Each time it writes a tick's frames, it first asks the probe for a report, which reads the stream at that moment:

report.go
func read(st *sse.Stream, m *demo.Meter, now time.Time) Reading {
	r := Reading{Frames: m.Frames, Coding: st.Encoding(), Last: m.Last, FPS: m.Rate(now, 4*time.Second), Beats: m.Beats}
	r.Tier, r.Heap = st.Tier()
	r.Events, r.Wire = st.Sent()
	if b := st.Budget(); b != nil {
		r.Budget = b.Stats()
	}
	return r
}

demo.Meter is the frame writer's count of the stream's writes: the bytes of each, when they went out, and what the hub sent in between. The report goes out as a patch of $_stream in the same write as the frames, so it describes the stream up to the frame before. On this page every frame carries one; in the landing page's slot, one a second at most.

The coding

sse.Negotiate picks the coding with the highest weight in your browser's Accept-Encoding, zstd before brotli before gzip when they tie. Chrome, Edge and Firefox accept zstd, Safari from 26.3. zstd sends more bytes than brotli for an eighth of its CPU or less: on one core, a 57 KB page with five rows changed per frame took zstd 29 to 30 µs a frame for 405 bytes on the wire, and brotli at quality 4 249 to 257 µs for 155 bytes. The coding reads none when your browser accepted none, or when the budget had no room for a brotli or gzip encoder.

The setting from the budget

The hub shares a memory budget among its streams: half the process's memory limit. This site runs with GOMEMLIMIT=192MiB, so the streams share 96 MiB: their encoders, 32 KiB for each stream besides, and the frames the hub keeps for the views. Your stream's first frame picks its setting. Its window must hold your largest frame, and here no less than 2^17. A zstd stream gets the largest setting that fits both its fair share, what the limit leaves after the frames and the streams divided by the streams that compress, and what is left of the limit:

Setting Window Reserved
zstd 2^19 512 KiB, with twice that as history 1.70 MiB
zstd 2^19 low memory 512 KiB 1.11 MiB
zstd 2^18 low memory 256 KiB 880 KiB
zstd 2^17 low memory 128 KiB 752 KiB
br q4 2^17 128 KiB 1.33 MiB
br q3 2^17 128 KiB 848 KiB

The window is how far back the encoder looks for what a frame repeats. Low memory keeps zstd's history at the window, for more CPU per frame. When a new stream finds no room, every zstd stream above the new fair share moves down at its next write, so your setting can change while you watch. A brotli stream keeps its setting until it closes: the window its frames need, at quality 4 while the budget is at most half full and at 3 after that. When not even the smallest fits, a stream goes out uncompressed. zstd asleep is a zstd stream that holds no encoder: before its first frame, after a hibernation, or while the budget has no room for it, when its frames go out in raw blocks.

Reserved for your encoder

The heap that the budget reserves for your setting: the most lith measured an encoder of that setting to hold after sessions of 50 to 230 KB frames, rounded up. The budget adds up these reservations; it does not measure the heap.

Events and the wire

Events are the Datastar events as the server formats them: datastar-patch-elements with your table's HTML and datastar-patch-signals with these numbers in JSON. The wire is what your encoder made of them, the bytes the server wrote, before TLS and HTTP framing. The ratio so far divides the one by the other, from the stream's first byte.

The last frame

A frame here is one write: the views that changed in a tick, compressed and flushed together. Its ratio tells how many bytes of events went into each byte on the wire. The large table's frame carries about 28 KB of events; with calm churn eight of its 1,536 cells change, and the frame takes a few hundred bytes. With storm a quarter of the cells change, and the ratio falls to about 7:1.

The window must hold the frame before, or there is nothing to refer back to. In lith's measurements a board of 142 KB a frame takes 1,471 bytes on the wire with a 2^19 window, 2,703 at 2^18 with low memory, and 10,831 at 2^17, where the frame before is out of reach. A stream's first frame has no history at all, and neither has the first frame after a hibernation: those are the spikes in the line.

Frames a second

The table view renders every 250 ms, and a little more than that apart in practice: each render is due 250 ms after the tick that ran the one before. The rate counts the writes of the last four seconds.

Heartbeats

After 20 s without a frame, the hub sends an SSE comment, three bytes of events, so that proxies keep the connection open. The page never sees a comment; the meter finds the heartbeats as the bytes the stream sent between two of its writes. While the table moves there are none. Pick Still, wait half a minute and pick Calm again: the next report counts them.

Hibernation

After a minute without a frame, the hub hibernates the stream (live.Options.Hibernate): the stream ends its zstd frame, gives its encoder to a pool and its reservation back to the budget, and its setting reads zstd asleep. A heartbeat then goes out in a zstd frame of its own, 15 bytes instead of 6. The next frame takes an encoder from the pool and starts without history: lith measured a 37 KB list at 3,790 bytes on the wire after waking.

The site's streams and the budget

Every stream of the hub opens through the budget, which counts them by what they hold: that gives the number of open streams and the list under the meter. The meter is what the budget reserves, the frames and the streams' own 32 KiB included, against the limit. With 200 open streams and windows down to 2^18, this site measured 110 MB resident, 100 MB of it encoders, with 115 streams at zstd 2^18 with low memory and the rest uncompressed.

The payload

Your choice of size and churn is your tab's row in site_tabs, written by a command. Still freezes the table at the step it was chosen:

commands.go
func (c SetPayload) Apply(tx *writer.Tx) error {
	var s TabState
	if err := demo.LoadTab(tx.Context(), tx, Slug, c.Viewer, &s); err != nil {
		return err
	}
	if c.Size != "" {
		s.Size = c.Size
	}
	if c.Churn == Still && s.churn() != Still {
		s.Frozen, s.From = StepAt(c.At), s.churn()
	}
	if c.Churn != "" {
		s.Churn = c.Churn
	}
	s.Op = c.Op
	return demo.SaveTab(tx, Slug, c.Viewer, s, c.At)
}

The table at a step is a function of its size, its churn and the step: the cells change in an order that visits every cell before it comes round again, a fixed number of them per step. So the tabs that chose the same share one render of each step, and your tab's view only reads your row and picks that render.

What the inspector costs the server

Measured on 2026-10-13 on a development machine, an Intel i5-13500, not on the VPS that serves this site, with the site's binary on four cores and GOMEMLIMIT=192MiB as deployed: 100 inspectors with the large table, read by a load test on other cores that does not decompress them, over 60 s each:

Churn CPU Bytes a frame Heap after a collection
Calm 0.08 cores 503 87 MiB
Busy 0.09 cores 1,619 87 MiB
Storm 0.16 cores 4,413 89 MiB

The budget gave all 100 streams zstd 2^18 low memory, 82.8 of its 96 MiB, which is most of that heap. The CPU goes into compressing about 400 frames a second; the table renders once a step for all the tabs that share it. Between collections the heap grows to the goal that the memory limit sets, so the process stayed at 190 to 197 MiB resident, below the unit's MemoryHigh=224M.