Browse Prior Art Database

A new methodology for the nodejs performance optimization on Multi-core system

IP.com Disclosure Number: IPCOM000240166D
Publication Date: 2015-Jan-08
Document File: 3 page(s) / 117K

Publishing Venue

The IP.com Prior Art Database

Abstract

Nodejs is a single thread platform, it is mainly working as async processing, but in some situation, especially in multi-core cpu system, it is always can not works as good as the single-core cpu system. This disclosure is focus on distribute the nodejs main event loop in main single thread into different cpu-core to handle the process, then aggregate the result in certain condition in order to make full use of all the cpu core, to make the nodejs works as fast as possible inside multi-core cpu system.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 81% of the total text.

Page 01 of 3

A new methodology for the nodejs performance optimization on Multi

A new methodology for the nodejs performance optimization on Multi-

--core system

core system

As nodejs is focus on asynchronous processing, it is fully make use of the CPU resource in single thread without any thread switch wasting, but when in the popular multi-core system, it is always rely on one single core, so tohave a mechanism which can take full advantage of the multi-core system in nodejs is really important.

This disclosure describes a new

mechanism

to optimize the nodejs processing behavior on multi-core system. It includes thread

split and re-combine.

The main claim points of this disclosure is:

1> node internal component for its single thread process split into different CPU core 2> node internal component for aggregate the splitted process result automatically

The advantages of this disclosure is:

1> take the full advantage of the multi-core processors

2> aggregate the result automatically without any developer's effort

Detail description


1. Architect

- setup the event loop pool

- split the Queue into different core processor

- aggregate the parallel result if necessary

1


Page 02 of 3

2


Page 03 of 3


2. Processor core split and aggregation

- set the thread affinity to bind the thread or process to corresponding processor core

- distribute the REQ thread to different core:

#include

#include

void setThreadToCPU(int _cpuID) {

cpu_set_t mask;

cpu_set_t get;

CPU_ZERO(&mask);

CPU_SET(_cpuID, &mask);...