Node/Adonis CPU on VPS


I’ve read some stuff about Node not using more then one tread/core on a CPU, is that correct and does this mean that it is no use choosing a VPS with more then one core?


Yes it runs on one core by default, you can run a cluster of server ( only if you need it )


so i don’t need more than 1 CPU core on my VPS?

How about memory?

I will run about 5 Adonis sites with low traffic.


Every node/adonis instance will have an own process. 5 adonis sites could run with 5 processes on a singe core or spread over multiple cores if available.

For 5 Adonis sites with low traffic 1 CPU core should be more than enough, but this highly depends on CPU performance, traffic, other processes like databases, …


PM2 (process-manager for Node) can utilize more than one core for your apps.


@virk how would one properly cluster an adonis instance across multiple cores without using something like PM2? I’m using the legacy adonis version as an HTTP REST API.


Using the Nodejs inbuilt cluster module. Just read the node.js official docs for cluster and code will go in server.js file


@hashbang, if you solve this please share the server.js code.

Thank you.

'use strict'

| Http Server
| Here we boot the HTTP Server by calling the exported method. A callback
| function is optionally passed which is executed, once the HTTP server
| is running.
const cluster = require('cluster')
const numCPUs = require('os').cpus().length

const http = require('./bootstrap/http')

if (cluster.isMaster) {
  console.log(`Master ${} is running`)

  // Fork workers.
  for (let i = 0; i < numCPUs; i++) {

  cluster.on('exit', (worker, code, signal) => {
    console.log(`worker ${} died`)

    console.log('Starting a new worker')

} else {

  // In this case it is an HTTP server
  http(function () {

  console.log(`Worker ${} started`)


Thank you so much. I use Adonuxt, any chance someone knows how to apply the code above in this server.js?

'use strict'

| Http server
| This file bootstrap Adonisjs to start the HTTP server. You are free to
| customize the process of booting the http server.
| """ Loading ace commands """
|     At times you may want to load ace commands when starting the HTTP server.
|     Same can be done by chaining `loadCommands()` method after
| """ Preloading files """
|     Also you can preload files by calling `preLoad('path/to/file')` method.
|     Make sure to pass relative path from the project root.

const { Ignitor } = require('@adonisjs/ignitor')

new Ignitor(require('@adonisjs/fold'))
  .then(() => {
    return use('App/Services/Nuxt').build()
  .then(() => {
    use('Logger').info('Nuxt is ready to handle requests')


Hey Peter, add .preLoad(‘start/your_file.js’) juste after .fireHttpServer()