Hello, I'm Jonathan.
π¨βπ» I'm an engineer, formerly at @github, @dropbox, @usecanvas, @heroku. Next, something new.
π My pronouns are βheβ/βhimβ.
π¬ You can reach me by emailing me.
a clustering server for node that speaks in signals
Home Page: npmjs.org/package/clusterflock
License: MIT License
Hello, I'm Jonathan.
π¨βπ» I'm an engineer, formerly at @github, @dropbox, @usecanvas, @heroku. Next, something new.
π My pronouns are βheβ/βhimβ.
π¬ You can reach me by emailing me.
I run an express app with clusterflock like so:
$ node server.js
ns=clusterflock pid=4635 type=master evt="starting master"
ns=clusterflock pid=4637 type=worker evt="starting worker"
ns=clusterflock pid=4635 type=master evt="clusterflock is listening on port 5000"
ns=clusterflock pid=4636 type=worker evt="starting worker"
ns=clusterflock pid=4638 type=worker evt="starting worker"
ns=clusterflock pid=4639 type=worker evt="starting worker"
The processes look like this:
$ ps
PID TTY TIME CMD
467 ttys000 0:00.85 -bash
4635 ttys000 0:00.24 node server.js
4636 ttys000 0:00.38 /usr/local/bin/node /path/to/server.js
4637 ttys000 0:00.38 /usr/local/bin/node /path/to/server.js
4638 ttys000 0:00.38 /usr/local/bin/node /path/to/server.js
4639 ttys000 0:00.39 /usr/local/bin/node /path/to/server.js
Now I send SIGTERM to the master:
$ kill -s SIGTERM 4635
and I get this in the console output:
ns=clusterflock pid=4635 type=master evt="received SIGTERM, sending myself SIGQUIT"
ns=clusterflock pid=4635 type=master evt="received SIGQUIT, attempting graceful shutdown"
ns=clusterflock pid=4635 type=master evt="worker (pid 4636) disconnected"
ns=clusterflock pid=4635 type=master evt="worker (pid 4637) disconnected"
ns=clusterflock pid=4635 type=master evt="worker (pid 4638) disconnected"
ns=clusterflock pid=4635 type=master evt="all workers disconnected"
ns=clusterflock pid=4635 type=master evt="worker (pid 4639) disconnected"
ns=clusterflock pid=4635 type=master evt="timeout exceeded, forcing shutdown"
ns=clusterflock pid=4635 type=master evt="received SIGTERM, ignoring (already shutting down)"
ns=clusterflock pid=4638 type=worker evt="ignoring SIGTERM, waiting for master to disconnect"
ns=clusterflock pid=4637 type=worker evt="ignoring SIGTERM, waiting for master to disconnect"
ns=clusterflock pid=4636 type=worker evt="ignoring SIGTERM, waiting for master to disconnect"
ns=clusterflock pid=4639 type=worker evt="ignoring SIGTERM, waiting for master to disconnect"
all processes are still running:
$ ps
PID TTY TIME CMD
467 ttys000 0:00.85 -bash
4635 ttys000 0:00.24 node server.js
4636 ttys000 0:00.39 /usr/local/bin/node /path/to/server.js
4637 ttys000 0:00.38 /usr/local/bin/node /path/to/server.js
4638 ttys000 0:00.38 /usr/local/bin/node /path/to/server.js
4639 ttys000 0:00.39 /usr/local/bin/node /path/to/server.js
It would be nice if this could be used for more than just http
servers. Maybe the interface could be passed in as an option and default to http
if not set:
var interface = options.interface ? options.interface : http;
interface.createServer(handler);
interface.listen(options.port);
It would also need to support interface specific options such as certs/keys for https
. Thoughts?
(Edit: maybe not interface
as that's a reserved word, but you get the idea.)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.