https://github.com/ericclemmons/start-cluster
Start a Node cluster by simply running `start-cluster`
https://github.com/ericclemmons/start-cluster
Last synced: about 1 month ago
JSON representation
Start a Node cluster by simply running `start-cluster`
- Host: GitHub
- URL: https://github.com/ericclemmons/start-cluster
- Owner: ericclemmons
- License: mit
- Created: 2015-12-20T01:28:00.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-12-22T16:15:03.000Z (over 9 years ago)
- Last Synced: 2025-03-10T19:03:22.185Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 8.79 KB
- Stars: 11
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `start-cluster`
> Start a Node cluster by simply running `start-cluster`.
[](https://travis-ci.org/ericclemmons/start-cluster)
[](https://codecov.io/github/ericclemmons/start-cluster)
[](http://npm.im/start-cluster)
[](http://npm-stat.com/charts.html?package=start-cluster)
[](http://opensource.org/licenses/MIT)
[](https://github.com/semantic-release/semantic-release)
[](http://commitizen.github.io/cz-cli/)- - -
By default, `npm start` runs your application as a single instance via `node server.js`.
On production, **it's best to run multiple instances** (i.e. an instance per CPU core) so that, when the application crashes or throws exceptions, other instances can field subsequent requests while the erroneous one restarts.
Otherwise, **requests will fail until `server.listen()` is executed**. For sufficiently large applications with several dependencies, **this can potentially be seconds**.
### Usage
#### 1. Install
```shell
$ npm install start-cluster --save
```#### 2. Add to `package.json`
```json
{
"scripts": {
"start": "start-cluster"
}
}
```#### 3. Customize
If your server script is located elsewhere:
```json
{
"scripts": {
"start": "start-cluster src/server.min.js"
}
}
```### License
> MIT License 2015 © Eric Clemmons