Caching is hard

  Рет қаралды 24,276

Hussein Nasser

Hussein Nasser

Күн бұрын

In this episode of the backend engineering show we discuss an article written by the Forem team illustarting a bug they recently fixed in their caching layers. They go into good level of details explaining the 3 levels of caching that they have. I go through this article in this episode and give my opinion at the end as to why we shouldn’t really cache unless we need to. Enjoy
0:00 Intro
1:00 Three level of caching
7:39 Edge Caching
8:30 Backend Rails Caching
10:30 Database Caching
15:00 Understand why you Cache
Article
dev.to/devteam/the-three-cach...
Fundamentals of Database Engineering udemy course (link redirects to udemy with coupon)
database.husseinnasser.com
Introduction to NGINX (link redirects to udemy with coupon)
nginx.husseinnasser.com
Python on the Backend (link redirects to udemy with coupon)
nginx.husseinnasser.com
Become a Member on KZbin
/ @hnasr
🔥 Members Only Content
• Members-only videos
🏭 Backend Engineering Videos in Order
backend.husseinnasser.com
💾 Database Engineering Videos
• Database Engineering
🎙️Listen to the Backend Engineering Podcast
husseinnasser.com/podcast
Gears and tools used on the Channel (affiliates)
🖼️ Slides and Thumbnail Design
Canva
partner.canva.com/c/2766475/6...
Stay Awesome,
Hussein

Пікірлер: 48
@hnasr
@hnasr 2 жыл бұрын
Get my Introduction to Database Engineering course. Head to database.husseinnasser.com for a discount coupon. Link redirects to udemy with coupon applied.
@joannicolausantandreu2876
@joannicolausantandreu2876 Жыл бұрын
amazing course, i'm having a lot of fun. By the way, it would be nice to have a course of caching engineering fundamentals explaining the the big ideas behind and comparing multiple nowadays solutions and also discussing their architectures and its internals.
@BraedenSmith
@BraedenSmith 2 жыл бұрын
There are only two hard problems in computer science: cache invalidation, naming things & off-by-one errors
@ChrisAthanas
@ChrisAthanas 2 жыл бұрын
My favorite computer science joke
@morgenshow9523
@morgenshow9523 2 жыл бұрын
came here for this
@tafarakasparovmhangami2356
@tafarakasparovmhangami2356 2 жыл бұрын
Poetic software engineering. A message for the future generations: "This guy is a legend!"
@AnantKumarS
@AnantKumarS 2 жыл бұрын
Hussein man, keep this show (BE engineering Show) ongoing. The knowledge gained from episodes of this show are golden!
@hnasr
@hnasr 2 жыл бұрын
Will do ! 🙏 appreciate it
@acollierr17
@acollierr17 2 жыл бұрын
Great video, Hussein! The last part where you talked about why we cache sure hit it home. I will definitely keep those aspects in mind going forward with my own code.
@OtterSwims
@OtterSwims 2 жыл бұрын
I learn so much from your videos, thank you. Your channel is so underrated
@morgenshow9523
@morgenshow9523 2 жыл бұрын
he‘s saying decent things but not out of this world knowledge. For me, it‘s relaxing to see another engineer knowing the depth of things and seeing him be concerned of the same things, it‘s a validating comfortable feeling
@akashdesarda502
@akashdesarda502 2 жыл бұрын
The statement, “without understanding what step is causing performance issue or slowing down the application & instead just adding a cache layer is just bad practice”. I was is (kind of) in the process to the same, this hit me hard & got me thinking & I think know I now what instead I should be doing. Thanks.
@maurin5266
@maurin5266 2 жыл бұрын
your voice is so chill, like it bro❤️
@prabhatism
@prabhatism 2 жыл бұрын
Will you be talking about the atlassian outage?
@gyroninjamodder
@gyroninjamodder 2 жыл бұрын
10:15 Fundamentally there is nothing wrong with pushing to a CDN. The issue is that you need to add extra complexity to your application when the end result is optimizing the response time for one user (per edge server). It also requires you to know your user's access patterns well. If it's a personal blog it's an easy to decision to add your latest blog post as there will be a surge of traffic to it when you publish it. But what if you are a blogging platform? Some user's new posts may be read by very few people, so whose new posts should be pushed to the CDN? The CDN is in a much better place to know what resources are being requested and which are the most popular and which aren't and should be remvoed from the cache. Cloudflare, Cloudfront, and Google Cloud CDN, don't even support being pushed to AFAIK. This kind of shows there isn't a market demand for it.
@wahdangun
@wahdangun 2 жыл бұрын
maybe in blogging platform you can predict which one to cache based on previous pattern, like maybe that user that posting always so much view etc..
@gyroninjamodder
@gyroninjamodder 2 жыл бұрын
@@wahdangun Yes, it's possible, but it's high complexity for a low reward.
@pranjalgoyal6747
@pranjalgoyal6747 2 жыл бұрын
Just needed this 💯💯
@anthonyoleinik6472
@anthonyoleinik6472 2 жыл бұрын
Can you go more into “pushing is unpredictable”? If I were designing a system, I’d opt for pushing to the CDN to avoid unnecessary polls. Why poll once a second if nothing had changed? I’d like to read more on this topic if you have references.
@larssonsoder4824
@larssonsoder4824 2 жыл бұрын
Hi guys, could you advise me when to use redis, hazelcast and memcache I'm choosing a caching technology for our project. I tried to find the comparison between redis and hazelcast and memcache online but they just talk about the basic characteristics, I mean it's quite ambiguity
@chrishabgood8900
@chrishabgood8900 10 ай бұрын
if you cache in a db table you could use a trigger to update it.
@run8236
@run8236 2 жыл бұрын
can you pls suggest few books that you have read and which helped in your learning journey
@hnasr
@hnasr 2 жыл бұрын
I started re-reading Transaction Processing: Concepts and Techniques by Gray, Reuter. Really good book for understanding database workloads.
@gordonsau2989
@gordonsau2989 2 жыл бұрын
For the database caching, I think maybe the problem can be solved if there are some special keywords to tell the database that the attribute is a cache in the other table and what the cache invalidation should be. I wonder if there are databases that already do it
@gordonsau2989
@gordonsau2989 2 жыл бұрын
actually, trigger functions already do the job
@AnantKumarS
@AnantKumarS 2 жыл бұрын
I have a serious question, where do you find these tech articles?
@hnasr
@hnasr 2 жыл бұрын
Google news, and people send me articles. This one was sent to me in order to react and give my opinion on .
@apusingh1967
@apusingh1967 Ай бұрын
Is it possible to implement cache in load balancer?
@IvanRandomDude
@IvanRandomDude 2 жыл бұрын
I read somewhere (not sure where): If you don't think that managing the state and caching are hard then consider the fact that 90% of the problems in a system go away after reboot
@pisanghangus2
@pisanghangus2 2 жыл бұрын
Will u make a new udemy course soon ?
@hnasr
@hnasr 2 жыл бұрын
Yes working on a new one.
@pisanghangus2
@pisanghangus2 2 жыл бұрын
@@hnasr looking forward to it
@devyetii
@devyetii 2 жыл бұрын
Just a beginner question, why can't edge caching work with encrypted media file ? Let's say for example our cache is a KV pair, the key is known but the value is encrypted. Why don't we use something like a MAC hash for validation that doesn't till too much about the encrypted content yet signifies if it was changed or not ?
@hnasr
@hnasr 2 жыл бұрын
Good question, When you encrypt with TLS, a new ephemeral symmetrical key is used. So that even if you take the same piece of content it will create a completely different encrypted cipher (thats the power of encryption) As a side effect you have no idea what is the content being encrypted so you can’t cache it.
@devyetii
@devyetii 2 жыл бұрын
@@hnasr Got it. Thank you 🙏
@hououinkyouma5372
@hououinkyouma5372 2 жыл бұрын
Plus hashing might be computationally expensive to do at scale just to verify content changes.
@gyroninjamodder
@gyroninjamodder 2 жыл бұрын
@@hnasr It can. Netfilx encrypts videos in its cache (for DRM purposes). In regards to having the origin sign a response that can get replayed by a CDN chrome supports signed exchanges but it complicates things when you could just trust your CDN provider. There is a trade off between using nontechnical measures (i.e. contracts or trust) and technical measures (i.e. encryption or signatures) when protecting a system.
@ashishjullia638
@ashishjullia638 2 жыл бұрын
But why he deleted that article?
@muhamadrafipamungkas4465
@muhamadrafipamungkas4465 2 жыл бұрын
I have tons of JIRA's issue because of stupid cache
@rashie
@rashie 2 жыл бұрын
👍👍
@ChrisAthanas
@ChrisAthanas 2 жыл бұрын
You forgot off by one errors
@rick-kv1gl
@rick-kv1gl 2 жыл бұрын
Caches are like eidi. Everyone gets a cache. You get a cache, you get a cache and you get a cache !
@istiakferdous6864
@istiakferdous6864 2 жыл бұрын
Cache
@superchdk
@superchdk 2 жыл бұрын
I thought time was hardest problem in CS? 🕒 🤪
@ShashankVermaa
@ShashankVermaa Жыл бұрын
Another one : Exactly once semantics.
@Septumsempra8818
@Septumsempra8818 9 ай бұрын
Caching is kicking my @ss. Django caching tutorials or 8 lines long.
@foodorder610
@foodorder610 2 жыл бұрын
hi good- i have this message-Or use my current location This IP, site or mobile application is not authorized to use this API key. Request received from IP address 82.165.88.128, with empty referer can you help us for this ?
@AMFLearning
@AMFLearning 2 жыл бұрын
nice #amflearningbydoing #amflearning
Why this query is fast
17:02
Hussein Nasser
Рет қаралды 19 М.
Каха ограбил банк
01:00
К-Media
Рет қаралды 7 МЛН
100❤️
00:20
Nonomen ノノメン
Рет қаралды 75 МЛН
Кәріс өшін алды...| Synyptas 3 | 10 серия
24:51
kak budto
Рет қаралды 1,3 МЛН
Redis In-Memory Database Crash Course
50:01
Hussein Nasser
Рет қаралды 54 М.
NSDI '13 - Scaling Memcache at Facebook
23:18
USENIX
Рет қаралды 10 М.
The Anatomy of a Proxy Server | The Backend Engineering Show
23:12
Hussein Nasser
Рет қаралды 10 М.
Before you move to HTTP/3 ...
11:31
Hussein Nasser
Рет қаралды 15 М.
This is why you need caching
10:03
Web Dev Cody
Рет қаралды 37 М.
How does Caching on the Backend work? (System Design Fundamentals)
22:45
Software Developer Diaries
Рет қаралды 29 М.
package.json is not enough
15:40
Hussein Nasser
Рет қаралды 53 М.
Distributed Transactions are Hard (How Two-Phase Commit works)
16:24
Hussein Nasser
Рет қаралды 31 М.
John Mearsheimer on Ukraine, Gaza & escalation dominance | SpectatorTV
47:51
Mutual TLS  | The Backend Engineering Show
50:16
Hussein Nasser
Рет қаралды 21 М.
Нашел еще 70+ нововведений в iOS 18!
11:04
Дени против умной колонки😁
0:40
Deni & Mani
Рет қаралды 13 МЛН