Skip to content

Add optional parallel eager loading - #339

Open
elpete wants to merge 3 commits into
nextfrom
feat/55-parallel-eager-loading
Open

Add optional parallel eager loading#339
elpete wants to merge 3 commits into
nextfrom
feat/55-parallel-eager-loading

Conversation

@elpete

@elpete elpete commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

Closes #55

Issue review

Recommendation: 7/10 — implement as opt-in. Independent eager-load queries can benefit from concurrency when database latency dominates, especially for several unrelated top-level relationships. It should not be the default: extra threads add overhead, consume more database connections, and do not help a single relationship or necessarily improve low-latency local queries.

Implementation

  • adds an optional parallel boolean to with, e.g. .with(["author", "comments"], true)
  • runs independent top-level eager loads on separate threads
  • preserves nested eager-load configuration within each top-level branch
  • propagates worker failures instead of returning partial relationship data
  • fails explicitly if workers do not complete within 60 seconds
  • retains the existing sequential path by default and for a single top-level relationship

Test-first evidence

The public regression initially failed because both eager-load callbacks ran on the request thread. It now verifies that both relationships hydrate correctly and that each callback executes on a distinct worker thread.

Validation

  • focused EagerLoadingSpec: 28 passed, 0 failed, 0 errors
  • full Lucee 6 suite: 496 passed, 0 failed, 0 errors, 3 skipped
  • box run-script format
  • git diff --check

Uses qb@14.0.0-beta.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant