<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/a-simple-example-for-nodejs-multiprocessing--6o5r709e" -->

---
title: A simple example for NodeJS multiprocessing | daily.dev
description: The cluster module allows you to easily create a network of processes that all share server ports. While this is perfectly good code, it will run on only 1...
canonical: https://daily.dev/posts/a-simple-example-for-nodejs-multiprocessing--6o5r709e
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: A simple example for NodeJS multiprocessing | daily.dev
og:description: The cluster module allows you to easily create a network of processes that all share server ports. While this is perfectly good code, it will run on only 1...
og:url: https://daily.dev/posts/a-simple-example-for-nodejs-multiprocessing--6o5r709e
og:image: https://api.daily.dev/og/posts/_6O5r709E.png
og:image:alt: A simple example for NodeJS multiprocessing
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# A simple example for NodeJS multiprocessing

**[Towards Dev](https://daily.dev/sources/towardsdev)** · 3 min read · 40 upvotes · 1 comments

## Summary

The cluster module allows you to easily create a network of processes that all share server ports. While this is perfectly good code, it will run on only 1 core of your most probably multicore environment. So what we can improve is to take advantage of the cluster module and fork our process to increase the software throughput.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://towardsdev.com/a-simple-example-for-nodejs-multiprocessing-9f90abf96e3?source=rss----a648dc4ecb66---4>

## Community discussion

Top comments from developers on daily.dev.

**@devvsakib** · 1 upvotes

> great

---

Tags: [#nodejs](https://daily.dev/tags/nodejs), [#rest-api](https://daily.dev/tags/rest-api)

[View this post on daily.dev](https://daily.dev/posts/a-simple-example-for-nodejs-multiprocessing--6o5r709e)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"A simple example for NodeJS multiprocessing","url":"https://daily.dev/posts/a-simple-example-for-nodejs-multiprocessing--6o5r709e","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/a-simple-example-for-nodejs-multiprocessing--6o5r709e"},"datePublished":"2022-09-20T09:39:58.606Z","dateModified":"2022-09-20T09:39:58.605Z","description":"The cluster module allows you to easily create a network of processes that all share server ports. While this is perfectly good code, it will run on only 1...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/4d2ff950ab60cf4755a1f89a01837eac","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/4d2ff950ab60cf4755a1f89a01837eac","isAccessibleForFree":true,"articleSection":"Towards Dev","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Towards Dev","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/2c710db2750a4a70835862534cb7c9d4","url":"https://daily.dev/sources/towardsdev"},"commentCount":1,"discussionUrl":"https://daily.dev/posts/a-simple-example-for-nodejs-multiprocessing--6o5r709e","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":40},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":1}],"keywords":"nodejs,rest-api","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Towards Dev","item":"https://daily.dev/sources/towardsdev"},{"@type":"ListItem","position":3,"name":"A simple example for NodeJS multiprocessing"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/a-simple-example-for-nodejs-multiprocessing--6o5r709e","comment":[{"@type":"Comment","text":"great","datePublished":"2022-09-22T08:51:48.742Z","url":"https://daily.dev/posts/_6O5r709E#c-uO84ZV3uA","author":{"@type":"Person","name":"Sakib Ahmed","url":"https://daily.dev/devvsakib","image":"https://avatars.githubusercontent.com/u/88339569?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}}]}
```

