0 views
Which patterns for ensuring microservice fault tolerance do you know?
AI answer
Common microservice resilience patterns:
- Timeouts for network calls so requests do not hang indefinitely.
- Retries with exponential backoff and jitter—only for transient errors and idempotent operations; it is important to limit the number of attempts.
- Circuit breaker: temporarily stops calls to a failing dependency and later checks whether it has recovered.
- Bulkhead: isolates thread pools, connection pools, or resource limits so a failure in one dependency does not exhaust the resources of the entire service.
- Load limiting and backpressure: limits on requests, queues, and concurrency, with controlled rejection of excess load.
- Fallback and graceful degradation: for example, returning cached or partial data when appropriate.
- Replication, health checks, and automatic failover to healthy instances.
- Queues and asynchronous processing to decouple services; handlers must account for retries and duplicates.
These patterns should be combined with metrics, logging, and tracing. Improper retries, such as retries without limits, can worsen overload.
Also asked at Коммит (Аутстафф на проект "Ростелекома")
- How to protect the system from creating multiple payments if the user presses the pay button many times?
- How is the N+1 query problem solved in ORM?
- What types of indexes are available in PostgreSQL?
- There are several services (2-3), and there is an end-to-end business scenario passing through all services. If an operation on one of the services in the middle or at the end fails, the system ends up in an inconsistent state. What methods can be used to achieve inter-service transactionality (either the entire scenario is applied, or none of it is), if each service has its own database?
- What databases have you worked with the most?
Similar questions
- How did you design fallback logic for LLM or Redis failures?
- How can you ensure the reliability of a distributed transaction across three microservices (warehouse, payment, supplier)? What patterns are used for this?
- Briefly describe the Saga pattern with compensation: what happened if one of the steps failed?
- What approaches do you know for implementing distributed transactions in microservices?
- Why is it a bad idea from the outset to use synchronous HTTP REST communication between microservices throughout the entire order flow?