Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retry Pattern Vs fall back pattern in rest client

We have multiple resources exposed as REST service and running in to design argument whether client needs to implement re-try logic if service in unavailable due to network and/or application level failures. Is it worth it? One group argues, if service is unavailable then there is no point of re-trying but other group argues there may be network busy issues and re-try could help. There are no statistics to defend either arguments at this time. How about implementing a fall back URL (a replica of original http resource) and use fall back service during failures.

Any suggestions based on your prior experience?

like image 726
kamoor Avatar asked Dec 08 '14 18:12

kamoor


1 Answers

Keep in mind that when a service request is failing, it can be due to network overload or service degradation. In several cases the best option is to just fail immediately. Regarding using a fall back URL, it probably will not solve your problem, since it could keep network under high load.

Suggestion is to take a look in patterns such as:

  • Backpressure: http://mechanical-sympathy.blogspot.com.br/2012/05/apply-back-pressure-when-overloaded.html , http://engineering.voxer.com/2013/09/16/backpressure-in-nodejs/
  • Circuit breaker, Load Shedding: http://martinfowler.com/bliki/CircuitBreaker.html , http://techblog.netflix.com/2012/02/fault-tolerance-in-high-volume.html
  • Bulkhead pattern: http://skife.org/architecture/fault-tolerance/2009/12/31/bulkheads.html
like image 69
Luís Bianchin Avatar answered Oct 02 '22 04:10

Luís Bianchin