Service registries and discovery, what happens when the registry fails, heartbeats and registration, data consistency, eventual consistency, sagas for cross-service transactions, eventual vs strong consistency, deployment strategies, blue-green vs canary, and deployment tooling.
Published September 25, 2026
This lesson covers the "plumbing" questions. Show that you know both the Spring Cloud way (Eureka, Spring Cloud LoadBalancer) and the Kubernetes way (Services and DNS). Most new systems use the latter. For consistency, explain why distributed transactions are avoided, and what replaces them.
Short answer: A service registry is a database of available service instances and their network locations (host, port, health, metadata). Instances register on startup and deregister on shutdown. Clients, or load balancers, query the registry to find a healthy instance. Examples: Netflix Eureka, Consul, ZooKeeper, and, implicitly, Kubernetes (the API server plus the endpoints behind each Service).
Learn it in depth → Service Discovery
Short answer:
There are two variants:
http://order-service), and the platform routes the request.@Bean @LoadBalanced
RestClient.Builder restClientBuilder() { return RestClient.builder(); }
// "order-service" is resolved through discovery, not DNS
restClientBuilder.build().get().uri("http://order-service/api/orders/{id}", id).retrieve().body(OrderDto.class);
Short answer: It depends on the design, but it shouldn't cause an immediate outage:
Key points to cover:
Short answer: They register on startup, send periodic heartbeats (Eureka's default is every 30 seconds), and deregister on graceful shutdown. The registry evicts instances whose heartbeats stop, after a lease timeout. Clients refresh their cached registry periodically. Health checks, such as the Actuator health endpoint, can also mark an instance as down.
Key points to cover:
Short answer: Each service owns its data, so there's no single database transaction across services. Consistency is achieved with:
Key points to cover:
Learn it in depth → Outbox Pattern
Short answer: A consistency model in which, after an update, the different copies or services may disagree temporarily. If no new updates arrive, they all converge to the same state. For example, after an order is placed, the order service knows immediately, while the analytics dashboard and loyalty points catch up a few seconds later, through events.
Key points to cover:
Learn it in depth → Eventual Consistency Design
Short answer: With the Saga pattern. The business transaction is split into a sequence of local transactions, one per service. If a step fails, the steps that already completed are undone by compensating transactions, business-level reversals such as "refund payment" or "release stock".
PlaceOrder: Order(PENDING) → Payment.charge → Inventory.reserve → Order(CONFIRMED)
On failure at Inventory.reserve: Payment.refund → Order(CANCELLED)
Common trap: proposing two-phase commit (XA) across microservices. It couples services' availability, holds locks across the network, and most modern datastores and brokers don't support it well.
Learn it in depth → Saga Pattern
Short answer:
| Strong consistency | Eventual consistency | |
|---|---|---|
| Reads | Always see the latest committed write | May briefly see stale data |
| Availability during partitions | Lower (must coordinate or refuse) | Higher (keeps serving) |
| Latency | Higher (coordination, locks, consensus) | Lower |
| Complexity for developers | Simple mental model | Must handle staleness, retries and compensation |
| Fits | Balances, stock decrements, uniqueness | Feeds, analytics, notifications, search indexes |
Key points to cover:
Learn it in depth → CAP Theorem
Short answer: Each service is packaged as a container image, deployed through a CI/CD pipeline, and run on an orchestrator (Kubernetes, or ECS). The release strategies are:
Learn it in depth → Deployment Strategies
Short answer: You run two identical production environments. Blue serves live traffic while green gets the new version. After green passes its checks, you switch all traffic to green (at the load balancer or router). Rollback is just switching back.
Key points to cover:
Short answer: A canary sends a small percentage of real traffic (say 5%) to the new version, watches the error rate and latency, then increases the share step by step. A problem affects only a few users. Blue-green switches all traffic at once.
Key points to cover:
Short answer:
Learn it in depth → CI/CD Pipeline Design
Q: Do you still need Eureka on Kubernetes? A: Usually not. Kubernetes Services, DNS and readiness probes already provide discovery and load balancing. Eureka is mostly used in VM-based or hybrid deployments.
Q: What is the transactional outbox pattern? A: Write the business change and an "event to publish" row in the same local transaction. A separate relay (a poller, or CDC with Debezium) publishes the outbox rows to the broker. That avoids the dual-write problem, where the database commits but the event is lost, or the reverse.
Q: How do you roll back a canary that uses a new database column? A: Make schema changes expand-first. Add the new nullable column, and deploy code that writes both the old and new columns. Only after the rollout is fully complete do you remove the old column in a later release. Then the old version keeps working throughout.
Q: Choreography or orchestration for sagas? A: Choreography suits simple flows with a few steps, because there's no central component. Orchestration is easier to understand, monitor and change when there are many steps or complex compensation rules.