API Caching is Hard! Pitfalls you need to know

Поделиться
HTML-код
  • Опубликовано: 22 янв 2025

Комментарии • 12

  • @ba8e
    @ba8e 19 часов назад +14

    There are 2 hard problems in computer science: cache invalidation, naming things, and off-by-1 errors.

  • @buriedstpatrick2294
    @buriedstpatrick2294 18 часов назад +3

    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 ;)

  • @All-in-on-GME
    @All-in-on-GME 15 часов назад +1

    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.

  • @rafaelmendes6526
    @rafaelmendes6526 12 часов назад

    Maybe I missed, but Materialized Views are another great way of having read-only tables with non-normalized data

  • @obiwanjacobi
    @obiwanjacobi 19 часов назад +2

    @6:17 You really need to watch the pronunciation of 'cache-hit' 😁

  • @kagisowilliam982
    @kagisowilliam982 16 часов назад

    I had a performance issue about a month ago. Ended up opting for memory caching. The cache expires after a couple of minutes.

  • @Polychronius
    @Polychronius 15 часов назад

    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... :)

    • @midoevil7
      @midoevil7 13 часов назад

      What is TLA 😅?

  • @yousef.a.k3793
    @yousef.a.k3793 16 часов назад +1

    Why do you put an IDE thumbnail? I think you're going to show some code to explain your idea every time.

    • @CodeOpinion
      @CodeOpinion  15 часов назад

      good point, i'll adjust it