Book Image

Node.js High Performance

By : Diogo Resende
Book Image

Node.js High Performance

By: Diogo Resende

Overview of this book

Table of Contents (14 chapters)

Host limits


The place where you host your application—the server—has limits. There are two types of limits on the host: hardware and software. Hardware limits can be easy to spot. Your application might be consuming all of the memory and needing to consume disk to continue working. Adding more memory by upgrading your host, whether physical or virtual, seems to be the right choice.

For Node.js applications you also have a software memory limit imposed by V8, so don't forget about this when upgrading your memory banks. As a 32-bit environment has a limit of more or less 3.5 GB, I'm assuming that you're upgrading memory in a 64-bit environment. In this case, your application would be running by default at a 1 GB V8 limit. You then need to run your application with a higher limit by starting it in a way similar to the following command:

$ node --max_old_space_size 4000 application

This would run application.js with a 4 GB memory limit. This is actually not recommended. You have probably chosen...