Shades: Expediting Kademlia’s Lookup Process Gil Einziger, Roy Friedman, Yoav Kantor Computer Science, Technion.

Download Report

Transcript Shades: Expediting Kademlia’s Lookup Process Gil Einziger, Roy Friedman, Yoav Kantor Computer Science, Technion.

Shades: Expediting
Kademlia’s Lookup Process
Gil Einziger, Roy Friedman, Yoav Kantor
Computer Science,
Technion
1
Kademlia Overview
Kademlia is nowadays implemented in many popular
file sharing applications like Bit-torrent, Gnutella,
and eMule.
Applications over Kademlia have 100’s of millions users
worldwide.
Invented in 2002 by Petar Maymounkov and David
Mazieres.
2
Kademlia is good
Kademlia has a number of desirable features not
simultaneously offered by any previous DHT.
– It minimizes the number of configuration messages
nodes must send to learn about each other. Easy to
maintain
– Configuration information spreads automatically as a
side-effect of key lookup. Easy to maintain
– Nodes have enough knowledge and flexibility to route
queries through low-latency paths. Fast Log(N) lookups
– Kademlia uses parallel, asynchronous queries to avoid
timeout delays from failed nodes.
Fault tolerant
3
Many ways to reach the
same value…
K possible peers to make
the first step.
The first peer returns k
other peers that are
closer to the value.
Each one of these peers
returns other closer
peers
And so on…
Until finally we reach
the k-closest nodes.
These nodes store the
actual value!
4
All roads lead to Rome…
Many users that
love Fry…
Please wait …
we’re all laptops
here.
Popular content
Many possible
routing paths…
But all of them lead to
the same k closest peers.
5
Latency
Our Goal:
the latency and
TheReduce
big picture
remain very easy to maintain.
Chord
Kademlia
Low latency DHTS
typically require
gossip to maintain a
large state.
Shades
Other DHTS are
easier to maintain,
but encounter longer
routing.
Overheads
Kelips
OneHop
6
Caching to the rescue!
Motivation: If a value is popular, we should be able
to hit a cached copy before reaching the k-closest
nodes.
Local Cache – After searching an item, cache it
locally. (Guangmin, 2009).
LC
KadCache – After searching an item, send it to the
last peer along the path.
KC
Kaleidoscope – Break symmetry using colors.
Designed to reduce message cost, and not latency.
7
Caching Internet Content
Frequency
• The access distribution of most content is skewed
▫ Often modeled using Zipf-like functions, power-law,
etc.
A small number of very popular
items
For example~(50% of the weight)
Long Heavy Tail
For example~(50% of the weight)
Rank
Caching Internet Content
Frequency
• Unpopular items can suddenly become popular and vice
versa.
Blackmail is such an ugly word. I
prefer "extortion".
The "X" makes it sound cool.
Rank
Shades overview
• Form a large distributed cache
from many nodes.
– Make sure these caches are accessible
early during the lookup.
• Single cache behavior –
– Admission policy
– Eviction policy.
10
Palette
The Palette provides a mapping from colors to nodes
of that color.
We want to have at least a single node, from every
color.
K- buckets
Palette
11
Shades in Brief
• Do the original Kademlia lookup and in
the same time, contact correctly
colored nodes from the palette.
Original routing advance
us towards the value.
12
Correctly colored nodes– are likely to
contain a cached copy of the value.
Multiple cache lookups
Problem: If the first routing step is not successful,
how can we get additional correctly colored nodes ?
Solution: Use the palette of contacted nodes!
Looking for
“bender” a
key.
Response
+
node.
13
Eviction and Admission Policies
Cache Victim
Eviction Policy
(Lazy LFU)
One of you guys
should leave…
New Item
Admission
Policy
Winner
TinyLFU
is the new item
any better than
the victim?
What is the common Answer?
TinyLFU: LFU Admission Policy
Keep inserting new items to the
histogram until #items = W
#items
2
1
3
4
2
2
1
1
10
7
9
8
5
Once #items
reaches W - divide
all counters by 2.
TinyLFU Example
Cache Victim
New Item
Eviction Policy
(Lazy LFU)
2
1
3
4
2
1
2
Admission
Policy
Winner
TinyLFU
Victim Score: 3
New Item Score: 2
Victim Wins!
What are we doing?
Approximate
Past
Future
It is much cheaper to maintain an
approximate view of the past.
TinyLFU operation
• Estimate(item):
MI-CBF
Bloom Filter
▫ Return BF.contains(item) +MI-CBF.estimate(item)
• Add(item):
▫ W++
▫ If(W == WindowSize)
 Reset()
▫ If(BF.contains(item))
Return MI-CBF.add(item)
BF.add(item)
Reset
•Divide W by 2,
•erase Bloom filter,
•divide all counters by 2.
(in MI-CBF).
Eviction Policy: Lazy LFU
Motivation: Efficient approximation of the LFU
eviction policy, in case that admission is rare.
“Search for the least frequently used item… in a
lazy manner”
A
7
B
6
Search item
C
8
Search item
D
5
Victim
Search item
E
2
F
17
Victim Get Victim 2
1
Get Victim 3
G
31
Search item
Victim
19
Shades Tradeoff
• What happens as the number
of colors increases?
We form larger distributed
caches.
But it is more difficult to fill
the palette.
22
Comparative results
• Emulation
– We run the actual implementation, sending and
receiving actual UDP packets. (Only the user is simulated)
• Scale - Different network sizes up to 5,000 Kademlia peers.
• Experimental settings: Each peer does:
• 500 requests warm-up.
• 500 requests measurement interval.
(Up to 2.5 Million find value requests in warm-up and
2.5 Million requests in measurement)
• Experiment generation:
Each peer receives a file with
1000 requests from the appropriate workload. All users
continuously play the requests.
23
Wikipedia trace
(Baaren & Pierre 2009)
“10% of all user requests issued
to Wikipedia during the period from September
19th 2007 to October 31th. “
YouTube trace
(Cheng et al, QOS 2008)
Weekly measurement of ~160k newly created
videos during a period of 21 weeks.
• We directly created a synthetic distribution for each week.
24
Comparative results
YouTube workload 100 items cache.
More queries are finished
sooner.
This is the ideal corrnerOther caching strategies
we want to complete as offer only a marginal
many of the lookups as reduction of the number of
contacted nodes.
soon as possible!
25
Comparative results
YouTube workload unbounded cache.
Shades is also better for
unbounded cache!
Notice that Shades_100 is
still better than other caches
with unbounded cache.
26
Comparative results
Wikipedia workload - 100 items cache.
27
Comparative results
Load is more balanced because frequent items
are found in a single step.
Similar message overheads to other
suggestions.
28
Conclusions
Latency improvement– up to 22-34% reduction of
median latency and 18-23% reduction of average
latency.
Better load distribution – Busiest nodes are
22-43% less congested – cached values are not close
to the stored values.
Reproducibility– Shades is an open source project :
https:// code.google.com/p/shades/
Kaleidoscope, KadCache and Local are released as
part of the open source project
OpenKad: https://code.google.com/p/openkad/.
Feel free to use them! 
29
The end:
Any questions ?
Thanks for listening!
30