Circuit Breaker

Hi, I have few doubts regarding tyk circuit breaker. These are not clearly mentioned in docs, can anyone please help here ?

  1. What all errors/failures results circuit breaker into open state ? Is it 5xx or some other errors as well ?
  2. Will circuit breaker work for latency ? Is it latency based circuit breaker ?
  3. What is x & y% in this docs Circuit Breaker

    ?
  4. Does it supports globally as well as service/target level circuit breaking ?
    Globally (Enabling circuit breaker by configuring it once)
    Service Level (Enabling separately for each service)

Let me help with a bit of clarity.

  1. What all errors/failures results circuit breaker into open state ? Is it 5xx or some other errors as well ?

Only 5xx errors trigger the circuit breaker. It is intended to handle upstream or server errors. However, a gateway timeout can also trigger it since it returns 504.

  1. Will circuit breaker work for latency ? Is it latency based circuit breaker ?

No I don’t think this works for latency.

  1. What is x & y% in this docs Circuit Breaker

It’s simply the percentage of the sample size. For example x = 10 and y = 100, then your threshold percent is (10/100) % in float range of 0 - 1.

There is a gotcha where the value of the samples have to be collected within a 10 sec window before they are evaluated. So for 10/100, 100 requests have to be retrieved first before checking whether the conditions meet for the breaker to be tripped.

The implementation was based on very high requests or calls. If you want the webhooks events then please use v4.0.5 and v4.2.0 (unreleased yet at this time) and above.

  1. Does it supports globally as well as service/target level circuit breaking ?
    Globally (Enabling circuit breaker by configuring it once)
    Service Level (Enabling separately for each service)

There is no global circuit breaker at the moment. It’s only on an API / Service level. However, if you have the dashboard, then you should be able to use Open Policy Agent to append a circuit breaker to every API/Service using the regex .* path.

Hope this helps