Search This Blog

Friday, April 16, 2010

Release It! - Chapter 5.5 Fail Fast

Waiting around for a slow failure response is a huge waste of time.  If the system can predict that an operation will fail, it is better to tell the caller now so his resources don't get tied up.  A load balancer knows if servers are available so configure them to return immediately with a resource unavailable error rather than queing up the request and waiting around for a server to free up.  Services can check the state of resource pools or Circuit Breaker prior to use and Fail Fast if their use will fail. Check for resource availability prior to the start of a transaction.  Very basic parameter checking in a servlet might be useful if it can avoid pulling in resources on a transaction that is just going to fail with validation errors. Report system failures( resources unavailable) different from an application failure (invalid formatting of date).  You don't want to trip a Circuit Breaker because a user entered bad data multiple times but you do if there is no disk space left.
  • avoid Slow Responses and Fail Fast - if your system can't meet SLA, let callers know right away and not wait for a timeout. 
  • reserve resources, verify Integration Points early - try and allocate and verify important resource prior to doing any work.  Grab that huge buffer you need and verify all the Circuit Breakers are reporting ok.
  • user input validation - do basic user input validation prior to reserving resources.  Don't bother checking out a database connection just to find out a required parameter is missing from the call.

No comments:

Post a Comment