# Multi-thread vs Multi-processing in Nodejs ### Summary | | Multi-thread | Multi-processing | | -------------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------- | | Implementation | `worker-threads` | `cluster`, `child-process` | | Communication | Messages, SharedArrayBuffer | Messages | | Synchronization | Atomics | - | | Prometheus metrics | Need to manually deliver metrics to the main thread | Need another HTTP server and metrics endpoint for process | | Data transfer (JSON) | 1) Structured clone serialization <br>2) Transfer data via messages or via shared buffer | 1) Structured clone serialization <br>2) Transfer data via messages | | Data transfer (Any) | 1) Need custom Serializer <br>2) Transfer data via messages or via shared buffer | 1) Need custom Serializer <br>2) Transfer data via messages | ### Multi-thread Node.js page [worker threads](https://nodejs.org/api/worker_threads.html) #### Multi-processing Node.js page [child_process](https://nodejs.org/api/child_process.html) Node.js page [cluster](https://nodejs.org/api/cluster.html)