课件5 Introduction to Telecommunication Networks
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
2009 Michael Rabbat
Sending Chunks: tit-for-tat • Alice sends chunks to four neighbors currently sending her chunks at the highest rate • re-evaluate top 4 every 10 secs • every 30 secs: randomly select another peer, starts sending chunks • newly chosen peer may join top 4
2009 Michael Rabbat
Circle DHT (2)
O(N) messages on avg to resolve query, when there are N peers
1111
1110 1110
0001
I am
Who’s resp for key 1110 ?
0011
0100
1110
• Each peer keeps track of IP addresses of predecessor, successor, short cuts. • Reduced from 6 to 2 messages. • Possible to design shortcuts so O(log N) neighbors, O(log N) messages in query
• key = 13, then successor peer = 14 • key = 15, then successor peer = 1
2009 Michael Rabbat
Circular DHT (1)
1 3 4 12 10 5 8
15
• Each peer only aware of immediate successor and predecessor. • “Overlay network”
10
ECSE 414, Lecture 5
BitTorrent: Tit-for-tat
(1) Alice “optimistically unchokes” Bob (2) Alice becomes one of Bob’s top-four providers; Bob reciprocates (3) Bob becomes one of Alice’s top-four providers
1100
1110 1110 1110
0101
Define closest as closest successor
2009 Michael Rabbat
1010
1000
Circular DHT with Shortcuts
1 3 15 4 12 10 5 8 Who’s resp for key 1110?
2009 Michael Rabbat
How to assign keys to peers?
• Central issue:
• Assigning (key, value) pairs to peers.
• Rule: assign key to the peer that has the closest ID. • Convention: closest is the immediate successor of the key. • Ex: n=4; peers: 1,3,4,5,8,10,12,14;
• Thursday, October 8, during regular class time
2009 Michael Rabbat
ECSE 414, Lecture 5
2
Topics for Today
• Peer-to-peer applications • Application programming with Sockets
2009 Michael Rabbat
ECSE 414, Lecture 5
4
Client-server: file distribution time
Server
• server sequentially sends N copies:
• NF/us time
F
dN uN
us
u1 d1 u2
Lecture 5 Application Layer
Peer-to-Peer Applications, Sockets ECSE 414 – Fall 2009
Announcements
• Project groups
• Form teams of 5-6 • Message me (WebCT) ASAP • Project topics announced by Thursday
peer
2009 Michael Rabbat ECSE 414, Lecture 5 8
BitTorrent (1)
• file divided into 256KB chunks. • peer joining torrent: • has no chunks, but will accumulate them over time • registers with tracker to get list of peers, connects to subset of peers (“neighbors”) • while downloading, peer uploads chunks to other peers. • peers may come and go • once peer has entire file, it may (selfishly) leave or (altruistically) remain
• Peers can also insert (key, value) peers
2009 Michael Rabbat
DHT Identifiers
• Assign integer identifier to each peer in range [0,2n-1].
• Each identifier can be represented by n bits.
• key: hash of file name; value: IP address of holder • key: TorrentID; value: list of active peers
• Peers query DB with key
• DB returns values that match the key
2009 Michael Rabbat
ECSE 414, Lecture 5
3
Comparing Client-server, P2P architectures
Question : How much time distribute file initially at one server to N other computers?
2009 Michael Rabbat ECSE 414, Lecture 5 9
BitTorrent (2)
Pulling Chunks • at any given time, different peers have different subsets of file chunks • periodically, a peer (Alice) asks each neighbor for list of chunks that they have. • Alice issues requests for her missing chunks • rarest first
2009 Michael Rabbat
increases linearly in N ECSE 414, (for5 large N) Lecture
5
P2P: file distribution time
Server
• server must send one F u1 d1 u2 d2 copy: F/us time us • client i takes F/di time to Network (with dN download abundant bandwidth) uN • NF bits must be downloaded (aggregate) • fastest possible upload rate (assuming all nodes sending file chunks to same peer): us + Σui
i=1,N
dP2P = max { F/us, F/min(di) , NF/(us + Σui) }
i
i=1,N
2009 Michael Rabbat ECSE 414, Lecture 5 6
Comparing Client-server, P2P architectures
P2Pwenku.baidu.comCase Study: BitTorrent
• Require each key to be an integer in same range. • To get integer keys, hash original key.
• eg, key = h(“Led Zeppelin IV”) • This is why they call it a distributed “hash” table
Server u1 d1 u2 d2
us: server upload bandwidth ui: client/peer i upload bandwidth di: client/peer i download bandwidth
File, size F dN uN
us
Network (with abundant bandwidth)
• P2P file distribution
tracker: tracks peers participating in torrent
torrent: group of peers exchanging chunks of a file
obtain list of peers trading chunks
d2
• client i takes F/di time to download
Network (with abundant bandwidth)
Time to distribute F to N clients using = dcs = max { NF/us, F/min(di) } i client/server approach
2009 Michael Rabbat
1
Peer Churn
3 4
15
12 10
• To handle peer churn, require each peer to know the IP address of its two successors. • Each peer periodically pings its two successors to see if they are still alive.
• Homework Assignment #1 due Thursday, Sep 17 • No Tutorial sections • Instead: TA Office hours (starting today) • Midterm exam
• Mondays and Tuesdays, 1:30pm-2:30pm, ENGTR 4105
With higher upload rate, can find better trading partners & get file faster!
2009 Michael Rabbat 2: Application Layer 11
Distributed Hash Table (DHT)
• DHT = distributed P2P database • Database has (key, value) pairs;
Sending Chunks: tit-for-tat • Alice sends chunks to four neighbors currently sending her chunks at the highest rate • re-evaluate top 4 every 10 secs • every 30 secs: randomly select another peer, starts sending chunks • newly chosen peer may join top 4
2009 Michael Rabbat
Circle DHT (2)
O(N) messages on avg to resolve query, when there are N peers
1111
1110 1110
0001
I am
Who’s resp for key 1110 ?
0011
0100
1110
• Each peer keeps track of IP addresses of predecessor, successor, short cuts. • Reduced from 6 to 2 messages. • Possible to design shortcuts so O(log N) neighbors, O(log N) messages in query
• key = 13, then successor peer = 14 • key = 15, then successor peer = 1
2009 Michael Rabbat
Circular DHT (1)
1 3 4 12 10 5 8
15
• Each peer only aware of immediate successor and predecessor. • “Overlay network”
10
ECSE 414, Lecture 5
BitTorrent: Tit-for-tat
(1) Alice “optimistically unchokes” Bob (2) Alice becomes one of Bob’s top-four providers; Bob reciprocates (3) Bob becomes one of Alice’s top-four providers
1100
1110 1110 1110
0101
Define closest as closest successor
2009 Michael Rabbat
1010
1000
Circular DHT with Shortcuts
1 3 15 4 12 10 5 8 Who’s resp for key 1110?
2009 Michael Rabbat
How to assign keys to peers?
• Central issue:
• Assigning (key, value) pairs to peers.
• Rule: assign key to the peer that has the closest ID. • Convention: closest is the immediate successor of the key. • Ex: n=4; peers: 1,3,4,5,8,10,12,14;
• Thursday, October 8, during regular class time
2009 Michael Rabbat
ECSE 414, Lecture 5
2
Topics for Today
• Peer-to-peer applications • Application programming with Sockets
2009 Michael Rabbat
ECSE 414, Lecture 5
4
Client-server: file distribution time
Server
• server sequentially sends N copies:
• NF/us time
F
dN uN
us
u1 d1 u2
Lecture 5 Application Layer
Peer-to-Peer Applications, Sockets ECSE 414 – Fall 2009
Announcements
• Project groups
• Form teams of 5-6 • Message me (WebCT) ASAP • Project topics announced by Thursday
peer
2009 Michael Rabbat ECSE 414, Lecture 5 8
BitTorrent (1)
• file divided into 256KB chunks. • peer joining torrent: • has no chunks, but will accumulate them over time • registers with tracker to get list of peers, connects to subset of peers (“neighbors”) • while downloading, peer uploads chunks to other peers. • peers may come and go • once peer has entire file, it may (selfishly) leave or (altruistically) remain
• Peers can also insert (key, value) peers
2009 Michael Rabbat
DHT Identifiers
• Assign integer identifier to each peer in range [0,2n-1].
• Each identifier can be represented by n bits.
• key: hash of file name; value: IP address of holder • key: TorrentID; value: list of active peers
• Peers query DB with key
• DB returns values that match the key
2009 Michael Rabbat
ECSE 414, Lecture 5
3
Comparing Client-server, P2P architectures
Question : How much time distribute file initially at one server to N other computers?
2009 Michael Rabbat ECSE 414, Lecture 5 9
BitTorrent (2)
Pulling Chunks • at any given time, different peers have different subsets of file chunks • periodically, a peer (Alice) asks each neighbor for list of chunks that they have. • Alice issues requests for her missing chunks • rarest first
2009 Michael Rabbat
increases linearly in N ECSE 414, (for5 large N) Lecture
5
P2P: file distribution time
Server
• server must send one F u1 d1 u2 d2 copy: F/us time us • client i takes F/di time to Network (with dN download abundant bandwidth) uN • NF bits must be downloaded (aggregate) • fastest possible upload rate (assuming all nodes sending file chunks to same peer): us + Σui
i=1,N
dP2P = max { F/us, F/min(di) , NF/(us + Σui) }
i
i=1,N
2009 Michael Rabbat ECSE 414, Lecture 5 6
Comparing Client-server, P2P architectures
P2Pwenku.baidu.comCase Study: BitTorrent
• Require each key to be an integer in same range. • To get integer keys, hash original key.
• eg, key = h(“Led Zeppelin IV”) • This is why they call it a distributed “hash” table
Server u1 d1 u2 d2
us: server upload bandwidth ui: client/peer i upload bandwidth di: client/peer i download bandwidth
File, size F dN uN
us
Network (with abundant bandwidth)
• P2P file distribution
tracker: tracks peers participating in torrent
torrent: group of peers exchanging chunks of a file
obtain list of peers trading chunks
d2
• client i takes F/di time to download
Network (with abundant bandwidth)
Time to distribute F to N clients using = dcs = max { NF/us, F/min(di) } i client/server approach
2009 Michael Rabbat
1
Peer Churn
3 4
15
12 10
• To handle peer churn, require each peer to know the IP address of its two successors. • Each peer periodically pings its two successors to see if they are still alive.
• Homework Assignment #1 due Thursday, Sep 17 • No Tutorial sections • Instead: TA Office hours (starting today) • Midterm exam
• Mondays and Tuesdays, 1:30pm-2:30pm, ENGTR 4105
With higher upload rate, can find better trading partners & get file faster!
2009 Michael Rabbat 2: Application Layer 11
Distributed Hash Table (DHT)
• DHT = distributed P2P database • Database has (key, value) pairs;