Skip to content

aslipchenk/Node.Js-Clusterization

Repository files navigation

Node.Js-Clusterization

Description

This is a simple application where you can add images from your local storage. In this application i specially add big for loop cycle in order to see how clusterization works in Node.Js.

Usage

Clone repository, run in terminall node index.js and open http://localhost:3000, add image click upload, if you want to see image in full screen you can link http://localhost:3000/show. In order to see how clusterization works you need to install autocannon:

npm i autocannon -g

Autocannon its a simple application that can send requests on you server. You can use it to write:

autocannon -d 10 -c 200 localhost:3000

Where -d - time in seconds, -c - value of connects to your server.

Tests

When you run node index.js

Снимок экрана 2021-01-10 в 21 46 15

When you run node cluster.js

Снимок экрана 2021-01-10 в 21 47 02

I make many tests and if we have high loaded server with many process clusterization is a good solution for us. But sometimes one main thread its better if we has a simple application you can delete for loop cycle in file server.js and run tests again. You will see that server with cluster little bit slower then one thread server.

Also i add restarting worker if we had some errors.

Снимок экрана 2021-01-10 в 21 48 03

Run command kill (value of PID)

Снимок экрана 2021-01-10 в 21 48 53

Thanks

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published