Skip to content

Instantly share code, notes, and snippets.

View tarekahsan709's full-sized avatar
:octocat:

Tarek Ahsan tarekahsan709

:octocat:
View GitHub Profile
@tarekahsan709
tarekahsan709 / cluster.md
Created October 5, 2017 11:26 — forked from learncodeacademy/cluster.md
Node Cluster - Enhance your node app by using all the cores of your processor.

Here's all you have to do to add clustering to your node.js application.

  • save this code as cluster.js, and run cluster.js instead of server.js (or /bin/www, or whatever it's called for your project)
  • the only line you'll need to change is the last line - it needs to point to the location of your server.js file
var cluster = require('cluster');

if (cluster.isMaster) {
  // Count the machine's CPUs
 var cpuCount = require('os').cpus().length;
AngularJS Back To Top Directive.
Uses AngularJS, jQuery, Font Awesome, and SCSS.