In addition to the last part, always measure performance first! Get some metrics from your production environment so you have an objective view of where optimizations are needed so you don't waste time and effort on hypothetical scenarios. It's also very rewarding to see graphs go down after you've deployed something, as a little treat for yourself ;)
Dealing with aggregations in caching scenarios can be difficult to get right or even do at all. If your API allows for many inputs, then caching becomes cumbersome or ineffective due to having to identify and execute on persisting the maximum level to aggregate to as possible without breaking functionality for any of the inputs, but still aggregating enough to make it worth it. I always feel like I should set up caching for these scenarios and then end up realizing it's not the best solution.
For me the hardest part is the concurrent nature of a cache, even worse if it is also distributed. Some day I'll learn TLA+ or such so I can get it... Someday... :)
There are 2 hard problems in computer science: cache invalidation, naming things, and off-by-1 errors.
Classic.
In addition to the last part, always measure performance first! Get some metrics from your production environment so you have an objective view of where optimizations are needed so you don't waste time and effort on hypothetical scenarios. It's also very rewarding to see graphs go down after you've deployed something, as a little treat for yourself ;)
Absolutely
Dealing with aggregations in caching scenarios can be difficult to get right or even do at all. If your API allows for many inputs, then caching becomes cumbersome or ineffective due to having to identify and execute on persisting the maximum level to aggregate to as possible without breaking functionality for any of the inputs, but still aggregating enough to make it worth it. I always feel like I should set up caching for these scenarios and then end up realizing it's not the best solution.
Maybe I missed, but Materialized Views are another great way of having read-only tables with non-normalized data
@6:17 You really need to watch the pronunciation of 'cache-hit' 😁
I had a performance issue about a month ago. Ended up opting for memory caching. The cache expires after a couple of minutes.
For me the hardest part is the concurrent nature of a cache, even worse if it is also distributed. Some day I'll learn TLA+ or such so I can get it... Someday... :)
What is TLA 😅?
Why do you put an IDE thumbnail? I think you're going to show some code to explain your idea every time.
good point, i'll adjust it