Node.js / NestJS

Performance & Cloud Deployment

Event loop, blocking I/O, profiling, memory leaks, query optimization, compression, clustering, worker threads, load balancing, strategic caching (Redis + HTTP), AWS (ECS, Lambda), serverless, deployment strategies (blue/green, canary)

30 câu hỏi phỏng vấn·
Senior
1

Which approach optimizes NestJS container deployment in AWS ECS?

Câu trả lời

To optimize ECS deployment of NestJS containers: use multi-stage Docker builds to reduce final image size (build stage + minimal production stage), leverage Docker layer caching to accelerate builds, use ECR (Elastic Container Registry) in same region to reduce latency, configure appropriate health checks, use Fargate to simplify management, define optimal resource limits (CPU/memory), implement graceful shutdown for SIGTERM. An optimized Node.js alpine image can be <100MB vs >1GB unoptimized.

2

What are the main phases of the Node.js event loop?

Câu trả lời

The Node.js event loop has six main phases: timers (setTimeout/setInterval), pending callbacks (deferred I/O callbacks), idle/prepare (internal), poll (retrieve new I/O events), check (setImmediate), and close callbacks. Each phase has a FIFO queue of callbacks to execute. The poll phase is most important as it handles I/O events.

3

What is the impact of a blocking operation (blocking I/O) in Node.js?

Câu trả lời

A blocking operation in Node.js blocks the entire event loop, preventing all other operations from being processed. This severely degrades performance since Node.js is single-threaded. Synchronous operations like fs.readFileSync, crypto.pbkdf2Sync, or intensive loops block the main thread. Always use asynchronous versions or delegate to worker threads.

4

How to identify a memory leak in a Node.js production application?

5

Which tool to use for CPU performance profiling in a NestJS application?

+27 câu hỏi phỏng vấn

Nắm vững Node.js / NestJS cho lần phỏng vấn tiếp theo

Truy cập tất cả câu hỏi, flashcards, bài kiểm tra kỹ thuật, bài tập code review và mô phỏng phỏng vấn.

Bắt đầu miễn phí