Comcast / jrugged

A Java libary of robustness design patterns
Apache License 2.0
266 stars 93 forks source link

Implement Skeptic pattern as a CircuitBreaker alternative #5

Open joercampbell opened 11 years ago

joercampbell commented 11 years ago

There's an interesting pattern called a "Skeptic" presented in this paper:

http://www.hpl.hp.com/techreports/Compaq-DEC/SRC-RR-77.pdf

(as seen on Werner Vogel's blog). It's somewhat similar to a CircuitBreaker but has different recovery behavior and perhaps deals better with intermittent problems. This would make an interesting addition to JRugged.

ekmason12 commented 8 years ago

Brian and I are working with Silvia and Karen to implement the SkepticBreaker pattern as a project for an Open Source Computer Science class at UPenn. For now we're working on a forked repo - https://github.com/ekmason12/jrugged - in the CIS399 branch. We're currently in an implementation phase and plan to start rigorous testing once initial implementation is complete.

joercampbell commented 8 years ago

Awesome - I look forward to seeing the first pull request. :)

bvand commented 8 years ago

We've realized that the best way to include the SkepticBreaker as an alternative will likely involve some refactoring of CircuitBreaker and its related classes. I've attached a few slides below that show how we envision the new architecture.

We'd appreciate any feedback you might have - this direction will require a decent amount of refactoring and changing/adding tests, but we think that it makes sense in terms of structure and will organize the code shared by SkepticBreaker and CircuitBreaker.

Proposed Refactoring for SkepticBreaker.pdf

joercampbell commented 8 years ago

Ok - So, I think my first question is why two different factories? You went through the trouble to refactor (or propose a refactor) to get yourself an abstract breaker... wouldn't the factory essentially be giving you back a 'breaker' ? Whats the driving reason to have two factories instead of one? ie. a factory that gives me a reg break OR a skeptic breaker is really just an argument difference yes? (Even with having an abstract factory class).

bvand commented 8 years ago

We had wanted to keep them separate because of their different properties, but having one actually makes more sense to keep track of both types. We can handle their differences by having "addSkepticBreaker" and "addCircuitBreaker" methods in BreakerFactory. I've attached the updated architecture.

Proposed Refactoring for SkepticBreaker v2.pdf

joercampbell commented 8 years ago

Thanks guys - I think that makes much more sense now, the picture looks good and looking for much forward to seeing some of the refactor and code. ;)

@trevmex , @weggert - Any thoughts here on the design?

bvand commented 8 years ago

We're almost done with the refactor and testing, but we have a few questions about some implementation details, about the existing examples in jrugged-examples (we made one for SkepticBreaker), and also about how you'd like to review our changes. Would you like to check out the code in our branch, or just have us submit a pull request? Also, do you have some time later this week to discuss some of the details about the SkepticBreaker and the examples?

joercampbell commented 8 years ago

A pull request would be awesome. :)

Sure - what time did you have in mind? I am going to be fairly busy on Thursday, but wed and friday are more open. Lemme know.

Joe

bvand commented 8 years ago

Sounds good - we'll probably be able to send the request tomorrow.

Friday after 4pm would be best for us. If that doesn't work, one of us could probably find some time tomorrow. Thanks!