NOTE
StrongLoop Arc and slc are no longer under active development, and will soon be deprecated. Arc's features are being included in the IBM API Connect Developer Toolkit: Please use it instead.
Skip to end of metadata
Go to start of metadata

Overview

To take advantage of multi-core systems, you can run Node applications as a cluster of worker processes (workers), all receiving requests on the same port.  

When StrongLoop Process Manager (PM) runs an application, it automatically runs it in a cluster with a number of workers equal to the number of CPU cores on the system.  When you deploy an application with Arc, you can run the application in a multi-process cluster: simply enter the number of processes to run in the Build & Deploy module.  See Building and deploying with Arc for details.

If any one process in a cluster is terminated or dies due to application error, StrongLoop Process Manager automatically starts up another process and attaches it to the cluster without having to restart the application, thus providing zero application downtime.  If you inadvertently push a faulty deployment to a cluster, StrongLoop PM ensures rolling restarts: If the first process being restarted crashes, then the deployment is not pushed out to the remaining processes in the cluster.

You can control an application cluster running under the control of StrongLoop PM with  the slc ctl command, with the following sub-commands:

  • status (the default sub-command): Report the status of the cluster workers.
  • set-size: Set cluster size to the specified number of workers.
  • restart: Restart all worker processes.
  • stop: Shutdown all worker processes and stop the cluster controller.

For example, this command sets the cluster size for a service named my-app to four processes:

See slc ctl for complete documentation. 

Viewing cluster status

Use the default status command to view the status of application workers:

The command shows the process ID of the master (supervisor) process, the number of workers, and the workers' process IDs.

Resizing clusters at runtime

The slc ctl command enables you to resize a cluster at runtime with the set-size subcommand.

If your Node instances are under-utilized, and having fewer workers makes sense, set the size of the worker pool lower without taking your application down. Or, if your Node instances are 100% CPU-bound and you have free CPUs, increase the number of workers.