You are on page 1of 22

DEVELOPMENT OF A DISTRIBUTED SYSTEM

SIMULATOR
A
Project Report
Submitted in Partial Fulfilment of The Degree

Bachelor of Technology
of
National Institute of Technology Calicut
By
Arun P Y2094
Jose Mathew Y2044
Rakesh S Y2048

Under the guidance of


Mr. S.D. Madhukumar

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

NATIONAL INSTITUTE OF TECHNOLOGY


CALICUT- 673601
April 2006
NATIONAL INSTITTUTE OF TECHNOLOGY
CALICUT

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

Certified That This Main Project Entitled

DEVELOPMENT OF A DISTRIBUTED SYSTEM


SIMULATOR

]Is a bonafide report of the work done by

Arun P Y2094
Jose Mathew Y2044
Rakesh S Y2048

In Partial Fulfilment of
Bachelor of Technology degree

_____________________________________________________________________

Mr. S. D. Madhukumar Dr. M. P. Sebastian


Senior Lecturer Professor and Head
Dept of Computer Science and Engineering Dept of Computer Science and Engineering

2
Acknowledgement

We thank Mr. S D Madhukumar, Senior Lecturer, Department of Computer


Science and Engineering NIT Calicut for his guidance and co-operation. We also
acknowledge the advice and help given to us by our friends. We would like to extend
our gratitude to the entire faculty and staff of the CSED NITC, who stood by us in all
pits and falls I had to face during the development phase of this project.

3
Table of Content
1 INTRODUCTION..................................................................................................6
1.1 Project Overview............................................................................................6
1.2 Motivation for Project ....................................................................................6
1.3 Project Objectives ..........................................................................................7
2 BACKGROUND....................................................................................................8
2.1 Background Research.....................................................................................8
2.2 Platform and Software Choice for the project................................................8
3 DSSIM PACKAGES..............................................................................................9
3.1 DSSIM Packages..........................................................................................11
3.1.1 The dssim package ...............................................................................11
3.1.2 The util package ...................................................................................11
4 DESIGN ...............................................................................................................12
4.1 Network Types .............................................................................................12
4.2 Overlay Network ..........................................................................................12
4.3 Failure and Recovery ...................................................................................12
5 IMPLEMENTATION ..........................................................................................13
5.1 DSSIM..........................................................................................................13
SimModel .............................................................................................................13
SimEvent ..............................................................................................................13
5.2 Link Types....................................................................................................14
5.3 Logical Network...........................................................................................15
5.4 Link Failure and Recovery...........................................................................16
6 Testing..................................................................................................................18
7 Future Work .........................................................................................................19
8 Conclusion............................................................................................................20
9 REFERENCES.....................................................................................................21

4
Abstract

A distributed system is a piece of software that ensures a collection of independent


computers to appear to its users as a single coherent system. The software simulating
this is a distributed system simulator. A Distributed system simulator is used for
evaluating the performance of the different algorithms such as middleware routing
algorithms. In actual implementation it is difficult to evaluate effectively a large-scale
distributed system which has substantial resource requirements in terms of node count
and network topology. This project aims at developing distributed system simulator
for testing and evaluating different algorithms intended to be run over large
distributed systems like the internet. Existing Distributed system simulators are far
less realistic. The newly developed simulator is a more realistic one incorporating new
features such as different types of physical links, dynamic link failure and recovery
simulation and it provides an enhanced logical visualization of the overlay network.

5
1 INTRODUCTION
This Chapter outlines the aims of the project and motivation behind its
implementation.

1.1 Project Overview

Currently existing network simulators lacks scalability. Distributed system simulator


DSSIM by Peter Pietzuch, (Computer Laboratory, University of Cambridge)
incorporates scalability but it is not much realistic. DSSIM only provides some basic
functionalities of Distributed system. This project is an attempt to add some additional
features to DSSIM to make it a more realistic simulator for a large scale distributed
system such as the internet. The new simulator will provide a better testing ground for
routing algorithms, new protocols, new services and applications.

1.2 Motivation for Project

Middleware has emerged as a critical second level of the enterprise IT infrastructure,


between the network and application levels. There had been an attempt to develop a
new event based middleware based on publish subscribe model rather than the already
implemented middlewares based on request reply model. The new event based
middleware is based on the research paper Hermes by Peter R. Peitzuch.

The new middleware is needed to be tested on a simulator before being implemented


over the internet. The simulator can be used for testing and evaluating different parts
of an event based middleware including event model, routing model etc. The existing
Distributed system simulator DSSIM is only a primitive simulation of an actual
distributed system. So we tried to add some new features to DSSIM such as different
types of networks, overlay networks and failures of network links.

6
1.3 Project Objectives

The major objectives of this project are as follows:

Implementation of an overlay network


Reflecting the unpredictable nature of network links in a real Distributed
system like the internet.
Expanding the concepts of links by introducing new link types.

7
2 BACKGROUND
The background section of this project looks at areas considered during the
development phase of the simulator. This includes research conducted on Hermes a
research paper on event based middleware, and DSSIM a skeletal distributed system
simulator. This section will also consider tools and the programming language used
for implementation.

2.1 Background Research

The research was mainly on understanding the concepts of an event- based


middleware. For this, the thesis which proposed the event-based middlewares Hermes
[1] and Rebecca [2] proved to be beneficial. The routing models are implemented on
the lines of a publish/subscribe model - a model where the nodes may be publishers,
who are the source of messages, or subscribers, who receive them. To get a rough idea
of the implementation and working of a Distributed system simulator, DSSIM [3]
implemented by Peter R. Peitzuch , University of Cambridge was useful.

DSSIM was downloaded, installed and configured. Further studies on its inputs and
outputs were made as a case study. DSSIM is a highly scalable distributed system
simulator. It supports simulations with 105 physical nodes. DSSIM has moderate CPU
and memory requirements. The performance of routing algorithms and other
distributed algorithms, protocols etc. can be measured by DSSIM. DSSIM models
latency and hop count of routing messages in the physical network. DSSIM uses a
hierarchical two-level distance vector routing algorithm

2.2 Platform and Software Choice for the project.

DSSIM was implemented on Java. Since this project used DSSIM as a basis to add
new features, the language Java is used. Java provides an extensive API for graphical
development. This APIs were used for developing the visualisations of both logical
and physical topologies. Netbeans IDE, an integrated development environment for
Java is used for the implementation.

8
3 DSSIM PACKAGES

For easier evaluation of routing models and better feasibility, it was decided that the
routing models would be implemented on the distributed systems simulator DSSIM.
The distributed systems simulator DSSim is implemented in Java as a single-threaded
discrete event simulator. The primary design consideration for DSSIM was
scalability. Therefore, it supports simulations with 10 physical nodes while only
having moderate CPU and memory requirements. DSSIM models the latency and the
hop count of routing messages in the physical network, and it also maintains a
measure for bandwidth consumption. Note that congestion caused by bandwidth-
limited links is not modeled in DSSIM.

DSSim distinguishes between a physical network topology generated by the topology


generator and a logical network topology obtained after mapping application-level
nodes that execute a distributed algorithm onto the physical nodes. Logical nodes
communicate through message passing, and DSSim simulates the routing of messages
in the physical network topology. Expensive routing table management frequently
limits the scalability of network simulators. DSSim uses a hierarchical two-level
distance vector routing algorithm that mimics Internet routing between and within
autonomous systems.

Figure 3.1 The Architecture of DSSIM

9
An overview of the internal architecture of DSSim is provided in Figure 3.1. The core
of DSSim is an event loop that takes simulation events from a time-ordered event
queue and executes them. A simulation event is, for example, the request of a logical
node to send a message, or the routing of a message by a physical node. Events are
added to the event queue by logical nodes through the EnvironmentIF interface.
This interface enables a logical node to interact with its environment and handle
messaging, monitoring, and time aspects during the simulation. The execution of
logical nodes is scheduled by the simulator, which calls a runNode method whenever
a particular node is supposed to run.

The functionality of the simulator can be extended with plug-ins that are inserted into
the event loop and can process simulation events. Currently there are four plug-ins
implemented in DSSim: a trace plug-in that records all simulation events in a file for
later replay, a statistics plug-in that gathers statistics during the simulation, and two
visualisation plug-ins. The visualisation plug-ins allow the display of a graphical
representation of the logical and physical network topologies and can visualise the
routing of messages and the internal state of logical nodes.

10
3.1 DSSIM Packages

In order to understand more about DSSIM, a brief description of the packages


implemented in DSSIM is given below.

3.1.1 The dssim package

The DSSIM package literally has the entire DSSIM contained in it. It contains sub-
packages that contain the code for the simulator, the codes for generating physical and
logical topologies, the code for generating a node, the codes for generating
visualisations etc. The sub packages in this package are:

1. The environment package: Provides all the interface classes which are
essential to implement an addressing scheme, a messaging scheme, a
simulation monitor, a clock etc.
2. The examples package: Has the source code giving examples as to how to
generate a running code for simulation purposes.
3. The node package: Has all the files necessary for making a node.
4. The simulator package : Is the package that 'contains' the simulator. This has
the necessary files for creating a simulator, handling simulation events in
message queues, sending messages from one node to the other simulation Eg a
real network etc, for creating a topology, for creating messaging and
monitoring interfaces, for selecting a routing model etc.

3.1.2 The util package

There is also a util package that provides some other utility classes which may be
used. Examples of some files are ByteArray.java, Debug.java, RingBuffer.java etc.

11
4 DESIGN
This chapter describes the design decisions made for achieving aims that were
specified in the introduction. This includes the new features added to DSSIM.

4.1 Network Types

Initially DSSIM supported only one kind of network. All the links in the network
were taken as identical. Diversity of networks must be incorporated for a realistic
simulation. So three generic classes of networks namely fast, normal and reliable,
were introduced. Using this new feature the event brokers can communicate in a
diverse way. They could choose either a fast network for fastest delivery or reliable
for secure communication.

4.2 Overlay Network

An overlay network is a computer network which is built on top of another network.


Initially there was no overlay network in DSSIM. Introducing overlay networks will
provide an abstract view of the entire network. Because of its high scalability, DSSIM
can simulate thousands of nodes present in the physical level. Providing this
abstraction will help in an easy monitoring of the entire system.

Nodes in the overlay network can be designed as a set of brokers having a one to one
correspondence with a selected set of physical nodes. . Nodes in the overlay can be
thought of as being connected by virtual or logical links, each of which corresponds to
a path, perhaps through many physical links, in the underlying network.

4.3 Failure and Recovery

Failure is a very common thing in actual networks. In very large networks, failures
occur frequently. So failure simulation is an indispensable thing in realistic
simulation. So we need to simulate random failures of network links. Algorithms in
distributed systems should be able to cope with network failures. So simulation of
failures is very important.

The simulator should be able to dynamically recover from failures. Failure recovery
should be achieved by modification of the routing tables. Now the messages will be
routed according to the new routing tables.

12
5 IMPLEMENTATION
This section describes the development of the final project solution based upon the
decision in the Design chapter and ideas formed during this phase.

5.1 DSSIM

DSSIM, Distributed Systems Simulator is developed by Peter R. Peitzuch. It is a


skeletal distributed system simulator implemented in Java. We are using the basic
class structure of DSSIM for adding new features, which makes it more realistic.

The major classes in DSSIM are

SimModel

SimModel defines the properties of the network to be simulated. It has got four main
attributes namely routing model, node mapping, node processing delay and router
processing delay. Routing model defines the strategy used for computing the routing
tables in the physical level. For example, All Shortest Path Routing Model. All
Shortest Path Routing Model will compute the shortest path between nodes.

Node Mapping contains information about all logical nodes in the network. It has a
mapping from logical nodes to their corresponding physical nodes. Node Processing
Delay is the time needed to process a message by the destination node. Router
Processing Delay is the time needed by an intermediate node to route the message to
its destination node.

SimEvent

DSSIM is a discrete event based simulator. Every action is handled as an event.


SimEvent consists of the set of pre-defined events in DSSIM.

Dssim

Events are handled in the class Dssim.

Topology

DSSIM provides some predefined topologies such as ring topology, transit stub
topology, random topology etc.

13
5.2 Link Types

Three new types of links were introduced into DSSIM, name Fast link, Normal Link
and Reliable Link. These three types of links differ in time delays, fast being the
fastest and reliable being the slowest. They also differ in their probability of failures,
reliable being the less probable and fast being most probable.

Three matrices were added for each type of links in the routing model to compute
individual routing tables. The matrices were delay matrix to represent the delay
between two nodes, nexthop matrix for finding the next hop in routing a message and
linkmatrix to specify the next link to follow in routing.

Routing strategy in case of multiple links is to follow the specified link to the
maximum. If a route cannot be found, then we will compromise with other link types
(most appropriate). For example, if we are finding a reliable route between two nodes,
we will follow reliable links to the maximum, and if it is not available we will
compromise with a normal link or in the worst case with a fast link.

The major additions and modifications are made in the following classes of the
DSSIM.

PhysicalLink : Added different types of links and assigned different


delays for them

AllShortestPathRoutingModel: Added three types of routing tables for three types of


Network

AllShortestPathRoutingModel: modified convertToMatrix() and calculateShortPath()


to support the types of network

PhysicalVisualiser : To visualise three types of links

EN

14
5.3 Logical Network

Logical network consists of set logical nodes and set of logical links. Logical nodes
can be considered as a set of brokers having a one to one correspondence with a
selected set of physical nodes. Node Mapping maps the logical nodes to physical
nodes. Logical Links were added as connections between these logical nodes.

There exists three types of logical networks, as there are three types of physical links.
Thus there can be three logical links between same logical nodes.

Messages are sent between logical nodes. But routing is done in the physical level.
We introduced a new header field to specify the type of network through which it
should be routed. Logical Nodes can alter these headers according to the routing
strategy in the overlay level. On receiving a message in the physical node, it will route
the message according to the header in the message.

To compute the logical links, messages would be sent between logical nodes.
Consider a message M is send between logical nodes A and B.
If that message reaches a logical node, say C, before reaching any other logical node,
then

nextHop[A][B] = C
nextHop[A][C] = C

else if message M reaches B before reaching any other logical node, then

nextHop[A][B] = B
nextHop[B][A] = A

The major additions and modifications are made in the following classes of the
DSSIM.

package uk.ac.cam.opera.dssim.node :- Added files to represent logical links and


logical network

LogicalVisualiser : to visualise logical network

15
5.4 Link Failure and Recovery

Physical link failure is simulated on a random manner. To simulate a failure we create


random events of link failure and entered into the event queue. Failure susceptibility
depends on the type of link. Reliable links have the least probability of failure and fast
links are the most susceptible. The losing of messages in the link at the time of failure
is simulated.

In case of a link failure, a distributed system should recover. Dynamic failure


recovery is implemented by recalculating the routing tables. The further transmission
of messages follows the new routing tables.

Fig 1 Physical Network before Link Failure

16
Fig 2 Physical Network after Link Failure

The major additions and modifications are made in the following classes of the
DSSIM.

SimEvent : Added a new event for link failure.

DSSim : Creating the link failure event and scheduling it in the


simulator

Topology : Deleting a link from the topology.

RoutingModel : Recalculating the routing tables after the link removal.

17
6 Testing
The DSSIM package contains some standard test programs which can used for testing
the new simulator. The test programs are slightly modified to verify the working of
new features added. The following example algorithms are tested on the simulator.

TopologyDiscovery.java

This is a simple algorithm used to discover all logical nodes in the overlay network.

Fig 3 TopologyDiscoveryPhysicalVisualisationExample

RandomMessageSimulation.java

This is another algorithm which sends messages randomly between Logical nodes.

18
7 Future Work
The future work may include adding different types of nodes such as reliable node
and unreliable node. It may also include considerations of node processing delay
variations. Node Failures can also be included in the simulator with failure
frequencies different for different types of nodes.

Extending the network types to other topologies such as transit stub topology,
random topology. Extending support to different routing models as well.

19
8 Conclusion
The new simulator is found to be more realistic than the old one. Different test
programs verified the new features added. This simulator is a better platform for the
testing of new internet applications and protocols. Future work includes the usage of
this simulator for testing the new event based middleware developed.

20
9 REFERENCES

[1] Peter R. Peitzuch: Hermes: A scalable event-based middleware,


http:// portal .acm.org/ citation.cfm? id=7080508.

[2] Rebecca: Large Scale Content-based Publish/Subscribe Systems.

[3] DSSIM : A Distributed System Simulator by Peter Pietzuch, Computer


Laboratory, University of Cambridge .

[4] Computer Networks: A Systems Approach, 3rd Edition by Larry Peterson


(Author), Bruce Davie (Author).

[5] The network simulator - ns-2. http://www.isi.edu/nsnam/ns/

21
This document was created with Win2PDF available at http://www.daneprairie.com.
The unregistered version of Win2PDF is for evaluation or non-commercial use only.

You might also like