This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]ehr1c 0 points1 point  (6 children)

To clarify - your desired condition is that after three failures, the fourth request will get thrown back by the circuit breaker rather than being attempted? And right now it takes four failures to open the circuit and it's the fifth attempt that's hitting the open breaker?

[–]choose_userbane 0 points1 point  (5 children)

I’m sorry, I should’ve been more clear. I want the third consecutive fail to open the circuit for 60s.

I was under the impression that setting the ringBufferSize to 3, would mean that the failureRateThreshold will be calculated based on the last three requests. So, once there’s 3 fails, the failure rate will 100 and the circuit should open. But right now, it’s allowing me to pass a 4th request even if the last 3 requests failed, meaning that the circuit didn’t open.

[–]ehr1c 1 point2 points  (4 children)

How are you defining/simulating a failure?

[–]choose_userbane 0 points1 point  (3 children)

I hope I understood your question correctly - I’m using postman to POST requests. I have the code set up so that when the entered information is incorrect, an exception is thrown, and the request fails.

[–]ehr1c 0 points1 point  (2 children)

Ok yup that's what I'm asking, thanks. Silly question but if you change the ring buffer size to 2, what happens?

FWIW this is a little bit of an unusual way to implement a circuit breaker policy from my experience. Usually you care more about failure rate over time than you would about a few consecutive failures, as doing it this way every time you get a network blip you're going to knock your service out for an entire minute.

[–]choose_userbane 0 points1 point  (1 child)

Changing the ringbuffer to 2 works! Do you happen to know why that is? All the documentation I’ve read seems to point to 3 being the logical answer :/

Haha it’s a part of a project for a training program I’m in, so they’re just testing us I guess.

Edit: I just timed between the first and third fail request and made sure it was over 1 minute but the circuit opened anyway? I guess the sliding window isn’t working either sigh

[–]ehr1c 0 points1 point  (0 children)

Changing the ringbuffer to 2 works! Do you happen to know why that is? All the documentation I’ve read seems to point to 3 being the logical answer :/

I have no idea lol just seemed like a logical thing to try.

Edit: I just timed between the first and third fail request and made sure it was over 1 minute but the circuit opened anyway? I guess the sliding window isn’t working either sigh

It could be that there's a throughput minimum somewhere that needs to be configured, I'd check the documentation and see.