MicroServices IPC

Nitin Kalra
2 min readJan 5, 2020

An important concept while working with MicroServices is IPC, i.e how to set up communication between multiple microservices.

Handling Partial Failure

A good approach to follow is the one described by Netflix. The strategies for dealing with partial failures include:

  • Network timeouts — Never block indefinitely and always use timeouts when waiting for a response. Using timeouts ensures that resources are never tied up indefinitely.
  • Limiting the number of outstanding requests — Impose an upper bound on the number of outstanding requests that a client can have with a particular service. If the limit has been reached, it is probably pointless to make additional requests, and those attempts need to fail immediately.
  • Circuit breaker pattern — Track the number of successful and failed requests. If the error rate exceeds a configured threshold, trip the circuit breaker so that further attempts fail immediately. If a large number of requests are failing, that suggests the service is unavailable and that sending requests is pointless. After a timeout period, the client should try again and, if successful, close the circuit breaker.
  • Provide fallbacks — Perform fallback logic when a request fails. For example, return cached data or a default value, such as an empty set of recommendations.

Netflix Hystrix is an open-source library that implements these and other patterns. If you are using the JVM you should definitely consider using Hystrix. And, if you are running in a non-JVM environment, you should use an equivalent library.

This is a nice resource for learning about these concepts

This course teaches how to build microservices in Spring Boot that are resilient and fault-tolerant.

If you found this article useful, you know what to do now. Hit that clap button and star the GitHub repo follow me to get more articles and tutorials on your feed.

--

--