Skip to content
Learn Netverks

Lesson

Step 32/36 89% through track

performance-mindset

Performance mindset

Last reviewed May 28, 2026 Content v20260528
Track mode
nodejs_server
Means
Node sandbox
Reading
~1 min
Level
advanced

This lesson

This lesson teaches Performance mindset: the syntax, APIs, and habits you need before advancing in Node.js.

The ORM is Django’s core productivity lever—N+1 queries and migration mistakes show up in every senior review.

You will apply Performance mindset in contexts like: REST/GraphQL APIs, BFF layers, CLIs, webhooks, and real-time services (with WebSockets).

Run JavaScript on the Node runner when configured—never mix arbitrary shell commands in lessons.

When functions, arrays, and basic OOP from intermediate lessons are familiar.

Node performance starts with measurement—profile before micro-optimizing. Most APIs are I/O-bound; fix N+1 queries and blocking code before tuning V8 flags.

Common bottlenecks

  • Synchronous fs/crypto on hot paths
  • Unbounded in-memory caches
  • Missing DB indexes and N+1 ORM queries
  • Huge JSON payloads without pagination
  • Logging every request body at info level

Tools

  • node --prof / clinic.js — CPU profiling
  • load testing — k6, autocannon
  • APM — Datadog, New Relic, OpenTelemetry traces

Scaling strategies

Vertical scale (bigger machine), horizontal scale (multiple instances behind load balancer), caching (Redis), and async job queues for slow work.

Important interview questions and answers

  1. Q: When add worker threads?
    A: CPU-heavy work blocking the event loop—image resize, bcrypt at high cost factor, large sync crypto.
  2. Q: Is Node slow?
    A: Wrong question—is it appropriate? I/O-heavy APIs often excel; CPU-heavy batch jobs may not.

Self-check

  1. Why measure before optimizing?
  2. What is an N+1 query problem?

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs on the configured server runner (dev: npm run runner with LEARNING_RUNNER_ENABLED=true). Output appears below the editor.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • Cluster mode when?
  • Memory leak symptom?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump