It's the final day of Launch Week and we're back with one last launch...
Encore.ts now provides Worker Pooling mode — a brand new way of running CPU-intensive JavaScript workloads that provides even more performance and scalability than has been possible before.
It works by combining the multi-threaded nature of Encore.ts' high-performance Rust runtime with multiple worker threads in NodeJS.
This means your applications are no longer constrained by JavaScript's single-threaded event loop. Instead, Encore.ts is now able to orchestrate and coordinate workloads across multiple event loops, providing a dramatic performance boost for CPU-intensive workloads.
In our tests, real-world applications that reach the limits of NodeJS' single-threaded performance have achieved up to a 5x performance improvement when using Encore.ts Worker Pooling, compared to Encore.ts running in single-threaded mode.
And this is on top of the already huge performance benefits that Encore.ts provides compared to other frameworks.
When enabled via a simple configuration in your Encore project, all worker thread management is handled automatically by Encore.ts.
You don't need to write any thread management code, create worker pools, or handle thread coordination yourself — Encore.ts takes care of creating and orchestrating worker threads based on your application's needs.
The Encore.ts Worker Pooling architecture involves a single process, consisting of the multi-threaded Encore.ts Rust runtime, and multiple independent worker threads in NodeJS.
Beyond distributing and load-balancing incoming HTTP requests, Encore.ts also automatically distributes incoming Pub/Sub messages to multiple worker threads.
At first glance, this architecture is not too different from existing solutions
for JavaScript multithreading, like using the node:worker_threads
module directly,
or sharing a TCP listening port across multiple processes via SO_REUSEPORT
:
However, these approaches have significant drawbacks when you want to share resources between threads, like database connection pools, HTTP client connections, or observability integrations. The complexity of sharing these resources safely often leads to a simpler but inefficient solution, where each process maintains its own separate resource pools. This results in unnecessary resource duplication and reduced performance:
Encore.ts Worker Pooling provides significant benefits over these approaches.
The Encore.ts Rust runtime is shared between Workers, providing much more efficient sharing of resources like database connection pools, HTTP client connections, observability integrations like Distributed Tracing, and more:
If you're already using Encore, update using encore version update
.
If you're new to Encore, install using the instructions below and then create an example app using encore app create
.
$ brew install encoredev/tap/encore
If you have questions or just want to hang out with other Encore developers, join our community on Discord.