irrelon-swarm

1.0.2 • Public • Published

Irrelon Swarm

A Node.js cluster manager allowing zero downtime reloads / deployments as well as some other advanced options.

When your application starts, Irrelon Swarm generates worker processes with the current application version (read from package.json).

Default Behaviour (Zero Downtime Deployments)

If the version in package.json updates to a newer version, the swarm arbiter reacts by forking new processes that are running the new version of your code and decommissions the old processes in a clean way that continues to serve any active connections until there are no more to serve, after which the old version processes will exit.

This allows you to deploy new versions of an application without impacting existing users who are already connected to your existing application endpoints so your application experiences zero downtime.

Advanced Behaviours

A/B Testing

The arbiter can be tasked with maintaining an even number of old and new version processes, splitting incoming connections between them. Over time you can determine the performance comparisons between the two versions.

Using the admin console you can ask the arbiter to roll back all processes to the old version or all processes can be upgraded to the new version.

If you do not intervene, the arbiter will allow new versions to be deployed but always keeping half of the processes one version behind the current.

Safe Deployment Mode

In safe mode the arbiter will respond to a new version by firing up a process for it while maintaining the current versions. Most of the swarm will therefore continue to operate the existing version but the one new process can be monitored and if it does not die within a set period of time (defaults to 30 mins or 1,000 requests handled but can be customised) the entire swarm will upgrade to the new version.

Install

npm i irrelon-swarm

Usage (Default Behaviour - Zero Downtime Deployments)

const swarm = require('irrelon-swarm');
swarm.start();

Usage (Advanced Behaviour - A/B Testing)

The arbiter can be tasked with maintaining an even number of old and new version processes, splitting incoming connections between them. Over time you can determine the performance comparisons between the two versions.

Using the admin console you can ask the arbiter to roll back all processes to the old version or all processes can be upgraded to the new version.

If you do not intervene, the arbiter will allow new versions to be deployed but always keeping half of the processes one version behind the current.

const swarm = require('irrelon-swarm');
swarm.start({
	abTest: true
});

Usage (Advanced Behaviour - Safe Deployment Mode)

In safe mode the arbiter will respond to a new version by firing up a process for it while maintaining the current versions. Most of the swarm will therefore continue to operate the existing version but the one new process can be monitored and if it does not die within a set period of time (defaults to 30 mins or 1,000 requests handled but can be customised) the entire swarm will upgrade to the new version.

const swarm = require('irrelon-swarm');
swarm.start({
	safeDeploy: true
});

Readme

Keywords

none

Package Sidebar

Install

npm i irrelon-swarm

Weekly Downloads

0

Version

1.0.2

License

ISC

Unpacked Size

32.8 kB

Total Files

12

Last publish

Collaborators

  • coolbloke1324