E
E
Evgeny Zalivadny2020-12-18 07:26:12
Node.js
Evgeny Zalivadny, 2020-12-18 07:26:12

How many requests per second can a Node.js application process on 1 core?

How many requests per second can a Node.js application process on 1 core?
How can this be simulated and calculated on your machine?

UPD: the question is primarily about a "minimally loaded", bare http server, without a database and a cache, giving, say, the string "hello world". And after that, about some average web application, an online store, for example, on Express + GraphQL + PostgreSQL + Redis ...

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladimir Korotenko, 2020-12-18
@firedragon

A strange question, but I will answer:
1. create a virtual machine that is as similar as possible to your environment at the host, for example 1 cpu + 512 gb ram
2. put the node that the host has
3. create an apache jmeter test script

Y
Yuriy Vorobyov, 2020-12-18
@YuriyVorobyov1333

Run the node via docker or via pm2 , knowingly highlighting one core in their configs, install and "click" on it via autocannon

docker config

FROM node:12-alpine

WORKDIR /app

COPY . .

RUN npm install

CMD ["npm", "start"]

запустить это так: docker run -it --cpus="1" имя_контейнера

pm2 config

Вроде нельзя нормально сэмулировать 1 cpu, поэтому здесь я попытался через кластер на 1 инстанс
module.exports = {
  apps: [
    {
      name: 'API',
      script: './bin/www',

      instances: 1,
      autorestart: true,
      exec_mode: 'cluster',
      max_memory_restart: '1G',
    },
  ],
};

R
Rerurk, 2020-12-18
@Rerurk

It's one thing to go to the toilet in a big way, another thing in a small one. It's one thing when a woman goes to the bathroom, another man

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question