Hystrix icon indicating copy to clipboard operation
Hystrix copied to clipboard

Hystrix not fall properly

Open saboteurkid opened this issue 10 years ago • 3 comments

Hi all, I have a situation that I need to call an external service (in my case is RESTful) My Code If I understand properly, that after 20 times fail (by default), Hystrix should open the circuit, but in my case, it not. It cause me a lot trouble be cause the 3rd service quite bad and their downtime quite large. Can anyone explain me where I do it wrong? Thank in advance. P/s: Sorry for my bad English.

saboteurkid avatar Jun 30 '16 08:06 saboteurkid

For a circuit to open, 2 conditions need to be met:

  1. Volume must be high enough. This is controlled by config: https://github.com/Netflix/Hystrix/wiki/Configuration#circuitBreaker.requestVolumeThreshold
  2. Error rate must be high enough. This is controlled by config: https://github.com/Netflix/Hystrix/wiki/Configuration#circuitbreakererrorthresholdpercentage

If you're seeing a command fail very frequently, but the circuit isn't opening, see what rate your command is executing at. If you'd like it to open, then you might need to lower the volume threshold.

mattrjacobs avatar Jun 30 '16 16:06 mattrjacobs

Thank for these link. I've read it, but may be I'm not fully understand. Just wondering why when my code running, the Error/ Total percentage is stuck as 10/10 -100% when time out = 1sec.

In source code (it quite a complex code for me), Hystrix check the Total error vs VolumeThreadhold then check the error percentage. But in my case, the Total error not counting on (same for Total request).

Just wonder why it not counting on to 20, but stuck in 10?

saboteurkid avatar Jun 30 '16 17:06 saboteurkid

The counters are all windowed, meaning they only track the last n seconds of metrics. (The default is 10 seconds). So as commands are executing, the new ones appear in the counter, and the metrics older than 10 seconds fall off.

In your case, it sounds like you're observing a steady rate of 1 cmd/sec, so the counter for this command will alway contain 10 data points.

mattrjacobs avatar Jul 06 '16 04:07 mattrjacobs