Date post: | 26-Jan-2017 |
Category: |
Technology |
Upload: | matilda-rhode |
View: | 252 times |
Download: | 0 times |
P2P: Simulations and Real World Networks
Matilda Rhode and Matt Courtney
(Partial) Average functionpublic void nextCycle(Node node, int protocolID) { int linkableID = FastConfig.getLinkable(protocolID); Linkable linkable = (Linkable) node.getProtocol(linkableID); if (linkable.degree() > 0) { Node peer = linkable.getNeighbor(CommonState.r.nextInt(linkable .degree()));
// Failure handling if (!peer.isUp()) return;
AverageFunction neighbor = (AverageFunction) peer .getProtocol(protocolID); double mean = (this.value + neighbor.value) / 2; this.value = mean; neighbor.value = mean; } }
(Partial) Maximum functionpublic void nextCycle(Node node, int protocolID) { int linkableID = FastConfig.getLinkable(protocolID); Linkable linkable = (Linkable) node.getProtocol(linkableID); if (linkable.degree() > 0) { Node peer = linkable.getNeighbor(CommonState.r.nextInt(linkable .degree()));
// Failure handling if (!peer.isUp()) return;
MaximumFunction neighbor = (MaximumFunction) peer .getProtocol(protocolID); double maximum = this.value
if (neighbor.value > this.value) { maximum = neighbor.value; }
this.value = maximum; neighbor.value = maximum; } }
(Partial) Minimum functionpublic void nextCycle(Node node, int protocolID) { int linkableID = FastConfig.getLinkable(protocolID); Linkable linkable = (Linkable) node.getProtocol(linkableID); if (linkable.degree() > 0) { Node peer = linkable.getNeighbor(CommonState.r.nextInt(linkable .degree()));
// Failure handling if (!peer.isUp()) return;
MaximumFunction neighbor = (MaximumFunction) peer .getProtocol(protocolID); double maximum = this.value
if (neighbor.value < this.value) { maximum = neighbor.value; }
this.value = maximum; neighbor.value = maximum; } }
Gossip-based protocols
• Gossip or epidemic protocol
• Each node has only a partial view of the network
When all nodes hold the same value
Using Incremental Stats printed in average observer to see when network is ‘settled’
control.avgo: 0 1.0 99.99999999999999 50 50.5 867.4354435651799 1 1CDSimulator: cycle 0 donecontrol.avgo: 1 1.0 69.6938775510204 50 23.386122448979595 414.34298362076936 7 1CDSimulator: cycle 1 donecontrol.avgo: 2 1.0 31.30612244897959 50 5.162040816326529 49.386130098853386 26 2CDSimulator: cycle 2 donecontrol.avgo: 3 1.0 7.061224489795918 50 1.4040816326530612 1.6661425086486068 44 2CDSimulator: cycle 3 donecontrol.avgo: 4 1.0 1.0 50 1.0 0.0 50 50CDSimulator: cycle 4 done
Largest value held by
any nodeCycle
Smallest value held by
any node
Network size
Mean value
Variance in values
Total nodes holding
minimum value
Total nodes holding
maximum value
Minimum function, linear distribution of values (1,100) , network size = 50
When all nodes hold the same value
Using Incremental Stats printed in average observer to see when network is ‘settled’
control.avgo: 0 1.0 99.99999999999999 50 50.5 867.4354435651799 1 1CDSimulator: cycle 0 donecontrol.avgo: 1 1.0 69.6938775510204 50 23.386122448979595 414.34298362076936 7 1CDSimulator: cycle 1 donecontrol.avgo: 2 1.0 31.30612244897959 50 5.162040816326529 49.386130098853386 26 2CDSimulator: cycle 2 donecontrol.avgo: 3 1.0 7.061224489795918 50 1.4040816326530612 1.6661425086486068 44 2CDSimulator: cycle 3 donecontrol.avgo: 4 50 1.0 0.0 50 50CDSimulator: cycle 4 done
Largest value held by
any nodeCycle
Smallest value held by
any node
Network size
Mean value
Variance in values
Total nodes holding
minimum value
Total nodes holding
maximum value
Minimum function, linear distribution of values (1,100) , network size = 50
1.0 1.0
When all nodes hold the same value
Using Incremental Stats printed in average observer to see when network is ‘settled’
control.avgo: 0 1.0 99.99999999999999 50 50.5 867.4354435651799 1 1CDSimulator: cycle 0 donecontrol.avgo: 1 1.0 69.6938775510204 50 23.386122448979595 414.34298362076936 7 1CDSimulator: cycle 1 donecontrol.avgo: 2 1.0 31.30612244897959 50 5.162040816326529 49.386130098853386 26 2CDSimulator: cycle 2 donecontrol.avgo: 3 1.0 7.061224489795918 50 1.4040816326530612 1.6661425086486068 44 2CDSimulator: cycle 3 donecontrol.avgo: 4 1.0 1.0 1.0 0.0 CDSimulator: cycle 4 done
Largest value held by
any nodeCycle
Smallest value held by
any node
Network size
Mean value
Variance in values
Total nodes holding
minimum value
Total nodes holding
maximum value
Minimum function, linear distribution of values (1,100) , network size = 50
50 50 50
Varying parameters• Protocol {AverageFunction, MaximumFunction, MinumumFunction}
• Network size [2,50000]
• Distribution of values {Linear, Peak}, distribution parameters
• k, directed edges out of each node [1,8]
• Network Topography {WireKOut, WireINet, WireRegRootedTree, WireRingLattice, WireStar, WireWS}
• Network dynamism {Static, Dynamic, Oscillating}, dynamic and oscillating parameters
Distribution
Static config filerandom.seed 1234567890control.shf Shuffle
simulation.cycles 10network.size 100 protocol.lnk IdleProtocol
protocol.0 example.aggregation.protocol.0.linkable lnk init.rnd WireKOutinit.rnd.protocol lnkinit.rnd.k 5
init.lin LinearDistributioninit.lin.protocol 0init.lin.max 100init.lin.min 1
init.peak example.aggregation.PeakDistributionInitializerinit.peak.value 10000init.peak.protocol 0
include.init rnd lin
control.avgo example.aggregation.AverageObservercontrol.avgo.protocol 0
k
MaximumFunction
Distribution Parameters
ProtocolNetwork size
Distribution
Static config filerandom.seed 1234567890control.shf Shuffle
simulation.cycles 10network.size protocol.lnk IdleProtocol
protocol.0 example.aggregation.protocol.0.linkable lnk init.rnd WireKOutinit.rnd.protocol lnkinit.rnd.k 5
init.lin LinearDistributioninit.lin.protocol 0init.lin.max 100init.lin.min 1
init.peak example.aggregation.PeakDistributionInitializerinit.peak.value 10000init.peak.protocol 0
include.init rnd lin
control.avgo example.aggregation.AverageObservercontrol.avgo.protocol 0
ProtocolNetwork size
MaximumFunction
100
kDistribution Parameters
Static config fileProtocol
Network sizeDistribution
MaximumFunction
100
1001
10000
lin
kDistribution Parameters
random.seed 1234567890control.shf Shuffle
simulation.cycles 10network.size protocol.lnk IdleProtocol
protocol.0 example.aggregation.protocol.0.linkable lnk init.rnd WireKOutinit.rnd.protocol lnkinit.rnd.k 5
init.lin LinearDistributioninit.lin.protocol 0init.lin.max init.lin.min
init.peak example.aggregation.PeakDistributionInitializerinit.peak.valueinit.peak.protocol 0
include.init rnd
control.avgo example.aggregation.AverageObservercontrol.avgo.protocol 0
random.seed 1234567890control.shf Shuffle
simulation.cycles 10network.size protocol.lnk IdleProtocol
protocol.0 example.aggregation.protocol.0.linkable lnk init.rnd WireKOutinit.rnd.protocol lnkinit.rnd.k 5
init.lin LinearDistributioninit.lin.protocol 0init.lin.max init.lin.min
init.peak example.aggregation.PeakDistributionInitializerinit.peak.valueinit.peak.protocol 0
include.init rnd
control.avgo example.aggregation.AverageObservercontrol.avgo.protocol 0
Static config fileProtocol
Network sizeDistribution
MaximumFunction
100
1001
10000
lin
kDistribution Parameters
random.seed 1234567890control.shf Shuffle
simulation.cycles 10network.size protocol.lnk IdleProtocol
protocol.0 example.aggregation.protocol.0.linkable lnk init.rnd WireKOutinit.rnd.protocol lnkinit.rnd.k
init.lin LinearDistributioninit.lin.protocol 0init.lin.max init.lin.min
init.peak example.aggregation.PeakDistributionInitializerinit.peak.valueinit.peak.protocol 0
include.init rnd
control.avgo example.aggregation.AverageObservercontrol.avgo.protocol 0
Static config fileProtocol
Network sizeDistribution
MaximumFunction
100
1001
10000
lin
kDistribution Parameters
5
Static config file
MaximumFunction
100
1001
10000
lin
1
random.seed 1234567890control.shf Shuffle
simulation.cycles 10network.size protocol.lnk IdleProtocol
protocol.0 example.aggregation.protocol.0.linkable lnk init.rnd WireKOutinit.rnd.protocol lnkinit.rnd.k
init.lin LinearDistributioninit.lin.protocol 0init.lin.max init.lin.min
init.peak example.aggregation.PeakDistributionInitializerinit.peak.valueinit.peak.protocol 0
include.init rnd
control.avgo example.aggregation.AverageObservercontrol.avgo.protocol 0
Observations
• Ran many simulations and recorded results
• Used Tableau to analyse
Protocol
Network size
Network ~ Linear(0,100); k=5; static network
Distribution
k
Benefits of Simulation
Allows for a ‘sterile’ environment where approaches can be designed to improve the components of a P2P network’s
functionality.
Benefits of Simulation
Test various approaches and topologies for their suitability in the given scenario. This may imply a suitability for a real life
application.
Other Projects
“http://doc.tm.uka.de/tr/TM-2011-4.pdf” , “https://dspace.stir.ac.uk/bitstream/1893/3688/1/ccnc-2011-jamie.pdf”
Dynamic config fileRemoving nodes/
OscillatingDynamic
parameterssimulation.cycles 5
network.size 100
protocol.link IdleProtocol
protocol.coord example.hot.InetCoordinates
protocol.1 example.aggregation.MaximumFunctionprotocol.1.linkable link
init.0 example.hot.InetInitializer init.0.protocol coordinit.1 peersim.dynamics.WireRingLatticeinit.1.protocol linkinit.1.coord_protocol coordinit.1.k 5
init.ld LinearDistributioninit.ld.protocol 1init.ld.max 100init.ld.min 1
control.dnet DynamicNetworkcontrol.dnet.add -10control.dnet.from 1control.dnet.until 5
control.onet OscillatingNetwork
k/alpha/ k, betaTopography
simulation.cycles 5
network.size 100
protocol.link IdleProtocol
protocol.coord example.hot.InetCoordinates
protocol.1 example.aggregation.MaximumFunctionprotocol.1.linkable link
init.0 example.hot.InetInitializer init.0.protocol coordinit.1 peersim.dynamics.WireRingLatticeinit.1.protocol linkinit.1.coord_protocol coordinit.1.k 5
init.ld LinearDistributioninit.ld.protocol 1init.ld.max 100init.ld.min 1
control.dnet DynamicNetworkcontrol.dnet.add control.dnet.from control.dnet.minsize
control.onet OscillatingNetwork
Dynamic config fileRemoving nodes/
OscillatingDynamic
parameters
-101
2
100203
k/alpha/ k, betaTopography
simulation.cycles 5
network.size 100
protocol.link IdleProtocol
protocol.coord example.hot.InetCoordinates
protocol.1 example.aggregation.MaximumFunctionprotocol.1.linkable link
init.0 example.hot.InetInitializer init.0.protocol coordinit.1init.1.protocol linkinit.1.coord_protocol coordinit.1.k 5
init.ld LinearDistributioninit.ld.protocol 1init.ld.max 100init.ld.min 1
control.dnet DynamicNetworkcontrol.dnet.add control.dnet.from control.dnet.minsize
control.onet OscillatingNetwork
Dynamic config fileRemoving nodes/
OscillatingDynamic
parameters Topography k/alpha/ k, beta
-101
2
100203
peersim.dynamics.WireRingLattice
simulation.cycles 5
network.size 100
protocol.link IdleProtocol
protocol.coord example.hot.InetCoordinates
protocol.1 example.aggregation.MaximumFunctionprotocol.1.linkable link
init.0 example.hot.InetInitializer init.0.protocol coordinit.1init.1.protocol linkinit.1.coord_protocol coordinit.1.
init.ld LinearDistributioninit.ld.protocol 1init.ld.max 100init.ld.min 1
control.dnet DynamicNetworkcontrol.dnet.add control.dnet.from control.dnet.minsize
control.onet OscillatingNetwork
Dynamic config fileRemoving nodes/
OscillatingDynamic
parameters Topography k/alpha/ k, beta
-101
2
100203
peersim.dynamics.WireRingLattice
k 5
Dynamic config fileRemoving nodes/
OscillatingDynamic
parameters Topography k/alpha/ k, beta
-101
2
100203
peersim.dynamics.WireRingLattice
k 5
simulation.cycles 5
network.size 100
protocol.link IdleProtocol
protocol.coord example.hot.InetCoordinates
protocol.1 example.aggregation.MaximumFunctionprotocol.1.linkable link
init.0 example.hot.InetInitializer init.0.protocol coordinit.1init.1.protocol linkinit.1.coord_protocol coordinit.1.
init.ld LinearDistributioninit.ld.protocol 1init.ld.max 100init.ld.min 1
control.dnet DynamicNetworkcontrol.dnet.add control.dnet.from control.dnet.minsize
control.onet OscillatingNetwork
Dynamic Network (killing nodes)
Oscillating Network
Oscillating Network
Oscillating Network
WireKOut
WireInetTopology
WireRegRootedTree
WireRingLattice
WireStar
WireWS
Topographies
2
2
Topographies
2
2
2
2
Real World P2P• Structured - Overlay has fixed topology, protocol
aims to ensure an efficient search of network for a given resource.
ImageSRC:- “https://personalpages.manchester.ac.uk/staff/m.dodge/cybergeography/atlas/gnucleus_graph_large.gif”
Real World P2P• Unstructured - No formal topology, easy to build.
Allow for localised optimisations and are highly resilient against problems caused with high ‘churn’.
ImageSRC:- “http://courses.cse.tamu.edu/caverlee/csce438/hw/rand_graph.png"
Real World P2P• Hybrid - Combination of P2P and client-server
models. Currently tend to have better all round performance versus pure P2P and client-server.
ImageSRC:- “http://www.di.unipi.it/~hkholidy/projects/cids/CIDS%20in%20Pure%20P2P%20model.gif”
Real World P2P• Spotify(2011) - Hybrid model, utilises centralised
servers, P2P network, and a local cache. Only non web-based on-demand music streaming service.
ImageSRC:- “http://pansentient.com/2011/04/spotify-technology-some-stats-and-how-spotify-works/“
~8
~36~56
Real World P2P• Spotify - Simple use case
ImageSRC:- “http://pansentient.com/2011/04/spotify-technology-some-stats-and-how-spotify-works/“
• User selects track • If cached, play from there• Else
• Request first 15secs from servers. • Search P2P network for remainder of song.
Real World P2P
• Spotify’s P2P Network - Works like BitTorrent, using server-side trackers and network queries to locate peers. Returned peers are those that can support playback.
Predictable listening habits - Most users listen to the same music multiple times or listen to albums. Makes predictive caching possible, reducing network traffic.