Skip to content

Add optional parallel eager loading - #339

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

Add optional parallel eager loading#339
elpete wants to merge 29 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 branches can benefit from concurrency when database latency and hydration work dominate, especially for several unrelated top-level relationships. It should not be the default: concurrency consumes more database connections and CPU, and does not help a single relationship or necessarily improve low-latency queries.

Implementation

  • adds an optional parallel boolean to with, e.g. .with( [ "author", "comments" ], true )
  • uses ColdBox's AsyncManager and an application-wide bounded executor; applications can supply one with parallelEagerLoadingExecutor, otherwise Quick creates and owns a fixed executor
  • caps each query's parallelEagerLoadingMaxThreads by the configured executor's maximum pool size
  • performs retrieval, entity hydration, transformations, nested eager loading, and branch-local collection construction on workers
  • keeps matching and mutation of the original parent entities, plus top-level quickRelationshipLoaded, on the calling thread
  • hydrates polymorphic branches on workers without allowing them to mutate the original parents
  • gives every worker an isolated ColdBox request context and preserves the BoxLang application mappings and default datasource needed during hydration
  • propagates worker failures instead of returning partial relationship data, cancels outstanding work on failure or timeout, and avoids parallel work inside transactions
  • retains the existing sequential path by default and for a single top-level relationship

Validation

  • focused relationship/module suite on Lucee 5: 59 passed, 0 failed, 0 errors
  • focused relationship/module suite on BoxLang 1: 59 passed, 0 failed, 0 errors
  • full Lucee 5 suite: 624 passed, 0 failed, 0 errors, 3 skipped
  • full BoxLang 1 suite: 625 passed, 0 failed, 0 errors, 2 skipped
  • box run-script format:check
  • git diff --check

Uses qb@14.0.0-beta.3.

@elpete
elpete force-pushed the feat/55-parallel-eager-loading branch 3 times, most recently from b7ceb98 to 6847a98 Compare August 26, 2026 15:12
@elpete
elpete force-pushed the feat/55-parallel-eager-loading branch from 6847a98 to 26c7041 Compare August 27, 2026 00:06
@elpete
elpete force-pushed the feat/55-parallel-eager-loading branch from b374abd to 43b17d0 Compare August 27, 2026 00:39
@elpete
elpete force-pushed the feat/55-parallel-eager-loading branch from 43b17d0 to 6bec058 Compare August 27, 2026 00:39
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