Next: p2pns.tools.Simulator Up: Overview of simulation tools Previous: Overview of simulation tools

p2pns.tools.SimulationGenerator

p2pns.tools.SimulationGenerator is a Java program that, as its name suggests, generates a simulation file. The first step towards running a particular tree-first overlay simulation is the creation of a simulation file. For each simulation tick, the simulation file specifies peer identifiers joining the overlay (peers are numbered), the uplink bandwidth capacity for each joining peer, and the duration that each joining peer stays in the overlay.


In order to create a simulation file, user has to specify the following parameters in a configuration file:


The above listed parameters are specified using XML. p2pns utilizes the Spring bean framework that essentially allows the creation of complex object graphs using XML. Each bean is created as an object of a class specified. The id of a bean is declared so that beans can be refereed to in a created object graph. Thus for example, SimulatorGenerator class has a java bean property named "leaveDistribution". That property is assigned an object/bean with id leaveDist, which in turn is an object automatically created according to properties specified in leaveDist bean declaration. For more details refer to Spring framework.

Figure 1: Configuration file used to create simulation file sim-10k.xml
\begin{figure}
\begin{verbatim}
<beans>
<bean id=''a'' class=''p2pns.util.U...
...''bandwidthDist''/></property>
</bean>
</beans>\end{verbatim}
\end{figure}


Figure 1 shows an example of configuration file that is used to create a simulation file named sim-10k.xml. This configuration file specifies that half of the peers will have an uplink capacity of 1 (that is, it can can forward the stream to 1 other peer) and the other half will have an uplink capacity of 4. Note that multiple UplinkDescriptor's can be declared as long as total percentage property adds up to 1.


The join distribution used is Poisson with an average rate of 30, while the duration distribution is exponential with a lambda parameter of 0.01. p2pns.util.CernDistributionWrapper is used to incorporate any subclass of cern.jet.random.AbstractDistribution to p2pns. For available distributions refer to CERN Colt Scientific library at . In addition to CERN distributions,p2pns.util.MeanValueDistribution allows combining of any two cern.jet.random.AbstractDistribution subclasses. For example, in order to create join distribution where half of the peers arrive at tick 100 and the other half arrive between tick 1 and tick 100, one would specify MeanValueDistribution depicted in Figure 2.

Figure 2: MeanValueDistribution example
\begin{figure}
\begin{verbatim}
<beans>
...
<bean id=''arriveDist1'' clas...
...Dist''/>
</property>
...
</bean>
</beans>\end{verbatim}
\end{figure}


After a configuration file has been specified, it is passed as a parameter to the p2pns.tools.SimulationGenerator Java program. This utility will generate a simulation file. SimulationGenerator is a non-deterministic. If SimulationGenerator is run twice with the same configuration input it will likely generate different simulation files.


Such a generated simulation file can be reused for multiple simulations involving different overlay algorithms. Each overlay simulation thus uses the exact same input for the entire simulation.


  
Next: p2pns.tools.Simulator Up: Overview of simulation tools Previous: Overview of simulation tools