Peer Sim (P2P network)
-
Upload
sijo-emmanuel -
Category
Education
-
view
209 -
download
1
Transcript of Peer Sim (P2P network)
![Page 1: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/1.jpg)
PeerSim (P2P Network)Sijo Emmanuel & Hein Min Htike
![Page 2: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/2.jpg)
What is PeerSim?Peer Simulator (PeerSim) is a simulation engine
Used to write network protocols for P2P (Peer-to-Peer) networks
Scalable (up to 1 million nodes), portable and highly configurable
Open source Peer-to-Peer (P2P) system developed using Java
Developed at the department of Computer Science in University of Bologna
![Page 3: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/3.jpg)
What is a simulation engine?An application on top of which we can write simulations, collect
results and analyze them.
The engine takes care of the temporal structure of the experiment
The programmer takes care of the logic of the interactions among the elements of the scenario.
There are two modes of simulation engines:
More on next slide!!
![Page 4: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/4.jpg)
PeerSim Simulation Engines
PeerSim has two simulation modes:Event-driven: a set of events (messages) are scheduled at different
simulation time and the node protocols are run accordingly to messages’ delivery times.
Cycle-driven: sequential simulation, in each cycle each protocol’s actions are executed by every node (we will be focusing on this)
![Page 5: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/5.jpg)
Aim●To create new protocol
○ protocols to find Min & Max in the network
●To explore PeerSim package
![Page 6: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/6.jpg)
Objectives●To create new protocols to generate networks with the maximum
and minimum value.○ create package for new codes
○ create two classes for Min and Max protocols
○ create observer classes
○ create Max and Min configuration files
○ visualise the topology of the network
![Page 7: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/7.jpg)
Key themes/Ideas ●Key theme and idea was to calculate Max and Min values that exists
within the network
●Source of idea - Average function ??
●More on next slides!!!
![Page 8: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/8.jpg)
Average Function●Calculates average between two interacting nodes, and assign that
value to them.
●Perform that computation at every node in each cycle.
●After certain amount of time, all the average values in the network converge.
![Page 9: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/9.jpg)
Min/Max Function●Finds min/max value between two interacting nodes, and assign
that value to them.
●Perform that computation at every node in each cycle.
●After certain amount of time, all the values in the network become (the same) min/max.
![Page 10: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/10.jpg)
Design & Implementation
![Page 11: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/11.jpg)
MaxFunction and MinFunction● Took AverageFunction class as example to create MaxFunction and
MinFunction
![Page 12: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/12.jpg)
Observer classes●Based on AverageObserver, we created two different observer
classesa. node values in the network (NodeValuesObserver)
b. similar to average observer (MaxMinObserver)
![Page 13: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/13.jpg)
NodeValuesObserver●observes the values at each node in all the cycles.
○ to see how the values of the nodes change over time
![Page 14: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/14.jpg)
NodeValuesObserver● same as AverageObserver,
except execute() method,
● use MedianStats Object
○ to print out all the values in node
○ more about MedianStats in next slide
● line 111
○ protocol name
○ cycle
● line 112 - 114: print node values
● line 115: number of nodes
![Page 15: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/15.jpg)
MedianStats and IncrementalStats ●included in peersim.util package
●IncrementalStats - keep track of statistics about the network○ average, min, max, etc.
●MedianStats - extends IncrementalStats○ can retrieve median element
○ STORE all the elements (ArrayList)
○ we added a getter method to retrieve all the elements
![Page 16: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/16.jpg)
MaxMinObserver●Observe the statistics about the nodes at each cycle
●Same as AverageObserver, except changes to what we want to see in output
![Page 17: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/17.jpg)
MaxMinObserver● same as AverageObserver, except execute() method
● MedianStats is used
● line 112 - prints out only Minimum and Maximum values of the network and no. of nodes
![Page 18: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/18.jpg)
Configuration File●We wrote several configuration files with different components to
learn more about PeerSim.
●Different components we tried will be preseneted in coming slides.
![Page 19: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/19.jpg)
Configuration FileCreated configuration files based on Average configuration file for
Max and Min
● simulation.cycles value are the number of cycles in the network
● network.size is the size of the network
![Page 20: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/20.jpg)
Configuration File: ProtocolsCreated new protocols to run Max and Min functions
● IdleProtocol is the topology of the network which determines the nodes and degree of network
● aMaxMin.MaxFuntion reads in the Max function and uses it to find the maximum value in the network
● IdleProtocol serve as a source of neighbourhood information for other protocols
● It stores links: useful to model a static link-structure
![Page 21: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/21.jpg)
Configuration: Linking Nodes●link nodes to form network
●takes “linkable” protocol, add edges to define topology
●WireKOut: adds random connection○ Parameter: k - number of edges coming out of each node
![Page 22: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/22.jpg)
Configuration: Assigning Values to Nodes●assign values to the node during initilisation
●ways to distribute values○ provided in peersim.vector package
○ PeakDistribution
■ parameter: peak - peak value
■ assign peak nodes the peak value, the rest 0
○ LinearDistribution
■ parameter: min and max
■ assign values in the range (min & max) in linearly increasing manner from min to max
○ UniformDistribution
■ parameter: min and max
■ assign values in random from the range (min & max)
![Page 23: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/23.jpg)
Configuration: Distribution ExamplesUniform Distribution
Linear Distribution
Peak Distribution
![Page 24: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/24.jpg)
Configuration File: Visualisation●used built-in GraphPrinter control
○ provided in peersim.report package
○ print the whole graph in given format
●two parameters○ outf - prefix of filename
■ extension - .graph
■ prefix0000001.graph
○ format - format of output graph
■ neighborlist: neighborlist
■ edgelist: one node pair at each line for each edge
■ gml: generic format for many graph tools
●We used Gephi to visualise the graph ○ change file name from .graph extension to .gml
![Page 25: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/25.jpg)
Configuration File: Visualisation ExampleExample .gml file
Graph visualised in GephiNodes = 1000, k = 10Edges = 10000
![Page 26: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/26.jpg)
Configuration File: Statistics●Used built-in DegreeStats control
○ provided in peersim.report package
○ statistics about the node degree in graph
●four parameters○ n: numbers of nodes for sampling degree
○ method: method to print results
■ stats: statistics about degrees of graph (min degree, max degree, average degree, etc.)
■ freq: frequency of degrees of graph
■ list: lists degree of sampled nodes
○ linktype: type of links to print information about (live (default), dead, all)
○ trace: trace the given number of nodes
![Page 27: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/27.jpg)
Configuration File: Statistics ExampleExample print out to console using stats
Example print out to console using lists & n = 10
Example: freq & n = 25
![Page 28: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/28.jpg)
Configuration File: Dynamic Network●dynamically change the size of network
○ add or remove nodes from the network
●line 31: adds DynamicNetwork control to configuration file.○ provided in peersim.dynamics package
●line 32: take out 500 nodes from network
●line 33 & 34: when to add/remove nodes from network
![Page 29: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/29.jpg)
Results - INetwork size: 10,000
Protocol: MaxFunction
Connection: WireKOut (k=30)
Observer: MaxMinObserver
Dynamic Network: remove 500 from cycle 1 till 5
![Page 30: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/30.jpg)
Results - IINetwork size: 10,000
Protocol: MinFunction
Connection: WireKOut (k=30)
Observer: MaxMinObserver
Dynamic Network: remove 500 from cycle 1 till 5
![Page 31: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/31.jpg)
What have been achieved?●Created Max/Min functions
●Created two observer classes
●Multiple configurations with different components
●Visualised the graph
![Page 32: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/32.jpg)
Observations●the more the edges, the faster it reaches min/max/average of the
network○ using the same configurations except k;
■ k=10, 20 cycles for all nodes to become minimum value
■ k = 20, 14 cycles for all nodes to become minimum value
■ k = 30, 12 cycles for all nodes to become minimum value
![Page 33: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/33.jpg)
Benefits of PeerSim (P2P Network)Portability
Possible to reuse simulation code with minor modification
Allows user defined entities to replace almost all predefined entities
highly configurable
Architecture based on extendable and pluggable component features
Scalability Provides high scalability
Can simulate millions of network nodes
Can hold up a network up to 106 nodes in the cycle-based model
Able to solve problems related to scalability
One of the major parameters on which a simulator can be analysed
![Page 34: Peer Sim (P2P network)](https://reader036.fdocumentos.com/reader036/viewer/2022081422/58a59fa61a28abaf3e8b678b/html5/thumbnails/34.jpg)
Limitations of PeerSim Lack of support for simulating unstructured or semi-structured P2P
routing protocols
Ability to scale will be reduced if resources are not used efficiently
Limited support for extending the simulator for protocols other than Bit
Difficult to implement other protocols as the simulator is tightly coupled to the Bittorrent protocol
No support for distributed simulation
Simulator makes use of main memory to store visualisation eventsLimits the system performance in terms of nodes