Commit d62dcbb
Parallelise skill file fetches and reuse HTTPS connections (#5335)
## Summary
- Hoist a single shared `http.Client` in
`libs/aitools/installer/installer.go` so the transport pool reuses
TCP+TLS connections across fetches. `MaxIdleConnsPerHost` is bumped from
Go's default 2 → 16 so parallel fetches to `raw.githubusercontent.com`
actually reuse connections instead of churning handshakes.
- Fetch a skill's files concurrently in `installSkillToDir` via
`errgroup.WithContext` with `SetLimit(8)`. First error cancels in-flight
peers, preserving the prior bail-on-first-error semantics.
- Skills themselves are still installed serially across the outer loop.
Most of the cold-start win therefore comes from the shared client
keeping idle connections warm between sequential skills, rather than
from intra-skill parallelism alone.
## Why
`databricks aitools install` was sequential: every file constructed a
fresh `&http.Client{}` and threw it away, paying the full TCP+TLS
handshake per file. For `--experimental` (26 skills × ~5 files each =
~120 HTTPS GETs to GitHub raw) that meant wall-clock was dominated by
handshake round-trips.
Benchmarked locally against
`https://raw.githubusercontent.com/databricks/databricks-agent-skills/v0.2.0`
with a freshly built CLI on each side:
| Condition | Baseline | This change | Speedup |
|---|---|---|---|
| Cold (no DNS/CDN warm) | 42.7 s | 0.52 s | ~80× |
| Warm | 0.55–0.79 s | 0.20–0.21 s | ~3–4× |
The cold-start number is what a first-time `databricks aitools install
--experimental` user actually pays.
The `fetchFileFn` package var that tests stub remains unchanged, so no
test mocks need updating.
## Test plan
- [x] `go test ./libs/aitools/...` — all green, including `-race
-count=2`.
- [x] `gofmt -l libs/aitools/installer/installer.go` — clean.
- [x] `go vet ./libs/aitools/...` — clean.
- [x] End-to-end timing against live GitHub raw — see table above.
This pull request and its description were written by Isaac.
---------
Co-authored-by: simon <simon.faltum@databricks.com>1 parent b85b937 commit d62dcbb
2 files changed
Lines changed: 155 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
31 | 40 | | |
32 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
33 | 55 | | |
34 | 56 | | |
35 | 57 | | |
| |||
121 | 143 | | |
122 | 144 | | |
123 | 145 | | |
124 | | - | |
125 | | - | |
| 146 | + | |
126 | 147 | | |
127 | 148 | | |
128 | 149 | | |
| |||
555 | 576 | | |
556 | 577 | | |
557 | 578 | | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
558 | 584 | | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
574 | 600 | | |
575 | | - | |
576 | | - | |
| 601 | + | |
577 | 602 | | |
578 | 603 | | |
579 | 604 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| 11 | + | |
10 | 12 | | |
| 13 | + | |
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
| |||
188 | 191 | | |
189 | 192 | | |
190 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
191 | 302 | | |
192 | 303 | | |
193 | 304 | | |
| |||
0 commit comments