Anda di halaman 1dari 31

PEER TO PEER

NTVERK
HUR FUNGERAR DE?
Alex
Overview
What is Peer to Peer?

Where is Peer to Peer used?

How does Peer to Peer work?

Overview & Questions
Client-Server?
Computers are classes as either servers or
clients
Servers provide a resource or service
Clients request a resource or service
Clients initialize connection, make request, server
fulfills
Clear distinction between client and server
Client-Server Networks -
Disadvantages
Client-Server
As more clients connect, performance degrades
Solution of more servers is expensive
If servers are down, entire service is non-
functional
Allows for Denial of Service attacks
Peer to Peer?
Peer to Peer
Network is distributed
All are clients and servers simultaneously, called
peers
Any peer can make requests and any can answer
Networks of equals, no specific peer controls
anything
Peer to Peer Networks
Peer to Peer Advantages
Capacity typically increases with more users
Privacy
Stability
Peer to Peer Disadvantages
Harder to control
Security
How are Peer to Peer Networks
Used?
Used for much more than just file sharing
Streaming
Communications
Code Distribution
Currency
Peer to Peer Networks File
sharing
File sharing is most common use of peer to
peer
Users upload and download simultaneously
Cheap, low bandwidth way to distribute files
Users act as file servers for companies
Commonly used for free software (e.g. Linux)
Frequently used for copyright infringement
Peer to Peer Networks Streaming
Spotify uses peer to peer to cope with demand
First part from Spotifys servers
Searches Spotifys peer to peer network for
remainder
Servers only if peer to peer too slow
Pre-fetches next song via peer to peer
Means Spotify uses upload as well as download
Peer to Peer Networks
Communication
Commonly use peer to peer networks
Excellent for VoIP
Security
Encrypted peer to peer more secure than central
server

Skype traditionally used a peer to peer model
Skype moving to client-server
Allows synchronized instant messages
Provides other advantages (e.g. stopping ringing)
Peer to Peer Networks Code
Code deployment
Twitter has thousands of servers
Frequently update code, need to update servers
Previously took 40 minutes of server downtime
Moved to Murder (BitTorrent)
Distributes binaries to all servers in ~12 seconds


https://blog.twitter.com/2010/murder-fast-datacenter-code-deploys-using-
bittorrent
Peer to Peer Networks Bitcoin
Bitcoin, peer to peer digital currency
As common with peer to peer, no central authority
Blockchain
records transactions
distributed via peer to peer

Each transaction added to blockchain and
processed
Peer to Peer - Summary
Any network that involves
Distributed, equal computers (peers)
Generalized by a lack of central authority

Client and Server paradigms dont exist

But how does it actually work?
BitTorrent
Every file shared has associated .torrent file
Contains metadata
Always a list of file names and a hash
Can contain a lot more information as appropriate
Uniquely identifies a particular file or files
Each torrent split into small parts, defined by
.torrent
BitTorrent continued
Users install torrent client
Client can open and read .torrent file
Client downloads parts from peers that have them
Once client has a part, will seed it to others
This way, all peers download and upload or
seed

BitTorrent Demonstrated
BitTorrent Demonstrated
BitTorrent Demonstrated
BitTorrent Demonstrated
BitTorrent Demonstrated
BitTorrent Demonstrated
BitTorrent Demonstrated
BitTorrent Demonstrated
BitTorrent Demonstrated
How do peers connect?
Depends on the implementation
Central server to initially connect
Central server for authentication
Completely distributed (e.g. DHT)
Connecting IM (Instant
Messaging)
Often have a centralized server for
authentication
This central server keeps track of who is logged
in
Also means that each logged in user has access
to the IP address of each other logged in user

Typically use peer to peer for user to user
Users can seamlessly use peer to peer as client
has all IP addresses required available
Connecting BitTorrent
Two main methods
Tracker (Central server)
Older system
Tracker connects peers to each other
No shared material travels through tracker
DHT (Distributed Hash Tables)
Newer technique
Doesnt require a tracker or any central server at
all
Unstructured vs. Structured (DHT)
Unstructured
Older and more common
Client only aware of itself and those connected to
it
Connections and structure formed ad hoc as
required

Unstructured vs. Structured (DHT)
Structured
Each client aware of all others via hash table
Can communicate with other peers without
flooding
Decreases need for centralization in many
contexts


BitTorrent, DHT and Magnet Links
Magnet link means no torrent file required
Combined with DHT, BitTorrent is server-less

Example Magnet Link:
magnet:?xt=urn:sha1:YNCKHTQCWBTRNJIV4WNAE52SJUQCZO5C

xt is a URN (Universal Resource Name) for a
torrent.
Questions?

Anda mungkin juga menyukai