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 面接問題·
Senior
1

What is a modular monolith?

回答

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?

回答

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?

回答

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 面接問題

次の面接に向けてNode.js / NestJSをマスター

すべての問題、flashcards、技術テスト、コードレビュー演習、面接シミュレーターにアクセス。

無料で始める