Skip to content

Replace JS worker's rendezvous channel with unbounded queue#4704

Open
joshua-spacetime wants to merge 1 commit intomasterfrom
joshua/js-worker-queue
Open

Replace JS worker's rendezvous channel with unbounded queue#4704
joshua-spacetime wants to merge 1 commit intomasterfrom
joshua/js-worker-queue

Conversation

@joshua-spacetime
Copy link
Collaborator

@joshua-spacetime joshua-spacetime commented Mar 24, 2026

Description of Changes

Previously, a module’s JS worker thread was fed through a zero-capacity channel. That made every request handoff a rendezvous between the async producer task and the single JS worker thread. Under high concurrency, that synchronous handoff showed up as hot flume/lock/wakeup stacks on the critical path - the JS worker thread.

This patch brings V8 execution in line with WASM which also uses an unbounded request queue.

Changing that handoff to an unbounded queue decouples request producers from the JS worker. Producers can enqueue work without synchronizing directly with the worker on every request, and the worker can continue draining queued requests without paying the rendezvous cost each time. This shortens the critical path, reduces scheduler/locking overhead and increases throughput.

API and ABI breaking changes

None

Expected complexity level and risk

2

Testing

Manual performance testing

@joshua-spacetime joshua-spacetime changed the title test: make js worker queue unbounded Replace JS worker's rendezvous channel with bounded queue Mar 25, 2026
@joshua-spacetime joshua-spacetime marked this pull request as ready for review March 25, 2026 06:49
@joshua-spacetime joshua-spacetime changed the title Replace JS worker's rendezvous channel with bounded queue Replace JS worker's rendezvous channel with unbounded queue Mar 25, 2026
Base automatically changed from joshua/v8-heap-metrics to master March 25, 2026 22:37
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