feat(sdk): shareMedia / onMediaGrant — media grants over a Shade session
A grant for a sealed file or a live channel rides the Double Ratchet like any message. With an onMediaGrant handler registered, grants are routed there instead of onMessage; with none, they arrive as text as before. Bench results for @shade/media (1 GiB, up to 200 live viewers, 100 % delivered) committed with their chart spec. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
147
bench/media.chart.json
Normal file
147
bench/media.chart.json
Normal file
@@ -0,0 +1,147 @@
|
||||
[
|
||||
{
|
||||
"type": "bar",
|
||||
"title": "Sealed media throughput (MiB/s)",
|
||||
"subtitle": "1024 MiB of incompressible data, 1 MiB segments, one core",
|
||||
"y": {
|
||||
"label": "MiB/s",
|
||||
"min": 0
|
||||
},
|
||||
"note": "Bun 1.3.5; HTTP is localhost through the real media routes; size overhead 0.0046 %",
|
||||
"source": {
|
||||
"path": "media-results.json"
|
||||
},
|
||||
"series": [
|
||||
{
|
||||
"name": "MiB/s",
|
||||
"data": [
|
||||
[
|
||||
"seal (disk → disk)",
|
||||
259.1
|
||||
],
|
||||
[
|
||||
"read + verify (disk)",
|
||||
480.2
|
||||
],
|
||||
[
|
||||
"upload (HTTP PUT)",
|
||||
50.9
|
||||
],
|
||||
[
|
||||
"read + verify (HTTP Range)",
|
||||
209.5
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "bar",
|
||||
"title": "Seeking in a sealed film over HTTP (ms)",
|
||||
"subtitle": "open = footer + trailer + root check; seek = first 64 KiB at a random offset, no cache",
|
||||
"y": {
|
||||
"label": "ms",
|
||||
"min": 0
|
||||
},
|
||||
"note": "n = 10 opens, 100 seeks; localhost",
|
||||
"source": {
|
||||
"path": "media-results.json"
|
||||
},
|
||||
"series": [
|
||||
{
|
||||
"name": "p50",
|
||||
"data": [
|
||||
[
|
||||
"open",
|
||||
3.28
|
||||
],
|
||||
[
|
||||
"seek",
|
||||
3.98
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "p95",
|
||||
"data": [
|
||||
[
|
||||
"open",
|
||||
6.58
|
||||
],
|
||||
[
|
||||
"seek",
|
||||
8.21
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "line",
|
||||
"title": "Live fan-out: latency publish → decrypted, by viewers",
|
||||
"subtitle": "10 fps × 32 KiB frames (≈ 2.6 Mbit/s) for 6 s; relay in its own process, all viewers in one",
|
||||
"x": {
|
||||
"label": "viewers"
|
||||
},
|
||||
"y": {
|
||||
"label": "ms",
|
||||
"min": 0
|
||||
},
|
||||
"note": "delivered: 1 → 100 %, 10 → 100 %, 50 → 100 %, 100 → 100 %, 200 → 100 %. Every viewer verifies every signature and decrypts every frame, in one process, so the curve is mostly the viewers' CPU, not the relay's.",
|
||||
"source": {
|
||||
"path": "media-results.json"
|
||||
},
|
||||
"series": [
|
||||
{
|
||||
"name": "p50",
|
||||
"data": [
|
||||
[
|
||||
1,
|
||||
3
|
||||
],
|
||||
[
|
||||
10,
|
||||
6
|
||||
],
|
||||
[
|
||||
50,
|
||||
22
|
||||
],
|
||||
[
|
||||
100,
|
||||
15
|
||||
],
|
||||
[
|
||||
200,
|
||||
28
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "p95",
|
||||
"data": [
|
||||
[
|
||||
1,
|
||||
12
|
||||
],
|
||||
[
|
||||
10,
|
||||
20
|
||||
],
|
||||
[
|
||||
50,
|
||||
58
|
||||
],
|
||||
[
|
||||
100,
|
||||
72
|
||||
],
|
||||
[
|
||||
200,
|
||||
151
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user