移动对等网络覆盖网模拟器比较与开发

2015-07-02 00:19
关键词:模拟器节点

李 军

(1.哈尔滨工程大学 计算机科学与技术学院,黑龙江 哈尔滨 150001;2.安庆师范学院 数学与计算科学学院,安徽 安庆 246133)

移动对等网络覆盖网模拟器比较与开发

李 军1,2

(1.哈尔滨工程大学 计算机科学与技术学院,黑龙江 哈尔滨 150001;2.安庆师范学院 数学与计算科学学院,安徽 安庆 246133)

为了确定已有的通用网络模拟器和P2P网络模拟器能否很好的支持移动对等网络模拟,比较和分析了已有的二十余种网络模拟器的特性,得出了仅有极少数网络模拟器较适合移动对等网络覆盖网模拟的结论,并以其中一种模拟器为例,给出了移动对等网络覆盖网模拟的开发步骤,最后提出了移动对等网络覆盖网模拟器的发展方向。

移动对等网络;覆盖网;网络模拟器;并行性;触发方式

验证对等网络协议的性能主要有3种方法:一是通过理论分析,计算其路由算法的时间和空间复杂度;二是通过部署真实设备来进行系统仿真实验,如著名的PlanetLab[1]仿真网络,由1 160台主机组成,遍布全世界25个国家和地区,一百多所大学和研究机构,包括我国部分高校都加入了该网络。该网络可以用来进行覆盖网协议,内容分发协议,网络安全协议等多种虚拟网络协议的仿真;三是通过网络模拟器来进行网络协议的模拟,从而进行性能的比较、分析及优化。

网络模拟器中最著名的莫过于NS2[2]网络模拟器,它可以模拟成千上万个网络设备的运行,只需要在一台主机上几个小时即可完成。网络模拟器的优点是操作简单、维护方便、系统投入较小、生成的实验结果可信度较高。对于P2P网络来说,网络模拟器主要分为两种,一种是通用网络模拟器,另一种是专门的P2P网络模拟器。前面提到的NS2是一种通用网络模拟器,它的优点是对网络层及以下层的支持较好,但对网络层以上,尤其是应用层的支持较差。P2P网络模拟器专门针对P2P网络开发,其中很多模拟器都实现了一些经典P2P网络模型,方便用来进行对比分析。但P2P网络模拟器通常忽略了某些实现细节,对底层网络的支持普遍不好。

1 通用网络模拟器

网络模拟器按照触发方式分,可以分为离散事件触发的模拟器和基于周期触发的模拟器。离散事件模拟器将计划好的事件存放在事件队列中,按照触发条件依次执行事件,每个事件是指模拟器需要执行的相应动作。基于周期触发的模拟器按照时间周期来执行相应的动作,效率相对较高,但与实际情况的符合程度不如离散事件模拟器。除此以外,模拟器的运行方式有串行和并行两种,并行方式可以提高模拟器的运行效率,缩短实验时间。为了模拟不同的网络,大多数通用模拟器支持生成特定类型的网络拓扑结构,有些还支持专门的网络拓扑生成器。典型通用网络模拟器分类与对比如表1所示。

2 P2P网络模拟器

P2P网络模拟器按照网络模式分,可以分为流模式和包模式。采用流模式的模拟器工作在应用层上,对网络进行了简化,节点之间直接计算通过端的带宽和延迟。采用包模式的模拟器按照数据包来计算网络带宽、延迟等,是比较精确的网络模式。大部分的P2P模拟器采用了流模式。

除此以外,不同的P2P网络模拟器支持不同类型的P2P网络,如非结构化网络或结构化网络,也有同时支持两种的。和通用网络模拟器一样,P2P网络模拟器也有并行与否、是否支持扰动和节点移动性等方面的不同。典型P2P网络模拟器分类与对比如表2所示。

表1 典型通用网络模拟器分类与对比表

注:文献[3-4]对带宽模拟没作说明,文献[6]对并行没作说明。

表2 典型P2P网络模拟器分类与对比表

从表2可以看出,与通用网络模拟器大多数由C++语言编写不同,P2P网络模拟器大部分是由Java语言编写的,P-Sim[23]是由解释性语言Python编写的。部分P2P网络模拟器没有采用离散事件的触发方式,而是采用了周期方式。PeerSim[11]与dPeerSim[25]同时支持离散事件和周期触发两种方式,其中dPeerSim是PeerSim的并行化改进版本。有近一半的P2P网络模拟器没有能够支持并行化模拟操作,从而影响了执行效率,尤其对于多处理器计算平台来说,并行化模拟操作能够有效缩短模拟时间。

3 P2P网络模拟器的选择与应用

对于P2P网络模拟器,按照以下标准进行移动对等网络覆盖网模拟器的选择:

1)能够同时支持结构化和非结构化的P2P网络模拟;

2)触发方式为离散事件;

3)能够模拟网络扰动;

4)能够支持移动节点的模拟;

5)主程序仍在更新、有技术支持。

按照以上5条标准,只有Oversim和PeerfactSim两种P2P网络模拟器满足要求。两种模拟器都提供了详细的技术文档,始终在进行版本更新,并且都是开源免费的。相比较而言,PeerfactSim模拟器对移动网络的支持更加简单方便、其开发语言Java较Oversim的开发语言C++更加规范、学习周期更短。实践证明,PeerfactSim模拟器完全能够满足移动对等网络覆盖网模拟实验的各种要求。

3.1 PeerfactSim的基本结构

PeerfactSim是一个基于Java开发的离散事件模拟器,采用了分层的体系结构,共分为5层,自底而上分别为网络层、传输层、覆盖层、服务层和应用层。节点扰动模型在网络层实现,目前支持KAD、指数、常数3种模型。模拟器引擎贯穿各层,并通过登录与统计模块提供与外部软件的接口。

3.2 PeerfactSim的应用与开发

PeerfactSim模拟器提供了详细的操作手册和开发技术文档,开发者需熟悉Java程序设计语言和开发模式的相关知识。整个PeerfactSim的应用开发过程可分为以下步骤:

1)设置节点属性、赋初值

节点的属性与初值由算法决定,一般按照命名规则在以下3个源文件中进行定义:

xxxnodefactory.java

xxxnode.java

xxxservice.java

2)实现节点间消息

节点间如果不需要发送消息则此步骤可以省略,一般将源程序放在.messages文件夹下,下面是一个程序示例:

public class PingMessage extends BaseMessage

{

public PingMessage(GnutellaOverlayID sender, GnutellaOverlayID receiver, int ttl, int hops, BigInteger descriptor)

{

super(sender, receiver, ttl, hops, descriptor);

}

}

3)实现节点操作

将关于节点操作的源文件放在.operations文件夹下。此步骤为开发重点,需要模拟的算法主要需要在这部分实现,其中模拟操作的具体调用机制已被PeerfactSim模拟器封装在内部,一般情况下在protected void execute()中实现算法即可。

4)设置缺省参数值

在xxxConfiguration.java文件中设定默认参数值,方便修改。

5)实现数据监控与结果输出

通过分析器(analyzer)或Debugger进行实验数据监控,是开发的重点之一。

实验结果一般输出到文件,可指定文件夹。

6)修改配置文件并运行

配置文件存放在.config文件夹下,为xml格式。节点个数、移动速度、扰动模型、会话时间等都可以自行设定。

7)数据整理与展示

数据经整理可通过GnuPlot软件直接输出图,也可将数据手工输入Matlab作图。

4 结束语

本文为实现移动对等网络覆盖网的模拟,对多种网络模拟器进行了分析和对比,给出了每个网络模拟器详细的属性说明,包括开发语言、支持的网络类型、触发方式、是否支持节点的扰动和移动等等。以PeerfactSim模拟器为例介绍了移动对等网络覆盖网模拟的详细开发步骤和示例。

目前虽有些模拟器对大规模移动对等网络覆盖网的模拟实现较好,但这些模拟器对于并行性的支持都较差。近年来,虽然已经有学者[27]对大规模并行P2P模拟器的设计与实现进行积极的探索,但如何开发新的并行模拟器以及增强现有模拟器的操作并行性仍是一个非常有挑战的课题。

[1] B. Chun, D. Culler, T. Roscoe, et al.. PlanetLab: an overlay testbed for broad-coverage services[J]. ACM SIGCOMM Computer Communication Review,2003, 33(3):3-12.

[2] The Network Simulator-ns-2[EB/OL]. (2014-12-19) [2015-03-20] https://ant.isi.edu/nsnam/index.php/ Main_ Page.

[3] OMNeT++[EB/OL].(2015-09-18)[2015-09-29] http://www.omnetpp.org/.

[4] G. F. Riley. Large-scale network simulations with gtnets [C]. Winter Simulation Conference. 2003: 676-684.

[5] OPNET[EB/OL]. (2012-10-01)[2015-03-29] http://www.opnet.com.

[6] A. Sobeih, M. Viswanathan, D. Marinov, et al.. J-Sim: an integrated environment for simulation and model checking of network protocols[C]. IEEE International Parallel and Distributed Processing Symposium. 2006.

[7] Xiang Zeng, R. Bagrodia, M. Gerla. GloMoSim: a library for parallel simulation of large-scale wireless networks[C]. Workshop on Parallel and Distributed Simulation. 1998.

[8] NS-3[EB/OL]. (2011-12-21)[2015-03-29]http://www.nsnam.org/.

[9] SSFNet[EB/OL]. (2004-01-15)[2015-03-29]http://www.ssfnet.org/homePage.html.

[10] T. M. Gil, F. Kaashoek, Jinyang Li, et al.. p2psim[EB/OL]. (2005-04-18)[2015-03-29] https://pdos.csail.mit. edu /archive/ p2psim/.

[11] A. Montresor, M. Jelasity. PeerSim: A scalable P2P simulator[C]. the 9th International Conference on Peer-to-Peer (P2P'09). 2009: 99-100.

[12] Qi He, M. Ammar, G. Riley, et al.. Mapping peer behavior to packet-level details: a framework for packet-level simulation of peer-to-peer systems[C]. 11th IEEE/ACM International Symposium on Modeling, Analysis and Simulation of Computer Telecommunications Systems. 2003: 71-78.

[13] I. Baumgart, B. Heep, S. Krause. OverSim: a flexible overlay network simulation framework [C]. 10th IEEE Global Internet Symposium (GI '07)b in conjunction with IEEE INFOCOM. 2007:79-84.

[14] N. S. Ting, R. Deters. 3LS: a peer-to-peer network simulator [C]. The third international conference on peer-to-peer computing, 2003: 212-213.

[15] S. Joseph. NeuroGrid: semantically routing queries in peer-to-peer networks [C]. International workshop on peet-to-peer computing, 2002: 202-214.

[16] M. T. Schlosser, T. E. Condie, S. D. Kamvar. Simulating a P2P file2sharing network [C]. 1st Workshop on Semantics in Peer-to-Peer and Grid Computing 12th International World Wide Web Conference. 2002: 69 -80.

[17] P. Garcial, C. Pairo, R. Mondéjar. PlanetSim: a new overlay network simulation framewok[J]. Lecture Notes in Computer Science, 2005, 3437: 123-136.

[18] Weishuai Yang, N. Abu-Ghazaleh. GPS: a general peer-to -peer simulator and its use for modeling bittorrent [C]. 13th IEEE International Symposium on Modeling, Analysis, and Simulation of Computer and Telecommunication Systems. 2005: 425-434.

[19] T. J. Giuli, M. Baker. Narses: a scalable flow-based network simulator[R]. Stanford University Technical Report, 2002.

[20] K. Kant, R.R. Iyer. Modeling and simulation of adhoc/P2P resource sharing networks [C]. The 13th international conference on modelling techniques and tools for computer performance evaluation. 2003: 1-27.

[21] K. Shudo, Y. Tanaka, S. Sekiguchi. Overlay Weaver: an overlay construction toolkit[J]. Computer Communications (Special Issue on Foundations of Peer-to-Peer Computing), 2007, 31(2): 402-412.

[22] S. Merugu, S. Sridhar, E. Zegura. P-sim: a simulator for peer-to-peer networks [C]. The 11th IEEE/ACM International Symposium on Modeling, Analysis and Simulation of Computer Telecommunication Systems (MASCOTS). 2003: 213-218.

[23] Guangyu Shi, Youshui Long,Hao Gong, et al.. HiFiP2P: the simulator capable of massive nodes and measured underlay [C]. IEEE International conference on Performance, Computing and Communications. 2008: 311-318.

[24] T. T. A. Dinh, M. Lees, G. Theodoropoulos, et al.. Large scale distributed simulation of P2P networks [C]. 2nd International Workshop on Modeling, Simulation, and Optimization of Peer-to-peer Environments (MSOP2P). 2008: 499-507.

[25] S. Sioutas, G. Papaloukopoulos, E. Sakkopoulos, et al.. A novel Distributed P2P Simulator Architecture: D-P2P-Sim[C]. The 18th ACM International Conference on Information and Knowledge Management. 2009.

[26] D.Stingl, C.Gross,J. Rückert, et al.. Peerfactsim.kom: a large scale simulation framework for peer-to-peer systems [C]. International Conference on High Performance Computing & Simulation. 2011: 577-584.

[27] 黄佳庆, 刘剑锋, 程刚, 等. 大规模并行分布式P2P算法模拟器设计与实现[J]. 华中科技大学学报(自然科学版), 2012, 40(2): 91-96.

Research on Application of Simulators for Overlays in Mobile Peer-to-Peer Networks

LI Jun1,2

(1. College of Computer Science and Technology, Harbin Engineering University, Harbin 150001, China; 2. School of Mathematics and Computational Science, Anqing Teachers College, Anqing 246133, China)

As the research of mobile peer-to-peer network comes to be in-depth continuously, evaluation and comparison of different overlay networks become a problem, urgently to be solved. Although the network protocols can be compared through theoretical calculation and system emulation, the network simulation method has a unique advantage to solve the problem. Therefore, in order to determine whether the existing general network simulator and peer-to-peer (P2P) network simulator can well support mobile peer-to-peer network simulation, the characteristics of more than twenty kinds of the existing network simulators are compared and analyzed. It is concluded that only few kinds of network simulators are suitable for mobile peer-to-peer network simulation. Taken one of them as an example, it shows the development steps of mobile peer-to-peer network simulation. At the end, it gives the developing direction of mobile P2P overlay network simulators.

mobile peer-to-peer networks, overlays, network simulators, parallelism, trigger mode

2015-03-10

国家自然科学基金(61073042)和安徽省高等学校省级自然科学研究重点项目(KJ2014A144)。

李军,男,黑龙江哈尔滨人,博士,安庆师范学院数学与计算科学学院副教授,主要研究移动对等网络与复杂网络。

时间:2016-1-5 13:01 网络出版地址:http://www.cnki.net/kcms/detail/34.1150.N.20160105.1301.010.html

TP302.7

A

1007-4260(2015)04-0037-04

10.13757/j.cnki.cn34-1150/n.2015.04.010

猜你喜欢
模拟器节点
驾驶模拟器转向系统的设计与研究
了不起的安检模拟器
基于图连通支配集的子图匹配优化算法
5G OTA测量宽带平面波模拟器的高效优化方法与应用
盲盒模拟器
划船模拟器
一种基于链路稳定性的最小MPR选择算法
结合概率路由的机会网络自私节点检测算法
面向复杂网络的节点相似性度量*
采用贪婪启发式的异构WSNs 部分覆盖算法*