0% found this document useful (0 votes)
7 views22 pages

Distributed Cache Management Strategies

Uploaded by

kapilguptansit
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views22 pages

Distributed Cache Management Strategies

Uploaded by

kapilguptansit
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

D

stri buted S

Lache
fast ↑einto promhereotherwise
checkache
-

dB
all
called Distributed Cache - amount of data
why we need to split the
data & store the
large
is too ,

data across several machines


is not
to ensure that data in the cache
Helps I cache is accessible
hardware failures
lost
during


-

ein network partition S


of
.

case
cache misses
It will minimize the number
of
calls to the datastor
and as a result no
of

① scalability
↑③① availability
Performance
mainwon functional requirements ① Iypersistance
s is imp
- about
think durability
start with a single
serve - need to

implement a

basic
in-memory
data store that
-

has limited capacity


&
use Liv Cache
hast table
using
limited
is
by
the maximum
hash table size
we need to aut datas which data should be wisted
more cache to
is an host O we can now
make each
host store

only a

chunk
of
data called
shard .

nence more
data can

be stored
memory >
-
-

memory
el

bandwidth
-

nigh
&

or
memory
-no Paring
& canscal
an
their
now rache client decide which shard to call
.
① Naive
approach

- cache hosth
go to
cache
add -high % of
whathappens of we a
muses
mode
cache host or some
new nence mod hashing
failures
&

dies, due to hardware voice


is a poor
to retrieve on tem calculate the hash, more backward
the host
clockwise to dent

·
Kash(key
host we calculate the hash of the
Adding new ,
a

we host and add it to the


ring , host 6 take

responsibley of
a
subset of key
and by
nost 4
nothing
changes jo
e nost
o
-

any
-

keyto
minimulneed
, we
That
renash
on server sudl, who
responsible for running all these
nash calculations I routing
selected cache
requests to the
host, its cache client
and
option give
management
i southel ofpipia
cache
-

tools like
to

chef, puppet to
deploy
,

modified file
we

every code
hosts
can use

to
in a

configuration
service host.
file -

need
simplest but not
flexible every
,
time lest
changes , to make
we
change
a a

deploy
we can
it out to
put file
every
in shared
service .

nost
Most To
semplify deployment
&

optionthe
2-
put file in shared hosto make service host
pol
service
,

you file periodically ,


we can use a dalmon process on
host thi
-

for
drawback- maintain the lest list time
cache host dus I or new one is added
manually update ,
the
, every
the
,

It would be to automate it
great
tion 39 coordination service discour cache nodes I monitor their health
op ,

whfguration
and sends heartbeatto the
achyregster
each service
the

heartbeats keptregistered in systemservice


long graps
As as come sorve is the
,
ache client the
of list cache server
from configuration
-

the "

implement higher operational cost


-
harder to
,
helps to
fully automate the list maintenance
scalabil .
present we can
memory
crate more shards
the shard become not want to
splet that shard
some a
of
may , we

nigh Availability is
network parte tion
*
not there
I a shard dies, or becomes unavailable due
all cache data for that shard is cost I all
to
- requests to the
shard will result in a cache miss
,
untel
keys are rehashed
,
We can do data
replication here
.
① set .

O
probabilistic protocols like gossip epidemic
,
broadcastFrees , bimodal
multicast, tend to
favor eventual consistency
.

① consensus protocols zor3


phase commits
,
panos, raft, chaiceptication

To keep simple, leader based replication


things we use
Now much casusto deal
&

with not shards ,


we

scale
by adding
out
can

ey of
read replicas be

tryto a
more

calls go
mas
through ne the
master
to
reconnect
allput
the
pies
throughca
get I to master connect
rep peats
S



livin
·

datacus
~ - cache
data
is still
available if
is
I data center
davon
Leader Election
D
kely separate component let's call it configuration service y
on a
avoid separate component
,
implement leader election cluster
a

in coche
, we wantto

is responsible for both leaders &


Configuration service
monitoring of followers &
-

expectedconfiguration

fall leads notworking as


ouyom
-

service can tepo

Its a distributed service


, usually consists of odd number of nodes (to achieve quorum) nodes ,
are located on machines that
fail independently (so that config service remains available in
case network partition . All nodes talk to each other

of
Top
usly
also
scepRedissentinal el

similar
we didn't achive free
better we don't
,high availibility
we do dath replication to nave
,
want to wait until leader sover replicates data to all the followers
performance
,

and ifleader datafailed beforrepwation


is o a
sever got
the data
,
first priority isfast
,
such cache misses are acceptable

consistency
& availabley
favors performance
cache
data replication
↑ over consistency
leads to asym
. if client
cache inconsistency or def lest of have
but
servers ,
we can solve these issues

will increase latency complexity of the


a
> we
may add TTL
, to
.
system
cleanup we can
X
passively expire. ie
it
when client tries
to access
,
the item is expired don't
,

use it
Active expiration I keep
beg
a
-

maintainance thread to cleanup

expired
items ↑
some probalisti
- when
used for , this
algo's are

saval iteme are tested


cache to the
local I remoe Cache add
services oftencache
-

use ,

client , so that
service don't need to V
can be used
or
googa guava

accessed rusted
not optimizedinside
for securely only
, by dono
fausted environments
-

-
clients ,
10 internet use firewall
expose
- ,

encryption decrypt
&
do data
- cotth performance (
absolutely implication
-

if exposed
required as &

serve
a
T
Metrics D Nodjautte while
calling the cade
E
&

catency 3) nets o messes u CPU ,

- memory velization on cache nosts


,
network/O

when recent
loge
who accessed
clint a
Cache
a
pronya that will set blo ideally cache
client
software
clients
should
be
simple dumb,introduce
& eche serves I will be responsible for
eache shald
picking
Twen twitte
proxy
-

make cache servers puck the shald


,
client can send
request to any cache
serves ,
server applies consistent
nashing I sends to appropriate shold

consistent has
add same serve to my angthe
can cause
multiple
domino
time
effect
(Jumphan
op by google
proportionalhas his -Yahoo)

You might also like