What are alternatives to timeouts and retries and how do they compare?

When dealing with unreliable networks or services, timeouts and retries are common strategies to ensure smooth operation. However, they aren't the only methods available. Here are some alternatives:

  • Circuit Breaker Pattern: This approach allows a system to fail fast by breaking the circuit when a service is experiencing too many failures. It prevents the application from continuing to make requests to an unresponsive service, thereby reducing strain on resources.
  • Fallback Mechanism: This strategy provides an alternative response when a service call fails. For instance, if a database call fails, you might return cached data instead, ensuring continued service availability.
  • Rate Limiting: Prevents overwhelming a service by limiting the number of requests allowed in a given timeframe. This can help maintain service reliability and manage loads effectively.
  • Load Shedding: This involves intentionally dropping requests when the system is under heavy load to maintain overall system stability. By prioritizing essential services, it ensures critical functions remain responsive.

Each alternative has its pros and cons, and often a combination of them can be used to create a robust and fault-tolerant system.


Circuit Breaker Fallback Mechanism Rate Limiting Load Shedding Alternatives to Timeouts Retries