The BitTorrent protocol
A peer-to-peer file sharing
protocol.
Problem Addressed
• How do we transfer a piece of data quickly
to a group of people interested in it.
– Web server
– Distributors
– Redhat patches
• Soln: BitTorrent based file swarming
Philosophy
• Author: Bram Cohen
• Based on Tit-for-tat
• Incentive - Uploading while downloading
• Pieces of files
Overall Architecture
Web Server Tracker
Web page
with link
to .torrent
nt
.torre
C
A
Peer
Peer [Seed]
B
[Leech]
Downloader Peer
“US” [Leech]
Overall Architecture
Web Server Tracker
Web page
with link
to .torrent
nce
u
nno
et-a
G
C
A
Peer
Peer [Seed]
B
[Leech]
Downloader Peer
“US” [Leech]
Overall Architecture
Web Server Tracker
Web page
with link
to .torrent
l i st
eer
e-p
ons
esp
R
C
A
Peer
Peer [Seed]
B
[Leech]
Downloader Peer
“US” [Leech]
Overall Architecture
Web Server Tracker
Web page
with link
to .torrent
Shake-hand
C
A
Sh Peer
ak
Peer e-h [Seed]
an
d B
[Leech]
Downloader Peer
“US” [Leech]
Overall Architecture
Web Server Tracker
Web page
with link
to .torrent
pieces
C
A pie
ce
s Peer
Peer [Seed]
B
[Leech]
Downloader Peer
“US” [Leech]
Overall Architecture
Web Server Tracker
Web page
with link
to .torrent
pieces
C
A pie
ce
s Peer
pie
Peer ce [Seed]
s
B
[Leech]
Downloader Peer
“US” [Leech]
Overall Architecture
Web Server Tracker
Web page
with link
to .torrent
n ce
u
n no st
t -a l i
Ge eer
-p
nse
o
e sp pieces
R
C
A pie
ce
s Peer
pie
Peer ce [Seed]
s
B
[Leech]
Downloader Peer
“US” [Leech]
Messages
• Peer – Peer messages
– TCP Sockets
• Peer – Tracker messages
– HTTP Request/Response
• B-encoding
.torrent
• url of the tracker
• Pieces <hash1,hash2,….hashn>
• Piece length
• Name
• Length
• Files
– Path
– length
Tracker
• Peer cache
– IP, port, peer id
• State information
– Completed
– Downloading
• Returns random list
Peer Operation
• Choking algorithm
– Choke/Unchoke
– Preferred peers
– Optimistic unchoke
– Snubbing behavior
• Prevented by Anti-snubbing.
• Upload to interested peers who are not
choking.
Peer Operation
• Verify on receiving complete piece
• Endgame Behavior
– Cancel
Experimental Client
Strengths
• Better bandwidth utilization
– Never before speeds.
• Up to 7 MB/s from the Internet.
• Limit free riding – tit-for-tat
• Limit leech attack – coupling upload &
download
• Spurious files not propagated
• Ability to resume a download
Drawbacks
• Small files – latency, overhead
• Random list of peers - naive
• Scalability
– Millions of peers – Tracker behavior (uses 1/1000 of
bandwidth)
– Single point of failure
• Robustness
– System progress dependent on altruistic nature of
seeds (and peers)
– Malicious attacks and leeches.
MNL’s Interest
• Robustness
– Devise possible attacks and find loopholes
– Secure against attacks
• Scalability
– Sharing across files
– Millions of users
• Possible extensions
– Peer optimization
• Upload just enough to maximize your download.
– Intelligent tracker
• Peer selection policy
– Dead sites
• Share html content
Optimism - hack
• Connect to as many peers as possible
• Benefit
– Optimistic unchoking
– Probability of free download increases
Peer upload optimization
• Upload enough to
stay within the
preferred list of as
many peers as download
possible
• Get the best
download deal with upload
minimum required
upload
Smarter tracker
• Classify peers
• Pick at random from Peers
each of these subsets
Fast Slow Completed
• No compromise on
random choice
• Will lead to a more
progressive peer
network.
Interesting links
• Official site: [Link]
• BitTorrent FAQ: [Link]
• Torrent sites
– [Link]
– [Link]
– [Link]
Remember
– leave your download windows open
– Big brother is watching!