concurrency-scalingAnswer last reviewed July 2026

When you send data between processes or worker threads in Node, what does that actually cost you?

Strong candidates know every message means serialize, copy, deserialize plus backpressure, and design protocols around ids and transfers, never big payloads.

What an AI-prepared candidate might say

So nothing travels by reference between processes or workers, it all gets copied. process.send to a child process serializes the message, JSON-style by default, or there's an advanced mode based on structured clone, and writes it over the IPC pipe. postMessage between worker threads structured-clones the value into the receiving thread. Plain data is fine either way, and structured clone also handles Buffers, Maps, Sets, circular references, that kind of thing. The cost grows with the message size, so big payloads get slow and memory-hungry. There are two escape hatches I know of. Transferables move ownership without copying, so an ArrayBuffer or a MessagePort listed in the transfer list detaches on the sender's side and reappears on the receiver's. And SharedArrayBuffer goes further, both sides read and write the same memory and nothing gets copied at all.

Senior
Locked

What each channel's pipeline actually does, JSON versus structured clone versus advanced serialization, where the copies land, and what a transfer list really moves.

Unlock the depth
Staff
Locked

Spotting serialization in a CPU profile, the protocol for when send starts returning false, and the redesigns that shrink messages by orders of magnitude.

Unlock the depth
Follow-up chain
When you send data between processes or worker threads in Node, what does that actually cost you? | NodeBook