Worker Threads in Node.js: Offloading CPU-Bound Work Without Blocking

Node.js has a single-threaded event loop, which is great for I/O-bound work and terrible for CPU-bound work. The moment you start doing image processing, cryptographic hashing, or PDF generation inside a request handler, every other request waits. Worker threads fix this — and they're more accessible than most people realize.

The event loop can only do one thing at a time. A 200ms CPU-bound operation doesn't just slow down one request — it delays every request queued behind it. At low traffic, this is invisible. Under load, it's catastrophic.