![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
cluster-magic
Advanced tools
run multi-threaded node.js network applications using the native cluster module
run multi-threaded node.js network applications using the native cluster module
sigterm
sighup
$ npm install cluster-magic --save
$ yarn add cluster-magic
A working snippet is available in the examples directory. Just run node examples/startup.js
File: startup.js
Initializes the cluster application
const _cluster = require('cluster-magic');
const _app = require('./application.js');
// start the clustered app (8 workers)
_cluster.init(_app, {
numWorkers: 8
});
File: application.js
Your socket based application which should be multiplexed
const net = require('net');
function startup(){
const server = net.createServer((socket) => {
// connections never end
});
server.listen(8000);
}
module.exports = {
// init hook
init: startup
};
To hot-restart (zero downtime) an application, just send a SIGHUP to the master process. This spawns new workers and disconnects all current workers from the cluster-proxy
Example
# send SIGHUP to process 12345
kill -HUP 12345
cluster-magic comes with as simple delayed-restart policy which suppresses infinite restart loops.
counter*200ms
to avoid infinite restart loops on internal application errors.
Well..this is may not what you expect from a "clustered application" but such an error requires that a manual fix will take place by the operations team (_logger.alert event is triggerd which SHOULD be observed)To specify the number of workers you can easily pass the environment variable NUM_WORKERS
to the nodejs process. Default is set to num_cpus*2
cluster-magic is OpenSource and licensed under the Terms of The MIT License (X11) - your're welcome to contribute
1.1.0 ###
FAQs
run multi-threaded node.js network applications using the native cluster module
The npm package cluster-magic receives a total of 5 weekly downloads. As such, cluster-magic popularity was classified as not popular.
We found that cluster-magic demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.