Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save wamatt/efdb31566134538fb7d9 to your computer and use it in GitHub Desktop.
Save wamatt/efdb31566134538fb7d9 to your computer and use it in GitHub Desktop.

Clustering: The basics

The trick? pass the file descriptor from a parent process and have the server.listen reuse that descriptor. So multiprocess in their own memory space (but with ENV shared usually)

It does not balance, it leaves it to the kernel.

In the last nodejs > 0.8 there is a cluster module (functional although marked experimental)

Note: not yet found a 100% reason to favor multi process/cluster nodejs over nginx/haproxy stuff:

Domains: keep it up , just a little bit longer

Current Cluster/Domain Enhancements:

The core included module is basic, it tells you to take care of all the stuff you need in zerodowntime environments. Most of the tools below allow you to:

  • wait for workers to correctly close or sigKill if past timeout
  • sigUSR2 to reload workers one by one
  • some provide a cli to do the work using a socket/network connection
  • kill a worker that has become unresponsive by waiting for a heartbeat
  • put itself offline and not accepting any new requests
  • Framework in use at ebay:

  • Good: complete with monitoring, control URL

  • Bad: Seems to be massive ...

Note: naught2 was a temporary fork, but it got merged into master again

talks about Zero Downtime Crashed by intelligently handling express errors with domains

  • Build by nodejs god @isaacs
  • To be investigated

Others to check:

Fleet: Extending the easy Git -> deploy

Not related, but also cool: EC2-fleet https://github.com/ashtuchkin/ec2-fleet

Older solutions:

(+2 years no updated & probably not nodejs > 0.8 compliant) So you can safely ignore these, but they can give inspiration

Worth mentioning:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment