




已阅读5页,还剩256页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
點對點通訊協定及應用教師研習,黃仁竑教授國立中正大學資工系,1,Agenda,2,Agenda,3,IntroductiontotheCourse,WhatareC/SandP2P,whyP2PP2PcharacteristicsP2Psystem,systemmodelsP2PoperationsIssuesofP2P,4,WhatisClient/Server,AClient/Servernetworkisadistributednetworkwhichconsistsofonehigherperformancesystem,theServer,andseveralmostlylowerperformancesystems,theClientsTheServeristheonlyproviderofcontentandserviceAClientonlyrequestscontentortheexecutionofservices,withoutsharinganyofitsownresourcesWithinC/StheparticipatingnodescaneitheractasaServeroractasaClientbutcannotembracebothcapabilities,R.Schollmeier,“Adefinitionofpeer-to-peernetworkingfortheclassificationofpeer-to-peerarchitecturesandapplications,”inProc.ofP2P01,pp.101-102,Aug.2001,C,C,C,C,C,S,client,server,5,6,P2P:anewparadigm,NapsterMusicsharingInformation(File)sharingKaZaa,GnutellaMorpheus,FreeNet,Grokster,DistributeddataprocessingSETIhomeFoldinghomePopularPowerDistributedapplicationsDistributedFilesystemDDoS,WhatisPeer-to-Peer(1/4),Peer-to-Peer(P2P)isawayofstructuringdistributedapplicationssuchthattheindividualnodeshavesymmetricroles.Ratherthanbeingdividedintoclientsandserverseachwithquitedistinctroles(suchasWebclientsvs.Webservers),inP2Papplicationsanodemayactasbothaclientandaserver.(IRTFP2Presearchgroup)AdistributednetworkarchitecturemaybecalledaPeer-to-Peer(P-to-P,P2P,)network,iftheparticipantsshareapartoftheirownhardwareresources(processingpower,storagecapacity,networklinkcapacity,printers,)ThesesharedresourcesarenecessarytoprovidetheServiceandcontentofferedbythenetwork(e.g.filesharingorsharedworkspacesforcollaboration).Theyareaccessiblebyotherpeersdirectly,withoutpassingintermediaryentitiesTheparticipantsofsuchanetworkarethusresource(Serviceandcontent)providersaswellasresource(Serviceandcontent)requestors(Servent-concept),R.Schollmeier,“Adefinitionofpeer-to-peernetworkingfortheclassificationofpeer-to-peerarchitecturesandapplications,”inProc.ofP2P01,pp.101-102,Aug.2001,7,WhatisPeer-to-Peer(2/4),EachnodehasequivalentcapabilityandresponsibilityShareresourcesamongalargenumberofpeersAllowindividualcomputerstocommunicatedirectlyovertheInternetCreateandmaintainnetworkswithoutcentralentitiesEachnode(peer)calledserventactsasbothaSERVerandacliENT,8,WhatisPeer-to-Peer(3/4),P2Pnetworkingisnotnew-fashionedTelephoneUsenetNewsin1979DNSP2Pnetworkingismostlyknownunderthebrandoffile-sharingNapster,9,WhatisPeer-to-Peer(4/4),P2PoverlaynetworkTheconnectednodesconstructavirtualoverlaynetworkontopoftheunderlyingnetworkinfrastructurePeer-to-peernetworktopologyisavirtualoverlayatapplicationlayer,A,B,C,D,E,F,G,10,P2POverlayNetwork,Edge(virtual)Alogicconnection(e.g.,TCPconnection)betweentwopeersAend-to-endpathoverIPnetworkOverlaymaintenanceNewnodeneedstoknowhowtojointheoverlayNeedtoknowtheedgeandneighborarealivePeriodicallypingtomakesureneighborisstillaliveOrsomesignalingprotocolNeedtostayontheoverlaynetworkIfneighborgoesdown,maywanttoestablishnewedge,11,12,WhyP2P?,GetridofServersSinglepointoffailure,centralizedcontrolandmanagement,accessfeeandmanagementfee,ClientsarenotsodumbBillionsofMhzCPU,tonsofterabytesdisk,millionsofgigabitsnetworkbandwidth,P2PisaboutresourcesharingFlexible,efficientinformationsharingP2PchangesthewayofWeb(Internet),P2PCharacteristics,ResourcesharingDecentralizationSelf-organization,13,P2PSystems(1/2),CollaborationInstantmessaging,chatroom,voiceoverIP,etc.Distributedcomputing(Gridcomputing)SETIHome,FoldingHome,EinsteinHome,Avaki,Entropia,etc.FileSharingNapster,Gnutella,Kazaa,Chord,etc.,14,P2PFile-sharingApplicationsKuro,.twezPeer,eDonkey/eMule,BitTorrent/BitSpirit(BT),P2PSystems(2/2),15,P2PSystemModels,CentralizedCentralindexingserversmaintainadirectoryofshareddataNapster,Kuro,etc.DecentralizedunstructuredNeithercentraldirectoryservernoranyprecisecontrolovernetworktopologyordataplacementGnutella,Kazaa,etc.DecentralizedstructuredNocentralizeddirectorybutshareddataplacementandtopologycharacteristicsofnetworkaretightlycontrolledbasedonDistributedHashTable(DHT)CAN,Chord,Pastry,Tapestry,etc.HierarchicalHybrid,Wewilldiscussthisindetailinchapter2!,16,P2POperations,Peerdiscovery(bootstrap)Resourcediscovery(search)LocatearesourcegivenitsidentifierCentralserversmaintainindexofallinformationUnstructuredP2PnetworksusefloodingStructuredP2Pnetworksusedistributedhashtable(DHT)Directcommunication,datatransfer,17,P2PSearchAlgorithms,CentralizedindexmodelDecentralizedunstructuredFloodedrequestsmodelHierarchicalmodel(Supernode)DecentralizedstructuredDocumentroutingmodel,DHT-basedrouting,18,IssuesofP2P,ScalabilityFaultresilienceCopyrightAnonymityTrustSecurityOthers,19,OrganizationofthisCourse,IntroductionInfrastructureofP2P(andsystems)ImprovementofP2PperformanceApplicationsofP2PPerformanceanalysisofP2PImplementationofP2P,20,InfrastructureofP2P,CentralizedNapsterUnstructuredGnutellaStructuredChord,CAN,PastryHierarchicalHybridunstructured+structured,KaZaa,BT,21,ImprovementofP2Pperformance,NeighborselectionInfrastructuremaintenanceoverheadReplication(cache)HotspotandFreeriderissuesSecurityRouting(proximity)Searching(keyword,semanticcontentsearch)DownloadMobileissues,22,ApplicationsofP2P,FilesharingVideoStreaming(Live,VOD,P2PTV)VoIPoverP2P(skype,P2PSIP)StorageSemanticcontentsearch()Wireless(structuredorMANET),23,EvaluatePerformanceofP2P,PrototypeimplementationRealimplementationonInternetorPalnet-LabtestbedHighprogrammingoverheadanddifficulttogetlargescalescenarioMostpracticalandconvincingresultsSimulationsUseP2PsimulatorsorwriteyourowncodeLesscomplexityandoverheadthanprototypingandpossibletogetlargescalesimulationMorerealisticthananalyticalmodelQuestionsonyoursimulationcodeandthedetailsofsimulationAnalyticalmodelsDevelopmathematicalmodelUsuallynoteasytomodelandneedssomeassumptions,24,ImplementationofP2P,JXTAOpenplatformforp2papplicationsSunMicrosystemsformedProjectJXTAundertheguidanceofBillJoyandMikeClary,25,26,Conclusion,P2PmaychangethewayofWeb/InternetLotsofcreativeapplicationstobedevelopedExpectarapidgrowthinInternettrafficStilllotsofproblemsIllegalcopies(copyrightproblem)SecurityUndesiredtraffic,Day1-1PerformanceAnalysisofP2P,Prof.Ren-HungHwangDept.ComputerScienceNodemodel:howanodeisdescribedinwhatdetailUsabilityHoweasytouse?APIs,documentations,well-maintained?ScalabilityHowlargethenetworksizecouldbe?Howlongtorunasimulation?StatisticsHowtocarryoutanalysisonsimulationresults?UnderlyingNetworkHowrealistictheunderlyingnetworkissimulated?Transportandnetworklayerprotocols?Cross-traffic?Linklatency?Topology?,SurveyofCurrentP2PSimulators,Others:Omnet+(),SFSNet(Chord,),3LS,P2PSim,PartoftheIRISproject,MIThttp:/project-,PeerSim,EUprojectBISONandEUprojectDELIS,Narses,StandardUniversity,inactivenow,NeuroGrid,DevelopedbyDr.SamJoseph,PlanetSim,DevelopedinthePlanetprojectattheUniversityRoviraiVirgili,Spain.http:/planet.urv.es/planetsim/Java,multi-threadedSimulationissplitintooverlaynetworksandservicesServicescanbere-usedDefaultoverlaymodel:Chord,SymphonySimulateupto100,000nodes,UsagesSurveyofP2PSimulators,Unspecified:simulationsaredonebutnoinformationofhowCustom:simulationscreatedbyauthorsspecificallyforthepaper,Thisisnotanidealstate:hardtobelieveandreproduceNS-2ismostcommonlyused,butisnotscalable,notdesignedforP2P,90%,ComparisonofP2PSimulators,InternetTopologyGenerator,MostofP2PsimulatorsdonotsimulateunderlyingtopologyButifyouusens2,youmayneedonePopulartopologygeneratorsINET/inet/(active)GT-ITM/fac/Ellen.Zegura/graphs.html(active)TIERS/nsnam/ns/ns-topogen.html#tiers(available)Brite/brite/(inactive),IntroductiontoPeerSim,AGPLopensourcelicensedP2PsimulatordevelopedatUniversityofBologna(BISONproject)Java-based,component-basedAimtocopewithP2PpropertiesHighScalability(millionnodes)HighlyconfigurableStillactive,documentavailableon-lineLimitationsUnderlyingtransportprotocolstackisnotsimulatedMessagesarenotmodeledbydefault(invokesobjectmethod),UsingPeerSim,SimulationmodesNetworkrepresentationInterfacesComponents,SimulationModes,Event-drivenAsetofeventsarescheduledatdifferentsimulationtimeandthenodeprotocolsarerunaccordinglyCycle-drivenTime-drivensequentialsimulationIneachcycleeachprotocolsactionsareexecutedbyeverynodesequentially,NetworkRepresentation,NetworkglobalarrayconsistsallnetworknodesNodenodesstateandactionsaredescribedthroughastackofprotocolsLinkableinterfacetoaccessandmanagenodesviewCDProtocol:interfacetodescribenodesactionsateachcycleControl:performstheglobalinitializationandperformanceanalysis,Network,Anodeisastackofprotocols,CDProtocolInterface,TheCDProtocolinterfaceisusedtodefinecycle-drivenprotocolsDefineactionsperformedbyeachnodeateachcycleEachnodecanrun(have)morethanonprotocolProtocolsareexecutedsequentially,LinkableInterface,Linkableisusedtomanageanodesview.Typicalactions:AddneighborGetneighborNodesdegreeRemoveneighbor,ControlInterface,ControlisusedtodefineoperationsthatrequireglobalnetworkknowledgeTypicaloperations:InitializationofthenetworkandprotocolsNetworkdynamismStatisticalanalysis(observer),Components,PeerSimiscomponent-basedTypesofcomponentsProtocolDynamics(andInitializers)ObserverComponentsarepluggable,ProtocolComponent,ProtocolisthecorealgorithmforusersImplementyourownP2PalgorithmhereImplementisasaJavamethodUseoflocalinformationYoucanimplementmorethanoneprotocols(noupperbound)onanodeEachprotocolhasanidentifier,DynamicsComponent,Implementthepeersim.dynamics.DynamicsinterfacetoadddynamismGlobalviewofthesystemADynamicscanbeusedasanInitializerNolimitsonthenumberofdynamicsExamplesofuse:resetnodestatussimulaterandomnodecrashes,ObserverComponents,Implementthepeersim.reports.ObserverinterfacetologimportantinformationofthesystemGlobalviewAnobservercanusethepeersiminternallogfacilitytoproduceconsistentdatalogduringsimulations.Nolimitsonthenumberofobserversinasimulation.,ModifyaComponent(ProtocolorControl),ExtendsorimplementsaclassImplementtheinterface,RevisitSimulationModes,Cycle,cycle-driven,event-based,Ignores-TransportLayerSimulation-Concurrency,Supports-TransportLayerSimulation-Concurrency,Directaccess,PeerSimProcess,LoadConfigurationfile,random.seed1234567890simulation.cycles30control.shfShufflenetwork.size50000protocol.lnkIdleProtocolinit.rndWireKOtocollnkinit.rnd.k20control.avgoexample.aggregation.AverageOtocolavg,Store,ClassConfiguration,Cycle-Driven,Networkinitializes(Node,Protocol)Initcontrol,Schedule(Protocoljep-2.3.0.jar;djep-1.0.0.jarpeersim.Simulator,Howtowriteasimulation,PeersimprovidesadevelopmentenvironmentObeyitsruletowriteyourcode,AGeneralPeersimFlowforCycle-drivenandEvent-driven,Request(Cycels,network.size,etc.),Response,AGeneralPeersimFlowforCycle-drivenandEvent-drivencont.,Createanetwork,FetchProtocols,Respoonse,StoreInnode,Clone,Network.size,1,2,Clone,initialize,AGeneralPeersimFlowforCycle-drivenandEvent-drivencont.,FetchControl,Response,Schedulecontrols,ScheduleProtocol,Accordingtoyoursimulationtype,Schedule,Run,Accordingtoyoursimulationtype,CallNextCycle()orCallProcessEvent(),Callexecute(),AGeneralPeersimFlowforCycle-drivenandEvent-drivencont.,Callanalysiscontrols,CycleProtocolWriting,TwowaysExtendtheclasshavingtheCDProtocolinterfaceImplementtheCDProtocolinterfaceModifyAddyourparameternameAddyourvariableConstructionfunctionnextCyclefunctionAdditionaclonefunctionorextendaclasshavingtheclonefunction,CycleInitandControlWriting,TwowaysExtendtheclasshavingtheControlinterfaceImplementtheControlinterfaceModifyAddyourparameternameAddyourvariableConstructionfunctionExecutefunction,EventProtocolWriting,TwowaysExtendtheclasshavingtheCDProtocolinterfaceImplementtheCDProtocolinterfaceModifyAddyourparameternameAddyourvariableConstructionfunctionprocessEventfunctionandnextCycle(option)Additionaclonefunctionorextendaclasshavingtheclonefunction,EventInitandControlWriting,TwowaysExtendtheclasshavingtheControlinterfaceImplementtheControlinterfaceModifyAddyourparameternameAddyourvariableConstructionfunctionExecutefunction,Labs,Lab1-aggregationprotocolLab2-aggregation+newscastprotocolLab3-loadbalancingprotocol.,Lab1:aggregationprotocol,ConfigurationfileComponentCodedescription,Lab1:Configurationfile,#PEERSIMEXAMPLE1#Basicsetrandom.seed1234567890simulation.cycles30control.shfShufflenetwork.size50000#Protocolprotocol.lnkIdleProtocolprotocol.avgexample.aggregation.AverageFunctionprotocol.avg.linkablelnk,Lab1:Configurationfilecont.,#Initinit.rndWireKOtocollnkinit.rnd.k20init.linLinearDtocolavginit.lin.max100init.lin.min1#controlcontrol.avgoexample.aggregation.AverageOtocolavg,Lab1:Component,ProtocolIdleProtocolAverageFunctionInitLinearDistributionControlAverageObserver,Lab1:AverageFunction,Lab1:AverageFunctioncont.,Lab1:LinearDistribution,Lab1:LinearDistributioncont.,Lab1:LinearDistributioncont.,Lab1:AverageObserver,Lab1:AverageObservercont.,Lab1:AverageObservercont.,Lab2:aggregationPeerIDpeerID=createPeerID(infra,peer);PipeIDpipeID=createPipeID(PeerGroupID.defaultNetPeerGroupID,pipe);peerID=createNewPeerID(PeerGroupID.defaultNetPeerGroupID);pipeID=createNewPipeID(PeerGroupID.defaultNetPeerGroupID);PeerGroupIDpgid=createNewPeerGroupID(PeerGroupID.defaultNetPeerGroupID);,CreatinganewAdvertisement,218,publicstaticvoidmain(Stringargs)/Thefollowingstepisrequiredandonlyneedtobedoneonce,/withoutthissteptheAdvertisementFactoryhasnomeansof/associatinganadvertisementnamespacewiththeproperobect/inthiscasttheAdvertisementTutorialAdvertisementFactory.registerAdvertisementInstance(AdvertisementTutorial.getAdvertisementType(),newAdvertisementTutorial.Instantiator();AdvertisementTutorialadvTutorial=newAdvertisementTutorial();advTutorial.setID(ID.nullID);advTutorial.setName(AdvertisementTutorial);tryadvTutorial.setIP(InetAddress.getLocalHost().getHostAddress();catch(UnknownHostExceptionignored)/ignoredadvTutorial.setOSName(System.getProperty();,Creatingmessagesandmessageelements,219,/*IllustratesaddingandretrievingaStringtoandfromaMessage*/publicstaticvoidstringExample()Messagemessage=newMessage();addStringToMessage(message,TutorialNameSpace,StringTest,Thisisatest);printMessageStats(message,true);System.out.println(StringValue:+getStringFromMessage(message,TutorialNameSpace,StringTest);,HelloWorldExample,Whentheapplicationcompletes,youcaninspectthevariousfilesandsubdirectoriesthatwerecreatedinthe./.cache/HelloWorldsubdirectory:PlatformConfigtheconfigurationfilecreatedbytheauto-configurationtoolcmthelocalcachedirectory;itcontainssubdirectoriesforeachgroupthatisdiscovered.Inourexample,weshouldseethejxta-NetGroupandjxta-WorldGroupsubdirectories.Thesesubdirectorieswillcontainindexfiles(*.idx)andadvertisementstorefiles(advertisements.tbl).,220,HelloWorldCode,221,packagetutorial.helloworld;importnet.jxta.platform.NetworkManager;importjava.text.MessageFormat;publicclassHelloWorldpublicstaticvoidmain(Stringargs)NetworkManagermanager=null;trymanager=newNetworkManager(NetworkManager.ConfigMode.EDGE,HelloWorld);System.out.println(StartingJXTA);manager.startNetwork();System.out.println(JXTAStarted);catch(Exceptione)e.printStackTrace();System.exit(-1);System.out.println(Waitingforarendezvousconnection);booleanconnected=manager.waitForRendezvousConnection(12000);System.out.println(MessageFormat.format(Connected:0,connected);System.out.println(StoppingJXTA);manager.stopNetwork();,PeerDiscoveryExample,ThisexampleillustrateshowtodiscoverotherJXTApeersonthenetwork.TheapplicationinstantiatestheJXTAplatform,andthensendsoutDiscoveryQuerymessagestothedefaultNetPeerGrouplookingforanyJXTApeer.ForeachDiscoveryResponsemessagereceived,theapplicationprintsthenameofthepeersendingtheresponse(ifitisknown)aswellasthenameofeachpeerthatwasdiscovered.,222,SampleOutput,223,SendingaDiscoveryMessageSendingaDiscoveryMessageGotaDiscoveryResponse3elementsfrompeer:unknownPeername=node1Peername=node2Peername=JXTA.ORG237SendingaDiscoverymessageGotaDiscoveryResponse3elementsfrompeer:unknownPeername=node3,PeerDiscoveryService,Usingthefollowingclassestoimplementdiscoveryservice:net.jxta.discovery.DiscoveryServiceasynchronousmechanismfordiscoveringpeer,peergroup,pipeandserviceadvertisementsandpublishingadvertisementsnet.jxta.discovery.DiscoveryListenerthelistenerinterfaceforreceivingDiscoveryS.jxta.DiscoveryEventcontainsDiscoveryR.tocol.DiscoveryResponseMsgdefinestheDiscoveryServiceresponse,224,publicclassDiscoveryServerimplementsDiscoveryListenerprivatetransientNetworkManagermanager;privatetransientDiscoveryServicediscovery;publicDiscoveryServer()trymanager=newNetworkManager(NetworkManager.ConfigMode.EDGE,DiscoveryServer,newFile(newFile(.cache),DiscoveryServer).toURI();manager.startNetwork();catch(Exceptione)e.printStackTrace();System.exit(-1);PeerGroupnetPeerGroup=manager.getNetPeerGroup();discovery=netPeerGroup.getDiscoveryService();/*main*/publicstaticvoidmain(Stringargs)DiscoveryServerdisocveryServer=newDiscoveryServer();disocveryServer.start();,PeerDiscoveryService(ServerExample),225,/*createanewpipeadv,publishitfor2minutnetworktime,*sleepfor3minutes,thenrepeat*/publicvoidstart()longlifetime=60*2*1000L;longexpiration=60*2*1000L;longwaittime=60*3*1000L;trywhile(true)PipeAdvertisementpipeAdv=getPipeAdvertisement();/publishtheadvertisementwithalifetimeof2mintutesSystem.out.println(Publishingthefollowingadvertisementwithlifetime:+lifetime+expiration:+expiration);System.out.println(pipeAdv.toString();discovery.publish(pipeAdv,lifetime,expiration);discovery.remotePublish(pipeAdv,expiration);trySystem.out.println(Sleepingfor:+waittime);Thread.sleep(waittime);catch(Exceptione)/ignoredcatch(Exceptione)e.printStackTrace();,PublishanAdvertisementviapropagationtootherpeersonthenetwork.,publishadvertisementstolocalgroup,226,/*Thismethodiscalledwheneveradiscoveryresponseisreceived,whichare*eitherinresponsetoaquerywesent,oraremotepublishbyanothernode*/publi
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- DB14-T 1599-2025 核桃林下套种绿豆技术规程
- 幼儿园装修工程保修责任报告合同
- 餐厅员工试用期服务承诺书及劳动合同
- 2025年非营利组织管理师资格考试试卷及答案
- 2025年心理健康教育师资格考试试题及答案
- 商业综合体室外停车位租赁服务协议
- 成都二手房买卖合同范本(带租赁权处理)
- 互联网长租公寓租赁及增值服务合同
- 钢筋原材料批量采购合同
- 书香展板活动方案
- 内分泌科临床路径存在问题及整改措施
- 嵊泗县洋山客运站工程环评报告
- 农家乐出租合同协议书
- 《腾讯案例分析》课件
- 线上运营项目合同协议
- 网络圈层化对青年价值观塑造的影响机制与干预策略
- 诺姆四达人才测评题库
- 豆制品厂退货管理制度
- DB21-T 4127-2025 石油化工产品检测分样技术规范
- 过单协议合同
- DB13T 5927-2024地热资源开发监测技术规范
评论
0/150
提交评论