Configuring Timeouts on the Product Page Service
Consider a scenario with a details service and a booking service that routes traffic to the product page. To prevent the system from waiting indefinitely for a response from the product page service, you can configure a timeout such that if the service takes longer than three seconds to respond, the request is automatically rejected. This is accomplished by adding a timeout option in the service configuration. Below is the VirtualService configuration that applies a three-second timeout to the product page:Configuring the Details Service
The details service configuration does not include a timeout. Instead, it is set up to route traffic normally. Here is the configuration for the details service:Simulating Service Failures with Fault Injection
To test how the system handles delayed responses, you can simulate a fault. For instance, introduce a fixed delay of five seconds for 50% of the traffic directed to the details service. This fault injection approach helps in validating the resilience of the system by forcing the product page service’s three-second timeout to trigger.Fault injection is a valuable technique for examining the robustness of microservices architectures. It enables you to proactively identify weak points in your system’s failure handling mechanisms.