-
What are the tradeoffs when it comes to optimizing for availability vs consistency?
- As my approach involves using the cache, my main tradeoffs are for consistency with latency and availability. One of the key defining factors here will be the cache expiry time. That's our main tradeoff for serving requests faster. If underlying data is not modified a lot, then the longer cache time would suffice and the system would work as expected. However, the issue comes when data updation happens and we still see the previous data because of longer cache time. So, we should decide on an ideal cache time depending upon available statistics on how often the data will change to arrive at the right decision (i.e. precise cache expiry time).
-
In a real-world scenario, if you only had to choose between availability and consistency, which criteria would you pick and why?
- In real-world, it depends on the usage of our system. In our case, if we know data updation doesn't happen quite frequently, we could choose between a highly available system and give up consistency for faster latency in our UI. If however, data updation happens frequently, we have to go with high consistency and have to give up our availability, and have to face increased latency.
-
Is it possible to get both - a highly available and highly consitent data all the time? If no, then why? If yes, then how?
- No it is not. Though we can guarantee availability in the context of returning response all the time and highly consistent data, it will suffer high latency. Our approach however tries to arrive at middle grounds of availability and consistency with minimal latency. We can't achieve everything cause to optimize for availability and latency we have to give up consistency in our case and vice versa.