Chord implementation for Peersim
Andrea Presa
presa.andrea@gmail.com
1. Configuration file
This document explains how to write the configuration file that allows to execute the chord protocol in the
Peersim network simulator. This is the content of the example file config-chord.cfg:
# random.seed 1234567890
simulation.endtime 10^6
simulation.logtime 10^6
simulation.experiments 1
network.size 5000
protocol.tr UniformRandomTransport
{
mindelay 0
maxdelay 0
}
These lines are standard declarations in Peersim event-driven protocols: the first one defines the seed used to
generate pseudo-random numbers (if uncommented all the simulations will behave the same, useful for
debugging), the second and the third define the time taken by the simulation and the logging of results, the
fourth the number of experiments, the fifth the number of nodes in the network. The last commands create a
transport protocol that will be necessary to send messages between nodes.
protocol.my ChordProtocol
{
transport tr
}
Here is where we define the core protocol that simulates the behaviour of a chord application in every node.
Messages will be exchanged by the transport protocol defined above.
control.traffic TrafficGenerator
{
protocol my
step 100
}
We need now to istantiate a control subclass that will generate lookup messages (source and destination are
randomly choosen) every predefined step of time.
init.create CreateNw
{
protocol my
idLength 128
succListSize 12
}
Prior to the simulation we have to create the perfect chord network. CreateNw class will initialize every
node by generating the Chord identifiers (randomly chose within the number of bytes specified in
idLength), linking successors (the succListSize is the size of the successors list) and predecessors,
- 1
- 2
前往页