Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
0
CAS Project Presentation
Andrea Marcozzi
27/03/2008
Dipartimento di Scienze
dell’Informazione, Università di
Bologna
1
Outline
! Aim of the project
! ResourceWorld
! Project Specifications
! Peersim guidelines
! Clustering Coefficient and Average Path
Length
! Churn
2
Aim of the project
! The aim of this project is to take an
existing protocol for P2P networks
called ResourceWorld
! To propose 2 modifications of such
protocol
! Analyze the results obtained with this
two modifications in order to understand
the global emergent mechanism
3
ResourceWorld
4
ResourceWorld Introduction
! In several peer-to-peer applications, systemsrequire their member nodes to behave in asocially beneficial way
! This approach is in contrast with the principle ofclassical individual rationality that states agentsshould select actions that maximize theirindividual utility
! ResourceWorld is a simple locally adaptiveprotocol that claims to produce socially rationaloutcomes through a process of self-organisationeven though nodes only act on their own utilityvalues
5
The ResourceWorld scenario
! We consider a situation in which there arepopulations of peer nodes that can storeand serve some number of resources (i.e.:Files)
! Each node has its own single nativeresource that it wishes to serve to someusers community achieving somespecified service level
! After each interaction, nodes get anappropriate utility
6
The ResourceWorld Model (I)
! Let’s consider a P2P overlay network in whicheach node has the following state:
– Strategy bit, A ! {0,1} (indicates if the nodeis altruistic or not)
– Skill, S ! {1,2,3,4,5} (indicates the resourceof the node)
– Neighbour list (max 20 neighbours)
! Periodically, with probability 0.5, nodes receivea request to be completed (Job, J !{1,2,3,4,5})
! Periodically, with a small probability, tworandom nodes are selected and their utilitiesare compared (SLAC) 7
System architecture
0. Newscast
(Peer Sampling Service)
1. SLAC
2. RW
(Application)
utility
Random node
(movement)
Cooperative
neighbor
Three protocols: Newscast, SLAC,
ResourceWorld (RW)
8
The ResourceWorld Model (II)
9
ResourceWorld Pseudo-code
At each cycle with probability 0.5:
each node i receives a certain job
if ( Si == job) then Ui += 1;
else
if ( STRATi == true ) then
for all neighbors j with random order
if ( Sj == job) then
Ui += -0.25;
Uj += 1;
With probability 0.2 the SLAC algorithm takes place
10
Experiments (parameters)! Peersim (http://peersim.sf.net)
! SLAC
! Network size: 4000 nodes
! Network degree: 20
! Initial topology: random
! Single node initialization:
– Strategy bit: 0 (defect)
– Skill: random
! Mutation: (MRT = 0.01; MRS = 0.005)
! Payoffs:
– Benefits from 0.1 to 2.0 by 0.1 steps
– Costs from 0.1 to 2.0 by 0.1 steps
! 10 runs for each experiments meaning
20 X 20 X 10 runs 11
Experiments (results) (I)
The utility measure we used to evaluate the
performances of the model is the Pcj : the
percentage of completed jobs
We found that to obtain a Pcj > 80%, the
Benefit payoff must be greater or equal
than the Cost payoff
When Cost > Benefit, we obtain a very low Pcj
When Cost = Benefit, the system takes longer
to reach Pcj > 80%
12
Experiments (results) (II)
13
ResourceWorld Conclusions
! We took the ResourceWorld model and
modified both benefit and cost utilities to
explore a large space of possible values
! In each case we checked if the protocol
maximized the collective utility or not
14
Project Specification
15
Implementation part
! Define 2 new mechanism of “Jobpassing”
– Pass only to altruistic nodes
– Job executed by altruistic nodes only
– Ordered visit of neighbors list
– Recursive job passing (small degree)
– …
! The global emergent mechanism mustbe understood
– Results must be compared and explainedwhatever they are
16
Beware not to cheat!
! Everything is based on local knowledge
! Other nodes’ state known only when
interacting with them
! It’s forbidden to chose nodes directly
from the network structure
– No global knowledge
– Only local views available for each node
17
Elaboration of the Data
! Examine the effects of the new proposed
mechanisms (through Observers):
– Cooperation
• Cooperation level (Percentage of coop nodes)
• Percentage of completed jobs (Pcj)
• Time for cooperation and Pcj
– Cooperation under Churn
• Same as above, but with churn
– Topology
• Clustering coefficient (CC)
• Average path length (APL)
• Network Snapshots
18
Elaboration of the Data (II)
! Examine initial settings effects on
performances
– Network size
– Network degree
– Skills number
– SLACER dropping parameter (W)
19
Provided code
! The package casProject provides:– Slacer
• Slacer protocol
• SLACERapp must be extended
• BooleanStrategyObserver (cooperating nodes)
• SlacerGraphPrinter (observer for snapshots)
– casProjectApp• casProject is the code you must write (extends
SLACERapp)
• casProjectObserver (Percentage of completed jobs)
! Additional Classes– If you need some additional mechanism feel free to
implement and use it!• New specific observer
20
Peersim Guidelines
21
Implementing new classes
! All the new code should be included in
classes implementing one (or more) of
the main peersim interfaces
– CDProtocol
– Linkable
– Control
22
Implementing CDProtocol interface
! peersim.cdsim.CDProtocol provides asingle method to describe protocolactions
– Void nextCycle (Node node, intprotocolID);
•node is the current running node
•protocolID is the protocol id in the currentnode protocol stack
– In nextCycle() any action performed by eachnode at each simulation cycle should beimplemented
23
Implementing Linkable interface
! peersim.core.Linkable provides abstract
methods for node view management
– public int degree();
– public Node getNeighbor(int i);
– public boolean addNeighbor(Node neighbor);
– public boolean contains(Node neighbor);
24
Implementing Control interface
! peersim.core.Control provides a single
method to describe global network
actions
– boolean execute();
! In execute(); any action performed at
each simulation cycle for global
management
25
Defining configuration parameters
! It is possible that components need
parameters to be passed by
configuration file
! peersim.config.Configuration provides
utilities to read parameters from
configuration file
– Numeric values
26
CDProtocol implementation example
public class casProject extends SLACERapp{
// configuration parameter definition
public static final String PAR_SKILLS = "numskills";
public casProject(String prefix) {
numSkills=Configuration.getInt(prefix+"."+PAR_SKILLS,5);
}
public void nextCycle( Node node, int protocolID ){
// protocol behavior
}
27
Control implementation examplepublic class casProjectObserver implements Control
{
public static final String PAR_PROT = "protocol";
public casProjectObserver(String name){
this.name = name;
pid = Configuration.getInt(name + "." + PAR_PROT);
}
public boolean execute(){
IncrementalStats queries=new IncrementalStats();
IncrementalStats completed=new IncrementalStats();
for (int i = 0; i<Network.size(); i++){
casProject protocol = (casProject) Network.get(i).getProtocol(pid);
queries.add(protocol.queries);
completed.add(protocol.completed);
}
double ratioComp=((double)completed.getSum()) / queries.getSum();
System.out.println(ratioComp);
Return false;
}
28
Configuration File (I)#random.seed 1150540268549
simulation.cycles 300
network.Shuffle
network.size 4000
protocol.0 example.newscast.SimpleNewscast
protocol.0.cache 20
protocol.1 slacer.Slacer
protocol.1.degree 20
protocol.1.linkable 0
protocol.1.application 2
protocol.1.reprprob 0.20
protocol.1.tagmutation 0.01
protocol.2 slacer.casProjectApp.casProject
protocol.2.linkable 1
protocol.2.numskills 5
protocol.2.queryprob 0.5
protocol.2.completed 1
protocol.2.processed -0.2
General settings
Protocols settings
29
Configuration File (II)
init.0 peersim.dynamics.WireKOut
init.0.protocol 0
init.0.k 20
init.1 slacer.SlacerInitializer
init.1.protocol 1
init.1.isolateprob 1
init.1.copyprob 1
init.2 slacer.casProjectApp.casProjectStrategyInitializer
init.2.protocol 2
init.2.quantity 0
Init.2.numskills 5
Init.2.skill_m 0.001
Init.2.strat_m 0.001
init.3 peersim.dynamics.WireKOut
init.3.protocol 1
init.3.k 20
Init.3.undirected
Control settings:
initialization
30
Configuration File (II)
control.ob0 slacer.BooleanStrategyObserver
control.ob0.protocol 2
control.ob1 slacer.casProjectApp.casProjectObserver
control.ob1.protocol 2
control.ob2 slacer.SlacerGraphPrinter
control.ob2.protocol 1
control.ob2.outf RWplot/
control.ob2.format dot
control.ob2.period 20
control.ob4 peersim.reports.GraphStats
control.ob4.protocol 1
control.ob4.period 50
control.ob4.nl 100
control.ob4.nc 100
Control settings:
Observers
31
Working with Peersim
32
Getting Peersim
! Peersim is available at
http://peersim.sourceforge.net
– (I suggest using peersim 1.0.1)
! Java 5 must be used, SunJava
JDK5.0(J2SE 1.5.0)
33
Compiling and Launching
! The easiest way for compiling peersim is
through this command:
javac -cp .:jep-2.3.0.jar:djep-1.0.0.jar `find . -name "*.java"`
To run a simulation the command you should
use is:
java -cp .:peersim-1.0.1.jar:jep-2.3.0.jar:djep-1.0.0.jar
peersim.Simulator slacer/casProjectApp/RW-conf1
34
Plotting the results
! Log files can easily be plotted using
Gnuplot or dragging them into Excel
! For the Network Snapshots, an easy
linux utility called Neato can be used
! For further information on Gnuplot and
Neato go to:– http://www.gnuplot.info/documentation.html
– http://www.graphviz.org/Documentation/neatoguide.pdf
35
Clustering Coefficient and
Average Path Length
36
Clustering Coefficient (CC)
! The CC for node i is the proportion of:
– links between the vertices within itsneighbourhood
– the number of links that could possiblyexist in i neighborhood
! If the graph is directed the number of
possible links is:
! It the graph is undirected the number
of possible links is:
! Network CC:
– Is the average of every node’s CC
!
ki(k
i"1)
!
ki(k
i"1)
2
37
Average Path Length (APL)
! Path length between node i and node j
– Minimum number of hops needed to gofrom i to j
– If j is a neighbor of i, the path length is 1
! APL is defined as the average number
of steps along the shortest paths for all
possible pairs of network nodes
38
Small World Networks
! A network with high CC and low APL is saidto be a Small World Network
! A Small World Network is a class of randomgraphs where most nodes are not neighborsof one another, but most nodes can bereached from every other by a small numberof hops or steps– High CC
– Small APL
! Examples– People acquaintance (social networks)
– Internet connectivity
– Gene networks 39
Calculating CC and APL with
Peersim
! Use the component:
peersim.reports.GraphStats
! Parameters:
– Protocol: the id of the protocol on which calculate
the CC and APL
– Period: every how many cycles
– nl: number indicating the dimension of the sample
of nodes on which to calculate the APL
– nc: number indicating the dimension of the sample
of nodes on which to calculate the CC
40
Churn
41
Churn can have several effects on a P2P system:
• data objects may be become unavailable if all replicas disconnect
• routing tables may become inconsistent
(e.g., entries may point to disconnected nodes)
• the overlay may become partitioned if many nodes suddenly
disconnect:
Effects of churn
42
Churn in peersim
! Use the component:
peersim.dynamics.DynamicNetwork
! Parameters:
– Add: number of nodes to add/remove
– Substitute
– Step
– From: starting cycle
– Until: end cycle
43
If you need any help
! Peersim resources page:
http://peersim.sf.net
! These slides on:
http://www.cs.unibo.it/~marcozzi
! For any questions:
44
References
! Hales, D. and Arteconi, S. (2006) Slacer: A self-organizing protocol for coordination in p2pnetworks. IEEE Intelligent Systems
! Hales, D. (2004) From selfish nodes tocooperative networks - emergent link basedincentives in peer-to-peer networks. In Proc. ofthe 4th IEEE International Conference on Peer-to-Peer Computing (P2P2004). IEEE ComputerSoc. Press
! Marcozzi, A. and Hales, D. (2008) EmergentSocial Rationality in a Peer-to-Peer System.Special Issue of ACS. (In press)