Git Product home page Git Product logo

node.js-cluster's Introduction

Node.js Cluster Project

This Node.js Cluster project is designed to demonstrate the use of the cluster module to create a multiprocessor Node.js application for better utilization of CPU cores. The project includes a simple Express application in app.js and a clustering logic in cluster.js.

Requirements

Before running the application, ensure you have the following installed:

  • Node.js (version 14.0.0 or higher)
  • npm (Node Package Manager)

Project Structure

  • app.js: Contains the main Express application logic.
  • cluster.js: Manages the creation of multiple worker processes using the cluster module.
  • package.json: Project configuration file with dependencies and start script.

How to Run

  1. Clone the repository:

    git clone https://github.com/saeedNW/node.js-cluster.git
  2. Navigate to the project directory:

    cd node.js-cluster
  3. Install dependencies:

    npm install
  4. Start the application:

    npm start

    This will launch the application and utilize multiple CPU cores via the cluster module.

Load Testing with loadtest

To test the application's performance, you can use the loadtest module. Follow these steps:

  1. Install loadtest globally:

    npm install -g loadtest
  2. Run the load test:

    loadtest -c 10 -t 10 -n 100 http://localhost:3000/cluster

    This command will simulate 10 clients (-c) making requests for 10 seconds (-t) with a total of 100 requests (-n) to the specified endpoint. Adjust the parameters as needed for your testing requirements.

node.js-cluster's People

Contributors

saeednw avatar

Stargazers

MoHoDarabi  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.