peer sim (p2p network)

34
PeerSim (P2P Network) Sijo Emmanuel & Hein Min Htike

Upload: sijo-emmanuel

Post on 16-Feb-2017

210 views

Category:

Education


1 download

TRANSCRIPT

Page 1: Peer Sim (P2P network)

PeerSim (P2P Network)Sijo Emmanuel & Hein Min Htike

Page 2: Peer Sim (P2P network)

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)

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)

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)

Aim●To create new protocol

○ protocols to find Min & Max in the network

●To explore PeerSim package

Page 6: Peer Sim (P2P network)

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)

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)

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)

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)

Design & Implementation

Page 11: Peer Sim (P2P network)

MaxFunction and MinFunction● Took AverageFunction class as example to create MaxFunction and

MinFunction

Page 12: Peer Sim (P2P network)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

Configuration: Distribution ExamplesUniform Distribution

Linear Distribution

Peak Distribution

Page 24: Peer Sim (P2P network)

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)

Configuration File: Visualisation ExampleExample .gml file

Graph visualised in GephiNodes = 1000, k = 10Edges = 10000

Page 26: Peer Sim (P2P network)

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)

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)

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)

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)

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)

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)

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)

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)

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