Does Istio allow to configure a maximum response timeout for a circuit breaker to open? How?

4/4/2019

I'm checking the documentation for the DestinationRule, where there are several examples of a circuit breaking configuration, e.g:

apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: bookinfo-app
spec:
  host: bookinfoappsvc.prod.svc.cluster.local
  trafficPolicy:
    connectionPool:
      tcp:
        connectTimeout: 30ms
          ...

The connectionPool.tcp element offers a connectTimeout. However what I need to configure is a maximum response timeout. Imagine I want to open the circuit if the service takes longer than 5 seconds to answer. Is it possible to configure this in Istio? How?

-- codependent
circuit-breaker
istio
kubernetes

1 Answer

4/4/2019

Take a look at Tasks --> Traffic Management --> Setting Request Timeouts:

A timeout for http requests can be specified using the timeout field of the route rule. By default, the timeout is 15 seconds [...]

So, you must set the http.timeout in the VirtualService configuration. Take a look at this example from the Virtual Service / Destination official docs:

The following VirtualService sets a timeout of 5s for all calls to productpage.prod.svc.cluster.local service in Kubernetes.

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: my-productpage-rule
  namespace: istio-system
spec:
  hosts:
  - productpage.prod.svc.cluster.local # ignores rule namespace
  http:
  - timeout: 5s
    route:
    - destination:
        host: productpage.prod.svc.cluster.local

http.timeout: Timeout for HTTP requests.

-- Eduardo Baitello
Source: StackOverflow