Node.js / NestJS

Microservices

Monolith vs modular monolith vs microservices, message patterns, transporters (TCP, Redis, NATS, RabbitMQ, Kafka), communication (sync/async, event-driven), CQRS, event sourcing, client/server

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

What is a modular monolith?

Câu trả lời

A modular monolith is an application deployed as a single unit but structured into strongly decoupled modules with clear boundaries. Unlike a classic monolith where everything is mixed, the modular monolith organizes code into independent modules that communicate via well-defined interfaces. This approach combines monolith simplicity (single deployment, simple ACID transactions) with microservices maintainability (separation of concerns, clear boundaries).

2

What is the main difference between a monolith and microservices?

Câu trả lời

The main difference lies in deployment and independence: a monolith is deployed as a single unit where all components share the same process and database, while microservices are independent services deployed separately with their own databases. Monoliths offer simplicity and easy ACID transactions but face scalability and maintenance issues at scale. Microservices enable independent scaling and autonomous deployments but introduce distributed complexity.

3

What is a message pattern in NestJS Microservices?

Câu trả lời

A message pattern in NestJS defines the communication mode between microservices. There are two main types: request-response (synchronous with expected response) and event-based (asynchronous without response waiting). The @MessagePattern() decorator defines a handler for request-response, while @EventPattern() handles asynchronous events. Pattern choice depends on use case: request-response for operations requiring immediate response, event-based for notifications and eventual consistency.

4

What is the role of a transporter in NestJS Microservices?

5

What is the difference between @MessagePattern() and @EventPattern()?

+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í