O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

Peer Sim (P2P network)

706 visualizações

Publicada em

Peer Sim simulation in Peer-to-Peer (P2P) networks

Publicada em: Educação
  • Seja o primeiro a comentar

  • Seja a primeira pessoa a gostar disto

Peer Sim (P2P network)

  1. 1. PeerSim (P2P Network) Sijo Emmanuel & Hein Min Htike
  2. 2. 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
  3. 3. 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!!
  4. 4. 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)
  5. 5. Aim ● To create new protocol ○ protocols to find Min & Max in the network ● To explore PeerSim package
  6. 6. 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
  7. 7. 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!!!
  8. 8. 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.
  9. 9. 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.
  10. 10. Design & Implementation
  11. 11. MaxFunction and MinFunction ● Took AverageFunction class as example to create MaxFunction and MinFunction
  12. 12. Observer classes ● Based on AverageObserver, we created two different observer classes a. node values in the network (NodeValuesObserver) b. similar to average observer (MaxMinObserver)
  13. 13. NodeValuesObserver ● observes the values at each node in all the cycles. ○ to see how the values of the nodes change over time
  14. 14. 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
  15. 15. 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
  16. 16. MaxMinObserver ● Observe the statistics about the nodes at each cycle ● Same as AverageObserver, except changes to what we want to see in output
  17. 17. 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
  18. 18. 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.
  19. 19. Configuration File Created 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
  20. 20. Configuration File: Protocols Created 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
  21. 21. 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
  22. 22. 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
  23. 23. Configuration: Distribution Examples Uniform Distribution Linear Distribution Peak Distribution
  24. 24. 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
  25. 25. Configuration File: Visualisation Example Example .gml file Graph visualised in Gephi Nodes = 1000, k = 10 Edges = 10000
  26. 26. 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
  27. 27. Configuration File: Statistics Example Example print out to console using stats Example print out to console using lists & n = 10 Example: freq & n = 25
  28. 28. 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
  29. 29. Results - I Network size: 10,000 Protocol: MaxFunction Connection: WireKOut (k=30) Observer: MaxMinObserver Dynamic Network: remove 500 from cycle 1 till 5
  30. 30. Results - II Network size: 10,000 Protocol: MinFunction Connection: WireKOut (k=30) Observer: MaxMinObserver Dynamic Network: remove 500 from cycle 1 till 5
  31. 31. What have been achieved? ● Created Max/Min functions ● Created two observer classes ● Multiple configurations with different components ● Visualised the graph
  32. 32. 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
  33. 33. 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
  34. 34. 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 events Limits the system performance in terms of nodes