<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>格物致知 &#187; PeerSim</title>
	<atom:link href="http://leeing.org/tag/peersim/feed/" rel="self" type="application/rss+xml" />
	<link>http://leeing.org</link>
	<description>keep Thinking</description>
	<lastBuildDate>Fri, 04 Nov 2011 16:20:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>PeerSim 源代码分析之一：程序入口</title>
		<link>http://leeing.org/2011/03/17/peersim-%e6%ba%90%e4%bb%a3%e7%a0%81%e5%88%86%e6%9e%90%e4%b9%8b%e4%b8%80%ef%bc%9a%e7%a8%8b%e5%ba%8f%e5%85%a5%e5%8f%a3/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://leeing.org/2011/03/17/peersim-%e6%ba%90%e4%bb%a3%e7%a0%81%e5%88%86%e6%9e%90%e4%b9%8b%e4%b8%80%ef%bc%9a%e7%a8%8b%e5%ba%8f%e5%85%a5%e5%8f%a3/#comments</comments>
		<pubDate>Thu, 17 Mar 2011 03:17:58 +0000</pubDate>
		<dc:creator>leeing</dc:creator>
				<category><![CDATA[PeerSim]]></category>

		<guid isPermaLink="false">http://leeing.org/2011/03/17/peersim-%e6%ba%90%e4%bb%a3%e7%a0%81%e5%88%86%e6%9e%90%e4%b9%8b%e4%b8%80%ef%bc%9a%e7%a8%8b%e5%ba%8f%e5%85%a5%e5%8f%a3/</guid>
		<description><![CDATA[PeerSim 的文档资料很少，有很多地方看上去概念很模糊，去年曾经翻译过官方的几篇文档，按顺序汇总如下： PeerSim 中文教程：解析 Cycle-based 模式仿真 PeerSim 中文教程：编写一个新协议 PeerSim 中文教程：拓扑生成器 PeerSim 中文教程：Event-driven 模型&#160; 当时翻译的时候，并没有深入地去学习，最近由于仿真的需要，又静下心来研究了几天，有些东西发现在文档中是无法得到一个很清晰的解释，看了一下PeerSim的源代码规模也并不是很大，所以决定 RTFSC (Read the F *** ing Source Code : –) ，源代码本身就是最好的学习资料，当然，这需要足够的耐心。 不过不得不说的是 PeerSim 的源代码的缩进真是有点混乱。 首先，是程序的入口 peersim.Simulator.java： package peersim; import java.io.*; import peersim.cdsim.*; import peersim.config.*; import peersim.core.*; import peersim.edsim.*; /** * peersim.Simulator.java * * 程序的入口，主要作用就是读取配置文件，并根据仿真类型来调用仿真引擎。 */ public class Simulator { // 某些静态变量，一看就懂。 [...]


Related posts:<ol><li><a href='http://leeing.org/2010/07/02/peersim-turtorial-how-to-write-a-new-protocol/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：编写一个新协议'>PeerSim 中文教程：编写一个新协议</a></li>
<li><a href='http://leeing.org/2010/07/04/peersim-tutorial-example-of-event-driven-model/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：Event-driven 模型'>PeerSim 中文教程：Event-driven 模型</a></li>
<li><a href='http://leeing.org/2010/07/02/peersim-turtorial-topology-generator/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：拓扑生成器'>PeerSim 中文教程：拓扑生成器</a></li>
<li><a href='http://leeing.org/2011/11/05/swing-%e5%b0%86-system-out-%e9%87%8d%e5%ae%9a%e5%90%91%e5%88%b0-jtextarea-%e5%92%8c-jtextpane-%e5%b0%81%e8%a3%85%e7%89%88/' rel='bookmark' title='Permanent Link: Swing : 将 System.out 重定向到 JTextArea 和 JTextPane (2)'>Swing : 将 System.out 重定向到 JTextArea 和 JTextPane (2)</a></li>
<li><a href='http://leeing.org/2011/02/24/java-%e5%a4%9a%e7%ba%bf%e7%a8%8b%ef%bc%9a%e6%8d%95%e6%8d%89%e7%ba%bf%e7%a8%8b%e4%b8%ad%e9%80%83%e9%80%b8%e7%9a%84%e5%bc%82%e5%b8%b8/' rel='bookmark' title='Permanent Link: Java 多线程：捕捉线程中逃逸的异常'>Java 多线程：捕捉线程中逃逸的异常</a></li>
</ol>]]></description>
		<wfw:commentRss>http://leeing.org/2011/03/17/peersim-%e6%ba%90%e4%bb%a3%e7%a0%81%e5%88%86%e6%9e%90%e4%b9%8b%e4%b8%80%ef%bc%9a%e7%a8%8b%e5%ba%8f%e5%85%a5%e5%8f%a3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PeerSim 中文教程：Event-driven 模型</title>
		<link>http://leeing.org/2010/07/04/peersim-tutorial-example-of-event-driven-model/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://leeing.org/2010/07/04/peersim-tutorial-example-of-event-driven-model/#comments</comments>
		<pubDate>Sun, 04 Jul 2010 11:32:44 +0000</pubDate>
		<dc:creator>leeing</dc:creator>
				<category><![CDATA[P2P]]></category>
		<category><![CDATA[PeerSim]]></category>

		<guid isPermaLink="false">http://leeing.org/?p=637</guid>
		<description><![CDATA[1. 介绍 本教程使用Event-driven模型来演示一个简单的例子，仍然使用的是gossip-based平均数协议，对消息的发送将进行更细节的建模；通过与cycle-based模型的对比，可以发现本协议存在的问题。 在Event-based模型中，除了时间管理和control传递给protocols的方式以外，其它与cycle-based模型相同。不可执行的Protocols（只用于存储数据，比如只存储邻居节点的linkable协议，或存储数值的vectors）可以以同样的方式应用和初始化，在peersim.cdsim包之外的controls也都可以使用。在默认情况下，在cycle-based模型中，controls会的每个周期中调用 ，但在event-based模型中，它们需要进行明确的调度，因为事件驱动模型并不存在周期的概念。 显然，我们可以编写专用于event-based模型的controls，即可以给协议发送事件（消息）。在很多情况下，这是必要的，因为系统经常完全或部分地由外部事件如用户的查询来驱动 ，这能很好地用由生成这些事件，并且驱动仿真执行的controls进行建模。 有些组件是不可用的。例如依赖于静态类peersim.cdsim.CDState（它提供了读取cycle相关的全局状态的接口）的所有组件。我们的经验是，很多依赖于这个状态的 cycle-based 组件可以经过简单的修改并删除这个依赖。 然而，可能有些令人吃惊的是，实现了cycle-based接口的peersim.cdsim.CDProtocol也可以使用于event-based模型，但是必须指出，在大部份的情况下这样做没有什么意义。然而，这个特性的有用之处在于：它让周期性地调用protocols变得很简单，这是一个几乎对所有与housekeeping，失效检测和sending heartbeat message有关的P2P协议来说典型的特性。 2. Protocol 下面以event-based模型来实现平均数协议： package example.edaggregation; import peersim.vector.SingleValueHolder; import peersim.config.*; import peersim.core.*; import peersim.transport.Transport; import peersim.cdsim.CDProtocol; import peersim.edsim.EDProtocol; /** * Event driven version of epidemic averaging. */ public class AverageED extends SingleValueHolder implements CDProtocol, EDProtocol { 首先，这里同时实现了EDProtocol和CDProtocol接口，前者能让这个类能处理输入的消息，后者则可能令人困惑，因为它属于cycle-based模型的接口。但注意 event-based 的协议不是必须实现CDProtocol接口的，然而想要实现一个可以周期性取得control的协议时，可以通过实现CDProtocol接口，并在配置文件中设置一个CDScheduler 来实现。这样，代码就显得更清晰：以一个单独的组件来管理周期性的执行，而且能单独地进行配置。最后，我们还能简单地将 cycle-based 的协议移植到 event-based 模型上。 [...]


Related posts:<ol><li><a href='http://leeing.org/2010/07/02/peersim-turtorial-how-to-write-a-new-protocol/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：编写一个新协议'>PeerSim 中文教程：编写一个新协议</a></li>
<li><a href='http://leeing.org/2010/07/02/peersim-turtorial-topology-generator/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：拓扑生成器'>PeerSim 中文教程：拓扑生成器</a></li>
<li><a href='http://leeing.org/2010/06/30/peersim-turtorial-analyse-of-cycle-based-model/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：解析 Cycle-based 模式仿真'>PeerSim 中文教程：解析 Cycle-based 模式仿真</a></li>
<li><a href='http://leeing.org/2011/03/17/peersim-%e6%ba%90%e4%bb%a3%e7%a0%81%e5%88%86%e6%9e%90%e4%b9%8b%e4%b8%80%ef%bc%9a%e7%a8%8b%e5%ba%8f%e5%85%a5%e5%8f%a3/' rel='bookmark' title='Permanent Link: PeerSim 源代码分析之一：程序入口'>PeerSim 源代码分析之一：程序入口</a></li>
<li><a href='http://leeing.org/2010/01/20/common-p2p-simulator/' rel='bookmark' title='Permanent Link: 常用的 P2P 仿真平台'>常用的 P2P 仿真平台</a></li>
</ol>]]></description>
		<wfw:commentRss>http://leeing.org/2010/07/04/peersim-tutorial-example-of-event-driven-model/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PeerSim 中文教程：拓扑生成器</title>
		<link>http://leeing.org/2010/07/02/peersim-turtorial-topology-generator/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://leeing.org/2010/07/02/peersim-turtorial-topology-generator/#comments</comments>
		<pubDate>Fri, 02 Jul 2010 11:35:15 +0000</pubDate>
		<dc:creator>leeing</dc:creator>
				<category><![CDATA[P2P]]></category>
		<category><![CDATA[PeerSim]]></category>

		<guid isPermaLink="false">http://leeing.org/?p=612</guid>
		<description><![CDATA[本教程描述了如何构建一个新的 PeerSim 拓扑生成器。 1. 什么是拓扑？为什么它很重要？ 在一个大型的动态P2P系统中，节点没有关于整个网络的信息，而所有的节点都可能拥有一些邻居节点，即节点能”感知”的peers，这种”感知”的关系就定义了一个覆盖网络，这是P2P系统中的一个基本概念。 很多P2P协议都需要在多个不同的网络拓扑上进行实验。PeerSim中的peersim.dynamic.Wire*类已经包含了很多拓扑结构，可以直接用来对linkable协议进行初始化，本教程将展示如何构建一个自定义的拓扑生成器。 2. 一个用来模拟Internet的简单模型 下面我们将编写一个拓扑生成器来构建类似于Internet的树状拓扑，整个构建过程基于一个特定的，与位置相关的preferential attachment方法，编写规则很简单，并且会考虑几何和网络的限制以更好地模拟真实的网络。Preferential attachment由参数a来调整，这个参数能扩大或减少几何位置所带来的影响。 这个规则的策略如下：给定一个单位正方形，将x0置于中心，即x0 = (0.5,0.5)，这个节点被称为root，令W()为与root相隔的跳数(hops)，对于i=1 … n-1，随机在单位正方形中选择一个xi，然后选择使下面的表达式值最小的节点xj来连接它： 在这里dist()是欧几里德距离而a (alpha)是权重参数，显然， 通过这个方案我们得到了一个x0以为根的树。这个拓扑中每个节点(除了root外)的出度都为1,如果想更深入地理解这个模型，可以参考下面的文章： Heuristically Optimized Trade-offs: A New Paradigm for Power Laws in the Internet Degree distributions of the FKP network model On Power-Law Relationships of the Internet Topology 3. 如何编码 我们的目标是编写一个可以根据 a (alpha)参数生成所需拓扑的PeerSim组件，并且能对生成的拓扑进行分析。这个拓扑可以在仿真过程中逐步生成，也可以用一个步骤生成拓扑，在这里我们倾向后者。为了构建需要的拓扑结构，我们需要下面的组件（注意这只是其中一种方案）。 一个protocol 类，可以存储坐标，它不具备行为元素，只是一个普通的容器。 一个initializer 类，可以为每个节点设置坐标值。 [...]


Related posts:<ol><li><a href='http://leeing.org/2010/07/02/peersim-turtorial-how-to-write-a-new-protocol/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：编写一个新协议'>PeerSim 中文教程：编写一个新协议</a></li>
<li><a href='http://leeing.org/2010/07/04/peersim-tutorial-example-of-event-driven-model/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：Event-driven 模型'>PeerSim 中文教程：Event-driven 模型</a></li>
<li><a href='http://leeing.org/2011/03/17/peersim-%e6%ba%90%e4%bb%a3%e7%a0%81%e5%88%86%e6%9e%90%e4%b9%8b%e4%b8%80%ef%bc%9a%e7%a8%8b%e5%ba%8f%e5%85%a5%e5%8f%a3/' rel='bookmark' title='Permanent Link: PeerSim 源代码分析之一：程序入口'>PeerSim 源代码分析之一：程序入口</a></li>
<li><a href='http://leeing.org/2010/06/30/peersim-turtorial-analyse-of-cycle-based-model/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：解析 Cycle-based 模式仿真'>PeerSim 中文教程：解析 Cycle-based 模式仿真</a></li>
<li><a href='http://leeing.org/2010/04/30/swing-redirecting-system-out-and-system-err-to-jtextpane-or-jtextarea/' rel='bookmark' title='Permanent Link: Swing : 将 System.out 重定向到 JTextArea 和 JTextPane'>Swing : 将 System.out 重定向到 JTextArea 和 JTextPane</a></li>
</ol>]]></description>
		<wfw:commentRss>http://leeing.org/2010/07/02/peersim-turtorial-topology-generator/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PeerSim 中文教程：编写一个新协议</title>
		<link>http://leeing.org/2010/07/02/peersim-turtorial-how-to-write-a-new-protocol/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://leeing.org/2010/07/02/peersim-turtorial-how-to-write-a-new-protocol/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 16:52:29 +0000</pubDate>
		<dc:creator>leeing</dc:creator>
				<category><![CDATA[P2P]]></category>
		<category><![CDATA[PeerSim]]></category>

		<guid isPermaLink="false">http://leeing.org/?p=592</guid>
		<description><![CDATA[本文的目的是在PeerSim中用Cycle-based模型实现一个简单的负载均衡算法。节点的状态有两种值：本地负载（local load）和配额(quota)，其中配额是指节点在每个周期中允许传输的“负载”的大小。配额是必要的，是一个时间单元中能传输的负载上限。每个节点与和它距离最远的邻居节点交换配额值，这里“距离最远”是指与当前节点的负载差异最大。经过对比距离，协议将在负载均衡时选用push或pull的方式。 在每个周期之后，配额值将会被存储。协议并不关心拓扑管理，它依赖于其它组件来访问邻居节点（例如，Newscast，或者由IdleProtocol实现的静态拓扑）。 一. 必要的组件 一般来说只编写一个协议类是不足够的，还需要一些附加的组件。例如，为了在每个周期结束时为每个节点存储配额值，需要一个特定的Control对象。基本上来说，PeerSim是一个可替换的组件集合，所以在开发时需要注意模块化以让代码尽可能重用，出于这样的目的，我们这样设计下面的类： protocol 它基于peersim.vector.SimpleValueHolder，这是一个简单的基类，用于访问一个浮点变量。Aggreation协议也使用了同样的基类。 ResetQuota 用于在每个周期结束时存储每个节点配额的control。 QuotaObserver 一个control，用于监视quota参数，即覆盖网中交换的流量大小。 initialization 这是在aggregation示例中的初始化器，这里也可以直接使用，因为它们实现了同样的接口SingleValueHolder。注意在example包中提供的初始化器是轻量级的，开发者应当更多地使用peersim.vector.*包中的初始化器。 observers 可以使用aggreagation.AverageObserver，因为这些组件实现了相同接口。 下面将根据源代码来解释这一过程： package example.loadbalance; import peersim.config.Configuration; import peersim.config.FastConfig; import peersim.core.*; import peersim.vector.SingleValueHolder; import peersim.cdsim.CDProtocol; public class BasicBalance extends SingleValueHolder implements CDProtocol { protected static final String PAR_QUOTA = "quota"; /** Quota amount. Obtained from config property {@link #PAR_QUOTA}. */ private [...]


Related posts:<ol><li><a href='http://leeing.org/2010/07/02/peersim-turtorial-topology-generator/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：拓扑生成器'>PeerSim 中文教程：拓扑生成器</a></li>
<li><a href='http://leeing.org/2010/07/04/peersim-tutorial-example-of-event-driven-model/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：Event-driven 模型'>PeerSim 中文教程：Event-driven 模型</a></li>
<li><a href='http://leeing.org/2010/06/30/peersim-turtorial-analyse-of-cycle-based-model/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：解析 Cycle-based 模式仿真'>PeerSim 中文教程：解析 Cycle-based 模式仿真</a></li>
<li><a href='http://leeing.org/2011/03/17/peersim-%e6%ba%90%e4%bb%a3%e7%a0%81%e5%88%86%e6%9e%90%e4%b9%8b%e4%b8%80%ef%bc%9a%e7%a8%8b%e5%ba%8f%e5%85%a5%e5%8f%a3/' rel='bookmark' title='Permanent Link: PeerSim 源代码分析之一：程序入口'>PeerSim 源代码分析之一：程序入口</a></li>
</ol>]]></description>
		<wfw:commentRss>http://leeing.org/2010/07/02/peersim-turtorial-how-to-write-a-new-protocol/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PeerSim 中文教程：解析 Cycle-based 模式仿真</title>
		<link>http://leeing.org/2010/06/30/peersim-turtorial-analyse-of-cycle-based-model/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://leeing.org/2010/06/30/peersim-turtorial-analyse-of-cycle-based-model/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 08:33:50 +0000</pubDate>
		<dc:creator>leeing</dc:creator>
				<category><![CDATA[PeerSim]]></category>
		<category><![CDATA[P2P]]></category>

		<guid isPermaLink="false">http://leeing.org/?p=574</guid>
		<description><![CDATA[本文介绍了PeerSim的基本概念，并解析了两个示例以更清晰地说明PeeSim的仿真流程。 Peersim支持两种仿真模式，即Cycle-based的模型和传统的event-based的模型，本文专注于前者， Cycle-based模型是一个简化的模型，拥有更好的伸缩性及性能，在拥有4GB内存的情况下，event-driven模式目前最多支持十万节点级别，而cycle-based模式则支持千万个节点级别。 但是Cycle-based模型缺少对传输层的仿真和并行处理，节点之间是直接通信的，仿真核心以一定的顺序周期性地给以节点控制。在运行时，可以进行任意的操作，如调用其它对象的方法并执行一些计算。 Cycle-based模型损失了一些真实性，虽然一些简单的协议可以忽略这些差别，但是在选择使用这个模型时，需要注意这些区别。我们可以相对简单地将Cycle-based的仿真移植到Event-driven引擎上，但在本文中不讨论这个话题。 一．基本介绍 PeerSim鼓励基于接口的模块化编程，每一个组件都能被其它实现了相同接口的组件代替，一般的仿真过程如下： 选择网络大小（即节点数量）。 选择要实验的一个或多个协议并进行初始化。 选择一个或多个Control对象来监视感兴趣的属性，并在仿真时修改一些参数（比如，网络大小，协议的内部状态，等等）。 根据配置文件，调用Simulator类运行仿真。 在仿真时创建的对象都是实现了一个或多个接口的类的实例，主要的接口如下所示： Node P2P网络是由节点组成的，节点是协议的容器。Node接口提供了对节点所包含的协议的访问方法，并为节点提供了固定的ID。 CDProtocol 这是一个特定的协议，被设计用来在Cycle-based模型中运行，它只定义了在每一个周期中要运行的操作。 Linkable 一般都由协议来实现，这个接口为其它协议提供了访问邻居节点集合的服务，节点间相同的linkable协议类的实例定义了一个覆盖网络。 Control 实现了这个接口的类可以在仿真期间的某个时间点调度执行，这些类一般用于观察或修改仿真过程。 Cycle-based仿真的生命周期是这样的： 读取配置文件（通过命令行参数传递进来），然后仿真器初始化网络中的节点和节点中的协议，每个节点都拥有相同的协议栈。节点和协议的实例是通过克隆来创建的，只有一个原型是通过构造方法创建，其它的节点和协议都是从这个原型中克隆而来。基于这个原因，协议类中clone方法的实现是很重要的。 初始化操作，设置每个协议的初始状态。初始化阶段是由Control对象控制运行的，仅在实验开始时运行一次。在配置文件中，初始化的组件可以由init前缀识别，在下面讨论的initializer对象也是controls，但为了标记其功能以区别于一般的Control对象，它被配置用来在初始阶段运行。 在初始化完成后，Cycle-based引擎在每一个周期中调用所有组件（protocols和controls）一次，直到完成了指定的周期数，或者某个组件决定终止仿真为止。在PeerSim中每一个对象（controls和protocols）都被赋以一个Scheduler对象，它定义了什么时候本组件将会被执行。在默认情况下，所有对象都会在每个周期中运行。但我们也可以配置一个protocol或control只在某些特定的周期中运行，也可以在每一个周期中指定组件的执行顺序。 下图展示了对controls和protocols的调度，其中C代表Control而P代表一个协议。图下方的数字代表PeerSim的周期，在最后一个周期后，可以运行一个control来获取最后的快照（snapshot）。 在一个Control收集数据时，数据将会被格式化并发送到标准输出或重定向到一个文件以进行后续的处理。 配置文件只是一个普通的ASCII文本，本质上就是java.util.Properties，以#开头的行代表注释。 用以下的方式在命令行的模式下运行，比如： java -cp peersim.Simulator config-edexample.txt 具体来说，可能是： java -cp D:\library\peersim-1.0.5\jep-2.3.0.jar;D:\library\peersim-1.0.5\djep-1.0.0.jar;D:\library\peersim-1.0.5\peersim-1.0.5.jar;D:\library\peersim-1.0.5\peersim-doclet.jar peersim.Simulator D:\library\peersim-1.0.5\example\config-edexample.txt 当然你的jar包和配置文件的位置可能有所不同，也可以将这个jar包直接加到 classpath上，就不必使用-cp参数来显示指定classpath。 二．配置文件示例一 Gossip-based Aggregation协议，Aggregation是聚集的意思，这里是指对一个分布于网络中的数值集合运行一个特定的函数进行计算（如求平均数，最大值，最小值等等），每个节点周期性地选择一个邻居节点进行通讯（基于覆盖网），并且在每次通讯时，基于前一个取得的近似值，相互更新它们下次计算的近似值。 本例将创建一个由50000个节点组成的固定P2P随机拓扑，选定的协议是使用average函数的Aggregation协议，每个节点中用于求平均的值使用一个区间在(0,100)的线性分布来初始化，最后再定义一个Control监视平均值。 # PEERSIM EXAMPLE 1 random.seed 1234567890 simulation.cycles 30 control.shf Shuffle network.size [...]


Related posts:<ol><li><a href='http://leeing.org/2010/07/04/peersim-tutorial-example-of-event-driven-model/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：Event-driven 模型'>PeerSim 中文教程：Event-driven 模型</a></li>
<li><a href='http://leeing.org/2010/07/02/peersim-turtorial-topology-generator/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：拓扑生成器'>PeerSim 中文教程：拓扑生成器</a></li>
<li><a href='http://leeing.org/2010/07/02/peersim-turtorial-how-to-write-a-new-protocol/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：编写一个新协议'>PeerSim 中文教程：编写一个新协议</a></li>
<li><a href='http://leeing.org/2011/03/17/peersim-%e6%ba%90%e4%bb%a3%e7%a0%81%e5%88%86%e6%9e%90%e4%b9%8b%e4%b8%80%ef%bc%9a%e7%a8%8b%e5%ba%8f%e5%85%a5%e5%8f%a3/' rel='bookmark' title='Permanent Link: PeerSim 源代码分析之一：程序入口'>PeerSim 源代码分析之一：程序入口</a></li>
</ol>]]></description>
		<wfw:commentRss>http://leeing.org/2010/06/30/peersim-turtorial-analyse-of-cycle-based-model/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>常用的 P2P 仿真平台</title>
		<link>http://leeing.org/2010/01/20/common-p2p-simulator/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://leeing.org/2010/01/20/common-p2p-simulator/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 08:39:20 +0000</pubDate>
		<dc:creator>leeing</dc:creator>
				<category><![CDATA[P2P]]></category>
		<category><![CDATA[OverSim]]></category>
		<category><![CDATA[p2psim]]></category>
		<category><![CDATA[PeerSim]]></category>

		<guid isPermaLink="false">http://leeing.org/?p=99</guid>
		<description><![CDATA[由于网络的研究和设计的复杂度很大，不能给出抽象的模型，且实验成本很高。研究人员对真实或接近真实的大规模网络实验环境的需求越来越强烈。大规模网络试验环境是当前计算机网络研究迫切需要解决的问题。 首先看一下目前使用较多的一些开源的P2P网络仿真器情况，其它的一些仿真器由于使用的人较少或者多年没有更新，所以没有在这里提及。 PeerSim  PeerSim 是一个模拟P2P overlay网络的软件，支持结构化和非结构化P2P网络模拟。PeerSim有两种模拟方式，cycle-based和event-driven。event-driven模式相对精确，cycle-based模式缺少传输层的模拟而且不能起到并发控制的作用，但占用资源少以适合于大规模的模拟，根据官方所发表的一篇最新论文，在拥有4GB内存的情况下，event-driven模式目前最多支持十万节点级别，而cycle-based模式则支持千万个节点级别。  PeerSim本身不带任何具体的协议实现，但是提供了很好的扩展性，目前已经有研究人员在其基础上实现了Bandwidth management protocol，a fault-tolerant FSM，Pastry，Chord，Skipnet，BitTorrent，Aggregation，SG-1，Peer sampling service，T-Man，PdProtocol，Slacer等协议，可以在项目主页上下载，但官方并不提供直接支持。 PeerSim采用Java语言，截止到2009年12月，PeerSim 下载次数已经超过12000次，已经有150多篇重要的P2P方面论文中使用PeerSim 模拟器，当中很少一部分是由 PeerSim 的作者编写的，但是PeerSim不支持分布式模拟。 更新情况：最新的主要版本1.0.0发布于2005年11月11日，后续的版本的更新修改事实上都极小，目前最高版本是2009年9月29日发布的1.0.5版本。 文档情况：官方只发布三篇文档，无论是cycle-based还是event-driven模式的文档都很少，源代码虽然不是很多，但是缺少必要的注释。 项目主页：http://peersim.sourceforge.net/ Oversim OverSim运行在类UNIX系统，采取OMNeT++ 实现其网络层，支持无结构和结构化P2P协议，已经实现了Chord, Pastry, Bamboo, Koorde, Broose, Kademlia, GIA, Vast和Publish-Subscribe for MMOGs协议。 OverSim 拥有图形化的交互界面，方便验证和调试。有INETUnderlying 网络和 Simple Underlying网络用于模拟网络层。能够模拟10万节点以上的规模，模拟代码易转化成为仿真代码，现在 OverSim 已经成功将一个基于P2P的DNS系统部署在PlanetLab 当中，实现了P2PNS系统，部署于450个节点上。 OverSim的实现语言为C++，综合来看，Oversim也是一个优秀的仿真工具。 更新情况：最近更新时间为2009年9月28日，近年来更新最频繁的模拟软件。 文档情况：很少。 项目主页：http://www.oversim.org/   P2Psim P2Psim 是一个免费的，多线程的，不关联的事件模拟器，用来评估，审查，和探索peer-to-peer协议，运行在UNIX-Like系统上，采用C++语言。P2Psim支持搅动、支持迭代和递归路由查询、可以通过继承来实现新协议、支持多种底层网络拓扑格式、支持一种网络时延模型；但是不支持分布式模拟和带宽变动，节点规模小（3000节点）。已经实现的协议有:Chord, Koorde, Kelips, Tapestry, Kademlia。 更新情况：最新版本发布于 2005年4月18日，四年半没有任何更新。 [...]


Related posts:<ol><li><a href='http://leeing.org/2011/03/17/peersim-%e6%ba%90%e4%bb%a3%e7%a0%81%e5%88%86%e6%9e%90%e4%b9%8b%e4%b8%80%ef%bc%9a%e7%a8%8b%e5%ba%8f%e5%85%a5%e5%8f%a3/' rel='bookmark' title='Permanent Link: PeerSim 源代码分析之一：程序入口'>PeerSim 源代码分析之一：程序入口</a></li>
<li><a href='http://leeing.org/2010/07/04/peersim-tutorial-example-of-event-driven-model/' rel='bookmark' title='Permanent Link: PeerSim 中文教程：Event-driven 模型'>PeerSim 中文教程：Event-driven 模型</a></li>
</ol>]]></description>
		<wfw:commentRss>http://leeing.org/2010/01/20/common-p2p-simulator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

