Hi,

i would like to implement a circuit breaker functionality with the help of
HAProxy.

For example, if the average response time of the http requests of a backend
server is above a certain threshold in the last x seconds, trip the circuit
breaker for a period of x seconds (respond with 503 and/or show error page
etc.). After the period has expired, close the circuit and forward requests
to the server as normal.
The same logic should be applied to http response status (if a defined
status (500) is above a ratio of 1% of all requests).

I want to use HAProxy for this task to not need to implement this
functionality/pattern in every single application or (micro)service.

I'm aware of "observe layer7" or "http_err_rate" fetch, but these doesn't
fulfill the requirements.

At the moment i haven't found a way to implement this with HAProxy built-in
functions.

I can think of a Lua solution, but i'm not sure if this is possible. I need
to save the backend response time of every transaction in a shared memory
segment (i want to avoid Redis if possible). Then read from this segment,
implement a sliding window and decide based on calculations+thresholds if
the circuit breaker should be tripped. A similar logic applies to http
response status.


Any ideas on this?


Best Regards / Mit freundlichen Grueßen
_____________
Bjoern

Reply via email to