Fault injection

The sidecar proxy provides a list of failure recovery network mechanisms for all the services being managed by Istio. As good practice, operators should not skip end-to-end service failure testing for the entire application. You may encounter restrictive timeouts of individual components when you test for overall failure recovery. Let's understand this with an example—you introduce 10 seconds of fault injection for end-to-end testing for a full life cycle of a transaction. However, you notice a particular intermediate service failure due to its own timeout of 6 seconds. You won't be able to notice the intermediate service failure without the fault injection feature.

To prevent such matters, Istio provides transparent fault injection for the service mesh. Instead of deleting service pods/containers to simulate packet loss at the TCP layer or to troubleshoot network latency, the best recommendation is to treat all observed application layers for fault tolerance, regardless of what the network failures might be. Continue to identify and isolate meaningful failures so that they can be injected at the application layer to enable application resiliency. Faults are injected into network requests that match certain conditions and enable request restrictions that might be prone to faults.

There are two types of fault injections that can be deployed:

  • Delays
  • Aborts

A delay is a timeout failure that can be caused by recently spiked network latency or a service overload from a downstream call. Aborts are service crashes that arrive from a downstream service. The majority of the time, this is either a connectivity issue or an HTTP 400 or 500 error.

Testing microservices for faults can be very challenging, but with the use of the virtual service primitive, it is possible to inject faults into the running application to test out their resiliency. This is a very important method for the Site Reliability Engineering (SRE) team.

By changing the definition of a service in real- time, the faults can be injected. For example, the following definition in a virtual service will introduce a delay of 2 seconds for 5% of the requests to the ratings service:

  hosts:
- ratings
http:
- fault:
delay:
percentage:
value: 0.05
fixedDelay: 2s

Next, we'll introduce abort rules.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.122.4