CN103995755A - Server optimizing method based on mobile terminal and server system - Google Patents
Server optimizing method based on mobile terminal and server system Download PDFInfo
- Publication number
- CN103995755A CN103995755A CN201410240926.8A CN201410240926A CN103995755A CN 103995755 A CN103995755 A CN 103995755A CN 201410240926 A CN201410240926 A CN 201410240926A CN 103995755 A CN103995755 A CN 103995755A
- Authority
- CN
- China
- Prior art keywords
- server
- mobile terminal
- data
- game server
- game
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Landscapes
- Mobile Radio Communication Systems (AREA)
Abstract
The invention provides a server optimizing method based on a mobile terminal and a server system. According to the server optimizing method, a new technical architecture is designed based on TCP long connection, long connection is replaced by TCP short connection, a shared memory is explored in a game server, and reading and writing are separated on a data access layer by arranging a database cache server. In addition, data retreat caused by shutdown of the server is avoided, and user experience of mobile phone games is promoted. An annular buffering area based on a producer and consumer model is arranged in the game server, a monitoring module used for monitoring the connection state of the mobile terminal is arranged in the game server, in this way, multiple aspects including the network connection mode, data caching, the network buffering area structure and the like are improved, and the user experience of the mobile phone games is further promoted.
Description
Technical field
The present invention relates to network game server technical field, particularly server optimization method and the server system based on mobile terminal, to promote the concurrent of service and I/O processing power.
Background technology
Mobile terminal or make mobile communication terminal refer to the computer equipment that can use in movement, saying of broad sense comprises that mobile phone, notebook, POS machine even comprise vehicle-mounted computer.In most of situation, refer to mobile phone or there is the smart mobile phone of multiple application function.Mobile terminal device uses wireless communication technology to carry out data transmission, and residing network environment is complicated and changeable, mobile terminal with server interaction process in, the phenomenon such as often there is disconnecting, read-write efficiency is lower and network performance is limited.For smart mobile phone, according to the feature of mobile phone games, mobile terminal does not need frequent and server interaction, but mobile phone users has higher requirement to the concurrency of whole communication system and robustness, server load-bearing capacity and network I/O efficiency.In prior art, smart mobile phone conventionally keeps long with network game server end as online game terminal and is connected, the inventor thinks, when mobile phone games number of users is uprushed, likely there is connecting bottleneck in this long connection mode, therefore be necessary to make improvement from many-sides such as network connection mode, data buffer storage, meshwork buffering plot structures, design the server optimization method based on mobile terminal of high concurrent, high I/O processing power, the user who further promotes mobile phone games experiences.
Summary of the invention
The present invention is directed to defect or deficiency that prior art exists, propose a kind of server optimization method and server system based on mobile terminal, to promote the concurrent of service and I/O processing power.
Technical scheme of the present invention:
Server optimization method based on mobile terminal, is characterized in that, described method comprises:
Mobile terminal is initiated connection request to game server, the rear foundation of the game server request of receiving is connected with mobile terminal, when a data interaction between mobile terminal and game server finishes, mobile terminal initiates to disconnect the operation of this connection, discharges shared resource; When having new data interaction request to produce between mobile terminal and game server, game server is set up new connection again with mobile terminal;
Between mobile terminal and game server, connection procedure is followed Transmission Control Protocol, game server for each with set in advance a time-out time being connected of mobile terminal, game server checks every one period of schedule time whether each connection is overtime, if overtime, to the corresponding mobile terminal of overtime connection, send and disconnect indication, mobile terminal receives to disconnect indicating and initiatively disconnects this connection.
Described method also comprises: in game server, be provided with for monitoring the monitoring module of the connection status of mobile terminal, performed processing function when a certain event and this event being set in advance in game server occurring, in online game operational process in mobile terminal, some event once registered in advance occurs, and monitors module and just can make alignment processing according to its corresponding event handling function.
Described method also comprises: the database caches server being connected with game server is set, and in game server, hewing out a part of physical memory that can be shared by several processes as shared drive, this shared drive is mapped to game server, the database caches server process address space separately;
Described shared drive is for game player's data of memory mobile terminal; During the process initiation of database caches server, from database, load game player's data to shared drive region, the process of game server is from shared drive region reading out data, when the game player's data on game server change, the data in shared drive region change thereupon, database caches server timing or instant by the game player's data write into Databasce after change.
Described method also comprises: the buffer circle based on producer consumer model is set in game server, and described buffer circle comprises reception buffer zone and sends buffer zone; The read operation of buffer circle and write operation, respectively by reading thread and writing thread and manage separately, are read thread and are responsible for reading out data from reception buffer zone, the data of taking-up are returned to the upper strata of buffer circle circle queue; Write thread and be responsible for data to write and send buffer zone, then send to the opposite end of circle queue.
Described method also comprises: described database can, with database caches server disposition in same computer, also can be deployed in different computing machines from database caches server separate part.
The described time-out time setting in advance is 5 minutes.
Described database caches server every 10 minutes by change after game player's data write into Databasce in.
Server system based on mobile terminal, is characterized in that, described system has adopted above-mentioned optimization method.
Technique effect of the present invention:
Server optimization method and the server optimization system based on mobile terminal based on mobile terminal provided by the invention made improvement from many-sides such as network connection mode, data buffer storage, meshwork buffering plot structures.
1. on the long basis connecting of TCP, design a kind of new Technical Architecture, by the short connection of TCP, replace long connection, this request and answer-mode system overhead are little, and cost is low, has greatly improved the load-bearing capacity of server.
2. in game server, open up shared drive, by database caches server is set, in data access aspect, realized " read-write is separated ".In addition, avoided the data retrace that brings because of the server machine of delaying, the user who promotes mobile phone games experiences.
3. the buffer circle based on producer consumer model is set in game server, described buffer circle comprises reception buffer zone and sends buffer zone, the read operation of buffer circle and write operation are respectively by reading thread and writing thread and manage separately, and server I/O performance is significantly improved.
4. in game server, be provided with for monitoring the monitoring module of the connection status of mobile terminal, performed processing function when a certain event and this event being set in advance in game server occurring, in online game operational process in mobile terminal, some event once registered in advance occurs, and monitors module and just can make alignment processing according to its corresponding event handling function.This event notice pattern is that a part of pressure has been shared in CPU computing consuming time, and the user who further promotes mobile phone games experiences.
Accompanying drawing explanation
Fig. 1 is that between mobile terminal and game server, connection procedure is optimized schematic diagram.
Fig. 2 opens up shared drive in game server, with the logical relation schematic diagram of database caches server.
Fig. 3 is buffer circle structural representation.
Embodiment
Below in conjunction with accompanying drawing, the embodiment of the present invention is described further.
Fig. 1 is that between mobile terminal and game server, connection procedure is optimized schematic diagram.As shown in Figure 1, mobile terminal is initiated connection request to game server, the rear foundation of the game server request of receiving is connected with mobile terminal, when a data interaction between mobile terminal and game server finishes, mobile terminal initiates to disconnect the operation of this connection, discharges shared resource; When having new data interaction request to produce between mobile terminal and game server, game server is set up new connection again with mobile terminal.Between mobile terminal and game server, connection procedure is followed Transmission Control Protocol, for each, (this time-out time can be set to 5 minutes to game server, also can need to arrange 30 seconds or 1 minute according to concrete system with setting in advance a time-out time being connected of mobile terminal.), game server checks that every one period of schedule time each connects whether overtime (this schedule time can be set to 10 minutes, also can arrange according to specific needs.), if overtime, to the corresponding mobile terminal of overtime connection, send indication, require mobile terminal initiatively to disconnect this connection.As a rule, mobile phone games backstage is the implementation pattern based on http protocol commonly, or adopts PHP technology to implement website back-stage management.According to the feature of mobile phone games, mobile terminal does not need frequent and server interaction, and long connection of TCP continues to take serve port, larger to system resources consumption.Under this pattern, each user occupies a connection, and most of connection all in state of activation, and when number of users reaches some levels, system performance declines on the contrary.Shown in Fig. 1 is to design a kind of new Technical Architecture on the long basis connecting, and by the short connection of TCP, replaces long connection, and short connection need to keep exactly in brief a lot of connections and establishment of connection simultaneously and close very frequent.It is fairly simple that the advantage of short connection is that management is got up, and the connection of existence is all effective connection, does not need extra control device, is conducive to realize high concurrent.
Fig. 2 opens up shared drive in game server, with the logical relation schematic diagram of database caches server.A part of physical memory that shared drive is shared by a plurality of processes.If a plurality of processes are all mapped to this region of memory the virtual address space of oneself, these processes just can directly be accessed this shared drive region, thereby can communicate by this region.
As a further improvement on the present invention, the database caches server being connected with game server is set, and in game server, hewing out a part of physical memory that can be shared by several processes as shared drive, this shared drive is mapped to game server, the database caches server process address space separately.Described shared drive is for game player's data of memory mobile terminal; During the process initiation of database caches server, from database, load game player's data to shared drive region, the process of game server is from shared drive region reading out data, when the game player's data on game server change, the data in shared drive region change thereupon, database caches server timing or instant by the game player's data write into Databasce after change.
As shown in Figure 2, process A is game server, and process B is DB caching server, and wherein shared drive region is player's data.Process B loads data into shared drive region from database while starting, process A is from shared drive region reading out data, when the player's data on process A change, just there is change in the data in shared drive region, process B learns that change has occurred shared drive area data naturally, thereby process B just can be regularly or immediately by data write into Databasce.By DB data buffer storage is set, process A is only responsible for from shared drive region reading out data, will write in a large number and frequently database manipulation and give process B and complete, and has realized " read-write is separated " in data access aspect.In addition, when process A collapses, because data are also in internal memory, process B can, in time by data write into Databasce, avoid the data retrace bringing because of the server machine of delaying.Therefore, buffer memory has very important effect for improving server I/O efficiency and stability.
Fig. 3 is buffer circle structural representation.Conventionally, meshwork buffering plot structure is that linear buffer district and read-write operation and game logic are in together in a thread, and read-write efficiency is not high.In addition, buffer area read-write operation is all in same thread with game logic, can cause message response to postpone when this thread block, and network I/O performance reduces, and affects player and experiences.As a further improvement on the present invention, the buffer circle based on producer consumer model is set in game server, described buffer circle comprises reception buffer zone and sends buffer zone; The read operation of buffer circle and write operation, respectively by reading thread and writing thread and manage separately, are read thread and are responsible for reading out data from reception buffer zone, the data of taking-up are returned to the upper strata of buffer circle circle queue; Write thread and be responsible for data to write and send buffer zone, then send to the opposite end of circle queue.As shown in Figure 3, the present embodiment has increased a kind of efficient buffer circle on the basis of above-mentioned optimization method, buffer circle is based on producers and consumers's model, the producer puts into data the tail end of array, and consumer takes out data from the other end of array, when reaching the afterbody of array, the producer raps around to the head of array.If only have a producer and a consumer, so just can accomplish without lock access buffer circle.Write pointer only allows the producer to access and revise, as long as write pointer was saved in new value in buffer zone before upgrading index, read pointer will be seen consistent data structure all the time.In like manner, read pointer also only allows consumer to access and revise.
As shown in Figure 3, when read pointer and write pointer equate, show that buffer zone is empty, and as long as write pointer after read pointer time, shows that buffer zone is full.In addition, the read-write operation of buffer zone should be separated from the worker thread of processing game logic, by a pair of read-write thread, be managed separately, read thread and be responsible for reading out data from reception buffer zone, the data of taking-up are returned to upper strata; Writing thread is responsible for the data that send buffer zone to send to opposite end.Separated through to the optimization in meshwork buffering district and network I/O and game logic, server I/O performance is promoted greatly.
Event notice pattern belongs in fact a kind of passive trigger mode, performed processing function when the good a certain event of system registered in advance and event occur, in game running process, when some event of registered in advance occurs, just can process corresponding logic according to its corresponding event handling function.As a further improvement on the present invention, on the basis of above-mentioned optimization method, the poll pattern that mobile phone games field is adopted is conventionally optimized for event notice pattern, be in game server, to be provided with for monitoring the monitoring module of the connection status of mobile terminal, performed processing function when a certain event and this event being set in advance in game server occurring, in online game operational process in mobile terminal, some event once registered in advance occurs, and monitors module and just can make alignment processing according to its corresponding event handling function.For example, it can be a call back function of a monitoring socket registration, whenever calling accept () function, needs call this call back function when opening new connection, when accepting new a connection, for the reading and writing of this new connection and error event are registered corresponding call back function, when having reading and writing or error event to occur, just can be carried out by corresponding call back function again.Thisly by initiatively becoming passive tupe, can from complicated games system, can peel off separately, for a part of pressure has been shared in CPU computing consuming time.
In sum, the game server based on mobile terminal is after above-mentioned optimisation strategy checking, and the concurrency of system and robustness, server load-bearing capacity and network I/O efficiency significantly improve, and user experiences and further promoted.
The above-described specific embodiment of the invention, does not form limiting the scope of the present invention.Any modification of making within the spirit and principles in the present invention, be equal to and replace and improvement etc., within all should being included in claim protection domain of the present invention.
Claims (8)
1. the server optimization method based on mobile terminal, it is characterized in that, described method comprises: mobile terminal is initiated connection request to game server, the rear foundation of the game server request of receiving is connected with mobile terminal, when a data interaction between mobile terminal and game server finishes, mobile terminal initiates to disconnect the operation of this connection, discharges shared resource; When having new data interaction request to produce between mobile terminal and game server, game server is set up new connection again with mobile terminal;
Between mobile terminal and game server, connection procedure is followed Transmission Control Protocol, game server for each with set in advance a time-out time being connected of mobile terminal, game server checks every one period of schedule time whether each connection is overtime, if overtime, to the corresponding mobile terminal of overtime connection, send and disconnect indication, mobile terminal receives to disconnect indicating and initiatively disconnects this connection.
2. the server optimization method based on mobile terminal according to claim 1, it is characterized in that, described method also comprises: in game server, be provided with for monitoring the monitoring module of the connection status of mobile terminal, performed processing function when a certain event and this event being set in advance in game server occurring, in online game operational process in mobile terminal, some event once registered in advance occurs, and monitors module and just can make alignment processing according to its corresponding event handling function.
3. the server optimization method based on mobile terminal according to claim 1, it is characterized in that, described method also comprises: the database caches server being connected with game server is set, and in game server, hewing out a part of physical memory that can be shared by several processes as shared drive, this shared drive is mapped to game server, the database caches server process address space separately;
Described shared drive is for game player's data of memory mobile terminal; During the process initiation of database caches server, from database, load game player's data to shared drive region, the process of game server is from shared drive region reading out data, when the game player's data on game server change, the data in shared drive region change thereupon, database caches server timing or instant by the game player's data write into Databasce after change.
4. the server optimization method based on mobile terminal according to claim 1, it is characterized in that, described method also comprises: the buffer circle based on producer consumer model is set in game server, and described buffer circle comprises reception buffer zone and sends buffer zone; The read operation of buffer circle and write operation, respectively by reading thread and writing thread and manage separately, are read thread and are responsible for reading out data from reception buffer zone, the data of taking-up are returned to the upper strata of buffer circle circle queue; Write thread and be responsible for data to write and send buffer zone, then send to the opposite end of circle queue.
5. the server optimization method based on mobile terminal according to claim 3, it is characterized in that, described method also comprises: described database can, with database caches server disposition in same computer, also can be deployed in different computing machines from database caches server separate part.
6. the server optimization method based on mobile terminal according to claim 1, is characterized in that, described in the time-out time that sets in advance be 5 minutes.
7. the server optimization method based on mobile terminal according to claim 3, is characterized in that, database caches server every 10 minutes by the game player's data write into Databasce after change.
8. the server system based on mobile terminal, is characterized in that, described system has adopted the server optimization method based on mobile terminal described in claim 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410240926.8A CN103995755A (en) | 2014-06-03 | 2014-06-03 | Server optimizing method based on mobile terminal and server system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410240926.8A CN103995755A (en) | 2014-06-03 | 2014-06-03 | Server optimizing method based on mobile terminal and server system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN103995755A true CN103995755A (en) | 2014-08-20 |
Family
ID=51309929
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410240926.8A Pending CN103995755A (en) | 2014-06-03 | 2014-06-03 | Server optimizing method based on mobile terminal and server system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103995755A (en) |
Cited By (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105117394A (en) * | 2014-11-04 | 2015-12-02 | 合肥轩明信息科技有限公司 | Application mode based on caching technology |
CN105207990A (en) * | 2015-08-13 | 2015-12-30 | 北京乐动卓越科技有限公司 | Method for accessing game server, server and network game system |
CN106649857A (en) * | 2016-12-30 | 2017-05-10 | 北京恒华伟业科技股份有限公司 | Reading and writing separation-based database operation method and apparatus |
CN106776056A (en) * | 2016-11-10 | 2017-05-31 | 北京像素软件科技股份有限公司 | Game data processing method, device and server |
CN108268332A (en) * | 2017-08-10 | 2018-07-10 | 广州神马移动信息科技有限公司 | Webpage abnormality monitoring method, equipment and system |
CN109286665A (en) * | 2018-09-17 | 2019-01-29 | 北京龙拳风暴科技有限公司 | The real-time long link processing method and processing device of moving game |
CN109922159A (en) * | 2019-03-27 | 2019-06-21 | 宁波大学 | A kind of method of the two-way virtual link in cloud between internet of things equipment |
CN111258779A (en) * | 2020-01-13 | 2020-06-09 | 中孚安全技术有限公司 | C + + 11-based network communication method and system |
CN112235204A (en) * | 2020-10-13 | 2021-01-15 | 中移(杭州)信息技术有限公司 | Data reporting method, system, electronic equipment and storage medium |
CN113065957A (en) * | 2021-02-09 | 2021-07-02 | 上海金融期货信息技术有限公司 | Futures trading system |
CN113304469A (en) * | 2020-02-26 | 2021-08-27 | 上海哔哩哔哩科技有限公司 | Game player matching method and device and computer equipment |
CN113552836A (en) * | 2021-07-09 | 2021-10-26 | 武汉数信科技有限公司 | Information interaction method and system for programmable controller |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080146340A1 (en) * | 2006-12-15 | 2008-06-19 | Miki Ben Ami | Multiplayer online trivia games and tournaments played for prizes |
CN103647768A (en) * | 2013-12-06 | 2014-03-19 | 北京奇虎科技有限公司 | Game client and realization method thereof |
-
2014
- 2014-06-03 CN CN201410240926.8A patent/CN103995755A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080146340A1 (en) * | 2006-12-15 | 2008-06-19 | Miki Ben Ami | Multiplayer online trivia games and tournaments played for prizes |
CN103647768A (en) * | 2013-12-06 | 2014-03-19 | 北京奇虎科技有限公司 | Game client and realization method thereof |
Non-Patent Citations (1)
Title |
---|
王瑞彪: "网络游戏服务器端网络引擎的研究与实现", 《中国优秀硕士学位论文全文数据库》 * |
Cited By (17)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105117394A (en) * | 2014-11-04 | 2015-12-02 | 合肥轩明信息科技有限公司 | Application mode based on caching technology |
CN105207990A (en) * | 2015-08-13 | 2015-12-30 | 北京乐动卓越科技有限公司 | Method for accessing game server, server and network game system |
CN105207990B (en) * | 2015-08-13 | 2019-03-15 | 北京乐动卓越科技有限公司 | A kind of method, server and network game system accessing game server |
CN106776056A (en) * | 2016-11-10 | 2017-05-31 | 北京像素软件科技股份有限公司 | Game data processing method, device and server |
CN106649857A (en) * | 2016-12-30 | 2017-05-10 | 北京恒华伟业科技股份有限公司 | Reading and writing separation-based database operation method and apparatus |
CN108268332A (en) * | 2017-08-10 | 2018-07-10 | 广州神马移动信息科技有限公司 | Webpage abnormality monitoring method, equipment and system |
CN109286665B (en) * | 2018-09-17 | 2021-04-20 | 北京龙拳风暴科技有限公司 | Real-time mobile game long link processing method and device |
CN109286665A (en) * | 2018-09-17 | 2019-01-29 | 北京龙拳风暴科技有限公司 | The real-time long link processing method and processing device of moving game |
CN109922159A (en) * | 2019-03-27 | 2019-06-21 | 宁波大学 | A kind of method of the two-way virtual link in cloud between internet of things equipment |
CN111258779A (en) * | 2020-01-13 | 2020-06-09 | 中孚安全技术有限公司 | C + + 11-based network communication method and system |
CN113304469A (en) * | 2020-02-26 | 2021-08-27 | 上海哔哩哔哩科技有限公司 | Game player matching method and device and computer equipment |
CN113304469B (en) * | 2020-02-26 | 2023-07-28 | 上海哔哩哔哩科技有限公司 | Game player matching method and device and computer equipment |
CN112235204A (en) * | 2020-10-13 | 2021-01-15 | 中移(杭州)信息技术有限公司 | Data reporting method, system, electronic equipment and storage medium |
CN112235204B (en) * | 2020-10-13 | 2023-04-07 | 中移(杭州)信息技术有限公司 | Data reporting method, system, electronic equipment and storage medium |
CN113065957A (en) * | 2021-02-09 | 2021-07-02 | 上海金融期货信息技术有限公司 | Futures trading system |
CN113065957B (en) * | 2021-02-09 | 2024-05-28 | 上海金融期货信息技术有限公司 | Futures trading system |
CN113552836A (en) * | 2021-07-09 | 2021-10-26 | 武汉数信科技有限公司 | Information interaction method and system for programmable controller |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103995755A (en) | Server optimizing method based on mobile terminal and server system | |
CN107111553B (en) | System and method for providing dynamic caching extension in more cluster heterogeneous processor frameworks | |
CN102426594B (en) | Method and system for operating database | |
CN110909025A (en) | Database query method, query device and terminal | |
CN101808121A (en) | Method and device for writing server log of mobile terminal into database | |
CN102752387B (en) | Data storage processing system and data storage handling method | |
CN103078933B (en) | A kind of method and apparatus determining data migration time | |
CN103207841A (en) | Method and device for data reading and writing on basis of key-value buffer | |
CN107743137B (en) | File uploading method and device | |
CN101615067A (en) | Coordinated link power management | |
CN102866908A (en) | Method for cleaning Android background applications and services | |
CN103139018B (en) | Network card status monitoring under a kind of modulation integral system and TCP communication method | |
CN105373369A (en) | Asynchronous caching method, server and system | |
WO2014206289A1 (en) | Method and apparatus for outputting log information | |
CN104142862A (en) | Overload protection method and device for server | |
CN106060909A (en) | Network access method and mobile terminal | |
CN101557427A (en) | Method for providing diffluent information and realizing the diffluence of clients, system and server thereof | |
CN103605727A (en) | Connection pool based efficient multiuser database access optimization method and framework | |
EP4213038A1 (en) | Data processing method and apparatus based on distributed storage, device, and medium | |
CN103309818A (en) | Method and device for storing data | |
CN107800767A (en) | A kind of access response management method, server and computer-readable recording medium | |
CN111416825A (en) | Inter-thread lock-free log management method and system, terminal and storage medium | |
CN104598615A (en) | Memory access method and device supporting data persistence | |
CN103377292B (en) | Database result set caching method and device | |
CN103793267A (en) | Queue access method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20140820 |
|
RJ01 | Rejection of invention patent application after publication |