What is Semian and when should you use it?
mainSemian is a library that uses heuristics to implement 'failing fast'. It is designed to prevent slow or unresponsive resources from degrading the overall capacity and response time of an application.
When to use Semian
Semian is most beneficial for applications aiming to eliminate Single Points of Failure (SPOFs) that are experiencing issues with slow resources. It is particularly useful when a resource becomes unresponsive or consistently slow, causing requests to hit full timeouts.
Key Problems Solved
- Response Time Spikes: Without Semian, if a resource (like a session store) is down or slow, every request attempting to access it must wait for the full timeout duration. Semian uses heuristics to detect these failures and fail the requests instantly, preventing the average response time from spiking.
- Capacity Loss: When workers (e.g., single-threaded web workers) wait for a slow resource to time out, they cannot serve other requests. This leads to a significant degradation in the cluster's total capacity. By failing fast, Semian frees up workers to handle other requests immediately.
Important Considerations
- Complexity: Semian introduces complexity and should be introduced with care. It works by raising exceptions based on heuristics; you must understand its behavior before using it in production.
- Not a Magic Wand: It does not solve all latency problems; it specifically addresses the impact of slow/unresponsive resources.
- Threaded vs. Evented: If your application is multithreaded or evented (unlike Resque or Unicorn), these problems may be less pressing, though Semian can still provide value.