Node.js: More Threads Than You Think

This ad is not shown to multipass and full ticket holders
JS Nation
JSNation 2026
June 11 - 15, 2026
Amsterdam & Online
The main JavaScript conference of the year
Learn More
In partnership with Focus Reactive
Upcoming event
JSNation 2026
JSNation 2026
June 11 - 15, 2026. Amsterdam & Online
Learn more
Bookmark
Rate this content

Node.js was announced in 2009 as a single-threaded JavaScript runtime. In 2018, it became multi-threaded, and no one noticed.

What can worker_threads do? What are they useful for? What's the best way of communicating between two threads?

This talk has been presented at React Advanced 2025, check out the latest edition of this React Conference.

FAQ

No, Node.js has not been single-threaded since the introduction of worker threads, which have been stable since Node.js version 10 in 2018. Worker threads allow for concurrent execution of JavaScript in a single process.

Node.js can handle traffic spikes in production by using the cluster module, which creates a master process to distribute incoming connections to worker processes. Additionally, using SO_REUSEPORT allows multiple processes to listen on the same port, improving load distribution.

SO_REUSEPORT is a feature that allows multiple processes to bind to the same port and the operating system's kernel to distribute incoming connections among these processes, improving load balancing and connection affinity.

Node.js applications can be efficiently scaled on Kubernetes by using a two-layer architecture: an ingress layer to route connections to pods, and within each pod, using VAT and SO_REUSEPORT for efficient load distribution among worker threads.

VAT improves performance over PM2 by avoiding the 30% overhead associated with inter-process communication in the PM2 cluster model, using SO_REUSEPORT for efficient load distribution, and providing higher throughput and reliability.

Yes, VAT supports WebSockets by handling connections at the kernel level, which is independent of the application protocol, allowing efficient management of WebSocket connections.

Yes, SO_REUSEPORT is not specific to web servers and can be used for any application that requires multiple processes to listen on the same port, benefiting from kernel-level load balancing.

A shared HTTP cache allows all workers within the same pod to share cached data, reducing redundant computations and improving response times by serving cached responses immediately, even if requests are handled by different workers.

VAT is a Node.js application server that uses SO_REUSEPORT for efficient load balancing. It supports features like built-in monitoring, logging, tracing, and health checks, and ensures zero downtime by managing worker threads efficiently.

Node.js worker threads allow each thread to have an independent event loop, enabling the handling of tasks independently without worrying about synchronization issues. This is especially beneficial for offloading CPU-intensive tasks from the main thread.

Paolo Insogna
Paolo Insogna
32 min
28 Nov, 2025

Comments

Sign in or register to post your comment.
Video Summary and Transcription
The talk covers a range of topics including Node.js evolution to a multi-threaded system, scaling with the cluster module, managing PM2 for efficient orchestration, challenges in SSR frameworks, TCP SO reuse port for resource utilization, VAT architecture for smart service routing, zero downtime deployment with shared cache, performance benchmark results, PM2 performance challenges, legality and functionality of TCP SO reuse port, kernel balancing considerations, tool comparison between PM2 and Deno, cache consistency challenges, VAT architecture with worker thread recovery, T-scaling for vertical scaling, and updating Node V6 applications.

1. Node.js Evolution and Worker Threads

Short description:

The talk transitions from front-end to back-end development, highlighting the evolution of Node.js to a multi-threaded system with worker threads for improved performance and scalability.

So, since we've been talking a lot about front-ends today, it's time now to make you suffer with a bit of back-ends. As long as you can run now, if you won't, otherwise, good luck. So there is a lot in the unknown. You are mostly, I assume, front-end engineers, which work with Node on many systems nowadays, which means that you use Node, but you don't actually use Node, which is kind of amazing to me. And let's see what it means for you.

The original intro is pretty fine, so I'm going to skip this one. I just want to let you know that I come from the smallest and less known region of Italy, and all you people should visit because it's just amazing. OK? OK. So Node.js is no longer single-threaded. Do you still believe that it's actually single-threaded? Raise your hand if you think so. OK, just go. It hasn't been single-threaded for a huge while now. So Anna Emingsen presented the Node worker threads in 2018. And it's been stable since 2018, June, on Node 10. We are at 25 now with the worker threads module.

So folks, please. The thing is that this approach has a huge advantage because each thread has an independent event loop. So you can do things totally independently. But unlike other systems, you don't really have to worry, unless you really have to, about synchronization, shared access to stuff, and so forth. So it's very, very, very good. And it's very, very good also to offload some of the CPU-intensive load out of the main thread. As you know, Node is meant to be IO-intensive, not CPU-intensive. So if you do CPU-intensive stuff, you're killing your main thread, which often is your only thread, so you're done. You see the problem, right?

2. Scaling Node.js with Cluster Module

Short description:

How to scale Node.js in production and handle traffic spikes efficiently using the cluster module for intelligent routing and resource management.

Why do you care? Well, the thing is that, how do you scale Node.js in production? Who is actually serving your shining SSR application? And I don't care about the framework. SSR. Let's just talk about SSR. Who is serving your SSR? Node. How do you serve it in production? How do you scale it in production? Okay. Okay. Now I want to talk about a familiar story that we all have been seeing for the last 20 years, 30 years. I mean, at the end of the slide, I will ask you, who is familiar with this thing? We have a situation. You have a traffic spike. You have several pods on your Kubernetes cluster, right? Now the problem is that if you go on your Grafana dashboard, you will see that the pod from one to 10 are like at 30% and two other two pods are 100%. So the requests are actually blocked. Your error rate is scaling up at 8%. So what do you want to do usually? The only thing you can actually do is to over provision your cluster. So you add more resources. You add more resources so you can take new requests. At some point, those pods also get queued up and you're back to the original problem. In the meanwhile, you will be wasting a lot of money on that. Now if you think that this is only about provisioning, it's not just about provisioning. Because if you have a coordination between APIs or micro frontends or whatever you want, if you have 185 milliseconds delay on one API, on another API, on another API, is half a second delay for the user. You already lost a user. There is customer churn. Now, raise your hand if you're familiar with this situation, please. The rest of you are just liars for the record, because we know that. We know that you're familiar with this. We know. So how do we handle the scaling inside the node?

Since node 0.6, which is from 2011, and maybe some of you were not even born back then, it was added the cluster module. The cluster module basically is a very intelligent technique that basically says, I have a master process which will just take connection in and basically route throughout workers, using Unix sockets. It's very, very clever. It worked for several years. It's the basis of PM2, which is a familiar orchestrator for this kind of multi-instance applications.

QnA

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

It's a Jungle Out There: What's Really Going on Inside Your Node_Modules Folder
Node Congress 2022Node Congress 2022
26 min
It's a Jungle Out There: What's Really Going on Inside Your Node_Modules Folder
Top Content
The talk discusses the importance of supply chain security in the open source ecosystem, highlighting the risks of relying on open source code without proper code review. It explores the trend of supply chain attacks and the need for a new approach to detect and block malicious dependencies. The talk also introduces Socket, a tool that assesses the security of packages and provides automation and analysis to protect against malware and supply chain attacks. It emphasizes the need to prioritize security in software development and offers insights into potential solutions such as realms and Deno's command line flags.
ESM Loaders: Enhancing Module Loading in Node.js
JSNation 2023JSNation 2023
22 min
ESM Loaders: Enhancing Module Loading in Node.js
Top Content
ESM Loaders enhance module loading in Node.js by resolving URLs and reading files from the disk. Module loaders can override modules and change how they are found. Enhancing the loading phase involves loading directly from HTTP and loading TypeScript code without building it. The loader in the module URL handles URL resolution and uses fetch to fetch the source code. Loaders can be chained together to load from different sources, transform source code, and resolve URLs differently. The future of module loading enhancements is promising and simple to use.
Towards a Standard Library for JavaScript Runtimes
Node Congress 2022Node Congress 2022
34 min
Towards a Standard Library for JavaScript Runtimes
Top Content
There is a need for a standard library of APIs for JavaScript runtimes, as there are currently multiple ways to perform fundamental tasks like base64 encoding. JavaScript runtimes have historically lacked a standard library, causing friction and difficulty for developers. The idea of a small core has both benefits and drawbacks, with some runtimes abusing it to limit innovation. There is a misalignment between Node and web browsers in terms of functionality and API standards. The proposal is to involve browser developers in conversations about API standardization and to create a common standard library for JavaScript runtimes.
The State of Node.js 2025
JSNation 2025JSNation 2025
30 min
The State of Node.js 2025
The speaker covers a wide range of topics related to Node.js, including its resilience, popularity, and significance in the tech ecosystem. They discuss Node.js version support, organization activity, development updates, enhancements, and security updates. Node.js relies heavily on volunteers for governance and contribution. The speaker introduces an application server for Node.js enabling PHP integration. Insights are shared on Node.js downloads, infrastructure challenges, software maintenance, and the importance of update schedules for security.
Out of the Box Node.js Diagnostics
Node Congress 2022Node Congress 2022
34 min
Out of the Box Node.js Diagnostics
This talk covers various techniques for getting diagnostics information out of Node.js, including debugging with environment variables, handling warnings and deprecations, tracing uncaught exceptions and process exit, using the v8 inspector and dev tools, and generating diagnostic reports. The speaker also mentions areas for improvement in Node.js diagnostics and provides resources for learning and contributing. Additionally, the responsibilities of the Technical Steering Committee in the TS community are discussed.
Node.js Compatibility in Deno
Node Congress 2022Node Congress 2022
34 min
Node.js Compatibility in Deno
Deno aims to provide Node.js compatibility to make migration smoother and easier. While Deno can run apps and libraries offered for Node.js, not all are supported yet. There are trade-offs to consider, such as incompatible APIs and a less ideal developer experience. Deno is working on improving compatibility and the transition process. Efforts include porting Node.js modules, exploring a superset approach, and transparent package installation from npm.

Workshops on related topic

Building a RAG System in Node.js: Vector Databases, Embeddings & Chunking
Node Congress 2025Node Congress 2025
98 min
Building a RAG System in Node.js: Vector Databases, Embeddings & Chunking
Featured Workshop
Alex Korzhikov
Pavlik Kiselev
2 authors
Large Language Models (LLMs) are powerful, but they often lack real-time knowledge. Retrieval-Augmented Generation (RAG) bridges this gap by fetching relevant information from external sources before generating responses. In this workshop, we’ll explore how to build an efficient RAG pipeline in Node.js using RSS feeds as a data source. We’ll compare different vector databases (FAISS, pgvector, Elasticsearch), embedding methods, and testing strategies. We’ll also cover the crucial role of chunking—splitting and structuring data effectively for better retrieval performance.Prerequisites- Good understanding of JavaScript or TypeScript- Experience with Node.js and API development- Basic knowledge of databases and LLMs is helpful but not required
Agenda📢 Introduction to RAG💻 Demo - Example Application (RAG with RSS Feeds)📕 Vector Databases (FAISS, pgvector, Elasticsearch) & Embeddings🛠️ Chunking Strategies for Better Retrieval🔬 Testing & Evaluating RAG Pipelines (Precision, Recall, Performance)🏊‍♀️ Performance & Optimization Considerations🥟 Summary & Q&A
Node.js Masterclass
Node Congress 2023Node Congress 2023
109 min
Node.js Masterclass
Top Content
Workshop
Matteo Collina
Matteo Collina
Have you ever struggled with designing and structuring your Node.js applications? Building applications that are well organised, testable and extendable is not always easy. It can often turn out to be a lot more complicated than you expect it to be. In this live event Matteo will show you how he builds Node.js applications from scratch. You’ll learn how he approaches application design, and the philosophies that he applies to create modular, maintainable and effective applications.

Level: intermediate
Build and Deploy a Backend With Fastify & Platformatic
JSNation 2023JSNation 2023
104 min
Build and Deploy a Backend With Fastify & Platformatic
Top Content
WorkshopFree
Matteo Collina
Matteo Collina
Platformatic allows you to rapidly develop GraphQL and REST APIs with minimal effort. The best part is that it also allows you to unleash the full potential of Node.js and Fastify whenever you need to. You can fully customise a Platformatic application by writing your own additional features and plugins. In the workshop, we’ll cover both our Open Source modules and our Cloud offering:- Platformatic OSS (open-source software) — Tools and libraries for rapidly building robust applications with Node.js (https://oss.platformatic.dev/).- Platformatic Cloud (currently in beta) — Our hosting platform that includes features such as preview apps, built-in metrics and integration with your Git flow (https://platformatic.dev/). 
In this workshop you'll learn how to develop APIs with Fastify and deploy them to the Platformatic Cloud.
Building a Hyper Fast Web Server with Deno
JSNation Live 2021JSNation Live 2021
156 min
Building a Hyper Fast Web Server with Deno
Workshop
Matt Landers
Will Johnston
2 authors
Deno 1.9 introduced a new web server API that takes advantage of Hyper, a fast and correct HTTP implementation for Rust. Using this API instead of the std/http implementation increases performance and provides support for HTTP2. In this workshop, learn how to create a web server utilizing Hyper under the hood and boost the performance for your web apps.
0 to Auth in an Hour Using NodeJS SDK
Node Congress 2023Node Congress 2023
63 min
0 to Auth in an Hour Using NodeJS SDK
WorkshopFree
Asaf Shen
Asaf Shen
Passwordless authentication may seem complex, but it is simple to add it to any app using the right tool.
We will enhance a full-stack JS application (Node.JS backend + React frontend) to authenticate users with OAuth (social login) and One Time Passwords (email), including:- User authentication - Managing user interactions, returning session / refresh JWTs- Session management and validation - Storing the session for subsequent client requests, validating / refreshing sessions
At the end of the workshop, we will also touch on another approach to code authentication using frontend Descope Flows (drag-and-drop workflows), while keeping only session validation in the backend. With this, we will also show how easy it is to enable biometrics and other passwordless authentication methods.
Table of contents- A quick intro to core authentication concepts- Coding- Why passwordless matters
Prerequisites- IDE for your choice- Node 18 or higher
GraphQL - From Zero to Hero in 3 hours
React Summit 2022React Summit 2022
164 min
GraphQL - From Zero to Hero in 3 hours
Workshop
Pawel Sawicki
Pawel Sawicki
How to build a fullstack GraphQL application (Postgres + NestJs + React) in the shortest time possible.
All beginnings are hard. Even harder than choosing the technology is often developing a suitable architecture. Especially when it comes to GraphQL.
In this workshop, you will get a variety of best practices that you would normally have to work through over a number of projects - all in just three hours.
If you've always wanted to participate in a hackathon to get something up and running in the shortest amount of time - then take an active part in this workshop, and participate in the thought processes of the trainer.