# Kiến trúc Microservices (.NET) > Phân rã service, API gateway, service discovery, giao dịch phân tán, mẫu khả năng phục hồi, kiến thức cơ bản về Kubernetes (deployments, services, config) - 25 câu hỏi phỏng vấn - Senior - [Câu hỏi phỏng vấn: .NET](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van.md) ## 1. Mẫu Bounded Context trong Domain-Driven Design áp dụng cho microservices là gì? **Câu trả lời** Một Bounded Context định nghĩa một ranh giới rõ ràng xung quanh một mô hình domain với ngôn ngữ ubiquitous và cơ sở dữ liệu riêng. Trong kiến trúc microservices, mỗi Bounded Context thường trở thành một microservice phân tán độc lập. Điều này đảm bảo tính tự chủ của dữ liệu và ngăn việc chia sẻ mô hình giữa các service. Ví dụ, thực thể User trong context Profile có thể chia sẻ ID với thực thể Buyer trong context Ordering, nhưng chúng vẫn là các mô hình riêng biệt với các thuộc tính và logic nghiệp vụ riêng. ## 2. Vai trò chính của một API Gateway trong kiến trúc microservices là gì? **Câu trả lời** Một API Gateway đóng vai trò là điểm vào duy nhất cho các nhóm microservices, hoạt động như một reverse proxy định tuyến các yêu cầu của client đến các service phù hợp. Nó triển khai mẫu Backend for Frontend (BFF) và xử lý các mối quan tâm xuyên suốt như xác thực, kết thúc SSL, caching và tổng hợp phản hồi. Điều này đơn giản hóa giao tiếp client-to-microservice bằng cách tránh nhiều lệnh gọi trực tiếp và tập trung hóa logic định tuyến. ## 3. Service discovery hoạt động như thế nào trong Docker Compose? **Câu trả lời** Docker Compose sử dụng DNS nội bộ cho service discovery. Mỗi service được định nghĩa trong docker-compose.yml có thể truy cập bằng tên service như một hostname. Ví dụ, nếu một service Redis có tên 'basketdata', các service khác có thể kết nối đến nó qua ConnectionString=basketdata. Docker tự động phân giải tên này thành địa chỉ IP nội bộ của container trên mạng Docker dùng chung, loại bỏ nhu cầu hardcode các địa chỉ IP. ## Còn 22 câu hỏi nữa - Nguyên lý của mẫu Circuit Breaker với Polly trong .NET là gì? - Làm thế nào để cấu hình một retry policy với Polly cho HttpClient trong .NET? Đăng ký miễn phí: https://sharpskill.dev/vi/login ## Các chủ đề phỏng vấn .NET khác - [Cơ bản về C#](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/csharp-basics.md): 25 câu hỏi, Junior - [LINQ & Delegates](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/csharp-linq-delegates.md): 20 câu hỏi, Junior - [Kiến thức cốt lõi ngôn ngữ C#](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/csharp-language-essentials.md): 15 câu hỏi, Junior - [Kiến thức cơ bản về ASP.NET Core](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/aspnet-core-fundamentals.md): 18 câu hỏi, Junior - [Vòng đời request trong ASP.NET Core](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/aspnet-core-request-lifecycle.md): 20 câu hỏi, Junior - [Configuration & Settings](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/configuration-settings.md): 20 câu hỏi, Junior - [Vòng đời ứng dụng](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/application-lifecycle.md): 20 câu hỏi, Junior - [Dependency Injection](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/dependency-injection.md): 24 câu hỏi, Mid-Level - [Entity Framework Core](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/entity-framework-core.md): 25 câu hỏi, Mid-Level - [Minimal APIs](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/minimal-apis.md): 18 câu hỏi, Mid-Level - [Phát triển Web API](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/web-api-development.md): 22 câu hỏi, Mid-Level - [Async trong ASP.NET Core](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/async-aspnet-core.md): 20 câu hỏi, Mid-Level - [Authentication & Authorization](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/authentication-authorization.md): 18 câu hỏi, Mid-Level - [HttpClient & Networking](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/httpclient-networking.md): 20 câu hỏi, Mid-Level - [Tuần tự hóa JSON](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/json-serialization.md): 20 câu hỏi, Mid-Level - [Entity Framework Core nâng cao](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/ef-core-advanced.md): 25 câu hỏi, Mid-Level - [Các tính năng nâng cao của C#](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/csharp-advanced-features.md): 20 câu hỏi, Mid-Level - [Clean Architecture](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/clean-architecture.md): 20 câu hỏi, Mid-Level - [Logging, Monitoring & Observability](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/logging-monitoring.md): 22 câu hỏi, Mid-Level - [Kiểm thử đơn vị & xUnit](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/unit-testing-xunit.md): 20 câu hỏi, Mid-Level - [Kiểm thử tích hợp](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/integration-testing.md): 18 câu hỏi, Mid-Level - [Docker & Containerization](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/docker-containerization.md): 16 câu hỏi, Mid-Level - [Quản lý gói NuGet](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/nuget-package-management.md): 16 câu hỏi, Mid-Level - [Memory Management & GC](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/memory-management-gc.md): 22 câu hỏi, Senior - [Lập trình phản ứng](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/reactive-programming.md): 24 câu hỏi, Senior - [Async/await & Mẫu thiết kế](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/async-await-patterns.md): 26 câu hỏi, Senior - [.NET Design Patterns](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/dotnet-design-patterns.md): 24 câu hỏi, Senior - [Tối ưu hóa hiệu năng](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/performance-optimization.md): 22 câu hỏi, Senior - [Bảo mật & Best Practices](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/security-best-practices.md): 24 câu hỏi, Senior - [SignalR & Thời gian thực](https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/signalr-realtime.md): 22 câu hỏi, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/vi/technologies/dotnet/cau-hoi-phong-van/microservices-architecture