Java Magazine, Sept/Oct 2018
ORACLE COM JAVAMAGAZINE SEPTEMBER OCTOBER 2018 49 the leading edge service for a while and a fallback solution is used until Hystrix decides to close the circuit again You can see this behavior clearly when I bring the price service down The application tries to access the service initially then the circuit breaker trips and the application will not even try to access the underlying service Specifically in this example you can see that on average my pricing requests are taking much less time 50th percentile is 36 ms than in the column where 15 of requests are failing This behavior highlights the main features of a Hystrix command that uses a circuit breaker It returns a fallback value if the underlying library or service is not responsive or throws an error It does not propagate the errors from underlying libraries to the client unless your requirements specify to do so It gives the library or the underlying service some time to recover Once the circuit breaker is open most requests will not hit the underlying service There will be one probing request sent once in a while to see if the underlying system recovered If the probing request succeeds the underlying system is deemed to be healthy and the requests are routed to use the system Monitoring An added benefit of using Hystrix is that it is easy to add a real time monitor to report how the system behaves To do that I need to add the following library which is responsible for emitting Hystrix statistics into my holdings project dependency groupId com netflix hystrix groupId artifactId hystrix metrics event stream artifactId version 120 version dependency And then I configure the stream servlet as shown in Listing 6
You must have JavaScript enabled to view digital editions.