Journal of Korea Game Society 2013 Apr; 13(2): 39-48 http://dx.doi.org/10.7583/jkgs.2013.13.2.39 게임프로그래밍 연산서버를적용한 MMORPG 게임서버에관한연구 배성길 *, 김혜영 ** 홍익대학교일반대학원게임학과 *, 홍익대학교게임학부게임소프트웨어전공 ** ddinggill@naver.com, hykim@hongik.ac.kr A Study on the MMORPG Server Architecture Applying with Arithmetic Server Sung-Gill Bae *, Hye-Young Kim ** Major in Game Software, Graduate School, Hongik University * Major in Game Software, School of Games, Hongik University ** 요약 가상공간에서대규모게임사용자들간의상호작용이활발히일어나는 MMORPG(Massively Multi-player Online Role-Playing Games) 에서는다수의클라이언트의접속요청및작업요청을실시간으로빠르게처리할수있어야한다. 그러나클라이언트의접속자수가늘어날수록처리해야할작업량이많아지며, 게임서버의부하도높아지게된다. 이를해결하기위해많은개발자들은분산서버구조를적용하여, 동적맵분할, 서버의기능에따른부하분산등의기법들을제시하고있다. 현재대부분의 MMORPG 게임서버는하나의월드를 Zone 방식으로나누어서각각의영역을다수의게임서버가담당하여게임을진행하고있다. 이러한방식은사용자의빈번한서버이동에따른데이터갱신등의오버헤드를발생하여게임서버에큰부하를주고있다. 따라서본논문에서는게임서버의부하를줄이기위해데이터의연산을담당하는연산서버를적용하여기존게임서버의효율은높이고더많은사용자의접속과작업을처리할수있는구조를제안하고, 수학적인모델링과성능분석을통해기존연구들과의비교시의제안기법의효율성을보였다. ABSTRACT In MMORPGs(Massively Multi-player Online Role-Playing Games) a large number of players actively interact with one another in a virtual world. Therefore MMORGs must be able to quickly process real-time access requests and process requests from numerous gaming users. A key challenge is that the workload of the game server increases as the number of gaming users increases. To address this workload problem, many developers apply with distributed server architectures which use dynamic map partitioning and load balancing according to the server function. Therefore most MMORPG servers partition a virtual world into zones and each zone runs on multiple game servers. These methods cause of players frequently move between game servers, which imposes high overhead for data updates. In this paper, we propose a new architecture that apply with an arithmetic server dedicated to data operation. This architecture enables the existing game servers to process more access and job requests by reducing the load. Through mathematical modeling and experimental results, we show that our scheme yields higher efficiency than the existing ones. Keyword : MMORPG, Distributed Server, Game User Received: Nov. 19, 2012 Revised(1st): Jan. 03, 2013 Revised(2nd): Feb. 22, 2013 Accepted: Feb. 28, 2013 Corresponding Author: Hye-Young Kim(Hongik Hongik University) E-mail: hykim@hongik.ac.kr ISSN: 1598-4540 / eissn: 2287-8211 C The Korea Game Society. All rights reserved. This is an open-access article distributed under the terms of the Creative Commons Attribution Non-Commercial License (http://creativecommons.otg/licenses/by-nc/3.0), which permits unrestricted non-commercial use, distribution, and reproduction in any medium, provided the original work is properly cited. Journal of Korea Game Society JKGS 39
연산서버를적용한 MMORPG 게임서버에관한연구 1. 서론 MMORPG(Massively Multiplayer Online Role-Playing Game) 의성장세가뚜렷하고시장이확대됨에따라게임사용자의수가증가함으로써하나의서버에서처리할수있는사용자의수와데이터의양의한계는중요한문제가되고있다. 이를해결하기위해분산서버방식의구조가사용되고있는데, 온라인게임서버는사용자들의그룹형성이나사용자들이게임을즐길수있는환경을제공하기위한게임의맵, NPCAI 등의데이터처리하는역할까지수행해야한다 [1]. 이게임서버의역할은처리해야하는게임데이터, 사용자관리등의수행해야하는게임서버의기능등의기준으로나누어져효율적으로수행할수있게설계되고, 확장성도고려해야한다. MMORPG를서비스하기위해서는하나의커다란맵을여러개의게임서버가담당하는영역으로나누어서게임플레이및사용자의처리를담당하게되는데이는결국사용자의수와네트워크트래픽의제한으로인해게임서버가담당하는영역이제한됨에따라게임서버의수가늘어나게되고이를통해서게임내에서사용자가맵을이동할시게임서버간사용자의이동이빈번하게발생하게되는데이러한점은게임서버에데이터를처리하는것보다큰부하를주고있다 [2,11]. 본논문에서는사용자의이동이빈번하게발생하는것을최소화하기위해기존게임서버의기능중하나인데이터연산을담당하는연산서버를적용하여게임서버의부하를줄이고게임서버가담당하는영역과사용자의수를늘림으로써효율적인게임서버를제안한다. 기반으로발전하고있고게임을동시에플레이하는사용자수또한증가함에따라서게임서버 1대가모든일을하는단일서버구조로는현재의대규모사용자처리하기에는불가능해졌다. 이를해결하기위해서 [Fig. 1] 과같은게임서버가수행하는기능들을각각의서버로독립적으로분산운용하여각기능을서버가담당하게하는분산서버구조가대세를이루고있다. 기능적으로로그인 / 업데이트서버, 통신서버, 게임서버, 데이터베이스서버등으로분산시킨후서버들간의통신을통해게임을처리하는구조다 [3]. 기존의온라인게임서버의구조는 [Fig. 1] 과같다. 사용자들은최초에로그인서버에접속하게되고사용자의최종적인위치를데이터베이스서버를통해서가져온뒤각위치에알맞은게임서버에사용자들을할당해준다. 그리하면사용자들은자신의위치에따른게임서버에접속을하게되고이를통해서게임을진행하게된다. 게임서버는접속한사용자의직접적인게임플레이환경을제공하고네트워크를통해게임을진행하고자신이담당하는맵의영역과사용자들을관리하여데이터를처리하게된다 [3,4]. 게임을진행하면서사용자는자신의서버가담당하는영역을벗어난위치로이동을하게되는데이때게임서버는정보를사용자가새롭게이동한영역을담당하는게임서버에서넘겨주고새로운게임서버가사용자의게임플레이를담당하게되는데이러한사용자이동작업은서버에큰부하를준다. 2. 관련연구 우수한기술의지원으로인해네트워크를이용한온라인게임들은다양한형태로거대한배경을 [Fig. 1] Present distributed server model 40 Journal of Korea Game Society 2013 Apr; 13(2): 39-48
A Study on the MMORPG Server Architecture Applying with Arithmetic Server 이러한구조에서는게임서버에몰리는사용자의수와네트워크트래픽의제한으로게임서버가담당하는영역이점점줄어드는반면, 게임서버의수가늘어나게되고담당하는영역또한작아진다. 그러면사용자가게임을플레이하는데있어서작은위치의이동만있더라도빈번한사용자의서버이동이발생하게되고이는서버를효율적으로사용하지못하는상황이발생하게된다. 이를해결하기위해 [Fig. 2] 의방법으로맵부하분산서버를이용하여게임서버가담당하는영역을동적으로변환해주며불균등한게임배경점유에따른각서버부하의불균형을제어하는방법으로각서버의효율을높이는방법이있으나서버간맵동적변환이이루어지게되는기준이게임마다너무나다르고부하도크다 [5,6]. 직접적인부하를줄이는방법을제안한다. 3. 제안기법본논문에서게임서버의작업부하를효율적으로나누어게임서버의연산작업중일부분을연산서버에서처리함으로써보다효율적인게임서버구조를제안한다. 3.1 연산서버의작업을위한메시지분배작업 [Fig 2] Dynamic allocation by map balancing [Fig. 3] Server architecture applied with Arithmetic server 다른방법으로는통신서버라는사용자접속과게임처리와실질적으로관계가적은채팅부분과같은메시지를처리 ( 게임서버가직접관여할필요없는인스턴스메시지 ) 하는서버가있는데이는사용자의맵이동시접속처리부분만을처리하기때문에게임에직접적인영향을끼치게되는즉, 게임서버에직접적으로부하를주는네트워크트래픽을감당하는데는제한이있다. 그리고클라이언트 -서버간통신이통신서버를무조건거쳐서가기때문에모든패킷의전달에있어서도 2단계과정을거치기때문에비효율적인방법이다. 이를해결하기위해서본논문에서는통신에는직접적으로관여하지는않지만게임서버의연산부분을처리하는연산서버의개념을두어게임서버의 [Fig. 3] 에서와같이게임서버와내부적으로연동되는연산서버를두어작업을분해하는방법이다. 이를위해기존게임유저에의해요청되는작업메시지의유형을게임서버가직접적으로처리해야하는메시지와연산서버를이용해작업을처리할수있는메시지로구분하는작업이필요하다. 로그인서버는유저의접속을처리한뒤유저가원하는게임서버로연결시켜준뒤그유저는자신의게임서버로연결되어자신의정보도게임서버에서관리한다. 게임서버의전체월드는 Zone방식으로구분되고유저가자신의게임서버가담당하는 Zone을벗어나게되면다른게임서버로이동이되는것이다 [7]. 이러한유저의접속과이동을처리하는작업요청메시지들은연산서버를이용해서 Journal of Korea Game Society JKGS 41
연산서버를적용한 MMORPG 게임서버에관한연구 하는것보다직접적으로게임서버에서처리하는것이게임서버자체가사용자정보를가지고있기때문에더효율적이므로이러한작업을연산서버에서담당할필요는없다. 게임을진행하는데있어필요한다양한작업메시지들의연산을연산서버에서담당할수가있는데일반적인게임에서의작업요청메시지중연산서버가담당가능한메시지와불가능한메시지를구별을 [Table 1] 에서와같이구별할수있다 [8,9,12]. [Table 1] Classified Working Message Classification Possible responsible message Impossible responsible message Working Message 1. movement of Character 2. message related to AI 3. message related to battle 4. message related to Item 5. message of character s position revision 6. movement of Monster 1. Access of Game Server by User 2. Movement of User between Game Servers 3. Chat message 4. message related to grouping 3.2 메시지부하분석을통한연산서버의활용 위에서분류한메시지종류를바탕으로연산서버가담당할수있는작업중게임서버에서직접적으로처리하는서버구조의속도와게임서버와연산서버와의통신시간과작업처리하는시간을비교하여연산서버를도입하여처리하는작업이더효율적인메시지작업들을연산서버가담당하게되는방법으로서버구조가구성된다. 유저의요청작업중실시간으로빠른응답이요구되는작업들은게임서버에서처리하는것이효율적이고연산등에소요되는시간은길지만빠른응답이요구되지않아도되는작업들을연산서버에서담당하도록하였다. [Fig. 4] Process of proposed scheme [Fig. 4] 에서보는것과같은작업과정을거쳐유저의작업요청작업을수행한다. 3.3 효율적인작업메시지선택게임진행시발생되는수식들의계산을위해서연산서버가담당할수있는메시지중에서기존서버구조와비교했을시가장효율적인메시지를구별하기위해각메시지마다기존서버구조에서걸리는총수행시간과본논문에서제안하는기법에서걸리는총수행시간을비교하여연산서버가작업을담당할메시지를선택한다. 효율적인작업메시지의조건은 [Table 2] 와같다. 42 Journal of Korea Game Society 2013 Apr; 13(2): 39-48
A Study on the MMORPG Server Architecture Applying with Arithmetic Server [Table 2] Efficient message condition 1. many request message 2. To minimize database access 3. Spent a lot of time working operation 4. minimizes the data transfer of the operations server task required upon request 3.1절에서분배한작업중사용자의이벤트에대한응답이바로전달되어져야하는전투관련메시지와게임서버와연결된데이터베이스서버를거쳐야하는아이템관련메시지는연산서버가작업을담당하는데있어서효율적이지못하다. 그러나사용자가비전투시이동하는이동동기화관련된메시지같은경우이벤트요청은계속해서요청이많지만요청시마다전투이벤트같은즉각적인반응이아닌어느정도의시간마다서버에서처리해주면되는메시지이다. [Table 2] 에서의조건을가장만족하는사용자의캐릭터이동동기화관련메시지와위치보정메시지, 몬스터이동동기화관련메시지들을연산서버에서선택하여게임서버대신에작업을수행한다. 사용자가작업을요청하는패킷을게임서버로보내면게임서버에서는패킷분류를하여연산서버로작업할패킷들은연산서버로변환된작업요청패킷을보낸다. 4. 성능분석 본논문에서는작업요청패킷을발생시키는가상의게임사용자들의접속을지속적으로발생시켜서기존연구와제안기법과의서버효율을비교하였다. 성능평가를위해지속적으로접속하는사용자수를증가하면서기존의서버모델과연산서버를적용한서버모델의성능을평가하고, 게임서버는두모델다같은성능의게임서버를하나씩사용하였고제안하는모델에서는연산서버를추가하여진행하였다. 서버의모델은 IOCP방식의모델을사용하였으 며데이터베이스는 MSSQL을서버와 ODBC로연동하여구현하고서버에서는실시간으로로그를분석하였다 [10]. [Table 3] Server execution time Arithmeticserver Classification Gameserver + Gamerver Working time Communication time Total execution time + + + + 4.1 사용자수에 른게임서버작업시간분석 게임서버와클라이언트간의분석패킷의설계는패킷의전체사이즈와타입을알려주는패킷헤더부분과실데이터부분으로구성되었다. 캐릭터의이동동기화관련메시지패킷을게임서버에요청하는클라이언트생성하여게임서버에요청하는방식으로진행하였다. 게임서버가처리하는전체메시지에서일반메시지의비중은 20% 정도이다 [8]. 기존의게임서버만을이용한모델에비해이동동기화관련메시지를연산서버에서처리하는제안모델의작업시간은기존모델의시간보다 80% 정도의시간만이걸렸다. 이는기존모델은게임서버에서사용자접속처리등의다른작업에도부하가걸리기때문이다. 은접속자의수, 는서버가처리하는전체메시지의수라하고 t는각메시지의작업을처리하는데걸리는시간을나타내며전체사용자의수에따른작업시간은 = * *...(eq. 1) 전체사용자의수에따른연산서버를적용한제안기법의작업시간은 Journal of Korea Game Society JKGS 43
연산서버를적용한 MMORPG 게임서버에관한연구 = * *0.8*t...(eq. 2) 가된다. 게임서버만을이용한총수행시간을 이라하고, 연산서버를이용한총수행시간을, 게임서버와사용자간의통신시간을, 그리고게임서버와연선서버의통신시간을 라고할때, 게임서버만을이용한총수행시간은 (eq. 1) 을통해서 = +...(eq. 3) [Fig. 5] Comparison of execution time 연산서버를이용한총수행시간은 (eq. 2) 를통해 = + +... (eq. 4) 가된다. 따라서기존의연구와제안기법에서의작업시간, 통신시간, 그리고총수행시간은 [Table 3] 과같이나타낼수있다. [Fig. 5] 에서와같이게임에접속하는사용자수를증가시키면서기존연구와제안기법의게임서버에서만의작업시간을비교하였다. 기존연구의게임서버는게임사용자의작업요청처리를게임서버자체적으로처리하고제안기법의게임서버는사용자의작업요청처리를전부하는것이아닌연산서버와나누어작업을하기때문에두모델의게임서버자체만의작업처리에걸리는시간은접속하는게임사용자의수가증가할수록기존연구와제안기법과의작업시간차가커지게된다. 즉접속하는게임사용자의증가수가똑같더라도게임서버의자체에걸리는부하는기존연구의기법에서는더많은부하가발생하기때문에제안기법이더욱효율적임을알수있다. [Fig. 6] 에서보듯이접속하는사용자의수가증가하면할수록연산서버를도입한모델과이전모델과의게임서버의작업시간은점점커짐을알수있다. 4.2 유저수에따른통신시간분석연산서버를적용한제안기법에서의게임서버와연산서버간의통신에대한오버헤드가미치는영향을분석하기위해게임서버와사용자간의통신시간과게임서버와연산서버간의통신시간을분석하였다. 대부분게임서버와사용자의통신시간은 20ms 정도면양호한네트워크상태라고본다 [5]. 따라서게임서버와사용자간의통신속도는 20ms 로일정하게유지되게가정하였고게임서버와연산서버는내부적인통신망으로이루어져있는테스트환경에서접속하는게임사용자의수를증가시키면서게임사용자와게임서버간의통신시간및게임서버와연산서버와의통신시간을측정하여 [Table 4] 에나타내었다. [Table 4] 와같이접속하는게임사용자의수가증가하더라도게임서버와연산서버의통신시간은크게늘어나지않고일정하게유지되는것을알수있다. 이는게임서버와연산서버의실험환경이 LAN기반의충분한대역폭이지원되고서버의수가제한적이었기때문이다. 44 Journal of Korea Game Society 2013 Apr; 13(2): 39-48
A Study on the MMORPG Server Architecture Applying with Arithmetic Server User (person) [Table 4] Communication time Commutication (server<->user) Communication (Game server<-> Arithmetic server) 100 20 1 200 20 1 300 20 1 400 20 1 500 20 1 600 20 1 700 20 1 800 20 2 User (person) (b) Execution time of proposed scheme Communication (srver-user) Server working Total execution time 100 20 11 31 200 20 11 31 300 20 11 31 400 20 13 33 500 20 13 33 600 20 15 35 700 20 16 36 800 20 17 37 4.3 서버총수행시간분석 [Table 5] 에서보듯이보통서버와사용자의통신시간은 20ms 정도면양호한상태인데사용자의수가늘어나고작업요청패킷의양이많이질수록서버의작업시간이늘어남에따라서서버와사용자의통신시간은일정하더라도서버의총수행시간은점차적으로늘어나고있다. 반면에 [Table 5] 에서보듯이연산서버의통신시간은일정하였지만서버의작업시간이처음사용자가 300명구간까지는작업시간이기존의구조가더욱효율적이었다. 400명구간부터는서버의작업수행시간의증가량이기존연구보다점차적으로좋아지기시작하였다. 즉, 게임사용자수가증가할수록서버의총수행시간의차이는점점커짐을알수있다. 성능분서시에서버작업시간에는게임서버와연산서버간의통신시간도포함하였다. 유저의수가 800 명인상황에서의서버의총수행시간의차이는 3ms로큰수치의차이는아니지만실제상용화된 MMORPG의접속유저수는 800명과는비교할수없이몇천, 혹은몇만명으로기하급수적으로늘어나게되는데그렇게된다면 [Table 5] 에서나타나는기존모델과제안기법의차이는더크게발생됨을예상할수있다. [Table 5] (a) Execution time of previous server User (person) Communication (srver-user) Server working Total execution time 100 20 10 30 200 20 10 30 300 20 12 32 400 20 13 33 500 20 15 35 600 20 17 37 700 20 19 39 800 20 20 40 [Fig. 6] Performance Comparison of server models Journal of Korea Game Society JKGS 45
연산서버를적용한 MMORPG 게임서버에관한연구 [Fig. 6] 과같이서버사용자와의통신시간을일정하게유지하더라도사용자의수가증가할수록본논문이제안한기법이더욱효율적임을알수있다. 5. 결론및향후과제본논문에서는기존의 MMORPG에서사용되던분산서버구조에서사용자가서버에몰림으로써발생되는작업의처리양에따른작업능률저하를줄이기위해연산서버를적용하여사용자의증가에따른작업에효율적으로처리함으로써효율적인서버구조를제안하였다. 기존모델의게임서버에서처리하던작업을연산서버에서나누어작업하여게임서버의작업처리량을감소시켰다. 즉, 게임서버의작업시간을향상시켜전체적인서버의총수행시간이효율적인모델을제안하였고이는사용자의수가증가할수록더나은모습을보였다. 제안기법에대한성능분석에서구현한환경이게임서버와연산서버가각각하나씩만존재하고, 패킷의종류도 MMORPG에쓰이는몇가지의제한적인메시지만을포함하고있다. 그러므로더욱효율적인검증을위해서는상용화된 MMORPG 게임서버의패킷분석을통해게임서버와연산서버의작업분배를실험함으로써신뢰도를높일수있을것으로예상한다. 또한, 연산서버와게임서버와의위치를내부의지역적인환경이아닌외부인터넷환경에서의성능비교도필요할것으로보인다. 향후연구로는또한제안기법에서의연산서버에서의처리할패킷을자동으로분별하는알고리즘을신뢰성있도록제안하고, 연산서버의작업수행능력을위한최적화알고리즘들을제안하며, 데이터베이스서버와의연동을고려하여최적화된게임서버를제안하고자한다. ACKNOWLEDGEMENTS This research was supported by the MKE(The Ministry of Knowledge Economy), NHN Corp. under IT/SW Creative research program supervised by the NIPA(National IT Industry Promotion Agency) (NIPA-2012-H0506-12-101). This work was supported by 2013 Hongik University Research Fund. REFERENCES [1] Jung-Yeoul Lim and three others Technical Trend of Distributed Game Server, Electronics and Telecommunications Trends, Vol. 20, No. 4, pp93-102, 2005 [2] Nam-Kyeong Um, Hyung-Jin Moon, Sang-Ho Lee, Design and Implementation of A Load Balancer Based on Load Equality between Game Servers, The Journal of the Korean Institute of Information and Communication Engineering, Vol. 32, No. 4, 2007 [3] Su-Min Jang, Jae-Soo Yoo, An Efficient MMORPG Distributed Game Server, Journal of Korea Contents Association, Vol. 7, No. 1 2007 [4] Kwang-Ho Yang and four others, Technical Trend of Online Game Server, Electronics and Telecommunications Trends, Vol. 16, No. 4, pp14-22, 2001 [5] Su-Min Jang, Jae-Soo Yoo, Efficient Distri buted Processing Scheme for Load Balancing of MMORPG Server, Journal of Korea Contents Association, Vol. 7, No. 11, pp69-75, 2007 [6] Jong-Gwan Choi, Hye-Young Kim, Woo-Sik Woo, A Study of a Game User Oriented Load Balancing Scheme on MMORP, Journal of Korea Game Society, Vol. 12, No. 3, pp69-76, 2012 46 Journal of Korea Game Society 2013 Apr; 13(2): 39-48
A Study on the MMORPG Server Architecture Applying with Arithmetic Server [7] Soon-Gohn Kim, Nam-Jae Lee, Seung- Weon Yang, A Management method of Load Balancing among Game Servers based on Distributed Server System Using Map Balance Server, Journal of Korea Navigation Institute, Vol. 15, No. 6, pp1034, 2011 [8] Seung-Weon Moon, Hyung-Jae Jo, A Study on Synchronization Distribution of Server Message in Online Games, Journal of Korea Game Society, Vol. 9, No. 2, 2009 [9] Dong-Hoon Han, Online Game Server programming, Information Publishing Group, 2007 [10] Hye-Young Kim, Moon-Sung Kim, Dae- Hyun Ham, A Study of Object Pooling Scheme for Efficient Online Gaming Server, Journal of Korea Game Society, Vol. 9, No. 6, 2009 [11] Santosh Kulkami Badumna Network Suite A Decentralized Network Engine for Massively Multiplayer Online Applications Peer-to-Peer Computing, 2009, P2P 09. IEEE Ninth International Conference 2009 [12] Carlos Eduardo Benevides Bezerra and one person, A load balancing scheme for massively multiplayer online games, Journal Multimedia Tools and Applications archive Vol. 45, Issue 1-3, 2009 년 배성길 (Bae, Sung Gill) 2006.2.25 홍익대학교게임소프트웨어학과이학사 2012.3.2- 현재홍익대학교일반대학원게임공학과 관심분야 : 게임서버, 분산서버, 게임제작 김혜영 (Hye-Young Kim) 2005.2 고려대학교컴퓨터학과이학박사 2005.3-2006.8 Wright State Uni. Post-Doc. 2007.3- 현재홍익대학교게임학부게임소프트웨어전공부교수 관심분야 : 모바일게임, 온라인게임서버, 게임엔진 Journal of Korea Game Society JKGS 47
연산서버를적용한 MMORPG 게임서버에관한연구 48 Journal of Korea Game Society 2013 Apr; 13(2): 39-48