Fixing Performance Issues - Introducing Caching with Circuit Breaker

If you've identified a bottleneck in your website which is causing performance issues, there a variety of approaches you can take to alleviate these. Often these bottlenecks revolve around data access whether that's from an external API, database, or a complex method that is resulting in intensive CPU usage.

If you haven't read our post on Accessing Volatile Resources, its a great read and will help you in understanding the problem with relying on external sources and the steps required keep your app performing well.

Introducing Circuit Breaker

In this post, we want to share an in-house library we've been using for years on our sites to easily add memory and file based caching with minimal code for each implementation.

Circuit Breaker works by specifying a CircuitId, CacheKey, WorkingDirectory (for file based cache), CacheDuration (how long you want to keep it in cache), and lastly a function delegate (your code you need to execute).