NodeJS - express server, pm2 cluser and nginx balancing - multiple threads NodeJS - express server, pm2 cluser and nginx balancing - multiple threads nginx nginx

NodeJS - express server, pm2 cluser and nginx balancing - multiple threads


It turns out that everything works just great.Problem was in the browser. When browser send the same http get requests they are queued. To change that i had to change invocation:

const els = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];const promises = els.map(() => axios.get("http://my_server_with_nginx:8000"));

to this:

const els = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];const promises = els.map((el) => axios.get(`http://my_server_with_nginx:8000?number=${el}`));


Are you sure that the requests are really on all cores? I mean to test this you will need to use a synchronous function. If you use async methods, the requests will be still accomplished asynchronously even on one thread.