nitrojs / nitrojs/nitro

Leverage worker_threads for pre-render concurrency

Open
#1,447 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discussion enhancement performance prerender v2
Dominant language
TypeScript
Stars
11.2k
Forks
899
Avg merge
2d 24m
Merged PRs (30d)
40

Description

Describe the feature

The pre-render concurrency implementation relies on Promise.all, and doesn't leverage multiple cpu cores.
Multithreading can be achieved with node.js using worker_threads

We could re-implement the concurrency implementation using worker threads, which would fix memory issues as we could apply concurrency based on available cores.

There's a couple libraries that makes things easier here https://github.com/piscinajs/piscina or https://github.com/andywer/threads.js

Additional information
  • Would you be willing to help implement this feature?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the current pre-render concurrency implementation that uses Promise.all, then review Node.js worker_threads and the suggested Piscina or threads.js libraries. The work is complete when pre-rendering uses worker-based concurrency constrained by available CPU cores and the reported memory issues are addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
backend, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.