Keeping up with the digital transformation wave, many enterprises are making the shift from a monolithic architecture to microservices. This is mainly because a single error won’t bring the whole application down. But does that mean that your Microservices Architecture is resilient to failures? While building applications, it is common for failures and errors to occur. A microservice ecosystem can fail at some point or the other and hence it is better to start embracing it. It is also best to create Microservices keeping failure in mind. 

What can go wrong?

Well, there are numerous reasons for failure in Microservices. It can be due to the release of new code, hardware failures, poor architecture, errors in code, network issues, etc.

Fault tolerance is a property that keeps the system operational even after failures in some components. Also, a property can mean any of these – Microservices, Database, and Load Balancer. Some of the patterns to make your Microservices Architecture fault-tolerant are:

  • Timeouts – You must have heard about a timeout in sports, but in the Microservices context it is a specified period of time allowed for an event to occur. A timeout covers the whole interaction from establishing a connection to the last byte of the response. Sadly, this doesn’t fit in with the SO_TIMEOUT feature. However, we can overcome it by using the JDK11 or OkHttp client. 
  • Retries – Let’s say your request failed, what would you do? Wait a bit and try again? But hold on a minute, there are a few tips to remember before retrying – Distinguish re-triable errors with re-triable before going ahead. 
  • Circuit Breaker – The whole idea of using a circuit breaker is to give a third party a chance to recover without any manual work.
  • Deadlines/Distributed Timeouts – In order to decrease waste resources and increase susceptibility, we must add extra metadata to a request. 
  • Rate limiters – A value depends on is dynamic and depends on multiple factors. Well, it can be code changes, CPU application running, busyness in the host machine, etc. This problem can be easily resolved by a limiter. 

For best practices on patterns to make your Microservices fault-tolerant.

Microservices Blogs

Translate »