Book Image

Node Web Development - Second Edition

By : David Herron
Book Image

Node Web Development - Second Edition

By: David Herron

Overview of this book

Table of Contents (17 chapters)
Node Web Development Second Edition
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
Index

Scaling to use all cores on multi-core servers


The next phase of deploying an application for production use is ensuring that you're fully utilizing the system resources available to you, and ensuring that the service can scale to meet traffic requirements.

V8 is a single thread JavaScript engine. This is good enough for the Chrome browser but it means a Node-based server on that shiny new 16 core server will have 1 CPU core going flat out, and 15 CPU cores sitting idle. Your manager may want an explanation for this.

A single thread process will only use one core. That's a fact of life. Using multiple cores in a single process requires multi-threaded software. But Node's no threads design paradigm, while keeping the programming model simple, also means that Node does not make use of multiple cores. What are you to do? Or more important, how are you to keep your manager happy?

The general technique is to share out incoming requests to several processes, or threads, depending on application server...