Apr 24, 2007

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

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.


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 :

No comments: