分布式系统课件:Chapter 3 Distributed Computing Paradigm

上传人:努力****83 文档编号:190717150 上传时间:2023-02-28 格式:PPT 页数:98 大小:2.04MB
返回 下载 相关 举报
分布式系统课件:Chapter 3 Distributed Computing Paradigm_第1页
第1页 / 共98页
分布式系统课件:Chapter 3 Distributed Computing Paradigm_第2页
第2页 / 共98页
分布式系统课件:Chapter 3 Distributed Computing Paradigm_第3页
第3页 / 共98页
点击查看更多>>
资源描述
CommunicationChapter 3Layered Protocols(3.1)进程间通信是分布式系统的核心.(屏蔽底层网络的物理特征).本章讨论通用的进程通信模型:1.RPC2.RMI3.MOM4.streamLayered Protocols(3.1)Layers,interfaces,and protocols in the ISO OSI model.2-1Layered Protocols(1)物理层:物理层:负责对电平信号(位)的传输;数据链路层:数据链路层:帧校验和纠错;网络层:网络层:路由(面向连接的协议称作X.25,面向非连接的协议称作IP(Internet 协议);传输层:传输层:消息的无损传送,并保持进入时的次序。建立在x.25或IP上;会话层:会话层:提供对话控制、对正在会话的对话者进行跟踪以及同步功能(如果中间断开,不需从头开始);表示层:表示层:消息表示(为了实现各机器内部表示方式不同的数据传递);应用层:应用层:公共事务遵循的一个杂项协议的集合.Layered Protocols(2)A typical message as it appears on the network.2-2Data Link LayerDiscussion between a receiver and a sender in the data link layer.2-3Client-Server TCP(a)Normal operation of TCP(不支持基于同步请求应答方式的交互过程).(b)Transactional TCP.(适用于的交互,减少交互次数)向握手协议TCP的漏洞DoS中的Syn Flood就是利用了TCP/IP协议的固有漏洞:假设一个用户向服务器发送了SYN报文后突然死机或掉线,那么服务器在发出SYN+ACK应答报文后是无法收到客户端的ACK报文的,这种情况下服务器端一般会重试(再次发送SYN+ACK给客户端)并等待一段时间后丢弃这个未完成的连接,这段时间的长度称为SYN Timeout,一般来说这个时间是分钟的数量级(大约为30秒-2分钟)。TCP的漏洞 一个用户出现异常导致服务器的一个线程等待1分钟并不是什么很大的问题,但如果有一个恶意的攻击者大量模拟这种情况,服务器端将为了维护一个非常大的半连接列表而消耗非常多的资源-数以万计的半连接,即使是简单的保存并遍历也会消耗非常多的CPU时间和内存,何况还要不断对这个列表中的IP进行SYN+ACK的重试。TCP的漏洞 实际上如果服务器的TCP/IP栈不够强大,最后的结果往往是堆栈溢出崩溃-即使服务器端的系统足够强大,服务器端也将忙于处理攻击者伪造的TCP连接请求而无暇理睬客户的正常请求(毕竟客户端的正常请求比率非常之小),此时从正常客户的角度看来,服务器失去响应,这种情况称为:服务器端受到了SYN Flood攻击(SYN洪水攻击)。Client-Server TCPTransactional TCP(TCP事务协议,记T/TCP)。“事务”(Transaction):一个客户向服务器发出请求,接下来是服务器给出响应(此“事务”非数据库中的事务处理,数据库中的事务处理有封锁、两步提交和回退)。T/TCP是对TCP的扩展,设计目的是使客户-服务器事务更快、更高效和更可靠。它省略了连接开始时TCP的三次握手,并缩短了连接结束时TIME_WAIT状态的持续时间。在客户-服务器事务中,T/TCP的性能与UDP相当,而且T/TCP具有可靠性和适应性,这两点相对UDP来说都是很大的改进。Middleware Protocols 中间件是一种应用程序(应用层),许多应中间件是一种应用程序(应用层),许多应用层的协议可以由它完成:用层的协议可以由它完成:身份认证(身份认证(authentication)分布式提交协议分布式提交协议分布式锁定协议分布式锁定协议高级消息传递(隐藏通信)高级消息传递(隐藏通信).Middleware ProtocolsAn adapted reference model for networked communication.2-5Remote Procedure Call-RPC(3.1)Many distributed systems have been based on explicit message exchange between process.However,the procedures send and receive do not conceal communication,which is important to achieve access transparency in distributed systems.Middleware communication protocols support high-level communication services(concealing communication).for example,RPC,ROI,message queuing service etc.Remote Procedure Call-RPC(3.2)1984年Birrell和Nelson提出了远程过程调用机制RPC(remote procedure call),允许程序去调用位于其它机器上的过程。当位于机器A的一进程调用机器B上的某过程时,机器A上的该进程被挂起,被调用的过程在机器B上执行。调用者将消息放在参数表中传送给被调用者,结果作为过程的返回值返回给调用者。消息的传送与I/O操作对于程序员是不可见的。Conventional Procedure Call考虑一个单机上的过程调用:count=read(fd,buf,nbytes);-fd整数 -buf字符型数组 -nbytes整数若主程序调用该过程,调用堆栈的情况如下图所示。Conventional Procedure Call(单机)调用前执行中Client and Server StubsPrinciple of RPC between a client and server program.Client and Server StubsHow to make a RPC look as possible like a local one?通过Client stub 与Server stub 实现透明通信Separation between interfaces and the procedure implementing.An interface at one machine,while the procedure itself resides on another machine.(接口与过程实现分离)Steps of a Remote Procedure Call1.Client procedure calls client stub in normal way2.Client stub builds message,calls local OS3.Clients OS sends message to remote OS4.Remote OS gives message to server stub5.Server stub unpacks parameters,calls server6.Server does work,returns result to the stub7.Server stub packs it in message,calls local OS8.Servers OS sends message to clients OS9.Clients OS gives message to client stub10.Stub unpacks result,returns to clientPassing Value Parameters(1)Steps involved in doing remote computation through RPC2-8Passing Value Parameters(1)内核内核打包参数客户客户存根客户机服务器调用返回服务存根拆包结果打包结果拆包参数调用返回服务 RPC中的调用与消息 Passing Value Parameters(2)分布式系统中通常由异构系统构成。各结点数字、字符和其它数据项的表示方式有所不同。例1:IBM主机使用的是EBCDIC码,而IBM PC中使用的是ASCII码。例2:Intel 80486 中字节是从右向左编号,而在其它一些系统如SPARC中正相反。Intel的格式称为最低有效字节优先,而SPARC的格式称为最高有效字节优先。Passing Value Parameters(2)a)Original message on the Pentiumb)The message after receipt on the SPARCc)The message after being inverted.The little numbers in boxes indicate the address of each byte(5,LLIJ)如果指出整数和字符串的区别(数字以位对换,字符以字节对换),则就可以正确的翻译。右向左编号左向右编号Passing Reference Parameters方法:1.不允许传递引用参数;2.将参数数组传给Server后,再生成指针使用,完成后再按同样方式返回给客户端;3.区分参数类型,仅返回输出型参数.Parameter Specification and Stub Generation 建立RPC协议;生成Client/Server Stub;Parameter Specification and Stub Generation 建立数据表示的标准及对复杂数据操作时遵循相同步骤,实现调用者之间互相交换的消息格式达成一致(RPC双方遵循相同协议).例如规定:字符:字的最右 俘点:一个字 数组:一组字,长度,内容A procedureThe corresponding messageIDL-Interface Definition Language Once the RPC protocol has been completely defined,the client and server stubs need to be implemented.It is easy to fully generate client and server stubs using IDL,So all RPC-based middleware systems offer an IDL to support application development.通过对IDL 描述的接口编译产生client and server stubs。Extended RPC Models原始RPC的缺点:必须消息传递隐含同步方式RPC的变种:Doors:equivalent RPC,for process that are colocated on the same machine,called doors.Asynchronous RPC.DoorsA door is a generic name for a procedure in the address space of a server process that can be called by process colocated with the server.The principle of using doors as IPC mechanism.不足之处:要求开发人员必须知道调用来自何方Asynchronous RPC(1)a)The interconnection between client and server in a traditional RPCb)The interaction using asynchronous RPC2-12Asynchronous RPC(2)A client and server interacting through two asynchronous RPCs2-13Example:DCE RPCDCE-Distributed Computing Environment,which has been developed by the OSF(Open Software Foundation now called the Open Group).DCE is a true middleware system in that it is designed to execute as a layer of abstraction between existing(network)operating systems and distributed application.There are a number of services that form part of DCE itself.Such as the distributed file service,directory service,security service,and distributed time service etc.DCE RPC is highly representative of other RPC systems,and its specification have been adopted in Microsofts base system for distributed computing.Writing a Client and a ServerThe steps in writing a client and a server in DCE RPC.2-14(to generate a prototype IDL file,unique identifier)(for different language)Binding a Client to a ServerClient-to-server binding in DCE.执行RPC前先要绑定到服务器,执行RPC的过程同前面2-15(network address and name)(确定进程确定进程)3.3 Remote Object InvocationTo expand the idea of RPCs to invocations on remote objects.(object-based distributed systems,CORBA,DCOM,J2EE).Separation between interfaces and the objects implementing.An interface at one machine,while the object itself resides on another machine.(接口与对象实现分离)Distributed ObjectsCommon organization of a remote object with client-side proxy.2-16Compile-Time versus Runtime Objects1.Compile-Time Object:编译时生成.对象形式直接与语言级对象相关联(Java,C+).优点:直观,编译时获得Stub;缺点:语言依赖性;2.Runtime Object:运行时生成.与语言无关.优点:语言无关性.缺点:通过object adapter实现对象的包装,管理.Persistent and Transient Objects Persistent Objects:不依赖于对象所在Server的状态.Transient Objects:依赖于对象所在Server的状态.Binding a Client to an ObjectBinding results in a proxy being placed the processs address spacea)An example with implicit binding using only global referencesb)An example with explicit binding using global and local referencesDistr_object*obj_ref;/Declare a systemwide object referenceobj_ref=;/Initialize the reference to a distributed objectobj_ref-do_something();/Implicitly bind and invoke a method(隐式绑定)(a)Distr_object obj_ref;/Declare a systemwide object referenceLocal_object*obj_ptr;/Declare a pointer to local objectsobj_ref=;/Initialize the reference to a distributed objectobj_ptr=bind(obj_ref);/Explicitly bind and obtain a pointer to the local proxy obj_ptr-do_something();/Invoke a method on the local proxy(b)Implementation of Object References对象引用包含:网络地址,端口,对象标示.缺点:不灵活,服务器固定通过实现句柄(指向代理实现),在绑定对象时动态加载代理(比如通过URL).u静态方法调用:开发程序时知道接口,例如:fobject.append(int)u动态方法调用:运行时才知道接口:例如:invoke(fobject,id(append),int)Parameter Passing当传递的参数是对象时:1.Passing an object by value 传递对象本身.2.Passing an object by reference 传递对象引用.Parameter PassingThe situation when passing an object by reference or by value.如果引用指向本如果引用指向本地对象地对象,则被引则被引用对象按值传递用对象按值传递.实例:The DCE Distributed-Object Modela)Distributed dynamic objects in DCE.(为每一个客户的请求动态创建一个对象)b)Distributed named objects(响应多个客户请求)适用于无法保证发出请求时接受端一定在执行适用于无法保证发出请求时接受端一定在执行,以及非同以及非同步等的情况步等的情况.Persistence Communication-A message is stored in a communication server as long as it takes to successfully deliver it to the next communication server.Transient communication-A message is stored in a communication server only as long as the sending and receiving application are executing.(If a communication server cannot deliver a message to the next server,or the receiver,the message will simply be discarded).3.4 Message-Oriented CommunicationGeneral organization of a communication system General organization of a communication system in which hosts are connected through a network2-20Examples in Persistence CommunicationAn e-mail system is also a typical example in which communication is persistent.持久性通信的例子:邮递系统和电子邮件.Persistence and Synchronicity in Communication(1)a)Persistent asynchronous communication(E-mail system)b)Persistent synchronous communication2-22.16种不同语义的通信方式:Persistence and Synchronicity in Communication(2)c)Transient asynchronous communicationd)Receipt-based transient synchronous communication2-22.2Persistence and Synchronicity in Communication(3)e)Delivery-based transient synchronous communication at message deliveryf)Response-based transient synchronous communicationMessage-Oriented Transient CommunicationBerkeley Sockets(1)Socket primitives for TCP/IP.PrimitiveMeaningSocketCreate a new communication endpointBindAttach a local address to a socketListenAnnounce willingness to accept connectionsAcceptBlock caller until a connection request arrivesConnectActively attempt to establish a connectionSendSend some data over the connectionReceiveReceive some data over the connectionCloseRelease the connection服务器端Berkeley Sockets(2)Connection-oriented communication pattern using sockets.The Message-Passing Interface(MPI)为了支持高速内部网中的高级特性,例如:高性能计算机系统的开发需要为了支持高速内部网中的高级特性,例如:高性能计算机系统的开发需要,支持不同形式的支持不同形式的Buffer和和同步,提出了同步,提出了MPI,它可以实现,它可以实现Fig.(C)-(F).Transient asynchronous,Receipt-based transient synchronous,Delivery-based transient synchronous,Response-based transient synchronous.The Message-Passing Interface(MPI)Some of the most intuitive message-passing primitives of MPI.PrimitiveMeaningMPI_bsendAppend outgoing message to a local send bufferMPI_sendSend a message and wait until copied to local or remote bufferMPI_ssend Send a message and wait until receipt startsMPI_sendrecvSend a message and wait for replyMPI_isendPass reference to outgoing message,and continueMPI_issendPass reference to outgoing message,and wait until receipt startsMPI_recvReceive a message;block if there are noneMPI_irecvCheck if there is an incoming message,but do not blockThe Message-Passing Interface(MPI)nMPI是全球工业、政府和科研部门联合推出的适合进程间进行标准消息传递的并行程序设计平台,最初版MPI 1.0本于1994年6月推出,MPI 2.0版于1998年年低推出;nMPI是目前应用最广的并行程序设计平台,几乎被所有并行计算环境(共享和分布式存储并行机、MPP、机群系统等)和流行的多进程操作系统(UNIX、Windows NT)所支持,基于它开发的应用程序具有最佳的可移植性;The Message-Passing Interface(MPI)n基于消息传递的并行程序执行模式:1.SPMD模式:单程序多数据流并行应用程序代码复制多份并独立执行,形成多个独立的进程进程一(内存)进程二(内存)进程三(内存)消息传递(交换数据、同步、规约)协同可执行代码The Message-Passing Interface(MPI)2.MPMD模式:多程序多数据流,除初始启动多个可执行代码,其余与SPMD模式一致;n共享存储与分布式存储:属于并行机体系结构的范畴,与消息传递并行程序设计平台无关;消息传递是相对于进程间通信方式而言的,消息传递是相对于进程间通信方式而言的,与具体并行机存储模式无关,任何支持进程间通信的并行机,均可支持消息传递并行程序设计;The Message-Passing Interface(MPI)n MPI并行程序设计平台由标准消息传递函数及相关辅助函标准消息传递函数及相关辅助函数数构成,多个进程通过调用这些函数(类似调用子程序),进行通信;MPI程序:n SPMD执行模式:一个程序同时启动多份,形成多个独立的进程,在不同的处理机上运行,拥有独立的内存空间,进程间通信通过调用MPI函数来实现;n 每个进程开始执行时,将获得一个唯一的序号(rank)。例如启动P个进程,序号依次为0,1,P-1;The Message-Passing Interface(MPI)MPI程序例程序例:进程0发送一个整数给进程1;进程1将该数加1,传递给进程2;进程2再将该数加1,再传递给进程3;依次类推,最后,进程P-1将该数传递给进程0,由进程0负责广播该数给所有进程,并打印输出。program example1 include “mpif.h”!MPI系统头文件 integer status(MPI_STATUS_SIZE),my_rank,p,source,dest,tag,ierr,datac-进入MPI系统 call MPI_Init(ierr)call MPI_Comm_rank(MPI_COMM_WORLD,my_rank,ierr)call MPI_Comm_size(MPI_COMM_WORLD,p,ierr)c-数据交换 data=0 tag =5 source=my_rank-1 if(source.eq.-1)source=p-1 dest=my_rank+1 if(dest.eq.p)dest=0 if(my_rank.eq.0)then call MPI_Send(data,1,MPI_INTEGER,dest,tag,MPI_COMM_WORLD,ierr)call MPI_Recv(data,1,MPI_INTEGER,source,tag,MPI_COMM_WORLD,status,ierr)else call MPI_Recv(data,1,MPI_INTEGER,source,tag,MPI_COMM_WORLD,status,ierr)data=data+1 call MPI_Send(data,1,MPI_INTEGER,dest,tag,MPI_COMM_WORLD,ierr)endifc-广播数据 call MPI_Bcast(data,1,MPI_INTEGER,0,MPI_COMM_WORLD,ierr)cc-打印输出 if(my_rank.eq.0)then if(data.eq.p-1)then print*,”Successful,data=”,data else print*,”Failure,data=”,data endif endifc call MPI_Finalize(ierr)end进入MPI系统退出MPI系统 MPI函数 进程0 进程1 进程2 进程3 Init()Comm_rank()my_rank=0 myrank=1 myrank=2 my_rank=3Comm_size()p=4 p=4 p=4 p=4 tag=5,data=0 tag=5,data=0 tag=5,data=0 tag=5,data=0 source=3 source=0 source=1 source=2 dest=1 dest=2 dest=3 dest=0数据交换 send()recv()recv()recv()data=data+1 空 send()闲 data=data+1 等 send()待 data=data+1 消息传递 send()recv()recv()recv()recv()Broadcast()output“data”Finalize()编译命令:mpif77 -o exam.e example.f 运行命令:mpirun np 4 exam.e 运行效果:MPI系统选择相同或不同的4个处理机,在每个处理机上运行程序代码exam.e。The Message-Passing Interface(MPI)一般的MPI程序设计流程图 程序参数说明Call MPI_Init()Call MPI_Comm_rank()Call MPI_Comm_size()建立新的通信器、定义新的数据类型和进程拓扑结构应用程序实体:计算控制程序体;进程间通信;Call MPI_Finalize()End进入MPI系统,通信器MPI_COMM_WORLD形成退出MPI系统Message-Oriented Persistence Communication Message-Queuing Model(1)本质:提供消息的中介存储能力,不需双方都在活动状态Four combinations for loosely-coupled communications using queues.2-26Message-Queuing Model(2)Basic interface to a queue in a message-queuing system.PrimitiveMeaningPutAppend a message to a specified queueGetBlock until the specified queue is nonempty,and remove the first messagePollCheck a specified queue for messages,and remove the first.Never block.NotifyInstall a handler to be called when a message is put into the specified queue.(注册一个处理程序注册一个处理程序,消息进入队列时调用消息进入队列时调用它它)General Architecture of a Message-Queuing System(1)The relationship between queue-level addressing and network-level addressing.(analogous to use of DNS for e-mail)队列的集合分布在多台机器上,需要一个队列-网络地址影射表General Architecture of a Message-Queuing System(2)The general organization of a message-queuing system with routers.2-29Message Brokers(conversion)The general organization of a message broker in a message-queuing system2-30An important application area of message-queuing system is integrating existing and new application into a single,coherent distributed information system,有时需要格式转换message-queuing system 实例:IBM MQSeries IBM公司在90年代起,将中间件产品作为一个重点,96年推出了面向消息的中间件产品MQ Series,它是一种message-queuing system的产品,它能够保证数据稳定可靠传输而且无丢失或重发。MQSeries作为消息中间件,它由一个信息传输系统和一个应用程序接口组成,其资源是信息和队列(Messaging and Queuing)。MQ应用程序可以通过使用一个简单而一致的应用程序编程接口来相互通信跨越具有不同处理器、操作系统、子系统和通讯协议的网络。它的功能是控制和管理一个集成的商业应用,使得组成这个商业应用的多个分支程序(模块)之间通过传递信息完成整个工作流程。MQSeries已在金融、交通、邮电等行业得到广泛应用。Example:IBM MQSeries MQSeries的特点:1)统一接口,跨越23种平台MQSeries具有目标应用程序位置的透明性(target application location transparency),即对于一个应用程序的开发者来说,只需知道队列的名字及与这个队列有关的一个特定服务,而不必关心系统的平台或系统在什么地方。Example:IBM MQSeries2)开发人员可以避开网络的复杂性MQSeries负责处理所有的通讯,开发人员不必编写任何通讯方面的程序。尤其在开发客户机/服务器模式的应用时,开发人员可以集中精力在与业务有关的客户端和服务器端的应用,而不必考虑操作系统和通讯,特别是底层的网络通讯。Example:IBM MQSeries3)处理不受时间的限制相互通信的程序可以在不同的时间运行。程序的运行是独立的、并行的、重叠的。如果逻辑允许,它们不必等待其他程序的应答而继续工作。MQSeries利用这种异步处理功能,可以更有效地使用资源,使用更灵活的处理模式,从而改进用户服务。Example:IBM MQSeries4)为分布式处理提供了可靠性MQSeries最重要的特点是确保信息可靠传输,一旦MQSeries接受一个信息传输的任务,会确保信息被传送到目标平台。信息的传输只有一次。所传递的信息不受所传内容格式或长度的限制。其机制保证业务数据一致性,在系统发生故障时,保证数据可以恢复,业务不会受到影响。这种传输方式还具有极强的灵活性,即使信息接收端不工作,信息发送端仍可正常工作并保证接收端启动后收到这些信息。Example:IBM MQSeries5)对应用程序结构无限制应用程序之间可以是一对一的关系,也可以是一对多、多对多的关系。应用程序之间的信息传递可以是单向,也可以是双向的。灵活的结构支持并行处理、多路广播以及其他应用程序之间的关系。Example:IBM MQSeriesGeneral organization of IBMs MQSeries message-queuing system.Queue manager-removing messages and handling incoming messages.Message Channel Agent(MCA)-sending MCA checks send queues and wrapping it into a transport-level packet,and send it along the connection to its associated receiving MCA.Receiving MCA listen for an incoming packet,unwrapping it,and storing it into the appropriate queue.2-31ChannelsSome attributes associated with message channel agents.AttributeDescriptionTransport typeDetermines the transport protocol to be usedFIFO deliveryIndicates that messages are to be delivered in the order they are sentMessage lengthMaximum length of a single messageSetup retry countSpecifies maximum number of retries to start up the remote MCADelivery retriesMaximum times MCA will try to put received message into queue由MCA和发送队列组成,MCA的属性:Message Transfer(1)The general organization of an MQSeries queuing network using routing tables and aliases.别名可以适应队列管理器的变化Message Transfer(2)(部分)Primitives available in an IBM MQSeries MQIPrimitiveDescriptionMQopenOpen a(possibly remote)queueMQcloseClose a queueMQputPut a message into an opened queueMQgetGet a message from a(local)queueMessage Transfer(3)管理MQ系统的一个重要部分是将各种队列管理器连接到一个一致的覆盖网络中,并对其连续地维护,包括队列管理器之间创建通道、填写路由表等(一般要手工)。覆盖网络的核心是Channel Control Function组件,逻辑上,该组件位于MCA之间,用于创建通道和路由表,以及管理驻留有消息通道代理的队列管理器。Data Stream(1)为连续媒体提供支持:为时间敏感的信息交换提供支持。数据流是数据单元的序列,可以应用于离散或连续的媒体。如TCP/IP连接的面向字节的离散数据流,和面向播放音频文件的连续数据流;连续数据流关键是采用同步传输模式。Data Stream(1)异步传输模式:流中的数据项是逐个传输,但是某一项在何时传输没有进一步限制。同步传输模式:数据流中的每一个单元都定义了一个端到端最大延迟时间。等时传输模式:数据单元必须按时传输,端到端延迟时间需同时受到上限和下限的约束。Data Stream(1)Setting up a stream between two processes across a network.Data Stream(2)Setting up a stream directly between two devices.2-35.2Data Stream(3)An example of multicasting a stream to several receivers.确保QoS(1)QoS(Quality of Service),时间敏感的需求一般也称为QoS需求。可以简化为如下特征:1.数据传输所需要的比特率;2.创建会话的最大延时;3.端到端的最大延时;4.最大延时抖动;5.最大往返延时;服务质量(QoS)各种不同业务对QoS的需求服务质量(QoS)控制方法n资源预留:带宽,缓冲区,CPU资源n缓存(消除延时抖动)n业务量整形(也是拥塞控制的两种常用方法)漏桶算法令牌桶法n接纳控制n队列调度BufferingSmoothing the output stream by buffering packets 在接收方,数据流在递交之前被缓存起来可以减少抖动;对于音频和视频点播,抖动是主要问题。漏桶算法以恒定的速率向网络发送流量整形(Traffic shaping)是在服务器端调节数据发送的平均速率(以及突发性)举例 计算机以25MB/s(200Mbps)速率产生数据,向网络发送1MB的数据(即以25MB/s速率发送了40ms),而网络的最佳传输速率不超过2MB/s,为了降低传送速率,令漏桶的=2MB/s,因此1MB的数据将传输500ms。令牌桶法令牌桶以每隔T秒产生令牌,分组得到令牌后就可发送,解决突发通信量。The leaky bucket algorithm enforces a rigid output pattern at the average rate,no matter how bursty the traffic is.Essentially what the token bucket does is allow bursts,but up to a regulated maximum length.举例n 设突发长度为S秒,令牌桶容量C bytes,令牌产生速率为 bytes/s,计算机最大数据速率M bytes/s。n 设前面的例子中,向网络发送1MB的数据,C=250KB,M=25MB/s,=2MB/s。n C+*S=M*S,S=C/(M-)=11ms(以25MB/s)n 剩余的以2MB/s发送364msC=250kBC=500kBC=750kBC=500kB令牌桶加10MB/s漏桶以25MB/s速率发11ms服务质量(QoS)控制技术n 综合服务(IntServ,Integrated Services)资源预留(RSVP协议)接入控制基于流的QoS控制技术,不适合大规模使用 n 区分服务(DiffServ,Differentiated Services)在分组的TOS域中标记基于类的QoS控制,但不是严格意义的QoSn 多协议标记交换(MPLS,Multi-Protocol Label Switching)服务质量(QoS)控制技术 综合服务(IntServ,Integrated Services)基于流的QoS控制技术,不适合大规模使用 区分服务(DiffServ,Differentiated Services)基于类的QoS控制,但不是严格意义的QOS因特网通过该服务为不同类型的数据提供服务。作业作业1:基于:基于RMI技术的远程词典应用,场景描述:技术的远程词典应用,场景描述:假设有一台应用服务器以RMI的方式向客户端提供英汉互译词典的服务。请同学们尝试完成服务器端程序的编码和一个客户端应用,并分别部署到两台计算机上进行测试。服务接口声明见附录。说明:说明:服务器端词典的容量不是考察的重点,可以使用数据库技术也可以使用Map在内存中保存少量的英汉词汇对应表。RMI有多种实现途径,参考网址中的内容只是其中一种,而且也不是最好的方式。请同学们不要局限于此,尽量通过google、soso、百度发现更多、更好的方式,并对其优劣进行对比。参考:参考:http:/ 附录:附录:public interface Translator/*param str 需要被翻译的单词*return 英汉互译后的内容,如果词典中不包含此单词返回null*/public String translate(String str);作业2:使用Socket编程实现文件上传。具体要求如下:Server端监听指定端口,接受Client端连接请求。Client通过发送connect请求与Server端建立Socket连接,然后向Server发送一个简单文件,Server接受该文件后存储到指定目录。完成上传后Server端主动断开连接。作业3(任选):MPI编程。在单机上安装、配置MPI 并行环境(Linux版),应用场景自定。
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 图纸专区 > 课件教案


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!