Commit ef02be9
perf: cold-start warm-up, O(1) protected-method gate, schema cache, debug-bar slimming (#3210)
* perf: cold-start warm-up, O(1) protected-method gate, schema cache, debug-bar slimming
Profiling-driven optimizations. JFR + ab profiling showed cold start is ~85%
Lucee CFML->bytecode compilation (bootstrap logic is only ~20ms) while warm
serving is already ~0.4ms; these target the cold path and a couple of clean
hot-path/dev wins, none changing public APIs.
- Dispatch gate (controller/processing.cfc): test the protected-helper set with
an O(1) StructKeyExists lookup instead of an O(n) ListFindNoCase scan. A
companion application.wheels.protectedControllerMethodsLookup struct-as-set is
built once at app start alongside the retained comma-list; case-insensitive
matching is unchanged.
- Column metadata (databaseAdapters/Base.cfc): memoize cfdbinfo "columns" per
datasource+table in application.wheels.cache.schema when cacheDatabaseSchema
is on. Rebuilt on reload, so schema changes are still picked up on reload.
- Dev debug bar (events/onrequestend/debug.cfm): externalize the static CSS/JS
to vendor/wheels/public/assets/{css,js}/debugbar.* (eliminating the CFML
##-escaping footgun) and collapse inter-tag whitespace. Dev-only; production
unaffected.
- Scaffold (cli templates): ship a /up liveness/warm-up endpoint that
`wheels deploy`'s healthcheck probes before cutover, plus production-config
warm-up recipe and inspectTemplate=never guidance.
Signed-off-by: Peter Amiri <petera@pai.com>
* docs(changelog): reference PR #3210 in perf fragments
Signed-off-by: Peter Amiri <petera@pai.com>
* chore(web): refresh visual baseline(s) (all)
Manually triggered baseline refresh via
.github/workflows/refresh-visual-baselines.yml
on branch peter/perf-cold-start-serving-followups.
Run when an intentional content/layout change makes the visual-regression
check fail. The new PNG(s) under web/tests/visual-baselines/ are now the
expected rendering; re-run the failing visual-regression job to flip the
check green.
* fix(model): move schema column cache out of the time-based cache namespace
Addresses the bot reviewer on #3210. The column-metadata cache stored raw
query objects under application.wheels.cache.schema, but every
application.wheels.cache.* category is owned by the time-based cull/count
machinery: $cacheCount() sums StructCount across all categories toward
maximumItemsToCache, and the cull dereferences `.expiresAt` on every entry
with no type guard (Global.cfc:904). A raw query has no expiresAt, so once the
global cache filled (page/partial/query caching, on by default in production)
and a cull was due, it would throw when it reached a schema entry.
- Move the cache to a sibling top-level key application.wheels.schemaColumnCache
(set in onapplicationstart next to, not under, cache) so the cull/count never
walk it. Matches the stated intent: persists for the app lifetime, rebuilt on
reload.
- Mirror $getFromCache's defensive shape: wrap the read in try/catch and
Duplicate() the cached query on store and on return, so a concurrent struct
read can't surface a partial value and no caller can mutate the cached query
in place (the first review's non-blocking note).
- Update schemaColumnCacheSpec and the changelog fragment for the new key.
Signed-off-by: Peter Amiri <petera@pai.com>
---------
Signed-off-by: Peter Amiri <petera@pai.com>
Co-authored-by: Peter Amiri <petera@pai.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>1 parent 35f5ebe commit ef02be9
18 files changed
Lines changed: 298 additions & 94 deletions
File tree
- changelog.d
- cli/lucli/templates/app
- app/controllers
- config
- vendor/wheels
- controller
- databaseAdapters
- events
- onrequestend
- public/assets
- css
- js
- tests/specs
- controller
- model
- web
- sites/guides/src/content/docs/v4-0-0/deployment
- tests/visual-baselines
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
10 | 15 | | |
11 | 16 | | |
12 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4389 | 4389 | | |
4390 | 4390 | | |
4391 | 4391 | | |
| 4392 | + | |
| 4393 | + | |
| 4394 | + | |
| 4395 | + | |
| 4396 | + | |
| 4397 | + | |
| 4398 | + | |
| 4399 | + | |
| 4400 | + | |
| 4401 | + | |
| 4402 | + | |
| 4403 | + | |
| 4404 | + | |
| 4405 | + | |
| 4406 | + | |
| 4407 | + | |
| 4408 | + | |
| 4409 | + | |
4392 | 4410 | | |
4393 | 4411 | | |
4394 | 4412 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
| 138 | + | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
417 | 417 | | |
418 | 418 | | |
419 | 419 | | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
420 | 446 | | |
421 | 447 | | |
422 | 448 | | |
| |||
430 | 456 | | |
431 | 457 | | |
432 | 458 | | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
433 | 467 | | |
434 | 468 | | |
435 | 469 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
112 | 119 | | |
113 | 120 | | |
114 | 121 | | |
| |||
400 | 407 | | |
401 | 408 | | |
402 | 409 | | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
403 | 417 | | |
404 | 418 | | |
405 | 419 | | |
| |||
0 commit comments