What are Distributed CACHES and how do they manage DATA CONSISTENCY?

What are Distributed CACHES and how do they manage DATA CONSISTENCY?

Gaurav Sen

5 лет назад

974,037 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Vraja Jivan
Vraja Jivan - 17.04.2019 18:11

Gaurav nice video. One comment. Writeback cache refers to writing to cache first and then the update gets propagated to db asynchronously from cache. What you're describing as writeback is actually write-through, since in write through, order of writing (to db or cache first) doesn't matter.

Ответить
Deb’s World
Deb’s World - 16.08.2023 18:04

Gaurav - One question here , i got about Write through and Write Back , what about the Read through and Read Back

Ответить
Prabhat Kumar
Prabhat Kumar - 06.08.2023 18:29

All the way explained here irrespective of order of writing into DB or cache are write thought caching. In Write back cache is only updated and DB is not part of the I/O completion. DB is updated later in background. @gaurav Sen

Ответить
MALLIKARJUNASWAMY B
MALLIKARJUNASWAMY B - 08.06.2023 20:41

What is kadka and where it used here ?

Ответить
Anastasia Naumko
Anastasia Naumko - 01.06.2023 04:00

thank you so much 😌

Ответить
Bhanu Bandaru
Bhanu Bandaru - 25.05.2023 00:14

Many relevant issues were discussed, but a resource with intent to educate should not have incorrect facts (wrong terminology in this case: write-through, write-around, write-back all mixed up). It causes more harm than good. I hope this is withdrawn and a new video is created.

Ответить
Mengyong Lee
Mengyong Lee - 09.05.2023 18:00

Notes:

In Memory Caching

- Save memory cost - For commonly accessed data
- Avoid Re-computation - For frequent computation like finding average age
- Reduce DB Load - Hit cache before querying DB

Drawbacks of Cache

- Hardware (SSD) much more expensive than DB
- As we store more data on cache, search time increases (counter productive)

Design

- Database (Infinite information) vs Cache (Relevant information)

Cache Policy

- Least Recently Used (LRU) - Top entires are recent entries, remove least recently used entries in cache

Issue with caches

- Extra calls - When we couldn’t find entry in cache, we query from database.
- Threshing - Input and output cache without ever using results
- Consistency - When update DB, we must maintain consistency between cache and DB

Where to place the cache

- Close to server (in memory)
- Benefit - Fast
- Issue - Maintaining consistency between memory of different servers, especially for sensitive data such as password
- Close to DB (global cache, i.e. Redis)
- Benefit - Accurate, Able to scale independently

Write-through vs Write-back

- Write-through - Update cache, before updating DB
- Not possible for multiple servers
- Write-back - Update DB, before updating cache
- Issue: Performance - When we update the DB, and we keep updating the cache based on that, much of the data in the cache will be fine and invalidating them will be expensive
- Hybrid
- Any update first write to cache
- After a while, persist entries in bulk to database

Ответить
Outis
Outis - 01.04.2023 04:04

I love your word lingos ..😂😂
The least frequently used is not being frequently used in real world ...damn u are the funniest online educator with great content

Ответить
MORPHEUS
MORPHEUS - 29.03.2023 15:59

Where did you got that white board ?

Ответить
Shoaib Zafar
Shoaib Zafar - 14.03.2023 19:34

This everything what I needed. I am really looking forward to learn that how can create an online game hosting server . I researched a lot on how do it and I didn't get it what is exactly happening. Your CDN video was really good 👍. Now I have understood how exactly CDN works and why it uses distributed caching 👍💯

Ответить
Moulik Adak
Moulik Adak - 12.03.2023 17:55

Cache are in-memory, so RAM not SSD

Ответить
Sankalp Arora
Sankalp Arora - 03.03.2023 20:32

Hey! Thanks for the video.
One question: If what pinned comment says is right, then, what would be the reason for Write-Back cache to be expensive?

Also, if what pinned comment says is right, then, we won't be able to use Write-Back mechanism where data is critical ( like financial, and passwords ) since DB is going to be updated asynchronously, and it could lead to inconsistencies, right ?

Please answer these. Thanks!

Ответить
Ozichukwu Chikwendu
Ozichukwu Chikwendu - 24.01.2023 21:58

How exactly do you benefit from reduced network calls by having a cache server/distributed cache servers?

Aren't you still going to be making network calls to these cache servers? The only benefit I see is that cache will make use of in-memory data storage. What am I missing?

Ответить
cole denesik
cole denesik - 13.01.2023 05:00

Please make a full series in Redis or Paid Course.

Ответить
Mahmudul Hasan Sohag
Mahmudul Hasan Sohag - 10.01.2023 07:31

Thanks

Ответить
bmcseal01
bmcseal01 - 25.12.2022 04:38

Solid explanation

Ответить
Umair Khan
Umair Khan - 18.10.2022 13:30

Hi, can you please do a video on ncache as well

Ответить
AmirTV
AmirTV - 29.09.2022 18:32

Wouldn't it make sense to put a load balancer in front of the distributed cache? And, then also in front of the DB? Trying to figure out why most architectures will put a load balancer in some layers, but not others. Like it seems that as long as we have a distributed/replicated component, then we would need to have an LB in front of it. Maybe some diagrams don't include it because some components have load balancing as a part of it; for example, an API gateway could be doing its own load balancing to know which service node to go to.

Ответить
AcidRaZor
AcidRaZor - 31.08.2022 11:23

Anyone caching passwords? Please let me know if you do

Ответить
Ashwin Asokan
Ashwin Asokan - 31.08.2022 09:46

Bhai. u r a life saver! Brilliant tutoring. Thank you!

Ответить
Nicklas Pillay
Nicklas Pillay - 30.08.2022 21:47

Great video👏

Ответить
Bobu Putheeckal
Bobu Putheeckal - 23.08.2022 04:55

I couldnt get info on Distributed Cache.

Ответить
velie a
velie a - 21.08.2022 04:17

redis that you mentioned here is a redis cache server or redis database?

Ответить
Mohd Aslam
Mohd Aslam - 19.08.2022 18:21

Hi

Good

Can you show that you have implemented

Thanks

Ответить
Ravi Mulchandani
Ravi Mulchandani - 18.08.2022 17:55

Nice Explanation Gaurav. This video covers basics of caching. In one of the interviews, I was asked to design the Caching System for stream of objects having validity. Is it possible for you to make some video on this system design topic?

Ответить
Alex N
Alex N - 15.08.2022 20:34

I think you mixed up write-through and write-back.
- write-through - the transaction is held until data is at rest (in DB). If transaction completed, data is persistently stored.
- write-back - the transaction completes (from user POV) as soon as cache is updated, DB update happens later. If cache fails, data may be lost.

Ответить
Haibo Yan
Haibo Yan - 05.08.2022 01:25

Explained like my interviewed candidate today.

Ответить
max-a-million
max-a-million - 04.08.2022 14:13

These videos are fantastic, thanks for making them!

But, I’m having trouble with one part of the video. In the example where you’re describing the differences between write-through and write-back, you mention that write-through isn’t viable if the value of x changes and is only updated in one servers in-memory cache - makes sense.

But, how does write-back solve that problem?

Server 1 performing a write-back is just updating the DB and evicting x in their own cache, but it doesn’t invalidate/evict x from another server’s (Server 2’s) cache. So, it seems to me that if S1 updates X with a write-back policy, and S2 reads X, there’s still opportunity for inconsistency.

Hope that makes sense and would love to get your (or anyones) feedback!

Ответить
Susnata Goswami
Susnata Goswami - 13.07.2022 12:12

The comment section tho oof

Ответить
Rahul Chawla
Rahul Chawla - 13.07.2022 11:33

wonderfully explained. thanks

Ответить
wonde-video
wonde-video - 08.07.2022 14:21

Please make a
video on this topic "Design Peer to Peer network".

Ответить
Yashwanth Dornala
Yashwanth Dornala - 08.07.2022 09:26

Data is not consistent any time with use of cache, you might get older data, I dont understand why we need to use it if it is not latest data as it might cause issues and clients may report

Ответить
saurabh pandey
saurabh pandey - 24.06.2022 00:29

Around 3.30, listed in the PROs of having Cache system. Can someone explain how network calls are being reduced. In real time scenarios, how can we reduce network calls because we are anyway pinging DB for information.

Ответить
CHENHAO FENG
CHENHAO FENG - 18.06.2022 18:59

great video,very helpful to learn english

Ответить
fakhruddin tahery
fakhruddin tahery - 12.06.2022 20:13

Great explanation

Ответить
C.T. Bell
C.T. Bell - 12.06.2022 01:15

So good!

Ответить
Figo Aranta
Figo Aranta - 30.05.2022 14:15

Hi Gaurav. Thank you so much for the video. I have one question tho. Say we have multiple caching instances, what tools can we use to distribute the calls from the web services to these global cache instances. One thing I have in mind is load balancer, but can load balancer be used in this scenario?

Ответить
Prasanth Raja
Prasanth Raja - 27.05.2022 10:08

Hi Guys, I am new to Redis Concept. I got a sudden requirement from client in one of my new service.
The Service is developed in Ruby technology. And The database it is using is EDW (snowflake). For cache purpose it is using Redis.
Now they are expecting me to do migrate from one Redis to another Redis.
Can you please someone help me what exactly that means?..

Ответить
bala srinivas
bala srinivas - 12.05.2022 00:05

It's like computer organization

Ответить
Seth Musselman
Seth Musselman - 02.05.2022 01:49

Misleading title. where is the distributed part?

Ответить
SYouTube name
SYouTube name - 01.05.2022 23:38

Teaching and learning are processes. Gaurav makes it fun to learn about stuff, then let it be systems or the egg dropping problem.
I might just take the InterviewReady course to participate in the interactive sessions.
Take a bow!

Ответить
Gustavo Rodrigues
Gustavo Rodrigues - 29.04.2022 23:01

Amazing Explanation!! Thanks!!

Ответить
Amber
Amber - 27.04.2022 18:59

<3

Ответить
Salman Mujtaba
Salman Mujtaba - 25.04.2022 05:30

I was squinting my eyes to look at the white board lol. Awesome video nonethelesss.

Ответить
Kevin Zehnder
Kevin Zehnder - 06.04.2022 18:00

learned a ton in this video thanks so much

Ответить
זכאים
זכאים - 24.03.2022 10:47

You didnt mentioned that with distributed cach , you can make microservices stateless!

Ответить