@semantu/multicore
v1.0.2
Published
To use multi core add this to lincd.config.js
Maintainers
Readme
To use multi core add this to lincd.config.js
exports.default = {
// ...
multiCore: true,
};Start your server with something like this:
node ./node_modules/@semantu/cli/lib/start.js --env production -- --max-old-space-size=8192And set up NGINX to route traffic to multiple Node.js processes with sticky sessions. PrimaryServer will automatically generate ports from the basic env.PORT variable. And increase each worker by 1. Here is an example where the primary server receives env.PORT = 4000 and the workers will be on ports 4001, 4002, and 4003.
The number of workers can be specified with process.env.NUM_WORKER_PROCESSES. If undefined, it defaults to the number of cores on the machine.
The nginx config needs to match whatever number of workers you have set.
upstream peacegame_backend {
ip_hash;
server 127.0.0.1:4001;
server 127.0.0.1:4002;
server 127.0.0.1:4003;
}
server {
listen 4000;
location / {
proxy_pass http://peacegame_backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}