Swiftorial Logo
Home
Swift Lessons
AI Tools
Learn More
Career
Resources

Node.js FAQ: Top Questions

21. What is the cluster module in Node.js?

The cluster module in Node.js allows a single Node.js process to fork multiple worker processes, utilizing multiple CPU cores to handle concurrent requests.

Key points:

  • Primary/Workers: Primary process forks workers; each runs an instance of the app.
  • Load Balancing: Built-in round-robin distribution of incoming connections.
  • IPC: Workers communicate with the primary via inter-process communication.
  • Use Case: Scaling CPU-bound or high-traffic applications.