Prepare for architecture interviews with 35+ questions on microservices patterns, communication, and best practices.
Microservices: architectural style decomposing application into small, independent services. Characteristics: single responsibility, independently deployable, own data store, communicate via APIs, technology agnostic, decentralized governance. Benefits: scalability, team autonomy, resilience. Challenges: complexity, distributed transactions, testing, monitoring.
Synchronous: REST (simple, HTTP-based), gRPC (fast, binary, streaming). Asynchronous: message queues (RabbitMQ, SQS), event streaming (Kafka). Patterns: request-response, publish-subscribe, event sourcing. Choose based on: latency requirements, coupling tolerance, reliability needs. Prefer async for loose coupling; sync for real-time needs.
API Gateway: entry point for all client requests. Responsibilities: routing, authentication/authorization, rate limiting, request/response transformation, aggregation, caching, logging, SSL termination. Popular: Kong, AWS API Gateway, nginx. Can become bottleneck; consider multiple gateways for different clients (BFF pattern).
Patterns: (1) Saga - sequence of local transactions with compensating actions for rollback, (2) Two-phase commit (2PC) - coordination, rarely used (blocking, single point of failure). Saga types: choreography (events) or orchestration (central coordinator). Design for eventual consistency where possible. Idempotent operations essential.
Service mesh: infrastructure layer handling service-to-service communication. Features: traffic management, security (mTLS), observability (tracing, metrics), resilience (retries, circuit breaking). Popular: Istio, Linkerd. Sidecar proxy pattern (Envoy). Use when: many services, need consistent policies, complex traffic management. Adds operational complexity.
Practice with interactive quizzes and get instant feedback.
Start Free Practice