05 Naming
05 Naming
Systems
CPSC 5520
Kevin Lundeen
Naming
What is naming?
Name Architectures
Hierarchical
Namespace
Example
DNS
Domain Name System
One of the most successful and longest-lived distributed system
desktop.seattleu.edu.
Before DNS
• Talk to Jake Feinler at Stanford
Research Institute! (Actually talk…)
• In the 1970’s, she’d add your host
name and its IP address to her
HOSTS.TXT file
• Don’t have an IP address? Talk to Jon
Postel at USC
• Then folks would occasionally take
the updated version via file sharing
(ftp)
• Or they might put their own name
for your server in their HOSTS.TXT
• There were no domains
By Elizabeth Feinler - Elizabeth Feinler (subject), CC BY-SA 3.0,
including .EDU
A colleague of Postel’s, Paul Mockapetris, invented DNS in early 1980’s
DNS Conceptual Architecture
• Name
• Domain labels delimited by dots
• Labels are composed of Roman letters, digits, and hyphen (up to 63 characters)
• Meant to be human-meaningful
• Can use “punycode” encoding to allow general unicode for “internationalized domain
names”
• Read from right to left, the dot signifies a “within” relation with its parent
domain
• Final (often-omitted) dot connects to the root domain
• Last (right-most) domain is a top-level domain (TLD) and intended to be one
of a sparse set: edu, org, com, mil, gov, etc.
• Subdomain of arbitrary depth is to the left of TLD
• Limited to max 253 characters including the dots
DNS
Conceptual
Architecture
(continued)
• How does DNS stack up with our 4-prong distributed system design
criteria from Chapter 1?
1. Support sharing of resources
Gives a distributed database of most hosts on the internet
2. Distribution transparency
Resolver seems to ”just work” for typical user
Access, Location, Relocation, Replication, Concurrency Transparency
(What about migration and failure transparency?)
3. Openness
Very open framework. Note incorporation into many other protocols (e.g. HTTP)
4. Scalability
Size Scalable: Over a billion named hosts and counting
Geographically Scalable: Worldwide
Administratively Scalable: ICANN, registries, local administration
DNS
Walkthrough
Application wants to know IP
address of fu.bar.goober.com
hsd1.wa.comcast.net
75.75.75.75
ISP’s Recursive Name
Local resolver Server
(sponsored
by O/S)
Local
Local /etc/ cache
cache resolve.conf
• Transport Protocol
• Usually UDP
• But TCP is used to address larger packets, security, etc.
• Failures
• Security
• Reverse lookup
• Have IP, but want to know corresponding host name
• Often done through tricky special domains
35.105.184.in-addr.arpa
• Blacklisting
• Similar idea
Distributed
Hash
Tables
Typical Flat
Namespace
The DHT Implementation
Hashing
• Hash function:
• Just something convenient
• Most OO languages require a hash() method and provide some decent ones
• Many hash functions are poorly distributed
• “Use the memory address” – aligned on 8-byte boundaries and within a very small range
• “Use a checksum” – empty and small objects clump up
• Bucket mapper:
• Usually just modulo bucket count
• This is a great workaround for poorly distributed hash functions!
• When buckets get too full?
• Require a priori knowledge of size
• Or, every once in a while, dramatically increase the bucket count
• With the modulo bucket mapper, this means nearly every object moves to a new bucket
Naïve Hash Tables
h(key) % 7 == 0
Bucket
Address hashes: 0, 7, 14, 21, 28, …
Table
[0] h(key) % 7 == 1
[1]
hashes: 1, 8, 15, 22, 29, …
[2]
[3]
[4] h(key) % 7 == 2
[5] hashes: 2, 9, 16, 23, 30, …
[6]
h(key) % 7 == 6
• Each bucket has a key, too, and is similarly hashed to find where it
belongs
• Each bucket is responsible for the range of hash codes from its own hash up
to the next greater one
• Next one is called the successor, for the bucket which hashes to h,
• This allows us to add any new bucket, anytime
• just move any objects from predecessor bucket with hash codes ≥ new
bucket’s hash code
• Usually depicted and modeled as a circle of buckets
• The starting range (0 to the first bucket) is given to the last bucket
• Removing a node is similarly easy
• But if it just fails without warning, well then we need some scheme for the
objects to migrate even though their bucket is dead
• Usually done with replicas in adjacent nodes
Consistent
Hashing
2160 0
bu
ck
et
2 147
+9
92
bucket 2
5
3
bu
bu
ck
ck
e
et
bucket 281 + 17
t21
53
2
03
DHT Overlays
10:49
:48
:47
:46
The End of Naming!