Repository navigation
Commit 2cdff9f
Remote cache: raise read concurrency and stop per-request CAT minting on VPNless
Summary:
Remote cache hits are slow mostly because of client-side queueing. On a warm cache Metro starts one `HttpGetStore` GET per module at once (thousands in flight), but `HttpStore` caps its agent at 64 sockets. Most of each logged `Cache get` duration is therefore time spent waiting for a socket; Manifold answers in about 100–150 ms.
On VPNless laptops there is a second cap. Every read carries `x-x2pagentd-inject-cat`, and x2pagentd mints a fresh CAT for every such request (`CatInjectFilter`). That holds reads to about 250/s per laptop, whatever the socket count.
Changes:
- `HttpStore` (metro-cache), both new options documented in `Caching.md`:
- `maxSockets` option; the default stays 64.
- `getParams` option, called before each request (and each retry); the parameters it resolves to are added to `params`, for short-lived credentials. A rejection fails the request with a `NetworkError`, which `HttpGetStore` treats as a miss. Without `getParams`, requests still start synchronously.
- `fb-config/vpnless`: `mintX2PAgentdCat(verifier, validitySeconds)` mints a CAT through x2pagentd's `cats.x2pagentd.local/create` endpoint (the one other tools already use).
- `getManifoldHttpConfig` (reads only):
- 256 sockets.
- On VPNless, no inject header. Instead `getParams` mints one `manifold.blobstore` CAT, valid for an hour, reuses it for 50 minutes, then mints again. Reads therefore send the same `crypto_auth_tokens` query parameter that x2pagentd injects today, minted once instead of per read. This does not depend on Manifold accepting reads without a CAT.
- Writes are unchanged.
Rollout notes:
- The `HttpStore` options take effect with the next Metro (MSDK) bump; the prebuilt Metro ignores them until then. The config side loads from the checkout immediately, so until the bump VPNless reads go out with no CAT at all. Manifold accepts that today (verified: reads without a CAT, and with a garbage CAT, return 200 with the payload).
- Transform cache keys hash every file under `xplat/js/config/metro` and `xplat/js/config/vpnless`. As with any config change, commits with this change get remote cache misses until the cache warmer has filled them.
Changelog: [Feature] metro-cache: `HttpStore` accepts `maxSockets`, to raise or lower its connection limit, and `getParams`, to add query parameters (such as a short-lived credential) to every request
Differential Revision: D1323316111 parent a21bdde commit 2cdff9f
3 files changed
Lines changed: 104 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| 52 | + | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
34 | 40 | | |
35 | 41 | | |
36 | 42 | | |
| |||
55 | 61 | | |
56 | 62 | | |
57 | 63 | | |
| 64 | + | |
58 | 65 | | |
59 | 66 | | |
60 | 67 | | |
| |||
96 | 103 | | |
97 | 104 | | |
98 | 105 | | |
99 | | - | |
100 | | - | |
| 106 | + | |
| 107 | + | |
101 | 108 | | |
102 | 109 | | |
103 | 110 | | |
| |||
138 | 145 | | |
139 | 146 | | |
140 | 147 | | |
| 148 | + | |
141 | 149 | | |
142 | 150 | | |
143 | 151 | | |
| |||
152 | 160 | | |
153 | 161 | | |
154 | 162 | | |
155 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
156 | 170 | | |
157 | 171 | | |
158 | | - | |
| 172 | + | |
159 | 173 | | |
160 | | - | |
| 174 | + | |
161 | 175 | | |
162 | 176 | | |
163 | 177 | | |
| |||
275 | 289 | | |
276 | 290 | | |
277 | 291 | | |
278 | | - | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
279 | 296 | | |
280 | 297 | | |
281 | 298 | | |
282 | 299 | | |
283 | | - | |
| 300 | + | |
284 | 301 | | |
285 | 302 | | |
286 | 303 | | |
287 | | - | |
| 304 | + | |
288 | 305 | | |
289 | 306 | | |
290 | 307 | | |
| |||
400 | 417 | | |
401 | 418 | | |
402 | 419 | | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
403 | 442 | | |
404 | 443 | | |
405 | 444 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
105 | 160 | | |
106 | 161 | | |
107 | 162 | | |
| |||
0 commit comments