Many innovative P2P algorithms designed for mobile ad-hoc networks (MANETs) have been designed to scale smoothly when handling a very large number of nodes and transmissions. To cope with the complexity of software development for large-scale MANETs, simulations are widely used instead because hardware implementations are too costly. Simulations are very well suited to testing and evaluating concepts, but when implementing algorithms for testing on target systems, unexpected problems can often surface. Thus, once simulations have provided satisfactory results, emulation is a more desirable approach for detecting and handling unexpected behavior before committing to large-scale deployment. In particular, given that large P2P testbeds require a large number of devices spread over a prohibitive space and are limited by complex programming models, the authors are featuring a Java-based emulator called Freemote. To demonstrate some of the practical advantages of combining simulation and emulation, Freemote makes it possible to integrate real and emulated nodes, and the real nodes (JMotes) run exactly the same Java programs as emulated nodes. Since the JMotes are still not very widely used, the Freemote emulator and JMotes have been designed to be compatible with the more popular Berkeley’s motes. Furthermore, remarkable visualization and development tools have been implemented to undertake large-scale emulation of ad-hoc algorithms, featuring a high level of realism. Freemote has been tested in emulations for up to 10,000 nodes, distributed over ten computers (refer to a preceding chapter of this book “P2P Information Lookup, Collection and Distribution in Mobile Ad-Hoc Network” for a test application running DHT algorithms). In this chapter, the authors present the Freemote platform along with the results of a brief comparison of emulation and simulation experiments.
P2P systems first emerged as overlays stacked on top of the Internet for many useful applications including file sharing, VoIP, distributed data storage (Freenet), collaborative tools, etc. (Khan & Wierzbicki, 2008). Their success is usually based on the peer-to-peer property intrinsic to the Internet, providing transmission routes between end-nodes. In MANETs, the situation is different because end-nodes can also act as routers; or more precisely wireless routers. This means that each end-node/router has at least one wireless link to all physical neighbors defined by its radio coverage area. MANETs also differ from the classical Internet because their wireless links are usually much less reliable than fixed links, and are often impaired by congestion. Also, assumptions generally made regarding bidirectional links may not be true, given differences between nodes caused by implementations, remaining battery power levels, time variances, physical environments, etc. Finally each end-node/router’s participation also varies in time in certain cases, due to its joining or leaving the MANET for a variety of reasons: changes in geographical position, turning itself off for some period of time to reduce power consumption, etc. The MANET node’s wireless router role can however be seen as an advantage, and for this reason many innovative algorithms have been designed for them. One possible goal for these algorithms is to ensure smooth scaling when applied to very large number of nodes and transmissions. Simulations must often be used however to evaluate P2P/MANETs applications, given the difficulty and expense involved in deploying a real, large-scale testing network. Also, monitoring of nodes in a real network is a time-consuming and complex task, given that nodes are usually distributed geographically, communicate over changing routes and might only provide few output modalities (often limited to a few LEDs) used to track execution, even during testing phases. Moreover, the deployment an ad-hoc network in real size for testing purposes requires extensive resources: equipment, space, time and manpower. Thus, since this phase cannot usually be actually conducted it may in some cases be replaced by specially designed software tools and frameworks able to run repeatable experiments in controlled environments or provide meaningful numerical values based on averages and statistical analyses. Due to time and resource constraints however, even experiments such as these cannot be always conducted.
Once a P2P algorithm has been designed and its performance demonstrated analytically or through simulation, it would be ideal to take the proposed algorithm’s source code and simply port it and run in an environment closer to reality, but without the irreproducible effects encountered in real environments. The same source code would have to be used to avoid any potential differences between the specifications and implementation.
With the afore-mentioned facts in mind, we developed the Freemote emulator in order to provide a suitable platform on which to test P2P applications and algorithms designed for MANETs of any size (a few or several thousands nodes). To ensure their practical suitability and behavior credibility in the simulated environment, we decided to link the emulated nodes with real nodes, thus forming an integrated ad-hoc network environment. These capabilities were thought to be the most important ones compared to other last-step performance evaluations preceding full-scale deployment in a real environment. Thus, to facilitate many aspects related to software development we chose the Java language. This choice is also justified given the availability of Java programmable JMote prototypes developed at the University of Applied Sciences in Fribourg (http://www.eia-fr.ch). This Freemote emulator is able to run the same Java source code on the real and emulated nodes, thus bringing experimental results closer to reality.
Given that Java programmed nodes are not widely used, we chose a transmission format compatible with the popular Berkeley motes programmed using the nesC programming language (nesC, 2008). This internodes communication is in fact based on the TinyOS (TinyOS, 2008) message format, allowing the well-known MICAZ and TelosB Berkeley type nodes to be used as real nodes.