Skip to content

Instantly share code, notes, and snippets.

View KevinVR's full-sized avatar
💻
Always Coding

Kevin Van Ryckegem KevinVR

💻
Always Coding
View GitHub Profile
@robinglen
robinglen / hello-world-node-fastify-clustered.js
Created September 16, 2018 16:34
Simple hello world in Node, using Fastify and clustering for Medium post
const cluster = require('cluster');
const numCPUs = require('os').cpus().length;
const fastify = require('fastify')();
const port = 8123;
if (cluster.isMaster) {
console.log(`Master ${process.pid} is running`);
for (let i = 0; i < numCPUs; i++) {
cluster.fork();
}