#LAMP人#pomelo-腾讯大讲堂_第1页
#LAMP人#pomelo-腾讯大讲堂_第2页
#LAMP人#pomelo-腾讯大讲堂_第3页
#LAMP人#pomelo-腾讯大讲堂_第4页
#LAMP人#pomelo-腾讯大讲堂_第5页
已阅读5页,还剩83页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Pomelo基于Node.js的游戏服务器框架网易圈圈套圈圈xiecc1CategoryThe state of pomeloMotivationFrameworkEvolutionPerformanceDemo2The state of pomeloFast, scalable, distributed game server framework for node.jsRealtime application server framework.Open sourced V0.2.0 2012.11.20 V0.3.0 2013.3.8V0.4.3 2013.6.113Pomelo定位Real

2、time application server framework Game server frameworkMobile gameWeb gameSocial gameLarge MMO RPG 4Pomelo社区5Pomelo社区6Pomelo社区7Pomelo社区8State of pomeloPomelo is not a single projectAlmost 30 repos in total9State of pomelo - clients10State of Pomelo code Code reading in community11State of pomeloReal

3、time application网易消息推送平台,已上线中国平安客服系统GamesN款移动网络游戏正在开发中12Lxjs 2013 - 里斯本/speakers/charlie-crane13CategoryThe state of pomeloMotivationFrameworkEvolutionPerformanceDemo14Motivation-node.js and game serverGame ServerFast Scalable Network Real-timeNode.js is a platform built onChromes JavaScript runtime

4、for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.15Motivation-node.js advantagesScalability - event driven I/OGa

5、me, high density network communicationLanguage, javascriptBrowser, HTML5, unity3d, cocos2d-x, other platform same language in client and serverLightweight, development efficiency, really quick iterationMulti-Process, Single threadNo lockSimple16Motivationnode.js disadvantageSome CPU sensitive action

6、sPath findingAISolutionOptimizationDivide processAll can be solved in practice17Node.js gameMozilla BrowserQuest18Node.js gamegoogle gritsgame19Motivation - our demo20Motivation-architecture of demo21Motivation-complicate servers22Motivation - game VS webLong connection VS Short connectionPartition:

7、 area based VS Load balanced clusterStateful VS StatelessRequest/Broadcast VS Request/response23Motivation-ProblemDistributed development is hard, is it?How many codes for this complicated architecture?A lot of servers and server types, how to manage?The server side rpc is complicated, how to simpli

8、fy? A lot of processesHow many servers do we need?How to spot the problem on multiple servers? Is it too heavy, not efficient?24Motivation-how to solve complexityToo complicated?solution: framework25Motivation-With pomeloPomelo makes distributed development really easy and pleasantAchieve this archi

9、tecture-almost zero CodeServer types and servers extention - simpleServers rpc - simple,zero config, no stubA lot of processesOne machine, small amount of resourcesSingle console,quick spot problem, no different to single processLightweight, extremely quick to start up26CategoryThe state of pomeloMo

10、tivationFrameworkEvolutionPerformanceDemo27Framework -28Framework - design goalAbstract of servers(processes)Auto extend server typesAuto extend serversAbstract of request , response and broadcastZero config request Simple broadcast apiOther mechanisms: filter, sessionServers communication-rpc frame

11、work29Framework - server abstractionWhy the name of node.js?Why does web not need server abstraction?Web is statelessLoad balancer, nginx, apacheCluster frameworksWhy server abstraction in pomelo framework?Game is statefulMulti-processes cooperate for one task30Framework - server abstractionfrontend

12、frontendbackendbackendbackendbackendforward messagepush messageby channelrpcmaster31Framework- server abstractionDuck typefrontendconnectorbackendareachatstatus32Server abstractionserversThe Duck33Framework-server abstraction34Framework - request abstractionZero configClient, like ajaxServer, like w

13、eb mvc framework35Framework - rpc framework36Framework rpc frameworkWhy rpc is so easy in pomelo?ThriftWriting a .thrift fileGenerate Thrift source codethrift -gen Copy the source to applicationPomelostart up, all doneClient and server in one projectServers folder conventionAuto generate proxy and r

14、emote on start up37Framework - channel&broadcastPush messages to a group of userschannelService.pushMessageByUids(msg, uids, callback);var channel = channelService.getChannel(area1);channel.pushMessage(msg);38CategoryThe state of pomeloOverviewFrameworkEvolutionPerformanceDemo39EvolutionFrom game se

15、rver to realtime application frameworkWe originally designed pomelo for game server, it ends up to be a realtime application server frameworkThe core of pomelo have nothing related to game serverIt turn out to be a better realtime application server framework40Evolution-why is pomelo better Why pome

16、lo is a better realtime application framework?MeteorMeteor is an ultra-simple environment for building modern websites. What once took weeks, even with the best tools, now takes hours with Meteor.SocketstreamDerbyWeb is not the only client side, the rise of the mobileIs fast development the most imp

17、ortant feature, or scalability?41Evolution-why is pomelo betterA server supports multiple clientsWeb , mobile, PC clients, seamlessly connectedAdaptible for different protocol-socket.io is perfect for browser, but not for mobileScalabilityDistributed architectureTake full advantage of CPU42 Evolutio

18、n-Pomelo connectorConnectorSIOConnectorHybridConnectorPomelo component LoaderMQTTConnectorSocket.io clientSocket, websocketclientMobile client43Evolution-消息推送平台44Evolution-mobileWe used to assume HTML5, flash as mainstream, it turned out to be mobile移动端游戏开发者占绝大多数跨平台, 客户端:cocox2d-xunity3d iOSandroid,

19、HTML5Flash数据包的大小, json is too wasteful,需要压缩数据45Message encode, decode46Evolution-original protobufOriginal protobuf47Evolution-pomelo protobufOur protobuf48Evolution-protobuf definitionHandler return json, auto encoded to protobuf49Evolution-pomelo an independent project, supporting unity3d, iOS, an

20、droid, C50CategoryThe state of pomeloOverviewFrameworkEvolutionPerformanceDemo51PerformanceDifferent application performance criteriaGame(especially MMO)High network density, high frequence of broadcastStateful, area limitation, can not scale wellOnline user is low, 1000 onlines per area, 7000 onlin

21、es per game is a miracleRealtime applicationMiddle network density, connectors hold long connectionsStateless, can be scale wellOnline user is highMemory is bottleneck52Game performance - stress testing53Game performance - stress testing54Performance - hardwareCPU , 24 coresMem, 48G55Performance - t

22、he result1600 onlines per area56Performance - the result1600 onlines , server load57Performance - the result800 onlines, fight each other58Performance - the resultServer load, fight each other59Pomelo Netflow V0.2Version 0.2, 400 online usersOut: 3645Kb/S in: 270Kb/s60Pomelo Netflow V0.3Version 0.3, 400 online usersOut: 925KB/S, in: 217KB/S, 1/4 Netflow of 0.261消息推送平台performanceServerClient62消息推送平台8 connectors, 41.7万个连接63消息推送平台1 connector, 30万连接,no gc, 3G内存64CategoryThe state of pomeloOverviewFrameworkEvo

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论