Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jclem/worker-monitor
monitor and kill Node workers
https://github.com/jclem/worker-monitor
Last synced: about 1 month ago
JSON representation
monitor and kill Node workers
- Host: GitHub
- URL: https://github.com/jclem/worker-monitor
- Owner: jclem
- License: mit
- Created: 2014-06-23T23:14:51.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-10-27T18:07:39.000Z (about 10 years ago)
- Last Synced: 2024-09-14T16:23:30.438Z (2 months ago)
- Language: JavaScript
- Homepage: https://npmjs.org/package/worker-monitor
- Size: 199 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# worker-monitor
A module for monitoring the memory usage of Node worker processes, and killing
them when they reach a specified limit. This module is designed to be used in
conjunction with [clusterflock](https://github.com/jclem/clusterflock).## Usage
Simply require and call `worker-monitor` for it to begin monitoring worker
processes:```javascript
if (require('cluster').isWorker) {
require('worker-monitor')();
}
```### Options
The `worker-monitor` function accepts a few options:
- `disconnectTimeout` (Default: `5000`) The time after which a disconnecting
worker will be immediately killed if it has failed to disconnect.
- `logPeriod` (Default: `10000`) The frequency with with a worker's memory usage
will be logged.
- `monitorPeriod` (Default: `5000`) The frequency with with a worker's memory
is monitored. This is when the worker will be killed if it exceeds
`memoryLimit`.
- `memoryLimit` (Default: `220000000`) The limit (in bytes) that a worker's RSS
may be.For example:
```javascript
require('worker-monitor')({
disconnectTimeout: 10000,
logPeriod : 5000
});
```## Thanks, Heroku
While I created and maintain this project, it was done while I was an employee
of [Heroku][heroku] on the Human Interfaces Team, and they were kind enough to
allow me to open source the work. Heroku is awesome.[heroku]: https://www.heroku.com/home