A Peer-to-Peer Simulator
-
Upload
uwe-schmidt -
Category
Technology
-
view
6.752 -
download
1
description
Transcript of A Peer-to-Peer Simulator
Introduction Model Simulation Application Summary
A Peer-to-Peer Simulator
Uwe Schmidt
Bachelor Thesis
August 17, 2006
Uwe Schmidt: A Peer-to-Peer Simulator 1 / 28
Introduction Model Simulation Application Summary
Outline
1 Introduction
2 Model
3 Simulation
4 Application
Uwe Schmidt: A Peer-to-Peer Simulator 2 / 28
Introduction Model Simulation Application Summary
Outline
1 Introduction
2 Model
3 Simulation
4 Application
Uwe Schmidt: A Peer-to-Peer Simulator 3 / 28
Introduction Model Simulation Application Summary
Peer-to-Peer File-Sharing
Gaining Importance
Less expensive in comparison to dedicated file serversExploit bandwidth of usersResilient to flashcrowds
BitTorrentFiles are separated into chunksPopular (also for legal purposes)
Microsoft AvalancheUses network coding for chunk distribution
Uwe Schmidt: A Peer-to-Peer Simulator 4 / 28
Introduction Model Simulation Application Summary
Motivation
Freeriding
Common problem of all P2P systemsLarge fraction of peers are free-ridersBitTorrent tries to restrain it by enforcing a tit-for-tat strategy
Primary purpose of the simulator:
Research the impact of the amount of free-riders on ...Download timesPeer load
Uwe Schmidt: A Peer-to-Peer Simulator 5 / 28
Introduction Model Simulation Application Summary
Outline
1 Introduction
2 Model
3 Simulation
4 Application
Uwe Schmidt: A Peer-to-Peer Simulator 6 / 28
Introduction Model Simulation Application Summary
General
Similar to BitTorrent (chunk-based file-sharing)Global knowledge of all other peers in the systemNo incentives to upload are given (such as tit-for-tat)Peers wait random time between downloads
Download BehaviorMultiple DownloadsQueued RequestsChunk SelectionPeer Selection
File
Peer Lists for Chunks
Chunk#1 Chunk#2 ... Chunk#n
ListPeer#6
Peer#40List
Peer#13Peer#2
Peer#77Peer#19
ListPeer#11Peer#5Peer#8
Peer
Chunk Selection
Peer Selection
Uwe Schmidt: A Peer-to-Peer Simulator 7 / 28
Introduction Model Simulation Application Summary
General Configuration GUI
Uwe Schmidt: A Peer-to-Peer Simulator 8 / 28
Introduction Model Simulation Application Summary
Peers
Separated into peer groups:
Peer GroupNumber of membersNumber of free-ridersBandwidth (upstream & downstream)Maximum number of simultaneous uploads & downloadsDisconnect probability after successful file download
Uwe Schmidt: A Peer-to-Peer Simulator 9 / 28
Introduction Model Simulation Application Summary
Peers Configuration GUI
Uwe Schmidt: A Peer-to-Peer Simulator 10 / 28
Introduction Model Simulation Application Summary
Files
Separated into file types:
File TypeNumber of filesNumber of copies (per file)File size (determines number of chunks)File distribution to peer groupsPopularity distribution of files among type
Global Chunk SizeApplies to all file types
Uwe Schmidt: A Peer-to-Peer Simulator 11 / 28
Introduction Model Simulation Application Summary
Files Configuration GUI
Uwe Schmidt: A Peer-to-Peer Simulator 12 / 28
Introduction Model Simulation Application Summary
Requests
Mean request periodRequest distribution to file types
Uwe Schmidt: A Peer-to-Peer Simulator 13 / 28
Introduction Model Simulation Application Summary
Requests Configuration GUI
Uwe Schmidt: A Peer-to-Peer Simulator 14 / 28
Introduction Model Simulation Application Summary
Outline
1 Introduction
2 Model
3 Simulation
4 Application
Uwe Schmidt: A Peer-to-Peer Simulator 15 / 28
Introduction Model Simulation Application Summary
Preliminaries
FactoriesCreate peers and filesDeploy files to peers
File Request GeneratorUses request configuration and file popularity settingsCreates empirical distributions for file indexesReplays this distributions during the simulation
Uwe Schmidt: A Peer-to-Peer Simulator 16 / 28
Introduction Model Simulation Application Summary
Discrete Event Simulation Concept
Ordered Event List
Next Event
removes
Entities
changes state
New Events
schedule
Data Collection
append data
inserted
Simulation Executive
executes
appends data
Uwe Schmidt: A Peer-to-Peer Simulator 17 / 28
Introduction Model Simulation Application Summary
Simulation Cycle
Peer
Download Part Upload Part
More Downloadspossible?
Select Chunk
yes
Update Downloads
no
Last Chunkof File?
Maybego Offline
yes
Select Peer Download Chunk
Incoming Chunk RequestDownload File
Add Chunks toDownload Queue
Process Download Queue
Download Complete
Chunk Download started Chunk Request Queued
Maybe startnew Request
More Uploadspossible?
Upload Chunk
yes
Queue Chunk Request
no
Update Uploads
no
Upload Complete
Process Upload Queue
File Request Generator
Uwe Schmidt: A Peer-to-Peer Simulator 18 / 28
Introduction Model Simulation Application Summary
Control
Uwe Schmidt: A Peer-to-Peer Simulator 19 / 28
Introduction Model Simulation Application Summary
Collected Data
Before the SimulationPeer groupsFile typesList of files with chunk mappingList of peers with file mapping
During the Simulation
Completed chunk transfersCompleted file downloadsMiscellaneous (e.g. peer goes offline)
After the SimulationList of peers with file mapping
Uwe Schmidt: A Peer-to-Peer Simulator 20 / 28
Introduction Model Simulation Application Summary
Outline
1 Introduction
2 Model
3 Simulation
4 Application
Uwe Schmidt: A Peer-to-Peer Simulator 21 / 28
Introduction Model Simulation Application Summary
Overview
Written in Java SE 5Used Eclipse 358 classes in 8 packages≈ 8000 lines of code and comments (JavaDoc)
Used LibrariesJakarta Commons Math→ Random Number GeneratorsJakarta Commons Configuration→ XML ConfigurationJFreeChart→ Charts
Uwe Schmidt: A Peer-to-Peer Simulator 22 / 28
Introduction Model Simulation Application Summary
Structure
Graphical User Interface
Configuration
changes
Simulator
controls
Random Number Generators
uses
Config File
save
Next Event
executes
Log Files
writes
Factories
uses
Console Mode
controls
load
Event List
removes
Peers
controls
New Events
schedule write
Chunks
transfer
Strategies
use
inserted
use create
Files
create
use consist of
File Request Generator
uses
returns Filesto download
uses
User
starts starts
use
Uwe Schmidt: A Peer-to-Peer Simulator 23 / 28
Introduction Model Simulation Application Summary
Used Design Patterns
Observer PatternSimulator→ Simulation State & ProgressConfiguration→ Changes
Singleton Pattern
Implemented by frequently used componentsSingle point of access from everywhereNo need to pass references on to other components
Command PatternHashtable that maps an ActionString to a CommandAvoid code duplication
Uwe Schmidt: A Peer-to-Peer Simulator 24 / 28
Introduction Model Simulation Application Summary
Extensions
General modular designSelection strategies are easy to change and extend
Example (Chunk Selection)Select rarest chunk among 50 randomly selected ones toreflect that peers have no global knowledge in reality
Example (Peer Selection)Select peer with most upstream leftSelect peer with smallest upload queue (if all are busy)
Uwe Schmidt: A Peer-to-Peer Simulator 25 / 28
Introduction Model Simulation Application Summary
Demo
Uwe Schmidt: A Peer-to-Peer Simulator 26 / 28
Introduction Model Simulation Application Summary
Summary
Easy and flexible way to simulate P2P systems (similar toBitTorrent)Tool to research the impact of free-riders, and otherparameters, on a P2P systemModular designed and extendable
Uwe Schmidt: A Peer-to-Peer Simulator 27 / 28
Thank you for your attention
Questions?
Uwe Schmidt: A Peer-to-Peer Simulator 28 / 28