Skip to content
/ throng Public
forked from hunterloftis/throng

A simple worker-manager for clustered apps

Notifications You must be signed in to change notification settings

fyockm/throng

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Throng

Dead-simple one-liner for clustered apps.

throng(start, { workers: 3 });

function start(id) {
  console.log(`Started worker ${id}`);

  process.on('SIGTERM', function() {
    console.log(`Worker ${id} exiting`);
    process.exit();
  });
}

Installation

npm install --save throng

Use

throng(startFunction, options);

All Options

throng(start, {
  workers: 4,       // Number of workers; defaults to CPU count
  lifetime: 10000,  // ms to keep cluster alive; defaults to Infinity
  grace: 4000       // ms grace period after worker SIGTERM; defaults to 5000
});

Tests

npm test

About

A simple worker-manager for clustered apps

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%