Commit 72d711d
feat: wire render cache into prebuilds reconciler
This commit integrates the render cache into the prebuilds
reconciliation flow, enabling cache sharing across all prebuild
operations.
Changes:
1. StoreReconciler:
- Add renderCache field (*dynamicparameters.RenderCache)
- Initialize cache in NewStoreReconciler()
- Pass cache to builder in provision() method
2. wsbuilder.Builder:
- Add renderCache field
- Add RenderCache(cache) builder method
- Pass cache to dynamicparameters.Prepare() when available
How it works:
- Single RenderCache instance shared across all prebuilds
- Each workspace build passes the cache through the builder chain
- Cache keyed by (templateVersionID, ownerID, parameterHash)
- All prebuilds use PrebuildsSystemUserID, maximizing cache hits
Expected behavior for a preset with 5 instances:
- First instance: cache miss → full render → cache stored
- Instances 2-5: cache hit → instant return
- Result: ~80% reduction in render operations per cycle
This addresses the resource cost identified in profiling where the
prebuilds path consumed 25% CPU and 50% memory allocations, primarily
from repeated Terraform file parsing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 22f5008 commit 72d711d
File tree
2 files changed
+34
-1
lines changed- coderd/wsbuilder
- enterprise/coderd/prebuilds
2 files changed
+34
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
91 | 94 | | |
92 | 95 | | |
93 | 96 | | |
| |||
253 | 256 | | |
254 | 257 | | |
255 | 258 | | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
256 | 267 | | |
257 | 268 | | |
258 | 269 | | |
| |||
686 | 697 | | |
687 | 698 | | |
688 | 699 | | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
689 | 716 | | |
690 | 717 | | |
691 | 718 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
61 | 65 | | |
62 | 66 | | |
63 | 67 | | |
| |||
102 | 106 | | |
103 | 107 | | |
104 | 108 | | |
| 109 | + | |
105 | 110 | | |
106 | 111 | | |
107 | 112 | | |
| |||
900 | 905 | | |
901 | 906 | | |
902 | 907 | | |
903 | | - | |
| 908 | + | |
| 909 | + | |
904 | 910 | | |
905 | 911 | | |
906 | 912 | | |
| |||
0 commit comments