3.0.0 • Published 5 years ago

@fibjs/cluster-server v3.0.0

Weekly downloads
7
License
MIT
Repository
github
Last release
5 years ago

@fibjs/cluster-server

NPM version build status appveyor build status Test coverage David deps Known Vulnerabilities npm download

Start a multi-thread server to take advantage of multi-core systems.

Install

$ npm i @fibjs/cluster-server --save

Usage

server.js :

const Cluster = require('@fibjs/cluster-server');
const path = require('path');

const server = new Cluster({
  port: 8000,// server port,default to 8000
  worker: path.join(__dirname, 'worker.js'), // full path to worker 
  numbers: 4,// default to cpu numbers
});

server.run(); // start server asynchronously
// server.close(); // close server

worker.js :

module.exports = req => {
  req.response.write('Hello, World!');
};

then you can start server:

  fibjs server.js

worker.js

We can export any handler described at http://fibjs.org/docs/manual/module/ifs/mq.md.html#Handler.

Questions & Suggestions

Please open an issue here.

License

MIT

3.0.0

5 years ago

2.0.3

5 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago