Showing posts with label source code. Show all posts
Showing posts with label source code. Show all posts

Apr 24, 2007

Simulation of BitTorrent Peer-to-Peer (P2P) Networks in ns-2

Overview:
Peer-to-peer (P2P) networks can reduce the distribution cost of large media files for the original provider of the data significantly. Thereby, the BitTorrent protocol is widely used in the Internet today. Most research work studies the protocol analytically, by simulations at the flow-level or real world experiments. Thereby, for flow-level simulations the influence of neglecting packet-level characteristics is not yet quantified.

Therefore, we implemented a BitTorrent-like protocol for the network simulator ns-2. We denote it as BitTorrent-like, because we do not intend to implement a specific version of BitTorrent, but aim at assessing the differences between a full simulation of all network layers and simplified simulations on the application-layer. Thus, some functionalities were simplified and others were omitted. In detail, in our simulator no torrent file is used and the downloaded data is not checked for data integrity by hash values. The HTTP tracker protocol is not implemented. That is, all tracker traffic is directly given to the peers rather than being transmitted over the network. We use this simplification because we are predominantly interested in the efficiency of the data transfers between the peers. Each peer runs the original unchoking algorithm. Thereby, anti-snubbing and the endgame-mode are neglected. We omitted the endgame mode in our implementation because it is not clearly specified when a peer switches to the endgame mode. Hence, different implementations realize it differently. Furthermore, anti-snubbing was omitted because it can result in situations where a peer does not contribute its upload bandwidth although it can transfer data to other peers. This can cause inefficiency in the network.

However, we implemented the super-seeding functionality because it improves considerably the performance for the flash crowd scenario. The BitTorrent implementation is modular. That is, the peer and the piece selection algorithms can be replaced by alternatives. Thus, different implementations of BitTorrent-like networks can be compared easily by simulations.

Reference:

K. Eger, T. Hoßfeld, A. Binzenhöfer, G. Kunzmann: "Efficient Simulation of Large-Scale P2P Networks: Packet-level vs. Flow-level Simulations", 2nd Workshop on the Use of P2P, GRID and Agents for the Development of Content Networks (UPGRADE-CN'07), in conjunction with 16th IEEE HPDC (High Performance Distributed Computing), June 25-29, 2007, Monterey Bay California, USA.

Source code:
Patch for ns-allinone-2.29
Sample script for packet-level simulation
Sample script for flow-level simulation

The patch changes the source code of agent.cc, agent.h, node.cc, node.h, tcp-full.cc, tcp-full.h and Makefile.in. Additionally, it adds the folder bittorrent/ with the corresponding files of the BitTorrent implementation. To apply changes run

patch -p1 < bittorrent.patch
in the ns-2.29 folder.
The two sample scripts simulate a flash crowd with initially only one seed and a number of leechers in the network.

Website Extracted from here

Kolja Eger
Hamburg University of Technology (TUHH)
Communication Networks
fon: +49-40-42878-3480
fax: +49-40-42878-2941
e-mail: eger@tuhh.de
web: http://www.tu-harburg.de/et6/staff/eger.html

tags :

Oct 16, 2006

Developing new queue management

Ilyes Gouta ilyes.gouta at gmail.com
Sat Apr 29 14:06:11 PDT 2006

Hi,

You have to create the necessary TCL binding within your new C++ code
too. That binding will be used later by your simulation scripts.

In the C++ part, you'll have to add a class like this:

static class NewQueueClass : public TclClass
{
public:
NewQueueClass () : TclClass("Queue/NewQueue") {}
TclObject* create(int, const char*const*)
{
return (new NewQueue);
}
} class_new_queue;

And then in the simulation script:

$ns node-config option1 option2 option3 -ifqType Queue/NewQueue
This will tell NS to use your new queue for the newly created nodes.

Hope it helps,
Ilyes Gouta.


On 4/29/06, Eduardo J. Ortega wrote:
Hi:
I tried this, recompiled ok, but my sims won't run no matter what my code is.
i thought maybe my code was wrong, so i decided to copy droptail.{cc,h} to
fifo.{c,h} and change class names to FIFO, then add fifo.o to makefile and
recompiile. It compiled, but again, sims won't run when i try to use fifo
instead of droptail.

Any clues?


On Saturday 29 April 2006 11:11, you wrote:
Hi,

Have a look into the ~/ns-2.x/queue directory. You'll find all sorts
of implementations for different active queues. This include RED, RIO,
PRIO, JOBS, etc.

Implementing a new queue is rather easy actually, you'll have to
inherit from Queue and implement the enque() and deque() methods. This
is really it! Don't forget to add you source code to NS's makefile to
get it compiled.

Regards,
Ilyes Gouta.


On 4/29/06, Eduardo J. Ortega wrote:
hey there:

Anyone knows how to code new queue algorithms into NS? (for example, choke)? Thanks.

--
Eduardo J. Ortega - Linux user #222873
"No fake - I'm a big fan of konqueror, and I use it for everything." --
Linus Torvalds



tags :