performance-observabilityAnswer last reviewed July 2026

How would you figure out how many instances a Node service actually needs? And when do you add instances versus just making the code faster?

A strong answer builds capacity from measured per-core throughput and makes the scale-out versus optimize call from where the bottleneck actually sits

What an AI-prepared candidate might say

Start by measuring what one instance can handle. A Node process runs your JavaScript on one thread, so one process uses roughly one CPU core for request work, and on a multi-core machine you run several processes with the cluster module, or several containers, to cover all the cores. Then you load test one instance to find how many requests per second it sustains inside your latency target. Divide expected peak traffic by that number, add some safety margin, and that's your instance count. You monitor CPU, event-loop lag, and latency so you know when you're near capacity. Whether to scale out or optimize depends on the bottleneck, I'd say. If CPU is spread across lots of requests, more instances help. If it's a single slow function or a blocked event loop, fixing the code is better. And scaling out costs money continuously while optimizing is a one-time effort, so you weigh those.

Senior
Locked

Why one Node process means one core for your JavaScript, how you actually measure requests-per-core, and what really caps a single instance's throughput.

Unlock the depth
Staff
Locked

How to plan capacity from measured headroom plus a safety margin, decide scale-out versus optimize by where the bottleneck lives, and spot the case where more instances make it worse.

Unlock the depth
Follow-up chain
How would you figure out how many instances a Node service actually needs? And when do you add instances versus just making the code faster? | NodeBook