docs: durable-execution feasibility study#259
Draft
NikolayS wants to merge 10 commits into
Draft
Conversation
Evaluate whether PgQue should extend into a durable-workflow engine (DBOS/absurd-style) on Postgres, and the adoption odds if so. Synthesizes deep research on DBOS, absurd, Temporal, Restate, Rivet, and Gadget Silo, grounded against SPECx 2.3 positioning and the PgQ engine constraints. Key finding: the durable layer needs SKIP-LOCKED claim/lease semantics, a second concurrency model beside PgQ rotation, so the zero-bloat differentiator does not transfer. Recommends a thin transactional-durable-enqueue + experimental checkpointed-steps path rather than a head-on Temporal/DBOS competitor.
Earlier draft concluded the zero-bloat differentiator does not transfer to a workflow layer, assuming a mutable workflow_status row updated per step (the DBOS/absurd strategy). That was wrong. Model workflow state transitions as appended events over the rotating log (continuation-passing): each step enqueues its successor instead of mutating a row. Transitions become appends, not UPDATEs, so zero-bloat carries through. Exactly-once handoff falls out of insert_event + finish_batch in one transaction; sleep/timers use the rotating send_at from PR #237; exclusivity is structural via cooperative consumers; the only mutable state is a current-state projection bounded by concurrency. Verdict flips from 'do not compete' to 'compete on a substrate SKIP-LOCKED systems cannot match for high-throughput durable workflows'. Remaining real risk: awaitEvent/join semantics.
Event-sourced durable-execution layer authored with samospec (all-Claude panel). Ships SPEC.md, self-contained HTML brief (BRIEF.html/index.html), and auxiliary artifacts under blueprints/workflows/. .nojekyll added for GitHub Pages.
Map the durable-workflow design to pgque's real primitives and verify the keystone against sql/pgque.sql: insert_event + finish_batch compose atomically in the caller transaction (exactly-once handoff), finish_batch is one subscription UPDATE per batch (amortization), ev_extra1..4 are settable+indexable (workflow_id lookup). Flags the retry_queue DELETE-bloat constraint (route sleeps through rotating send_at, PR #237), gives the new coordination DDL, concrete awaitEvent/emit + join SQL, a bloat audit, and the pgque gaps to close (promote send_at, ev_extra1 index, durable.sql).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Refreshes the durable-execution feasibility draft and workflow spec after review of Microsoft
pg_durableand after checking PR #259 for internal mismatches.What changed
pg_durableas fresh prior art and records the product boundary: workflow durability in Postgres, workflow code in app repositories.blueprints/workflows/HOT_PATH_BENCHMARK.md, the first gate for the batching question: compare mutableworkflow_statusupdates vs PgQue continuation events, plus dedup andwf_livevariants.workflow_idcapability model: raw ids exist in protected hot queue rows /ev_extra1; lower-trust audit, DLQ, metrics, and error/export surfaces must hash or truncate.Why
The old PR body and generated spec bundle contradicted the revised feasibility doc, and the draft predated
pg_durable, which is now the most relevant fresh prior art for Postgres-native durable execution.The new hot-path benchmark doc exists because the whole workflow idea lives or dies on one narrow claim: N workflow step-events in one PgQue batch should append N successors and advance the subscription once, without recreating per-workflow update churn.
Verification
Documentation only.
git diff --checkrgscan for stale active claims / architecture placeholderCurrent status
Keep as draft. The feasibility doc is useful now; the next real gate is the hot-path benchmark/prototype, not merging a claim.