Reduce repeated full-projection lookups during workflow execution - #509
Conversation
|
The source change passed full local PHPStan and 15 focused cases in aggregate, covering configured model/table/connection routing, cold-reload projection consistency, metadata-only external payload behavior, existing unique-key recovery, and fixed projection read counts. PR functional/corpus checks passed; the first style check caught one chained-call indentation introduced by the formatter. Commit c59828f corrects it and a second local style check is clean. The first broad run was cancelled and one complete source validation has been requested for the corrected commit. This remains draft, with no published-consumer or production performance claim. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #509 +/- ##
==========================================
+ Coverage 88.04% 88.06% +0.02%
==========================================
Files 460 460
Lines 63036 63059 +23
==========================================
+ Hits 55497 55531 +34
+ Misses 7539 7528 -11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Problem
Relates to #508. Repeated full monitoring projection rereads each existing timeline, wait, and timer row individually. Summary projection also derives activity and timer views more than once in the same pass. A small embedded workflow with three parallel activities followed by a timer per round exposes the growing cost.
Changes
No new cache, background projector, schema, durable-history format, or public execution contract.
Validation
Local PHP 8.4.25 / Laravel 13 source checks:
phpstan analyse src testsand changed-file ECS passed.c59828f4c7be77c6efd078419d0aed548c26c8fe: unit/coverage, all MySQL and PostgreSQL shards, MariaDB, Laravel 9-13 upgrade checks, regression corpus, contracts, and quality. PR checks also passed.Diagnostic only, not a published capacity benchmark: matched sequential runs on the same host, container limit 1 CPU / 1 GiB, SQLite in memory, fake no-op activity bodies, Workflow 2.0.12 versus this source overlay. Sixteen rounds produced 48 activity completions and 179 history events; both runs completed with the correct output and activity count.
XHProf on a separate three-round baseline attributes about 75% of elapsed profiled time to full summary projection. Profiler overhead is excluded from the timing table. The repository-owned three-round correctness reproduction is
tests/Unit/V2/ProjectionReplayTest.php; query-count regression is inProjectionPrefetchTest.php.This is a partial optimization: the remaining history-dependent PHP cost is still material. Keep #508 open until its acceptance criteria, broader correctness checks, and published-consumer follow-through are complete. No claim that this patch alone resolves the full performance problem.
Before Delivery
Current
mainconsumer audit: Server requires Workflow2.0.12exactly and will need a dependency update and rebuilt release. Sample App's embedded lock is2.0.12under^2.0, requiring a lock update and first-user verification. Waterline's Workflow dependency is development-only; refresh relevant embedded integration qualification without claiming a runtime package release is necessary. PHP SDK and CLI have no Workflow runtime dependency; there is no portable wire change requiring synchronized SDK releases. Deployment-specific follow-through stays in its owning private record.