《毕业论文(设计)基于MPI 的并行文件传输服务器群26837.doc》由会员分享,可在线阅读,更多相关《毕业论文(设计)基于MPI 的并行文件传输服务器群26837.doc(7页珍藏版)》请在三一办公上搜索。
1、基于MPI的并行文件传输服务器群 黄松林1 王 鹏1, 2 严伟才1 李裕森1 聂 治3(1. 成都信息工程学院并行计算实验室 四川 成都 610225;2. 电子科技大学 四川 成都 610054;3.成都理工大学 四川 成都 610059)摘 要:本文运用MPI、COM/ActiveX和面向缓存等技术设计并实现了文件并行传输理论的新模型,将传统的最小负载均衡调度单位缩小至低于单文档大小,并将命令处理和数据服务相分离。文中给出了系统拓扑图、命令处理流程图和核心模块的设计原理图。实际测试结果表明,该系统增强了处理并发请求的能力和带宽,大大提高了数据传输速率,证明了这一设计方案的可行性和有效性。
2、关键词:并行文件传输协议;MPI;并行文件I/O;集群监控中图分类号:TP393文献标识码:ATree-Structure Web Server Clusters Based on MPIHuang Songlin1 Wang Peng1, 2 Yan Weicai1 Li Yusen1 Nie Zhi3(1.Parallel Computing Laboratory, Chengdu University of Information Technology, Sichuan, Chengdu, 610225; 2. University of Electronic Science and T
3、echnology of China, Sichuan, Chengdu, 610054; 3. Chengdu University of Technology, Sichuan Chengdu 610059)Abstract: This paper discusses a new model of paralleled transfer theory of files in detail with technology of MPICOM/ActiveX and caching-oriented,which effectively reduce to single document for
4、 traditional least load balance scheduling units.System topology graph、the deal flow charts of command and the diagram of central module are described in the same time.The circulation result shows:this system enhances the ability of parallel query and increases the data transfer velocity, moreover,
5、validates the feasibility of this model. Key Words:PFTP ; MPI; Paralleled File I/O; Cluste Monitor.1 引言随着网络技术的发展和普及,人们对FTP传输的速度与稳定性要求越来越高。从结构上讲,FTP属于客户/服务器结构,是一种简单的多对一结构,即多台客户机向一台服务器发出请求,此服务器对各个客户机分时作出应答。随着并行FTP用户的增加, 服务器的网络传输效率会显著下降, 表现为:数据传输速度不稳定,服务器对请求响应迟缓,甚至拒绝应答,传统的解决方法是限制客户的连接数。本文将并行计算理论应用到传统的F
6、TP系统中,通过增加服务器结点的数量来增加带宽和同时访问连接数,并对这些服务器结点进行集中控制和管理,以确保整个系统中对用户是透明的,多台服务器节点并行地传输同一个文件的不同块,因而既增大了系统带宽又提高了文件传输速度。基于这种思想的并行文件传输服务器群,可以有效地解决现有FTP系统存在问题1-5。2 MPI及相关技术MPI (Message Passing Interface) 是由MPI论坛开发的一个非专利且独立于平台的消息传递函数库的与语言无关的标准规范,而不特指某一具体实现6。MPI是目前最重要的并行编程工具,它具有移植性好、功能强大、效率高等优点,而且有多种不同的实现版本,几乎所有的
7、并行计算机厂商都提供对它的支持,这是其他并行编程环境所无法比拟的。MPI不仅提供了多种通讯模式,其打/解包收发不连续数据功能有效的减少了通讯次数;他的扩充版本MPI-2提供文件并行I/O ,能够方便的实现文件的并行读写。基于这些原因,本文选用了MPI作为服务端系统的开发平台。3 基于MPI的并行文件传输服务器群模型3.1 并行服务器群的拓扑结构服务器节点呈层叠结构排列,分为调度节点与子结点。调度结点只有一个,调度服务器可能在下层搜寻负载最轻的子节点和进行并行I/O操作。子结点有多个,结点数可扩展,增加层内节点数目即可提升系统处理大批量请求的能力。当然,服务树具体的规模应以实际需求和单个服务器性
8、能而定。监控结点只有一个,独立于服务器群。如图1图1 PFTP系统拓扑图【注:11,接收用户请求。12分析消息中包含的文档大小,文件并行I/O。13,本地数据服务。14,MPI消息传递。15,响应客户请求;21,收集各结点监控数据。22,读取监控数据】3.2 并行服务器群的调度策略传统的分布式调度策略和负载均衡算法所采用的最小调度单位为文件甚至为本次连接,很难实现理想中的负载均衡。我们的目标是要设计并行服务的调度策略。模型中主服务器(单台)所维护的文件索引列表面向缓存,当解析到用户发出信息为列表目录时,立即在该索引表中应列表信息并返回用户;对应解析为下载信号时则根据用户所创线程数和子服务器实时
9、负载对任务分解、动态调度,并由子服务器(多台)并行提供数据服务,调度算法遵循在并行粒度范围内按最轻网络流量负载节点优先调度的法则,使得各子服务器在任意时刻其负载量均趋于一致,整体负载更加均衡。具体流程请参考表1。表1 主服务器处理用户的不同命令b a获取列表信息下载文件第一步读取文件索引表调用任务分配算法第二步由主服务器返回用户由子服务器并行返回用户(a. 用户命令;b. 主服务器处理步骤)与分布式系统一样7, 文件并行传输系统(称为PFTP系统)把命令处理和数据服务分离,并分别在不同的机器上执行,能有效的在不增加连接数的前提下增加带宽。子服务器能具体到对某一个文件进行并行服务,且任一子服务器
10、间无交互,很容易实现分布化。主服务器的内存中文件索引列表覆盖了镜像子服务器内共享目录的全部信息。对应在子服务器内存有简化版的文件索引表,只具有文件编号和路径的映射功能。主服务器直接返回列表信息于用户避免的大量的费时的tcp转接操作,而在所有服务器均设置文件索引表则优化了任务分配时的内部网络通信。主服务器申请load集合,用于缓存当前各子服务器实际文件服务负载信息,该全局信息为任务的精确调度提高了依据。该load集合的维护采用异步模式,即能在每次调度时直接于内存中获得信息又能根据子服务器的状态改变或当前文件服务完毕而发往主服务器的信号引起主服务器动态改变load集合的值。子服务器申请一队列用于缓
11、存主服务器分配的任务,该队列设有超时功能,在规定时限内一旦有用户通过连接验证立即将对应任务取出并按任务规定的偏移量I/O和提高数据服务。3.3 并行服务器群的MPI实现3.3.1 文件索引表 本文提出的并行文件传输服务器群建立在MPI的消息传递机制之上. 为了减少主服务器给子服务器通信的数据量, 在各子服务器内存中维护了同样的文件索引表(字符串数组), 数组的下标代表文件编号, 相应的字符串代表此文件的完整路径。 主服务器只需告诉子服务器文件编号, 子服务器就能从文件索引表得到完整路径。 但这样做的结果是主服务器每更改一次文件列表都要对子服务器上的索引表进行更新。而对数组进行增加/减少元素开销
12、比较大, 但稳定运行的服务器都不会经常变动文件,这种运行期间的文件列表更新操作是很少的, 所以不会对服务器性能造成影响。3.3.2 服务器命令处理流程图根据不同命令的处理情况, 将常用的命令分为以下5个组。1 申请数据通道命令, 用于主服务器传送文件列表信息给客户; 2 读文件列表命令; 3 写文件列表命令; 4 读写文件命令; 5 其它命令。 主服务器初始化完成后等待客户发送命令请求, 接收到客户端命令后, 通过命令解析,根据以上分类,进行不同的处理。流程图如下:图2 命令处理流程图本文提出的并行文件传输服务器群建立在MPI的消息传递机制之上。 由主节点维护文件列表(没有数据文件),各子服务
13、器必须具有相同的文件。 主服务器根据子服务器的负载进行任务分配, 然后各个子服务器同时发送数据到客户端。其基本流程图如下:3.3.3 客户端的实现COM (Component Object Model, 组件对象模型)是Microsoft创建的一种编程规范, 它允许任意两个组件互相通信, 在二进制级别上重用代码。 activeX是COM规范的一个实现。 客户端以activeX插件的形式实现, 它能够在Microsoft 的 Internet Explorer中被html代码调用, 这样就将c/s和b/s应用无缝集成。用户第一次访问时插件将自动下载并注册。 在客户端的角度看,基本流程如图3:图3
14、. 时序图3.4 并行服务器的监控模型为了确保服务器各个服务器节点安全地运行,增加一个节点作为监控节点,该节点独立运行于windows平台。监控内容包含: 机器名,CPU利用率,内存利用率,网卡流量,用户线程数,结点负载和系统时间等。服务器各结点每隔一秒写入一条记录。为了便于显示数据,采用B/S模式,用图形把当前各个节点的状态动态地显示在网页上。红色的柱形描述每秒各节点状况,曲线图描述各个节点最近10秒的记录。这样,管理员即使在远程,也能查看到系统的运行状况。4. 系统实际运行性能评价表2为系统在不同节点数的情况下传输不同大小的文件所需要的时间,从表中我们可以看出,采用本文所提出的并行FTP(
15、PFTP)系统后,系统的传输速度随着节点数的增加呈线性增长趋势。证明系统性能达到我们的设计要求。表2 不同节点数下系统文件传输时间实测表 节点数文件大小(MB)12341012秒6秒4秒待添加的隐藏文字内容13秒5061秒31秒21秒16秒100124秒42秒43秒32秒200248秒130秒86秒64秒5. 结语本文通过采用层叠式服务器结构及MPI作为通讯实现了并行文件传输。基于MPI的并行文件传输服务器群,可以很好地解决文件下载速度与并行连接上限等问题。通过系统数据传输性能进行实测,取得了良好的效果,验证了这种方案的可行性。该模型具有较高的性价比,实现了低成本、高性能服务器构架方法。在理论
16、上,只需增加子服务器结点的个数,即可提高服务器的性能,这就为网络视频传输,网络硬盘等存在大量数据传输的应用提供了一种新的思路。参考文献:1 Zhang XL,Barrientos M,Chen JBSeltzer M.HACC : An architecture for cluster-based Web servers.Proceedings of the 3rd USENIX Windows NT Symposium.1999.155-164.2 Yang CS, Luo MY. Efficient support for content-based routing in web serv
17、er clusters.Proceeding of the 2nd USENIX/IEEE Symposium on Internet Technologies and Systems. 1999.3 徐忻,吴介一. Web服务结构模型的研究与实现J. 微计算机信息,2006,5-3:103-105。4 Cohen A, Rangarajan S, Slye H. On the performance of TCP splicing for URL-aware redirection. Proceedings of the 2nd USENIX Symposium on Internet Te
18、chnologies and System. 1999. 117-125.5 杜增凯.基于内容的分布式web服务器调度算法J.软件学报,2003,Vol.14,No.12.6 都志辉.高性能计算之并行编程技术MPI并行程序设计M.清华大学出版社 北京,2001第一版7 李柳,吴丽娟,王占军.分布式FTP系统的设计与实现M. 辽宁工程技术大学学报, 2004. 4:222-224Editors note: Judson Jones is a meteorologist, journalist and photographer. He has freelanced with CNN for fou
19、r years, covering severe weather from tornadoes to typhoons. Follow him on Twitter: jnjonesjr (CNN) - I will always wonder what it was like to huddle around a shortwave radio and through the crackling static from space hear the faint beeps of the worlds first satellite - Sputnik. I also missed watch
20、ing Neil Armstrong step foot on the moon and the first space shuttle take off for the stars. Those events were way before my time.As a kid, I was fascinated with what goes on in the sky, and when NASA pulled the plug on the shuttle program I was heartbroken. Yet the privatized space race has renewed
21、 my childhood dreams to reach for the stars.As a meteorologist, Ive still seen many important weather and space events, but right now, if you were sitting next to me, youd hear my foot tapping rapidly under my desk. Im anxious for the next one: a space capsule hanging from a crane in the New Mexico
22、desert.Its like the set for a George Lucas movie floating to the edge of space.You and I will have the chance to watch a man take a leap into an unimaginable free fall from the edge of space - live.The (lack of) air up there Watch man jump from 96,000 feet Tuesday, I sat at work glued to the live st
23、ream of the Red Bull Stratos Mission. I watched the balloons positioned at different altitudes in the sky to test the winds, knowing that if they would just line up in a vertical straight line we would be go for launch.I feel this mission was created for me because I am also a journalist and a photo
24、grapher, but above all I live for taking a leap of faith - the feeling of pushing the envelope into uncharted territory.The guy who is going to do this, Felix Baumgartner, must have that same feeling, at a level I will never reach. However, it did not stop me from feeling his pain when a gust of swi
25、rling wind kicked up and twisted the partially filled balloon that would take him to the upper end of our atmosphere. As soon as the 40-acre balloon, with skin no thicker than a dry cleaning bag, scraped the ground I knew it was over.How claustrophobia almost grounded supersonic skydiverWith each tw
26、ist, you could see the wrinkles of disappointment on the face of the current record holder and capcom (capsule communications), Col. Joe Kittinger. He hung his head low in mission control as he told Baumgartner the disappointing news: Mission aborted.The supersonic descent could happen as early as S
27、unday.The weather plays an important role in this mission. Starting at the ground, conditions have to be very calm - winds less than 2 mph, with no precipitation or humidity and limited cloud cover. The balloon, with capsule attached, will move through the lower level of the atmosphere (the troposph
28、ere) where our day-to-day weather lives. It will climb higher than the tip of Mount Everest (5.5 miles/8.85 kilometers), drifting even higher than the cruising altitude of commercial airliners (5.6 miles/9.17 kilometers) and into the stratosphere. As he crosses the boundary layer (called the tropopa
29、use), he can expect a lot of turbulence.The balloon will slowly drift to the edge of space at 120,000 feet (22.7 miles/36.53 kilometers). Here, Fearless Felix will unclip. He will roll back the door.Then, I would assume, he will slowly step out onto something resembling an Olympic diving platform.Be
30、low, the Earth becomes the concrete bottom of a swimming pool that he wants to land on, but not too hard. Still, hell be traveling fast, so despite the distance, it will not be like diving into the deep end of a pool. It will be like he is diving into the shallow end.Skydiver preps for the big jumpW
31、hen he jumps, he is expected to reach the speed of sound - 690 mph (1,110 kph) - in less than 40 seconds. Like hitting the top of the water, he will begin to slow as he approaches the more dense air closer to Earth. But this will not be enough to stop him completely.If he goes too fast or spins out
32、of control, he has a stabilization parachute that can be deployed to slow him down. His team hopes its not needed. Instead, he plans to deploy his 270-square-foot (25-square-meter) main chute at an altitude of around 5,000 feet (1,524 meters).In order to deploy this chute successfully, he will have
33、to slow to 172 mph (277 kph). He will have a reserve parachute that will open automatically if he loses consciousness at mach speeds.Even if everything goes as planned, it wont. Baumgartner still will free fall at a speed that would cause you and me to pass out, and no parachute is guaranteed to wor
34、k higher than 25,000 feet (7,620 meters).It might not be the moon, but Kittinger free fell from 102,800 feet in 1960 - at the dawn of an infamous space race that captured the hearts of many. Baumgartner will attempt to break that record, a feat that boggles the mind. This is one of those monumental moments I will always remember, because there is no way Id miss this.