.NET

Microservices Architecture

Service decomposition, API gateway, service discovery, distributed transactions, resilience patterns, Kubernetes basics (deployments, services, config)

25 面接問題·
Senior
1

What is the Bounded Context pattern in Domain-Driven Design applied to microservices?

回答

A Bounded Context defines an explicit boundary around a domain model with its own ubiquitous language and database. In microservices architecture, each Bounded Context typically becomes an independent distributed microservice. This ensures data autonomy and prevents model sharing between services. For example, the User entity in the Profile context can share the ID with the Buyer entity in the Ordering context, but they remain distinct models with their own attributes and business logic.

2

What is the main role of an API Gateway in a microservices architecture?

回答

An API Gateway serves as a single entry point for groups of microservices, acting as a reverse proxy that routes client requests to appropriate services. It implements the Backend for Frontend (BFF) pattern and handles cross-cutting concerns like authentication, SSL termination, caching, and response aggregation. This simplifies client-to-microservice communication by avoiding multiple direct calls and centralizing routing logic.

3

How does service discovery work in Docker Compose?

回答

Docker Compose uses internal DNS for service discovery. Each service defined in docker-compose.yml is accessible by its service name as hostname. For example, if a Redis service is named 'basketdata', other services can connect to it via ConnectionString=basketdata. Docker automatically resolves this name to the container's internal IP address on the shared Docker network, eliminating the need to hardcode IP addresses.

4

What is the principle of the Circuit Breaker pattern with Polly in .NET?

5

How to configure a retry policy with Polly for HttpClient in .NET?

+22 面接問題

次の面接に向けて.NETをマスター

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

無料で始める