Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rricard/sspawn
DEPRECATED: fault-tolerant is a big word, I should keep quiet sometimes. It failed me many times in prod, use an init system, it's better.
https://github.com/rricard/sspawn
Last synced: about 14 hours ago
JSON representation
DEPRECATED: fault-tolerant is a big word, I should keep quiet sometimes. It failed me many times in prod, use an init system, it's better.
- Host: GitHub
- URL: https://github.com/rricard/sspawn
- Owner: rricard
- License: mit
- Created: 2013-09-11T09:21:30.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2013-09-11T14:54:45.000Z (about 11 years ago)
- Last Synced: 2024-10-12T05:45:30.363Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 156 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
sspawn
======Simple and fault-tolerant server spawner for Node.js
What ?
------sspawn uses node's cluster library to create forked processes of your application. When an error occurs, well, it's catched in a domain. Basically, your worker will crash but it will be recreated in seconds while the others continues processing requests.
So when uncatched and critical errors occurs, your node server continues working.
There's also a slight performance boost. Two synchronous tasks can run in parallel now. It's like a super-lightweight unicorn-like server for node.
Installation
------------`npm install sspawn`
Usage
-----```javascript
// Given a server (node http module, express, restify, ...)
var server = ...;// Require sspawn to create a Spawner instance, pass it the server, the port and the options
var spawner = require(server, 8000);// Spawn !
spawner.start();
```Documentation
-------------### `require('sspawn')(server)`
Create a spawner based on a server on port 8000 and logging to console
### `require('sspawn')(server, port)`
Pass a port
### `require('sspawn')(server, port, options)`
Add one of those options:
* `logger` Your logger (ex: console or winston)
* `port` The port, again
* `workers` How many workers do you want to spawn ?### `require('sspawn')(server, options)`
Pass directly the options
### `.start()`
Start the spawner