CSE 123b Communications Software Lecture 13: Load ... · Some slides courtesy Srini Seshan. May 20,...
Transcript of CSE 123b Communications Software Lecture 13: Load ... · Some slides courtesy Srini Seshan. May 20,...
CS
E 1
23b
CS
E 1
23b
Com
mun
icat
ions
Sof
twar
eC
omm
unic
atio
ns S
oftw
are
Spr
ing
2003
Spr
ing
2003
Lect
ure
13: L
oad
Bal
anci
ng/C
onte
nt D
istri
butio
n Le
ctur
e 13
: Loa
d B
alan
cing
/Con
tent
Dis
tribu
tion
Net
wor
ks (p
lus
som
e ot
her a
pplic
atio
ns)
Net
wor
ks (p
lus
som
e ot
her a
pplic
atio
ns)
Ste
fan
Sav
age
Ste
fan
Sav
age
Som
e sl
ides
cou
rtes
y Sr
iniS
esha
n
May
20,
200
3C
SE 1
23b
–Le
ctur
e 13
–C
onte
nt D
istr
ibut
ion
+Mis
c2
Tod
ay’s
cla
ssT
oday
’s c
lass
Qui
ck e
xam
ples
of o
ther
app
licat
ion
prot
ocol
s◆
Mai
l, te
lnet
, NFS
Load
Bal
anci
ng a
nd C
onte
nt D
istri
butio
n N
etw
orks
(CD
N)
May
20,
200
3C
SE 1
23b
–Le
ctur
e 13
–C
onte
nt D
istr
ibut
ion
+Mis
c3
Qui
ck d
escr
ipti
ons
of s
ome
othe
r Q
uick
des
crip
tion
s of
som
e ot
her
sam
ple
appl
icat
ions
sam
ple
appl
icat
ions
Sen
ding
E-m
ail
◆S
MTP
Rem
ote
term
inal
◆Te
lnet
, SS
H
Dis
tribu
ted
File
Sys
tem
s◆
NFS
May
20,
200
3C
SE 1
23b
–Le
ctur
e 13
–C
onte
nt D
istr
ibut
ion
+Mis
c4
Sim
ple
Mes
sage
Tra
nsfe
r S
impl
e M
essa
ge T
rans
fer
Pro
toco
l (S
MT
P)
Pro
toco
l (S
MT
P)
Like
HTT
P: T
CP
con
nect
ion
(por
t 25)
, AS
CII
strin
g co
mm
ands
Sam
ple
sess
ion:
HEL
O c
s.uc
sd.e
duH
ello
cs.
ucsd
.edu
[132
.239
.4.6
4]M
AIL
FR
OM
: sav
age@
cs.u
csd.
edu
250
OK
RC
PT T
O: j
oe@
cs.b
erke
ley.
edu
250
OK
DA
TA35
4 S
tartu
p m
ail i
nput
; end
with
<C
RLF
>.<C
RLF
>H
i Joe
… h
ow’re
you
doi
ng?
<CR
LF><
CR
LF>
250
OK
QU
IT22
1 C
losi
ng c
onne
ctio
n
May
20,
200
3C
SE 1
23b
–Le
ctur
e 13
–C
onte
nt D
istr
ibut
ion
+Mis
c5
Tel
net
Tel
net
TCP
-bas
ed p
roto
col (
port
23)
◆Te
lnet
clie
nt a
nd te
lnet
ser
ver
Firs
t neg
otia
te c
apab
ilitie
s (e
.g. t
erm
inal
siz
e, s
peed
, lin
e an
d a
time
vsch
arac
ter a
t a ti
me,
etc
.)Th
en s
impl
y se
nd k
eyst
roke
s fro
m c
lient
to s
erve
r and
se
nd d
ata
strin
gs fr
om s
erve
r to
clie
nt◆
Cha
ract
ers
trans
mitt
ed a
s 7
bits
(8th
bit 0
)◆
In-b
and
sign
allin
g»
Byt
e 0x
ff m
eans
“int
erpr
et a
s co
mm
and”
»W
hat i
f you
nee
d to
sen
d th
e sy
mbo
l 0xf
f? S
end
it tw
ice.
◆Tu
rn o
ff de
laye
d ac
ks?
May
20,
200
3C
SE 1
23b
–Le
ctur
e 13
–C
onte
nt D
istr
ibut
ion
+Mis
c6
Net
wor
k Fi
le S
yste
m (
NFS
)N
etw
ork
File
Sys
tem
(N
FS)
UD
P-b
ased
pro
toco
l
Rem
ote
Pro
cedu
re C
all (
RP
C) d
esig
n◆
RE
AD
, WR
ITE
, LO
OK
UP
, RE
MO
VE
, RE
NA
ME
, M
KD
IR, e
tc…
◆H
eade
r des
crib
es m
etho
d an
d da
ta ty
pes,
follo
wed
by
dat
a◆
All
requ
ests
fit i
n a
sing
le U
DP
dat
agra
m (u
p to
8k
in v
2, 6
4k in
V3)
; fra
gmen
tatio
n◆
Err
ors
in d
ata
stre
am?
◆S
ecur
ity?
May
20,
200
3C
SE 1
23b
–Le
ctur
e 13
–C
onte
nt D
istr
ibut
ion
+Mis
c7
Load
Bal
anci
ng/
Load
Bal
anci
ng/
Con
tent
Dis
trib
utio
nC
onte
nt D
istr
ibut
ion
Goa
l: Im
prov
e pe
rform
ance
/sca
labi
lity
for d
ownl
oadi
ng
cont
ent (
i.e. W
eb p
ages
)A
ppro
ach:
Rep
licat
e co
nten
t (pa
rticu
larly
Web
con
tent
) on
man
y se
rver
s
Cha
lleng
es◆
How
to re
plic
ate
cont
ent
◆W
here
to re
plic
ate
cont
ent
◆H
ow to
find
repl
icat
ed c
onte
nt◆
How
to c
hoos
e am
ong
know
n re
plic
as◆
How
to d
irect
clie
nts
tow
ards
repl
ica
»D
NS
, HTT
P 3
04 re
spon
se, a
nyca
st, e
tc.
Con
gent
Dis
tribu
tion
Net
wor
ks: A
kam
ai
May
20,
200
3C
SE 1
23b
–Le
ctur
e 13
–C
onte
nt D
istr
ibut
ion
+Mis
c8
How
to
repl
icat
e co
nten
tH
ow t
o re
plic
ate
cont
ent
Pus
h m
odel
◆P
roac
tivel
y co
py c
onte
nt to
spe
cific
repl
icas
◆H
ow to
cho
ose
thes
e?
Pul
l mod
el◆
Rea
ctiv
ely
repl
icat
e co
nten
t to
node
s th
at re
ques
t it
◆C
onte
nt is
repl
icat
ed to
pla
ces
whe
re it
is p
opul
ar
May
20,
200
3C
SE 1
23b
–Le
ctur
e 13
–C
onte
nt D
istr
ibut
ion
+Mis
c9
Ser
ver
Sel
ecti
onS
erve
r S
elec
tion
How
do
dire
ct c
lient
s to
a p
artic
ular
ser
ver?
◆A
s pa
rt of
rout
ing
anyc
ast,
clus
ter l
oad
bala
ncin
g◆
As
part
of a
pplic
atio
n H
TTP
redi
rect
◆A
s pa
rt of
nam
ing
DN
S
Whi
chse
rver
?◆
Low
est l
oad
to b
alan
ce lo
ad o
n se
rver
s◆
Bes
t per
form
ance
to
impr
ove
clie
nt p
erfo
rman
ce»
Bas
ed o
n G
eogr
aphy
? R
TT?
Thro
ughp
ut?
Load
?◆
Any
aliv
e no
de
to p
rovi
de fa
ult t
oler
ance
May
20,
200
3C
SE 1
23b
–Le
ctur
e 13
–C
onte
nt D
istr
ibut
ion
+Mis
c10
Rou
ting
Bas
ed
Rou
ting
Bas
ed
Any
cast
◆G
ive
serv
ice
a si
ngle
IP a
ddre
ss◆
Eac
h no
de im
plem
entin
g se
rvic
e ad
verti
ses
rout
e to
add
ress
◆P
acke
ts g
et ro
uted
rout
ed fr
om c
lient
to “c
lose
st”
serv
ice
node
»Closest
is d
efin
ed b
y ro
utin
g m
etric
s»
May
not
mirr
or p
erfo
rman
ce/a
pplic
atio
n ne
eds
◆Th
is is
don
e to
day
(som
etim
es b
y ac
cide
nt)
May
20,
200
3C
SE 1
23b
–Le
ctur
e 13
–C
onte
nt D
istr
ibut
ion
+Mis
c11
Rou
ting
Bas
edR
outi
ng B
ased
Clu
ster
load
bal
anci
ng◆
Rou
ter i
n fro
nt o
f clu
ster
of n
odes
dire
cts
pack
ets
to
serv
er◆
Mus
t be
done
on
conn
ectio
n by
con
nect
ion
basi
s –
why
?»
Forc
es ro
uter
to k
eep
per c
onne
ctio
n st
ate
◆H
ow to
cho
ose
serv
er»
Eas
iest
to d
ecid
e ba
sed
on a
rriva
l of f
irst p
acke
t in
exch
ange
»P
rimar
ily b
ased
on
loca
l loa
d»
Can
be
base
d on
late
r pac
kets
(e.g
. HTT
P G
et re
ques
t) bu
t mak
es s
yste
m m
ore
com
plex
May
20,
200
3C
SE 1
23b
–Le
ctur
e 13
–C
onte
nt D
istr
ibut
ion
+Mis
c12
App
licat
ion
Bas
edA
pplic
atio
n B
ased
HTT
P s
uppo
rt si
mpl
e w
ay to
indi
cate
that
Web
pag
e ha
s m
oved
Ser
ver r
ecei
ves
GE
T re
ques
t fro
m c
lient
◆D
ecid
es w
hich
ser
ver i
s be
st s
uite
d fo
r par
ticul
ar c
lient
and
ob
ject
◆R
etur
ns H
TTP
redi
rect
to th
at s
erve
rC
an m
ake
info
rmed
app
licat
ion
spec
ific
deci
sion
May
intro
duce
add
ition
al o
verh
ead
mul
tiple
co
nnec
tion
setu
p, n
ame
look
ups,
etc
.
May
20,
200
3C
SE 1
23b
–Le
ctur
e 13
–C
onte
nt D
istr
ibut
ion
+Mis
c13
Nam
ing
Bas
edN
amin
g B
ased
Clie
nt d
oes
nam
e lo
okup
for s
ervi
ceN
ame
serv
er c
hoos
es a
ppro
pria
te s
erve
r ad
dres
sW
hat i
nfor
mat
ion
can
it ba
se d
ecis
ion
on?
◆S
erve
r loa
d/lo
catio
n m
ust b
e co
llect
ed◆
Sou
rce
addr
ess
in D
NS
requ
est
◆R
ound
-rob
in»
Ran
dom
ly c
hoos
e re
plic
a»
Avo
id h
ot-s
pots
◆[S
emi-]
stat
ic m
etric
s»
Geo
grap
hy»
Rou
te m
etric
s
May
20,
200
3C
SE 1
23b
–Le
ctur
e 13
–C
onte
nt D
istr
ibut
ion
+Mis
c14
Nam
ing
Bas
edN
amin
g B
ased
Pre
dict
ed a
pplic
atio
n pe
rform
ance
◆H
ow to
pre
dict
? ◆
Onl
y ha
ve li
mite
d in
fo a
t nam
e re
solu
tion
Mul
tiple
tech
niqu
es◆
Sta
tic m
etric
s to
get
coa
rse
grai
n an
swer
»E
.g. W
est C
oast
vs
Eas
t Cos
t◆
Cur
rent
per
form
ance
am
ong
smal
ler g
roup
»E
.g. W
hich
Wes
t Coa
st s
erve
r is
leas
t loa
ded
How
doe
s th
is a
ffect
DN
S c
achi
ng?
◆Ty
pica
lly w
ant l
ow T
TL to
ada
pt to
load
cha
nges
◆W
hat d
o th
e fir
st a
nd s
ubse
quen
t loo
kups
do?
May
20,
200
3C
SE 1
23b
–Le
ctur
e 13
–C
onte
nt D
istr
ibut
ion
+Mis
c15
How
H
ow A
kam
aiA
kam
aiW
orks
Wor
ksC
onte
nt is
pre
pare
d by
rew
ritin
g U
RLs
for
repl
icat
ed c
onte
nt◆
<im
gsr
c=“h
ttp://
cnn.
com
/af/x
.gif”
> re
plac
ed w
ith <
img
src=
“http
://a7
3.g.
akam
aite
ch.n
et/7
/23/
cnn.
com
/af/x
.gif
”>
Clie
nts
fetc
h ht
ml d
ocum
ent f
rom
ser
ver
◆E
.g. f
etch
inde
x.ht
ml f
rom
cnn
.com
Clie
nt i
s fo
rced
to re
solv
e aX
YZ.
g.ak
amai
tech
.net
host
nam
e fo
r rep
licat
ed
cont
ent
May
20,
200
3C
SE 1
23b
–Le
ctur
e 13
–C
onte
nt D
istr
ibut
ion
+Mis
c16
How
H
ow A
kam
aiA
kam
aiW
orks
Wor
ksgT
LD/ro
ot s
erve
r giv
es N
S re
cord
for
akam
ai.n
etA
kam
ai.n
etna
me
serv
er re
turn
s N
S re
cord
for
g.ak
amai
tech
.net
◆N
ame
serv
er c
hose
n to
be
in re
gion
of c
lient
’s n
ame
serv
er (b
ased
on
IP a
ddre
ss o
f req
uest
)◆
TTL
is la
rge
G.a
kam
aite
ch.n
etna
me
serv
er c
hose
sa
cont
ent s
erve
r in
regi
on a
nd re
turn
s it
to c
lient
◆U
ses
aXY
Zna
me
& h
ash
func
tion
over
requ
est t
o pi
ck◆
TTL
is s
mal
l
May
20,
200
3C
SE 1
23b
–Le
ctur
e 13
–C
onte
nt D
istr
ibut
ion
+Mis
c17
Aka
mai
Aka
mai
Con
tent
Ser
vers
Con
tent
Ser
vers
Are
real
ly c
ache
s◆
Mod
ified
nam
e co
ntai
ns fi
le n
ame
◆If
cont
ent s
erve
r doe
sn’t
have
that
obj
ect t
hen
it is
re
ques
ted
from
prim
ary
serv
er a
nd c
ache
dTr
icky
issu
e is
sel
ectin
g w
hich
loca
l con
tent
se
rver
to u
se fo
r a p
artic
ular
requ
est
◆W
ant t
o sp
read
load
eve
nly
◆B
ut w
ant m
inim
al im
pact
if s
erve
r is
adde
d or
re
mov
ed
May
20,
200
3C
SE 1
23b
–Le
ctur
e 13
–C
onte
nt D
istr
ibut
ion
+Mis
c18
Naï
ve a
ppro
ach:
Con
tent
has
hing
Naï
ve a
ppro
ach:
Con
tent
has
hing
Bas
ic id
ea: h
ash
page
s ac
cord
ing
to th
eir
asso
ciat
ed k
eys
Stra
ight
forw
ard
solu
tion
◆A
ssum
e m
cach
es (s
erve
rs),
1, 2
, …, m
◆S
tore
pag
e w
ith k
ey x
on c
ache
(ax
+ b)
mod
mA
dvan
tage
s:◆
Load
bal
anci
ng: e
ach
cach
e st
ores
roug
hly
the
sam
e nu
mbe
r of p
ages
◆P
age
loca
tion:
a c
lient
can
eas
ily lo
cate
the
cach
e st
orin
g a
parti
cula
r pag
e
May
20,
200
3C
SE 1
23b
–Le
ctur
e 13
–C
onte
nt D
istr
ibut
ion
+Mis
c19
But
…B
ut…
Wha
t hap
pens
whe
n th
e nu
mbe
r of c
ache
s ch
ange
?◆
Virt
ually
eve
ry p
age
will
cha
nge
its lo
catio
n!»
(ax
+ b)
mod
m
(ax
+ b)
mod
(m+
1)
Wha
t hap
pens
whe
n a
user
kno
w o
nly
a su
bset
of
cach
es (i
.e.,
user
s ha
ve d
iffer
ent v
iew
s) ?
◆E
ach
user
will
look
on
a di
ffere
nt c
ache
for t
he s
ame
page
a=
2b
= 1
m=
3x
= 5
k =(
5*2+
1) m
od 3
= 2
12
35
12
351
23
5
May
20,
200
3C
SE 1
23b
–Le
ctur
e 13
–C
onte
nt D
istr
ibut
ion
+Mis
c20
Sol
utio
n: C
onsi
sten
t H
ashi
ngS
olut
ion:
Con
sist
ent
Has
hing
Ass
ume
◆E
ach
cach
e (s
erve
r) is
iden
tifie
d by
an
idun
iform
ly
dist
ribut
ed in
rang
e [0
, 1]
◆Th
e ke
y of
eac
h pa
ge is
uni
form
ly d
istri
bute
d w
ithin
th
e sa
me
rang
e [0
, 1]
A p
age
is s
tore
d to
the
cach
e (s
erve
r) w
hich
is
the
clos
esti
n th
e id
entif
ier s
pace
cach
epa
ges
May
20,
200
3C
SE 1
23b
–Le
ctur
e 13
–C
onte
nt D
istr
ibut
ion
+Mis
c21
Con
sist
ent
Has
h C
onsi
sten
t H
ash
––A
dvan
tage
sA
dvan
tage
sM
onot
one
addi
tion
of b
ucke
t doe
s no
t cau
se
mov
emen
t bet
wee
n ex
istin
g bu
cket
s
Spr
ead
& L
oad
smal
l set
of b
ucke
ts th
at li
e ne
ar
obje
ct
Bal
ance
no
buc
ket i
s re
spon
sibl
e fo
r lar
ge p
ortio
n of
uni
t int
erva
l
May
20,
200
3C
SE 1
23b
–Le
ctur
e 13
–C
onte
nt D
istr
ibut
ion
+Mis
c22
Aka
mai
Aka
mai
Exa
mpl
eE
xam
ple
End-
user
cnn.
com
(con
tent
pro
vide
r)D
NS
root
ser
ver
Aka
mai
serv
er
12
3
4
Aka
mai
high
-leve
l DN
S s
erve
r
Akam
ailo
w-le
vel D
NS
ser
ver
Clo
sest
Aka
mai
serv
er
11
6 7 8
9 10
Get
in
dex.
htm
l
Get
/cnn
.com
/foo.
jpg
12
Get
foo.
jpg
5
May
20,
200
3C
SE 1
23b
–Le
ctur
e 13
–C
onte
nt D
istr
ibut
ion
+Mis
c23
Aka
mai
Aka
mai
––S
ubse
quen
t S
ubse
quen
t R
eque
sts
Req
uest
s
End-
user
cnn.
com
(con
tent
pro
vide
r)D
NS
root
ser
ver
Aka
mai
serv
er
12
Aka
mai
high
-leve
l DN
S s
erve
r
Akam
ailo
w-le
vel D
NS
ser
ver
Clo
sest
Aka
mai
serv
er
7 8
9 10
Get
in
dex.
htm
l
Get
/cnn
.com
/foo.
jpg
May
20,
200
3C
SE 1
23b
–Le
ctur
e 13
–C
onte
nt D
istr
ibut
ion
+Mis
c24
Cav
eats
Cav
eats
App
roac
h on
ly a
pplie
s to
sta
tic o
bjec
ts◆
Am
azon
Web
pag
e is
diff
eren
t for
eve
ryon
eA
ssum
es IP
add
ress
of D
NS
requ
est i
s co
rrec
tN
eed
good
met
ric to
cap
ture
“clo
sene
ss” i
n ne
twor
k to
get
bes
t per
form
ance
Bas
ed o
n “p
ull”-
mod
el…
wha
t abo
ut s
udde
nly
popu
lar c
onte
nt?
How
ever
, in
prac
tice,
is v
ery
effe
ctiv
e
May
20,
200
3C
SE 1
23b
–Le
ctur
e 13
–C
onte
nt D
istr
ibut
ion
+Mis
c25
Sum
mar
yS
umm
ary
Con
tent
dis
tribu
tion
& L
oad
Bal
anci
ng◆
Rep
licat
e co
nten
t to
impr
ove
resp
onse
tim
e/ov
erhe
ad
Issu
es◆
How
to re
plic
ate
cont
ent
◆H
ow to
sel
ect b
est r
eplic
a◆
How
to d
irect
clie
nt to
repl
ica
May
20,
200
3C
SE 1
23b
–Le
ctur
e 13
–C
onte
nt D
istr
ibut
ion
+Mis
c26
Nex
t ti
me…
Nex
t ti
me…
Pee
r-to
-pee
r net
wor
ks◆
Nap
ster
, Gnu
tella
, KaZ
aA, C
hord
/CFS
, etc
.