Resource optimization method, related system, related device, equipment and storage medium
By setting up a heartbeat monitoring mechanism between the dedicated server and the business management server, releasing resources solves the problem of excessive consumption and unstable resource consumption for a long time, and achieves efficient resource provisioning and business sustainability.
Patent Information
- Application Number
- CN202510038706.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-09
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2045-01-09
AI Technical Summary
When long-running dedicated servers process large amounts of user requests and data storage, they are prone to excessive use and instability of hardware resources, affecting business continuity and user experience.
The business management server and the dedicated server monitor each other's heartbeat status, and release the resources of the dedicated server when the heartbeat status is abnormal, ensuring efficient resource allocation and stable system operation.
It realizes efficient resource allocation, reduces user loss caused by server problems, avoids network congestion and invalid occupation of hardware resources, and ensures business sustainability.
Smart Images

Figure CN119865523A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a resource optimization method, related system, related device, equipment and storage medium. Background Art
[0002] In many scenarios, such as online games and large network applications, dedicated servers (DS) need to run uninterruptedly for a long time. This is because these services need to provide services to users continuously. Once the server stops running, users will not be able to use related services normally, which may cause serious business interruption and user loss.
[0003] A DS that runs for a long time may continuously occupy a large amount of hardware resources such as CPU, memory, and disk I / O. For example, as the number of users increases and the complexity of user operations increases, DS needs to handle more computing tasks and data storage / reading operations, which causes the CPU to be in a high-load state for a long time and memory usage continues to rise. In addition, during the long-term operation, DS needs to maintain a continuous network connection with the client and process a large number of network data packets. If network resources are not managed properly, the network bandwidth will be over-occupied, network congestion will occur, and the efficiency and stability of data transmission will be affected.
[0004] At present, DS faces the problems of excessive resource consumption and instability in long-term operation, and an effective method is urgently needed to solve such problems. Summary of the invention
[0005] An embodiment of the present application provides a method, related system, related apparatus, equipment and storage medium for resource optimization. When a client cannot connect to a first dedicated server according to the target address of the first dedicated server sent by a business management server, the business management server and the first dedicated server monitor each other's heartbeat status. When an abnormal heartbeat status occurs in either party, the resources of the first dedicated server are released.
[0006] On one hand, the present application provides a method for resource optimization, which is applied to a resource optimization system, the resource optimization system including a business logic server, a business management server and a first dedicated server, and the method includes:
[0007] Receiving an address query instruction sent by a client, wherein the address query instruction is used to instruct the business logic server to query the address information of the first dedicated server, the business logic server provides a logic driver for the target business, and the first dedicated server is used to provide an operating environment for the target business;
[0008] Obtaining the target address of the first dedicated server according to the address query instruction;
[0009] Sending the target address of the first dedicated server to the client, so that the client connects to the first dedicated server according to the target address;
[0010] In case of a connection failure, obtaining a heartbeat monitoring status of a service management server, wherein the service management server has a communication relationship with the first dedicated server;
[0011] When the heartbeat monitoring status of the service management server is abnormal, the resources of the first dedicated server are released.
[0012] On the other hand, the present application provides a resource optimization system, including a business logic server, a business management server and a first dedicated server, wherein:
[0013] The business logic server receives an address query instruction sent by the client, wherein the address query instruction is used to instruct the business logic server to query the address information of the first dedicated server, the business logic server provides a logic driver for the target business, and the first dedicated server is used to provide an operating environment for the target business;
[0014] The service logic server or the service management server obtains the target address of the first dedicated server according to the address query instruction;
[0015] The service logic server or the service management server sends the target address of the first dedicated server to the client, so that the client connects to the first dedicated server according to the target address;
[0016] In case of connection failure, the first dedicated server obtains the heartbeat monitoring status of the service management server, wherein the service management server has a communication relationship with the first dedicated server;
[0017] When the heartbeat monitoring status of the service management server is abnormal, the first dedicated server releases resources.
[0018] Another aspect of the present application provides a resource optimization device, comprising:
[0019] A receiving module, used to receive an address query instruction sent by a client, wherein the address query instruction is used to instruct the business logic server to query the address information of the first dedicated server, the business logic server provides a logic driver for the target business, and the first dedicated server is used to provide an operating environment for the target business;
[0020] A query module, used for querying and obtaining a target address of the first dedicated server according to an address query instruction;
[0021] A sending module, used for sending the target address of the first dedicated server to the client, so that the client connects to the first dedicated server according to the target address;
[0022] an acquisition module, used to acquire the heartbeat monitoring status of the service management server in case of a connection failure, wherein the service management server has a communication relationship with the first dedicated server;
[0023] The release module is used to release the resources of the first dedicated server when the heartbeat monitoring status of the business management server is abnormal.
[0024] Another aspect of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the above-mentioned methods when executing the computer program.
[0025] Another aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the above-mentioned methods are implemented.
[0026] Another aspect of the present application provides a computer program product, including a computer program, which implements the above-mentioned methods when executed by a processor.
[0027] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0028] In an embodiment of the present application, a method for resource optimization is provided, which is applied to a resource optimization system, and the resource optimization system includes a business logic server, a business management server and a first dedicated server, and the method includes: first, the system receives an address query instruction sent by a client to instruct the business logic server to query the address information of the first dedicated server, and the system queries the target address according to the instruction and sends it to the client, so that the client is connected to the first dedicated server. When the connection fails, the system obtains the heartbeat monitoring status of the business management server that has a communication relationship with the first dedicated server, and once an abnormality is detected, the resources of the first dedicated server are released. The method provided in the embodiment of the present application, on the one hand, avoids idle resources caused by poor connection through an orderly address query and connection process, realizes efficient resource allocation, allows services such as online games to run stably and efficiently, and reduces user loss caused by server problems; on the other hand, in the face of connection failures, the rapid response mechanism based on heartbeat monitoring can timely release the resources of the first dedicated server that may fall into an abnormality, avoid its continuous occupation of a large amount of hardware resources such as CPU, memory, disk I / O and network bandwidth, resolve the risk of network congestion, and effectively solve the problem of excessive and unstable DS resource consumption under long-term operation, and ensure the sustainability of the business. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 An interface diagram of an application scenario of the resource optimization method provided in an embodiment of the present application;
[0030] Figure 2 An architectural diagram of an application scenario of the resource optimization method provided in an embodiment of the present application;
[0031] Figure 3 An architectural diagram of another application scenario of a resource optimization method is provided for an embodiment of the present application;
[0032] Figure 4 A flowchart of a resource optimization method provided in an embodiment of the present application;
[0033] Figure 5 A schematic diagram of a resource optimization system provided in an embodiment of the present application;
[0034] Figure 6 A schematic diagram of the heartbeat keep-alive of a dedicated server and a service management server provided in an embodiment of the present application;
[0035] Figure 7 A timing diagram of the resource optimization method provided in an embodiment of the present application;
[0036] Figure 8 A timing diagram of another resource optimization method provided in an embodiment of the present application;
[0037] Fig. 9 A structural diagram of a resource optimization system provided in an embodiment of the present application;
[0038] Fig.10 A structural diagram of a resource optimization device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0039] The embodiment of the present application provides a method for resource optimization to achieve efficient allocation of resources, so that the business can run stably and efficiently, and reduce user loss caused by server problems. In addition, the rapid response mechanism based on heartbeat monitoring can promptly release the first dedicated server resources that may fall into an abnormality, effectively solving the problem of excessive DS resource consumption and instability under long-term operation, and ensuring the sustainability of the business.
[0040] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0041] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0042] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0043] Before introducing the specific method of the present application, the application scenario of the resource optimization method in the present application is first exemplified. Of course, it should be known that the following application scenario is only an example and is not limited to this.
[0044] In a possible implementation, the method provided in the embodiment of the present application is applied to a game scenario, see Figure 1 , Figure 1 (A) shows the game interface after the client is connected to the dedicated server; Figure 1 (B) in the figure shows the game interface after the client is disconnected from the dedicated server.
[0045] In some games, multiple servers are required to provide services to support the operation of the game, including: game business logic server (Gamesvr), business management server (StarPSvr) and dedicated server (DS); among them,
[0046] Game business logic server (Gamesvr): On the one hand, it is like the "brain" of the game, responsible for controlling the progress of the entire game. For example, in a role-playing game, when the player reaches a certain level, Gamesvr will unlock the corresponding new plot, open new maps or grant new skills according to the preset rules, and guide the player to gradually go deeper into the game world. In addition, Gamesvr is fully responsible for the operation of the task system and achievement system in the game. For tasks, it will record the player's acceptance of tasks in detail and obtain the progress of task completion in real time. On the other hand, Gamesvr strictly controls various behaviors between players in the game to maintain the fairness and normal operation of the economic system in the game, avoid data anomalies or unfairness, and ensure the stability of the game environment.
[0047] Game business management server (StarPSvr): mainly responsible for coordinating the connection between various servers. When the game is running, ensure that the business logic server, dedicated server and other related servers can communicate and exchange data smoothly to ensure the stable operation of the entire game service system. For example, when a player enters a specific game world from the game lobby, StarPSvr coordinates all parties so that the player can smoothly access the corresponding server environment to play the game. In addition, it is also responsible for management functions related to the game world, such as players can use it to pull a list of different game worlds and choose the appropriate world to enter according to their needs. At the same time, it also has the ability to create a world to meet the needs of players to create exclusive game worlds under specific conditions. In addition, when players enter and exit the game world, do a good job of data interaction, resource cleaning and other management work to maintain the normal operation order of the game world.
[0048] Dedicated Server (DS): Responsible for executing the core logic rules of the game, ensuring that the game runs in an orderly manner according to the established rules. It provides long-term and stable operation guarantee for the game, has strong hardware resource support capabilities, uses its own CPU computing power to quickly process complex game logic operations, relies on sufficient memory to temporarily store a large amount of real-time game data, and relies on a stable network module to ensure fast and accurate data transmission, meeting the needs of players to log in to the game at any time and play smoothly. Even when a large number of players are online at the same time and operate frequently, it can maintain stability to prevent problems such as freezing and interruptions that affect the experience of the game. It stores the key data of players in the game, including the basic attributes of the characters, such as level, health, magic points, etc., as well as the equipment information and skill mastery of the players, and will continuously update and save these data as the players operate in the game, ensuring that each time the player logs in to the game, it can be restored to the state when they last exited. At the same time, it is also responsible for managing the basic data of the game world itself, such as map layout, resource distribution, monster refresh points, etc., to ensure the normal operation and sustainable development of the game world, and provide a solid data foundation for the long-term operation of the game.
[0049] See also Figure 2 , Figure 2 The architecture diagram of the resource optimization method provided in the embodiment of the present application is shown in FIG.
[0050] The terminal 201 includes a human-computer interaction screen, a processor and a memory. The human-computer interaction screen is used to display the game client interface. The human-computer interaction screen is also used to provide a human-computer interaction interface to receive the user's human-computer interaction operation during the game.
[0051] The terminal 201 includes but is not limited to mobile phones, tablet computers, laptop computers, desktop computers, intelligent voice interaction devices, virtual reality devices, smart home appliances, vehicle-mounted terminals, aircraft, etc.
[0052] The client 202 is run in the terminal 201. The client 202 takes a game client as an example, and the client 202 is deployed on the terminal 201. The client 202 can be run on the terminal 201 in the form of a browser, or in the form of an independent application (APP) or a small program.
[0053] The network 203 uses standard communication technologies and / or protocols, typically the Internet, but may be any network, including but not limited to Bluetooth, local area network (LAN), metropolitan area network (MAN), wide area network (WAN), mobile, dedicated network, or any combination of virtual private networks). In some embodiments, customized or dedicated data communication technologies may be used to replace or supplement the above data communication technologies.
[0054] The server 204 includes a processor, which is used to perform storage or read operations on the database 204. The server 204 involved in this application can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks (content delivery networks, CDN), and big data and artificial intelligence (artificial intelligence, AI) platforms. The server 204 includes a module for running a game business logic server, a module for running a game business management server, and a module for running a first dedicated server. A resource optimization system is run in the server 204, and the resource optimization system includes a game business logic server, a game business management server, and a first dedicated server.
[0055] The database 205 is used to store game information.
[0056] Specifically, after the user opens the game through the client 202, the client 202 needs to request to connect to the dedicated server:
[0057] As shown in step S211 , when the client cannot connect to the dedicated server through the address of the dedicated server stored locally, the client sends an address query instruction to the server 204 .
[0058] As in step S212, the resource optimization system in the server 204 receives the address query instruction sent by the client 202, wherein the address query instruction is used to instruct the game business logic server to query the address information of the first dedicated server, the game business logic server provides a logic driver for the target game business, and the first dedicated server is used to provide a running environment for the target game business;
[0059] In step S213, the resource optimization system in the server 204 obtains the target address of the first dedicated server according to the address query instruction;
[0060] In step S214, the resource optimization system in the server 204 sends the target address of the first dedicated server to the client, so that the client connects to the first dedicated server according to the target address;
[0061] In step S215, when the connection fails, the resource optimization system in the server 204 obtains the heartbeat monitoring status of the game business management server, wherein the game business management server has a communication relationship with the first dedicated server;
[0062] As in step S216, when the heartbeat monitoring status of the game business management server is abnormal, the resource optimization system in the server 204 releases the resources of the first dedicated server.
[0063] See also Figure 3 , Figure 3 Another architecture diagram of the resource optimization method provided in the embodiment of the present application applied to a game scene is shown. In one implementation, the scene includes a terminal 301, a client 302, a network 303, a network connection management server (Tconnd) 304, a game business logic server (Gamesvr) 305, a game business management server (StarPSvr) 306 and a dedicated server (DS) 307.
[0064] After the user opens the game through the client 302, the client 301 needs to request to connect to the dedicated server 307.
[0065] As shown in step S311, the client 302 obtains the address information of the dedicated server 307 from the local cache, and initiates a connection with the dedicated server 307 through the address information in the local cache. In the event of a connection failure, the client 301 sends an address query instruction to the network connection management server 304.
[0066] In step S312 , the network connection management server 304 sends the address query instruction to the game business logic server 305 .
[0067] When a player enters a game copy, the address information of the dedicated server 305 is stored in the game business logic server 305.
[0068] In step S313 , the game business logic server 305 sends the address information of the dedicated server 305 to the client 302 .
[0069] When the player enters the main mission of the game, the address information of the dedicated server 305 is stored in the game business management server 306.
[0070] In step S314 , the game business management server 306 sends the target address of the dedicated server 305 to the client 302 .
[0071] As shown in step S315, the client 302 connects to the dedicated server 305 via the target address.
[0072] As shown in step S316, in the case of connection failure, the dedicated server 307 and the game service management server 306 monitor each other's heartbeat status.
[0073] As in step S317, when the heartbeat status of the game business management server 306 is abnormal, the resources of the dedicated server 307 are released.
[0074] When the method provided in the embodiment of the present application is applied in a gaming scenario, on the one hand, efficient allocation of resources is achieved through address query and connection processes, allowing the client to quickly access services, reducing waiting time and improving operating efficiency; on the other hand, when facing connection failures, heartbeat monitoring is used to promptly handle exceptions to prevent the problem from spreading, thereby enhancing the stability and reliability of the system in a complex network environment, creating a smooth experience for users, and facilitating subsequent system maintenance and reducing maintenance costs.
[0075] See also Figure 4 , Figure 4 A flow chart of a resource optimization method is shown. The method is applied to a resource optimization system. The resource optimization system includes a business logic server, a business management server, and a first dedicated server. The method includes:
[0076] S410: Receive an address query instruction sent by a client.
[0077] The address query instruction is used to instruct the business logic server to query the address information of the first dedicated server. The business logic server provides a logic driver for the target business, and the first dedicated server is used to provide a running environment for the target business.
[0078] It is understandable that when the player starts the game client, the client will first try to connect to the first dedicated server (DS) using the locally cached DS address. If the connection fails, the client will send an address query instruction to the resource optimization system. This address query instruction is used to instruct the business logic server (Gamesvr) to query the address information of the first dedicated server (DS). The business logic server (Gamesvr) provides a logical driver for the target business of the game, while the first dedicated server (DS) is responsible for providing a specific operating environment for the game, such as storing and updating game maps, character status and other related data in real time to ensure the player's gaming experience.
[0079] S420. Obtain a target address of the first dedicated server according to the address query instruction.
[0080] It is understandable that after receiving the address query instruction, the resource optimization system will give priority to calling the business logic server (Gamesvr). If the player is in a specific game copy, etc., the game business logic server (Gamesvr) stores the address information of the first dedicated server (DS), then the system can directly query the target address of the first dedicated server (DS) from the business logic server (Gamesvr). For example, when the player enters a specific copy, the business logic server (Gamesvr) knows which specific first dedicated server (DS) the player should connect to based on the game process and copy settings, and can accurately provide the address of the server.
[0081] If the target address of the first dedicated server (DS) is not found in the business logic server (Gamesvr), the system will continue to call the business management server (StarPSvr). The business management server (StarPSvr) has related functions such as player world management. It will query the target address of the first dedicated server (DS) from the information stored in itself according to the address query instruction. For example, when the player is performing the main task of the game, the address information of the first dedicated server (DS) may be stored in the business management server (StarPSvr), and the business management server (StarPSvr) can provide the corresponding target address.
[0082] S430: Send the target address of the first dedicated server to the client, so that the client connects to the first dedicated server according to the target address.
[0083] It is understandable that the system sends the target address of the first dedicated server (DS) obtained by the query to the client. After receiving the target address, the client tries to connect to the first dedicated server (DS) again based on the address. This process is intended to ensure that the client can accurately and quickly connect to the first dedicated server (DS) that provides the operating environment for the game, so that the player can enter the game smoothly.
[0084] S440. In case of connection failure, obtain the heartbeat monitoring status of the service management server.
[0085] Among them, the business management server has a communication relationship with the first dedicated server.
[0086] It is understandable that if the connection between the client and the first dedicated server (DS) still fails, the system will start the troubleshooting mechanism at this time. Since the business management server (StarPSvr) has a communication relationship with the first dedicated server (DS), the system will obtain the heartbeat monitoring state of the business management server (StarPSvr).
[0087] In the game system, a heartbeat keep-alive mechanism is adopted between the business management server (StarPSvr) and the first dedicated server (DS). For example, the two parties agree to send heartbeat signals to each other at fixed intervals (such as 10s) to confirm the operating status of the other party. If the heartbeat monitoring state of the business management server (StarPSvr) is abnormal within a plurality of continuous heartbeat cycles, such as within the set N heartbeat cycles, the first dedicated server (DS) does not receive the heartbeat signal of the business management server (StarPSvr), or the business management server (StarPSvr) does not receive the heartbeat signal of the first dedicated server (DS) (based on the monitoring direction set by the actual system), it indicates that there may be a server failure or a network problem.
[0088] S450: When the heartbeat monitoring status of the service management server is abnormal, the resources of the first dedicated server are released.
[0089] It is understandable that once it is determined that the heartbeat monitoring state of the business management server (StarPSvr) is abnormal, the system will execute the operation of releasing the resources of the first dedicated server (DS). Based on the communication relationship between the business management server (StarPSvr) and the first dedicated server (DS), the first dedicated server (DS) will send a shutdown request instruction to the business management server (StarPSvr), and the shutdown request instruction is used to indicate to stop the service of the first dedicated server (DS). After receiving the shutdown request instruction, the business management server (StarPSvr) will perform relevant checks to confirm whether the first dedicated server (DS) meets the shutdown conditions. If it meets the conditions, the business management server (StarPSvr) will coordinate to store the data in the first dedicated server (DS) to a pre-set standby storage location (such as the second dedicated server, etc.), then stop the service of the first dedicated server (DS), and clear the data of the first dedicated server (DS), so as to realize the reasonable recovery and management of resources, avoid the continuous invalid occupation of resources, and ensure the stable operation of the game system and the efficient use of resources.
[0090] For easier understanding, see Figure 5 , Figure 5 The schematic diagram of the resource optimization system provided by the embodiment of the present application is shown. The architecture of the resource optimization method includes a client (Cilent) 510 and a server 520, and the server 520 includes a network connection management server (Tconnd) 521, a game business logic server (Gamesvr) 522, a game business management server (StarPSvr) 523, a game account management server (StarPaccountsvr) 524 and a dedicated server (DS) 525.
[0091] Specific:
[0092] The client (Cilent) 510 is the interface for players to interact with the game system. It is responsible for sending player operation requests to the server and receiving data fed back by the server to present the game screen and status. Its functions include: 1. Storing DS addresses: The DS addresses will be cached locally. When reconnecting, the locally cached DS addresses will be tried first to connect. 2. Initiating connection requests: When the locally cached DS address connection fails, a request is sent to the network connection management server (Tconnd) via the TCP protocol to obtain the latest DS address. 3. Processing connection results: Reconnect according to the latest DS address obtained from the server. If multiple reconnections fail, the corresponding processing is carried out according to the rules.
[0093] The network connection management server (Tconnd) 521 is responsible for managing the network connection between the client and the game server, coordinating connection requests and data transmission. Its functions include: 1. Receiving client requests: receiving requests from the client for the latest DS address. 2. Forwarding requests: forwarding the client's request to the game business logic server (Gamesvr) or the game business management server (StarPSvr) to obtain the latest DS address.
[0094] The game business logic server (Gamesvr) 522 processes the business logic in the game, such as the logic related to the core gameplay such as the battle, task, and prop usage in the game. Its functions include: 1. Processing DS address query: receiving the request from Tconnd and checking whether the latest DS address corresponding to the client can be obtained. 2. Address feedback: if the DS address of the client can be obtained, it will be returned to Tconnd and then passed to the client.
[0095] The game business management server (StarPSvr) 523 manages the game world and various business operations of players in the game, and is the core management unit for the operation of the game. Its functions include: 1. DS address management: When Gamesvr cannot obtain the DS address of the client, StarPSvr is responsible for providing the latest DS address. 2. Heartbeat keep-alive: There is a heartbeat keep-alive mechanism between the dedicated server (DS) to detect the operating status of the DS and ensure the stability and availability of the server. 3. Data migration management: When it comes to DS resource recovery or migration, it is responsible for coordinating related operations, such as starting a new DS and migrating data.
[0096] The game account management server (StarPaccountsvr) 524 is responsible for managing the game account information of the players, including account registration, login, character selection and other account-related operations. Its functions include: 1. Account management: processing player account creation, login verification and other operations. 2. Player status management: managing the player's account status and related data when it involves players switching between different DSs (such as returning from the DS corresponding to the copy to the DS corresponding to the main line of the game).
[0097] The dedicated server (DS) 525 is responsible for processing the game operations and data storage of a specific group of players, and provides corresponding game services according to different game scenes (such as the main game DS and the game copy DS). Its functions include: 1. Game service provision: providing game scene-related services to players connected to the server, such as game world rendering, player operation processing, etc. 2. Data storage: storing game data of players connected to the server, such as character status, game progress, etc. 3. Responding to heartbeats: responding to StarPSvr's heartbeat detection to indicate its own operating status. At the same time, in specific circumstances (such as heartbeat timeout, etc.), perform resource recovery or self-destruction operations to optimize resource utilization.
[0098] The following is a description of the process of the resource optimization method provided in the embodiment of the present application:
[0099] As shown in step S511, the client (Cilent) 510 first attempts to obtain the address of the stored dedicated server (DS) 525 from the local cache for reconnection. If the reconnection fails, the client will connect to the network connection management server (Tconnd) 521 through the TCP protocol and request to obtain the latest address of the dedicated server (DS).
[0100] As shown in step S512, the client sends BattleGetOngoingDsAddr to the game business logic server (Gamesvr) 522 through the network connection management server (Tconnd) 521 to request the address of the latest dedicated server (DS). If the game business logic server (Gamesvr) 522 can find the address of the dedicated server (DS) where the player is located, the client can directly use the address to connect.
[0101] When a player enters a game copy, the address information of the dedicated server (DS) 525 is stored in the game business logic server (Gamesvr) 522.
[0102] As shown in step S513, if the game business logic server (Gamesvr) 522 does not find the relevant address, it continues to request the latest dedicated server (DS) address from the game business management server (StarPSvr) 523.
[0103] As shown in step S514, if the game business logic server (Gamesvr) finds the latest dedicated server (DS) address, it returns the BattleGetOngoingDsAddr protocol request to the client; if not found, the game business management server (StarPSvr) returns the latest dedicated server (DS) address to the client.
[0104] As shown in step S515, the client uses the latest dedicated server (DS) address to try to reconnect again. If the reconnection fails multiple times (more than n times): if the player is in the main task of the game, it will return to the game lobby; if the player is in the game copy, it will return to the dedicated server (DS) corresponding to the main task of the game. The whole process mainly revolves around how the client obtains and connects to the appropriate dedicated server (DS) address to ensure that the player can smoothly enter the game or switch between different servers.
[0105] As shown in step S516, the game service management server (StarPSvr) and DS maintain an active connection through a heartbeat mechanism.
[0106] The method provided in the embodiment of the present application can effectively solve problems such as resource waste and system instability caused by server connection problems and failures in actual game scenarios, and achieve efficient allocation of resources and reliable operation of the system.
[0107] In an optional embodiment of the resource optimization method provided in the above embodiment of the present application, obtaining the target address of the first dedicated server according to the address query instruction includes:
[0108] The business logic server is called, and according to the address query instruction, the target address of the first dedicated server is obtained from the business logic server.
[0109] It is understandable that after the player starts the game client, the client will first try to establish a connection with the DS using the locally cached address of the first dedicated server (DS). If the connection fails, the client will send an address query instruction to the resource optimization system. The purpose of this instruction is to instruct the business logic server (Gamesvr) to query the address information of the first dedicated server (DS). The business logic server (Gamesvr) plays a key logic-driven role in the entire game operation process, providing logical support for the game as a target business; while the first dedicated server (DS) is responsible for creating the actual operating environment for the game, such as carrying game map data, managing player character status, and processing various interactive logics in the game.
[0110] After receiving the address query instruction sent by the client, the resource optimization system will call the business logic server (Gamesvr) according to the established process. In the actual operation scenario of the game, there are many situations that enable the business logic server (Gamesvr) to store the address information of the first dedicated server (DS).
[0111] For example, when a player enters a certain specific game copy, the business logic server (Gamesvr) will know the first dedicated server (DS) corresponding to the copy according to the pre-set rules and logic of the game. When receiving the address query instruction, the business logic server (Gamesvr) will search and match the data stored in it according to the relevant information in the instruction (such as the player's current game process, location, etc.). If the player is in the process of a specific copy, the business logic server (Gamesvr) will accurately identify the corresponding first dedicated server (DS) and extract the target address of the server from its stored address information library.
[0112] In this process, the business logic server (Gamesvr) is like an intelligent dispatch center, which clearly understands the corresponding relationship between each part of the game and the first dedicated server (DS). It can quickly determine which specific first dedicated server (DS) the player should connect to based on the player's real-time game status, and prepare the target address of the server, waiting for the next operation.
[0113] After the business logic server (Gamesvr) successfully queries the target address of the first dedicated server (DS), it will return the address to the resource optimization system. After receiving the address information, the resource optimization system will further send the target address of the first dedicated server (DS) to the client. After receiving the target address, the client will immediately try to connect to the first dedicated server (DS) again based on this address, hoping to successfully establish a connection so that the player can smoothly enter the game scene and continue the game experience.
[0114] In the whole process, the business logic server (Gamesvr) is called to query the target address of the first dedicated server (DS), making full use of the business logic server (Gamesvr)'s in-depth understanding of the game logic and its ability to control the game process. This method can quickly and accurately provide the client with the required server address in the game scene, ensuring the continuity and stability of the game service, and also conforming to the original design of the resource optimization system to allocate resources efficiently and orderly.
[0115] The method provided by the embodiment of the present application, when the system calls the business logic server to query the target address of the first dedicated server according to the address query instruction, can use the business logic server's deep understanding and control of the game logic and process. For example, in the game scene, the business logic server knows the corresponding relationship between each copy, task, etc. and the dedicated server, can quickly locate and provide the target address, avoids the complex search process, significantly improves the efficiency of address query, allows the client to obtain the required server address faster, reduces the player's waiting time, and improves the game experience. This query method is based on the business logic server's familiarity with the overall logic of the game, and its query results are more accurate. Directly calling the business logic server to query the address can give full play to its core role in the resource optimization system and avoid unnecessary resource consumption. Compared with repeatedly searching for addresses between multiple servers, this method reduces the waste of system resources in the address query link, allowing the system to use more resources for the key parts of the game operation, such as processing player interactions, rendering game screens, etc., realizing the reasonable allocation and efficient use of resources, and improving the system performance as a whole.
[0116] In an optional embodiment of the resource optimization method provided in the above embodiment of the present application, obtaining the target address of the first dedicated server according to the address query instruction includes:
[0117] In the case that the target address of the dedicated server is not obtained from the service logic server, the service management server is called, and the target address of the first dedicated server is obtained from the service management server according to the address query instruction.
[0118] It is understandable that after the player starts the game client, the client will first try to connect to the DS using the locally cached address of the first dedicated server (DS). If the connection operation fails, the client will send an address query instruction to the resource optimization system. The instruction clearly instructs the business logic server (Gamesvr) to query the address information of the first dedicated server (DS). The business logic server (Gamesvr) bears the key responsibility of providing logic drive for the target business of the game. It controls the game process, task system, and interaction logic between players; while the first dedicated server (DS) is the actual environment carrier for the game, responsible for carrying various real-time data in the game, such as player character information, game scene status, etc.
[0119] After receiving the address query instruction, the resource optimization system first calls the business logic server (Gamesvr) to perform an address query according to the normal process. However, in some specific game scenarios, the business logic server (Gamesvr) may not be able to query the target address of the first dedicated server (DS). For example, when the player participates in the main task of the game and the server allocation logic involved in the task is more complex, the business logic server (Gamesvr) does not directly store the corresponding first dedicated server (DS) address. At this time, the system will determine that the query of the business logic server (Gamesvr) has failed, and then start the backup query path.
[0120] After the system determines that the query of the business logic server (Gamesvr) is fruitless, it will call the business management server (StarPSvr). The business management server (StarPSvr) is responsible for coordinating the connection between various servers and managing the game world in the game system. It has comprehensive information about the game world, the player activity area, and the corresponding first dedicated server (DS).
[0121] After receiving the address query instruction, the service management server (StarPSvr) will accurately search the data stored in itself based on the key information contained in the instruction, such as the player's current game status, location, task progress, etc. For example, when the player is at a certain stage of the main task of the game, the service management server (StarPSvr) will locate the first dedicated server (DS) that the player should connect to at this stage according to the pre-set rules and data storage structure, and obtain its target address.
[0122] After the system determines that the query of the business logic server (Gamesvr) is fruitless, it will call the business management server (StarPSvr). The business management server (StarPSvr) is responsible for coordinating the connection between various servers and managing the game world in the game system. It has comprehensive information about the game world, the player activity area, and the corresponding first dedicated server (DS).
[0123] After receiving the address query instruction, the service management server (StarPSvr) will accurately search the data stored in itself based on the key information contained in the instruction, such as the player's current game status, location, task progress, etc. For example, when the player is at a certain stage of the main task of the game, the service management server (StarPSvr) will locate the first dedicated server (DS) that the player should connect to at this stage according to the pre-set rules and data storage structure, and obtain its target address.
[0124] After the service management server (StarPSvr) successfully queries the target address of the first dedicated server (DS), it will feed the address back to the resource optimization system. After receiving the target address, the resource optimization system quickly sends it to the client. After obtaining this target address, the client immediately tries to establish a connection with the first dedicated server (DS) again based on the address, hoping to successfully connect and allow players to enter the game world normally for game activities.
[0125] During the entire process, when the business logic server (Gamesvr) is unable to complete the address query task, it calls the business management server (StarPSvr) to query the target address of the first dedicated server (DS), thereby achieving coordination and cooperation between different servers in the resource optimization system. This mechanism ensures that even in complex and changing game scenarios, the client can still obtain the accurate address of the first dedicated server (DS), thereby effectively ensuring the continuity and stability of the game service. It makes full use of the advantages of the business management server (StarPSvr) in server management and game world information integration, provides a reliable backup path for the connection between the client and the first dedicated server (DS), and improves the ability of the entire system to cope with complex
[0126] The method provided in the embodiment of the present application switches to the business management server for query when the query of the business logic server fails. This fast and effective backup query strategy can reduce connection problems caused by address query failure. The client can obtain the target address in time and try to establish a connection with the first dedicated server, thereby avoiding the bad experience brought to users by the inability to obtain the address or the connection failure for a long time, and reducing the risk of user loss. At the same time, it also ensures the stable operation of the entire game or related business system, so that the system can still maintain a good service status when facing complex and changeable business scenarios.
[0127] In an optional embodiment of the resource optimization method provided in the above embodiment of the present application, the resource optimization system further includes a second dedicated server, and the method further includes:
[0128] In case of connection failure, obtaining the heartbeat monitoring status of the first dedicated server;
[0129] If the heartbeat monitoring state of the first dedicated server is abnormal, the data in the first dedicated server is stored in the second dedicated server, the service of the first dedicated server is stopped, and the data of the first dedicated server is cleared.
[0130] It is understandable that when a connection failure occurs, the heartbeat monitoring status of the first dedicated server (DS) is checked to determine whether the first dedicated server is abnormal. If an abnormality occurs, a series of measures are taken to ensure data security and optimize resources, including migrating data to the second dedicated server, stopping the first dedicated server service and clearing its data.
[0131] Heartbeat monitoring is a common server health check mechanism. By monitoring the heartbeat of the first dedicated server, it is possible to promptly detect whether the server is in normal operation. For example, in a game scenario, the server may have an abnormal heartbeat due to hardware failure, network problems, or software errors. In the event of a connection failure, the acquisition of the heartbeat monitoring status of the first dedicated server is triggered. This trigger mechanism can perform targeted checks when server problems may occur, avoiding unnecessary monitoring overhead.
[0132] When the heartbeat monitoring status of the first dedicated server is abnormal, the data therein is stored in the second dedicated server to ensure the security and availability of the data. For example, in the game server scenario, if the player's game data (character level, equipment, game progress, etc.) is lost, it will greatly affect the player experience. Through data migration, it can be ensured that these data will not be lost when the first dedicated server fails. This process may involve establishing a data transmission channel between the first dedicated server and the second dedicated server, packaging and encrypting (if necessary) the data in the first dedicated server, and then transmitting the data to the second dedicated server through a stable network connection, and storing it on the second dedicated server according to certain data structures and rules.
[0133] Once it is determined that the heartbeat of the first dedicated server is abnormal and the data has been successfully migrated, stopping its service can prevent further erroneous operations or data corruption. For example, if the server continues to run in an abnormal state, it may cause errors in the data being processed or cause waste of system resources (such as CPU, memory usage, etc.). Stopping the service may include terminating the game process, network communication process and other related operations running on the first dedicated server to ensure that the server no longer receives and processes new requests.
[0134] The purpose of clearing data is to completely release the resources of the first dedicated server. When an abnormality occurs in the server and the data has been migrated, the data stored in it is no longer necessary to retain it. Clearing data can restore the server to its initial state, which is convenient for subsequent reconfiguration or other purposes. This step may involve deleting game data files, temporary cache files and other related data storage content in the first dedicated server.
[0135] The method provided in the embodiment of the present application protects important data resources through timely data migration and avoids data loss caused by server failure. It stops and clears the data of the abnormal server, releases server resources, improves the resource utilization of the entire system, and avoids wasting resources on the faulty server. It can handle the abnormal server in time to prevent the faulty server from causing further interference to the operation of the entire system, thereby ensuring the stability and reliability of the system.
[0136] In an optional embodiment of the resource optimization method provided in the above embodiment of the present application, obtaining the heartbeat monitoring status of the first dedicated server includes:
[0137] Based on the communication relationship between the service management server and the first dedicated server, calling the service management server to monitor the heartbeat status of the first dedicated server in N cycles;
[0138] The heartbeat monitoring status of the first dedicated server is abnormal, including:
[0139] Within N cycles, the service management server does not monitor the heartbeat status of the first dedicated server.
[0140] It is understandable that the player attempts to establish a connection with the first dedicated server (DS) through the game client. When the client fails to connect to the first dedicated server (DS) multiple times based on the target address obtained from the business logic server (Gamesvr) or the business management server (StarPSvr), the system will determine that the connection has failed, and then trigger a series of subsequent operations to ensure the stable operation of the system and the rational use of resources.
[0141] Based on the communication relationship between the business management server (StarPSvr) and the first dedicated server (DS), the system calls the business management server (StarPSvr) to perform heartbeat monitoring on the first dedicated server (DS). In actual applications, the business management server (StarPSvr) and the first dedicated server (DS) will send heartbeat signals to each other at a pre-set time interval (such as 10s / time). The business management server (StarPSvr) will record whether the heartbeat signal sent by the first dedicated server (DS) is received within N cycles. For example, assuming that N is 5, the business management server (StarPSvr) will continue to monitor within 5 consecutive heartbeat cycles. If the business management server (StarPSvr) does not receive the heartbeat signal of the first dedicated server (DS) within these 5 cycles, it will be determined that the heartbeat monitoring status of the first dedicated server (DS) is abnormal.
[0142] When it is determined that the heartbeat monitoring status of the first dedicated server (DS) is abnormal, the system will start a series of operations such as data storage, service suspension, and data clearing:
[0143] The system calls the first dedicated server (DS) to extract the business data corresponding to all clients currently connected to the server. This data covers the key information of the players in the game, such as character level, equipment status, task progress, game scene coordinates, etc. Taking role-playing games as an example, all kinds of activities performed by players in the game will be recorded as corresponding business data. After the system organizes and packages this data, it transmits and stores it to the second dedicated server to ensure that the data will not be lost after the first dedicated server (DS) stops running, providing support for possible subsequent data recovery or business continuation.
[0144] In order to ensure the smooth progress of data migration and server outage, the system will force all clients currently connected to the first dedicated server (DS) to go offline. In actual operation, the system will send an offline notification to the client, informing the player that due to an abnormal situation on the server, it needs to be temporarily disconnected. Then, the system will actively cut off the connection with the client to ensure that all clients are disconnected from the first dedicated server (DS).
[0145] After all clients are offline, the system will stop all processes of the first dedicated server (DS). This includes the core logic processing process of the game, the data storage and reading process, the network communication process, etc. By stopping these processes, the first dedicated server (DS) will no longer occupy the system's computing resources, memory resources, and network bandwidth, etc., thus releasing resources.
[0146] In order to completely recycle resources and avoid possible interference caused by residual data, the system will clean up the data storage area of the first dedicated server (DS). All previously stored player business data, game world status data, etc. will be deleted, and the first dedicated server (DS) will be restored to its initial state for subsequent reconfiguration and use.
[0147] The method provided in the embodiment of the present application can effectively deal with abnormal situations occurring in the first dedicated server (DS), achieve proper preservation of data, reasonable recovery of server resources and stable operation of the system, and provide a strong guarantee for the normal operation of the entire resource optimization system.
[0148] In an optional embodiment of the resource optimization method provided in the above embodiment of the present application, obtaining the heartbeat monitoring status of the first dedicated server includes:
[0149] Based on the communication relationship between the service management server and the first dedicated server, calling the first dedicated server to monitor the heartbeat status of the service management server in N-1 cycles;
[0150] The heartbeat monitoring status of the service management server is abnormal, including:
[0151] Within N-1 cycles, the first dedicated server does not monitor the heartbeat status of the service management server.
[0152] It is understandable that during the game operation, when the client fails to connect to the first dedicated server (DS), the system begins to pay attention to the heartbeat monitoring status between the servers to determine whether the servers are running healthily. At this time, based on the communication relationship established between the business management server (StarPSvr) and the first dedicated server (DS), the system will start a specific process to obtain the heartbeat monitoring status of the first dedicated server (DS) to the business management server (StarPSvr).
[0153] The system will call the first dedicated server (DS) to perform heartbeat monitoring on the business management server (StarPSvr) according to the preset rules. The monitoring period set here is N-1 cycles, and the duration of each cycle is clearly defined in the system. For example, in the game scenario, it may be related to the regular heartbeat detection frequency between servers. Assuming that the regular heartbeat detection frequency is 10s / time, then each cycle is 10s (in actual application, the cycle duration is determined according to the system design).
[0154] The first dedicated server (DS) begins to continuously monitor the heartbeat signal sent by the service management server (StarPSvr) in these N-1 cycles. It can open a special monitoring thread or utilize an existing communication monitoring module to wait and detect whether to receive the heartbeat signal from the service management server (StarPSvr) in each cycle.
[0155] In each cycle, if the first dedicated server (DS) receives the heartbeat signal of the service management server (StarPSvr), it will record the receiving time, signal strength and other related information (if the system design requires recording these additional information). These records are helpful for the subsequent comprehensive judgment of the heartbeat status of the service management server (StarPSvr).
[0156] If the heartbeat signal is not received within a certain period, the first dedicated server (DS) will also accurately record the situation that the signal is not received within the period.
[0157] When all N-1 cycles of monitoring are completed, the first dedicated server (DS) will determine whether the heartbeat monitoring status of the service management server (StarPSvr) is abnormal based on the recorded information. The specific judgment condition is: if the first dedicated server (DS) does not monitor the heartbeat status of the service management server (StarPSvr) within these N-1 cycles, that is, it does not receive any valid heartbeat signal, then it is determined that the heartbeat monitoring status of the service management server (StarPSvr) is abnormal.
[0158] Assume that N-1=4 (ie, 4 monitoring cycles are set), each cycle is 10 seconds. Within the 40 seconds monitoring time, if the first dedicated server (DS) does not receive the heartbeat signal of the service management server (StarPSvr), then the abnormality judgment condition is met.
[0159] Once the heartbeat monitoring status of the business management server (StarPSvr) is determined to be abnormal, the result will be fed back to the system. The system will trigger a series of related operations based on pre-set strategies, such as further checking other system states, or starting resource recovery and server adjustment processes to ensure the stability and reliability of the entire game system.
[0160] For easier understanding, see Figure 6 , Figure 6 The schematic diagram of DS resource optimization mechanism is shown. The business management server (StarPSvr) and the dedicated server (DS) perform heartbeat keep-alive. Specifically, the business management server (StarPSvr) receives the heartbeat signal of the dedicated server (DS). If the business management server (StarPSvr) does not receive the heartbeat signal of the dedicated server (DS) in N cycles (i.e., the dedicated server (DS) loses connection in N cycles), the business management server (StarPSvr) pulls up a new dedicated server (DS) and performs data migration. Similarly, the dedicated server (DS) receives the heartbeat signal of the business management server (StarPSvr). If the dedicated server (DS) does not receive the heartbeat signal of the business management server (StarPSvr) in N-1 cycles (i.e., the business management server (StarPSvr) loses connection in N-1 cycles), the data of the dedicated server (DS) are all archived, and then the network connection between the first dedicated server (DS) and these clients is actively cut off to ensure that all clients can be disconnected from the server in time to avoid data transmission interruption or conflict during the server shutdown process.
[0161] In an optional embodiment of the resource optimization method provided in the above embodiment of the present application, storing data in the first dedicated server to the second dedicated server includes:
[0162] Calling the first dedicated server to obtain service data corresponding to all clients currently connected to the first dedicated server;
[0163] Stop the services of the first dedicated server, including:
[0164] Force all clients currently connected to the first dedicated server connection to log off;
[0165] Stop all processes of the first dedicated server.
[0166] It is understandable that during the game operation, a specific communication relationship is established between the business management server (StarPSvr) and the first dedicated server (DS). Based on this communication relationship, the system will start the monitoring process of the heartbeat status of the first dedicated server (DS). Specifically, the business management server (StarPSvr) and the first dedicated server (DS) will interact with each other's heartbeat signals at fixed time intervals according to pre-set rules, such as maintaining a heartbeat detection frequency of 10s / time, so as to keep the connection between the two parties alive and monitor the running status of the other party in real time.
[0167] When the heartbeat monitoring status of the first dedicated server (DS) needs to be obtained, the system will call the business management server (StarPSvr) to perform the monitoring task. The business management server (StarPSvr) will strictly follow the set time interval and continuously monitor the heartbeat status of the first dedicated server (DS) within N cycles.
[0168] For example, assuming that the set N value is 6, the service management server (StarPSvr) will pay close attention to whether the heartbeat signal sent by the first dedicated server (DS) can be received in the next 6 heartbeat cycles (10s per cycle, 60s in total). During this period, the service management server (StarPSvr) will accurately record the reception situation in each cycle.
[0169] After the monitoring process of N cycles is completed, the service management server (StarPSvr) will determine whether the heartbeat monitoring status of the first dedicated server (DS) is abnormal based on the recorded information.
[0170] If the service management server (StarPSvr) fails to detect the heartbeat status of the first dedicated server (DS) during these N cycles, that is, does not receive any heartbeat signal from the first dedicated server (DS), then the system will determine that the heartbeat monitoring status of the first dedicated server (DS) is abnormal.
[0171] Taking the case where N is 6 as an example, if the service management server (StarPSvr) does not receive the heartbeat signal sent by the first dedicated server (DS) once within these 6 10s cycles, then the judgment condition of heartbeat monitoring abnormality is met.
[0172] Once the system determines that the heartbeat monitoring status of the first dedicated server (DS) is abnormal, a series of subsequent operations related to resource optimization will be triggered, including: storing the data in the first dedicated server (DS) to the second dedicated server, forcing all clients currently connected to the first dedicated server (DS) to go offline, then stopping all processes of the first dedicated server (DS), and finally clearing the data of the first dedicated server (DS), so as to properly handle the abnormal server, ensure the stable operation of the entire game system, and reasonably recycle and optimize system resources.
[0173] Through the above specific implementation methods, the mechanism of obtaining the heartbeat monitoring status of the first dedicated server and judging abnormalities can be effectively implemented in the actual game environment, which provides key monitoring and judgment basis for the entire resource optimization system to deal with server abnormalities, and is an important link in ensuring system stability and rational use of resources.
[0174] Understandably, see Figure 7 , Figure 7 DS resource optimization timing diagram is shown. After the data of the first dedicated server is migrated to the second dedicated server, it is necessary to request the first dedicated server to enter the resource optimization process. Figure 7 (A), in the related technology, the forced killing process of the first dedicated server includes: 1. When it is necessary to migrate DS, StarSvr will initiate the "terminateDs forced killing" operation. 2. After DS receives the "terminateDs forced killing" instruction from StarSvr, it will perform the "kick back write start" operation, and DS will start to write back the player data to ensure that the data can be saved. 3. If the DS side exceeds the g6 component rpc timeout when writing back data, the g6 component will intervene and perform the "terminate timeout g6 forced killing" operation. In this case, since the data write back operation is not completed, there is a risk of data loss. 4. If there is no timeout, DS will complete the "kick back write end" operation to ensure that the data is completely written back. The existing self-destruction process uses the active terminateDs forced killing method. Although it can achieve the migration and shutdown of DS, there is a risk of data loss. When DS is writing back data, if the RPC timeout of the g6 component is exceeded, the g6 component will forcibly terminate DS, resulting in the inability to write back the data completely, which in turn causes data loss. This hidden danger is particularly prominent under high load or unstable network conditions, and may have a serious impact on user experience and data security.
[0175] like Figure 7In (B), 1. The business management server initiates the "kick everyone offline start" operation. This step is to ensure that all users connected to the first dedicated server can be safely kicked offline before DS self-destructs. After receiving the "kick everyone offline start" instruction, the first dedicated server will perform corresponding processing. 2. After receiving the instruction from the business management server, the first dedicated server will perform the "kick people and write back start" operation to write back the user data to ensure that the data can be saved. 3. After the first dedicated server completes the data write back, it will perform the "kick people and write back end" operation, indicating that the data write back has been completed. 4. After the first dedicated server completes the data write back, the business management server will initiate the "kick everyone offline end" operation to ensure that all users have successfully logged off. 5. The business management server will execute the "terminateDs force kill" operation to force kill the first dedicated server and complete the DS self-destruction process. The DS self-destruction mechanism of this application is divided into two stages: the first stage is to actively kick people out to ensure that user data can be safely written back; the second stage is to actively kill, after confirming that the user is offline and the data is written back, the first dedicated server is killed. This mechanism ensures the security of data during the DS self-destruction process through orderly interaction between the business management server, the second dedicated server and the first dedicated server, and avoids the risk of data loss.
[0176] The method provided in the embodiment of the present application optimizes the resources of DS, including a first stage and a second stage. In the first stage, all clients currently connected to the first dedicated server are forced to go offline, and the forced offline write-back is performed through the TCAplus module. When the write-back is completed, all clients currently connected to the first dedicated server are forced to go offline. In the second stage, terminateDs is used to forcibly kill the first dedicated server to stop all processes of the first dedicated server.
[0177] The method provided by the embodiment of the present application is that in the game scene, the judgment result of this heartbeat monitoring abnormality is crucial for resource optimization. If the heartbeat of the business management server (StarPSvr) is abnormal, it may mean that there is a problem with the communication between servers, and the first dedicated server (DS) may not be able to normally receive instructions or data from the business management server (StarPSvr). At this time, timely releasing the resources of the first dedicated server (DS) can avoid invalid occupation of resources and potential data errors. At the same time, the system may try to re-establish the communication connection between servers, or start a backup server to take over some functions to minimize the impact on game players and ensure the continued normal operation of the game.
[0178] In an optional embodiment of the resource optimization method provided in the above embodiment of the present application, releasing resources of the first dedicated server includes:
[0179] Based on the communication relationship between the service management server and the first dedicated server, calling the first dedicated server to send a shutdown request instruction to the service management server, wherein the shutdown request instruction is used to instruct to stop the service of the first dedicated server;
[0180] The business management server is called, and when the business management server confirms that the first dedicated server meets the shutdown conditions, the data in the first dedicated server is stored in the second dedicated server, the service of the first dedicated server is stopped, and the data of the first dedicated server is cleared.
[0181] It is understandable that when the system determines that the heartbeat monitoring status of the first dedicated server (DS) is abnormal and needs to store its data to the second dedicated server, the specific process is as follows:
[0182] Call the first dedicated server to obtain business data: The system will actively call the first dedicated server (DS). During the game, the first dedicated server (DS) bears the important responsibilities of executing the core logic of the game and managing data storage, and stores a large amount of key information related to players. At this time, the system instructs the first dedicated server (DS) to extract the business data corresponding to all clients currently connected to the server through specific interfaces and instructions.
[0183] For example, in the game, these business data include detailed information about the player's character, such as level, health, magic points, skills, etc.; as well as the player's equipment data, including equipment name, attribute bonus, enhancement level, etc.; it also covers the progress of the player's ongoing tasks, such as completed task steps, remaining task goals, etc.; as well as the player's game scene location coordinates, game world map-related status data, etc. These data are crucial to the player's gaming experience and record the player's real-time status in the game.
[0184] After receiving the instruction, the first dedicated server (DS) will organize and package the business data according to the preset data structure and format to form a complete data set, ready to be transmitted to the second dedicated server.
[0185] Data transmission and storage to the second dedicated server: The system will establish a data transmission channel between the first dedicated server (DS) and the second dedicated server to ensure that data can be transmitted safely and accurately. Using a stable network connection and a reliable data transmission protocol, the packaged business data is sent from the first dedicated server (DS) to the second dedicated server.
[0186] After receiving the data, the second dedicated server will store the business data in a suitable storage location according to the pre-set data storage rules, such as categorizing and storing the data by player ID, so that the data can be quickly and accurately retrieved and extracted when the player data needs to be restored later.
[0187] After the data storage operation is completed, the system will proceed to shut down the first dedicated server (DS). The specific steps are as follows:
[0188] Force clients to log off: To ensure a smooth server shutdown and data integrity, the system will force all clients currently connected to the first dedicated server (DS) to log off.
[0189] The system will send an offline notification to all connected clients via the network. The notification may briefly explain that due to an abnormal situation on the server, the connection needs to be temporarily disconnected, and remind players to try to log in again later.
[0190] Subsequently, the system will proactively cut off the network connection between the first dedicated server (DS) and these clients to ensure that all clients can be disconnected from the server in a timely manner to avoid data transmission interruption or conflict during the server downtime.
[0191] Stop all server processes: After all clients are offline, the system will further stop all processes of the first dedicated server (DS).
[0192] The first dedicated server (DS) runs multiple key processes that support the operation of the game, including the game core logic processing process, which is responsible for processing various operation instructions of the players, such as attack, movement, interaction, etc.; the data storage and reading process, which is used to manage the storage and extraction of game data; the network communication process, which is responsible for data interaction with the client and other servers; and the game scene rendering and update process, etc.
[0193] The system will stop these processes in a certain order, first stopping the network communication process to prevent new connection requests from entering; then suspending the data storage and reading process to ensure that the data is in a stable state; then stopping the game core logic processing process and scene rendering update process, etc., and finally completely stopping the operation of the first dedicated server (DS) so that it no longer occupies the system's computing resources, memory resources, network bandwidth, etc.
[0194] Understandably, see Figure 8 , Figure 8Another timing diagram of DS resource optimization is shown. Before the first dedicated server performs resource optimization, the first dedicated server sends a shutdown request instruction to the business management server to inquire whether the business management server can shut down the first dedicated server. When the business management server confirms that the first dedicated server meets the shutdown conditions, the first dedicated server enters the shutdown process. It also includes two stages, which will not be repeated in the embodiments of the present application.
[0195] The method provided in the embodiment of the present application can store the data of the first dedicated server to the second dedicated server and stop the operation of the first dedicated server in an orderly and reliable manner in an actual game scenario, thereby ensuring the data security of the game system and the reasonable recycling of resources when an abnormality occurs in the server.
[0196] See also Fig. 9 , Fig. 9 (A) shows a resource optimization system 910, including: a business logic server 9101, a business management server 9102 and a first dedicated server 9103, wherein:
[0197] The business logic server 9101 receives the address query instruction sent by the client, wherein the address query instruction is used to instruct the business logic server to query the address information of the first dedicated server, the business logic server provides a logic driver for the target business, and the first dedicated server is used to provide a running environment for the target business;
[0198] The service logic server 9101 or the service management server 9102 obtains the target address of the first dedicated server according to the address query instruction;
[0199] The service logic server 9101 or the service management server 9102 sends the target address of the first dedicated server to the client, so that the client connects to the first dedicated server according to the target address;
[0200] In case of connection failure, the first dedicated server 9103 obtains the heartbeat monitoring status of the service management server, wherein the service management server has a communication relationship with the first dedicated server;
[0201] When the heartbeat monitoring status of the business management server 9101 is abnormal, the first dedicated server releases resources.
[0202] In an optional embodiment of the resource optimization system provided in the above embodiment of the present application, the business logic server 9101 obtains the target address of the first dedicated server from the business logic server according to the address query instruction.
[0203] In an optional embodiment of the resource optimization system provided in the above-mentioned embodiments of the present application, when the business logic server 9101 fails to obtain the target address of the dedicated server through query, the business management server 9102 obtains the target address of the first dedicated server from the business management server according to the address query instruction.
[0204] In an optional embodiment of the resource optimization system provided in the above embodiment of the present application, Fig. 9 In (B), the resource optimization system 910 further includes a second dedicated server 9104,
[0205] In case of connection failure, the service management server 9102 obtains the heartbeat monitoring status of the first dedicated server;
[0206] If the heartbeat monitoring status of the first dedicated server is abnormal, the data 9103 in the first dedicated server is stored in the second dedicated server 9104, the service of the first dedicated server 9103 is stopped, and the data of the first dedicated server 9103 is cleared.
[0207] In an optional embodiment of the resource optimization system provided in the above embodiment of the present application, based on the communication relationship between the service management server and the first dedicated server, the service management server 9102 monitors the heartbeat status of the first dedicated server 9103 in N cycles;
[0208] If the service management server does not detect the heartbeat status of the first dedicated server within N cycles, it indicates that the heartbeat monitoring status of the first dedicated server 9103 is abnormal.
[0209] In an optional embodiment of the resource optimization system provided in the above embodiment of the present application, business data corresponding to all clients currently connected to the first dedicated server 9103 is obtained;
[0210] Force all clients currently connected to the first dedicated server 9103 to log off;
[0211] Stop all processes of the first dedicated server 9103.
[0212] In an optional embodiment of the resource optimization system provided in the above embodiment of the present application,
[0213] The first dedicated server 9103 sends a shutdown request instruction to the service management server 9102, wherein the shutdown request instruction is used to instruct to stop the service of the first dedicated server;
[0214] When the business management server 9103 confirms that the first dedicated server 9103 meets the shutdown conditions, the data in the first dedicated server 9103 is stored in the second dedicated server 9104, the service of the first dedicated server 9103 is stopped, and the data of the first dedicated server 9103 is cleared.
[0215] In an optional embodiment of the resource optimization system provided in the above embodiment of the present application,
[0216] The first dedicated server 9103 monitors the heartbeat status of the service management server 9102 in N-1 cycles;
[0217] Within N-1 cycles, the first dedicated server 9103 did not monitor the heartbeat status of the business management server 9102, indicating that the heartbeat monitoring status of the business management server 9102 is abnormal.
[0218] See also Fig.10 , Fig.10 A resource optimization device 1010 is shown, comprising:
[0219] The receiving module 10101 is used to receive an address query instruction sent by a client, wherein the address query instruction is used to instruct the business logic server to query the address information of the first dedicated server, the business logic server provides a logic driver for the target business, and the first dedicated server is used to provide an operating environment for the target business;
[0220] A query module 10102, configured to query and obtain a target address of the first dedicated server according to an address query instruction;
[0221] The sending module 10103 is used to send the target address of the first dedicated server to the client, so that the client connects to the first dedicated server according to the target address;
[0222] An acquisition module 10104 is used to acquire the heartbeat monitoring status of the service management server in case of a connection failure, wherein the service management server has a communication relationship with the first dedicated server;
[0223] The release module 10105 is used to release the resources of the first dedicated server when the heartbeat monitoring status of the business management server is abnormal.
[0224] In an optional embodiment of the resource optimization device provided in the above embodiment of the present application, the query module 10102 is also used to call the business logic server, and query the target address of the first dedicated server from the business logic server according to the address query instruction.
[0225] In an optional embodiment of the resource optimization device provided in the above-mentioned embodiment of the present application, the query module 10102 is also used to call the business management server when the target address of the dedicated server is not obtained from the business logic server, and query the target address of the first dedicated server from the business management server according to the address query instruction.
[0226] In an optional embodiment of the resource optimization device provided in the above embodiment of the present application, the resource optimization system further includes a second dedicated server,
[0227] The acquisition module 10104 is further used to acquire the heartbeat monitoring status of the first dedicated server in case of a connection failure;
[0228] The release module 10105 is also used to store the data in the first dedicated server to the second dedicated server, stop the service of the first dedicated server, and clear the data of the first dedicated server if the heartbeat monitoring status of the first dedicated server is abnormal.
[0229] In an optional embodiment of the resource optimization device provided in the above-mentioned embodiment of the present application, the acquisition module 10104 is also used to call the business management server to monitor the heartbeat status of the first dedicated server in N cycles based on the communication relationship between the business management server and the first dedicated server; within N cycles, the business management server did not monitor the heartbeat status of the first dedicated server.
[0230] In an optional embodiment of the resource optimization device provided in the above-mentioned embodiment of the present application, the release module 10105 is also used to call the first dedicated server to obtain the business data corresponding to all clients currently connected to the first dedicated server; force all clients currently connected to the first dedicated server to go offline; and stop all processes of the first dedicated server.
[0231] In an optional embodiment of the resource optimization device provided in the above embodiment of the present application, the release module 10105 is further used to call the first dedicated server to send a shutdown request instruction to the business management server based on the communication relationship between the business management server and the first dedicated server, wherein the shutdown request instruction is used to instruct to stop the service of the first dedicated server;
[0232] The business management server is called, and when the business management server confirms that the first dedicated server meets the shutdown conditions, the data in the first dedicated server is stored in the second dedicated server, the service of the first dedicated server is stopped, and the data of the first dedicated server is cleared.
[0233] In an optional embodiment of the resource optimization device provided in the above embodiment of the present application,
[0234] The acquisition module 10104 is also used to call the first dedicated server to monitor the heartbeat status of the business management server in N-1 cycles based on the communication relationship between the business management server and the first dedicated server; within the N-1 cycles, the first dedicated server did not monitor the heartbeat status of the business management server.
[0235] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0236] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0237] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0238] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0239] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0240] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a server or terminal device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store computer programs.
[0241] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for resource optimization, characterized in that: The method is applied to a resource optimization system, the resource optimization system includes a business logic server, a business management server and a first dedicated server, and the method includes: Receiving an address query instruction sent by a client, wherein the address query instruction is used to instruct the business logic server to query the address information of the first dedicated server, the business logic server provides a logic driver for the target business, and the first dedicated server is used to provide a running environment for the target business; Obtaining the target address of the first dedicated server according to the address query instruction; Sending the target address of the first dedicated server to the client, so that the client connects to the first dedicated server according to the target address; In case of connection failure, obtaining a heartbeat monitoring status of the service management server, wherein the service management server has a communication relationship with the first dedicated server; When the heartbeat monitoring status of the service management server is abnormal, the resources of the first dedicated server are released.
2. The resource optimization method according to claim 1, characterized in that: The querying and obtaining the target address of the first dedicated server according to the address query instruction includes: The business logic server is called, and according to the address query instruction, the target address of the first dedicated server is obtained from the business logic server through query.
3. The resource optimization method according to any one of claims 1-2, characterized in that: The querying and obtaining the target address of the first dedicated server according to the address query instruction includes: In the case where the target address of the first dedicated server is not obtained from the business logic server, the business management server is called, and the target address of the first dedicated server is obtained from the business management server according to the address query instruction.
4. The method for resource optimization according to claim 1, characterized in that: The resource optimization system further includes a second dedicated server, and the method further includes: In case of connection failure, obtaining the heartbeat monitoring status of the first dedicated server; If the heartbeat monitoring status of the first dedicated server is abnormal, the data in the first dedicated server is stored in the second dedicated server, the first dedicated server is stopped, and the data of the first dedicated server is cleared.
5. The method for resource optimization according to claim 4, characterized in that: The obtaining the heartbeat monitoring status of the first dedicated server includes: Based on the communication relationship between the service management server and the first dedicated server, calling the service management server to monitor the heartbeat status of the first dedicated server in N cycles, where N is an integer greater than 1; The heartbeat monitoring status of the first dedicated server is abnormal, including: In the N cycles, the service management server does not monitor the heartbeat status of the first dedicated server.
6. The method for resource optimization according to claim 4, characterized in that: The storing the data in the first dedicated server to the second dedicated server comprises: Calling the first dedicated server to obtain service data corresponding to all clients currently connected to the first dedicated server; The stopping of the operation of the first dedicated server comprises: Force all clients currently connected to the first dedicated server connection to log off; Stop all processes running the first dedicated server.
7. The resource optimization method according to claim 1, characterized in that: The releasing the resources of the first dedicated server comprises: Based on the communication relationship between the service management server and the first dedicated server, calling the first dedicated server to send a shutdown request instruction to the service management server, wherein the shutdown request instruction is used to instruct to stop the service of the first dedicated server; The business management server is called, and when the business management server confirms that the first dedicated server meets the shutdown conditions, the data in the first dedicated server is stored in the second dedicated server, the service of the first dedicated server is stopped, and the data of the first dedicated server is cleared.
8. The method for resource optimization according to any one of claims 1 to 7, characterized in that: The obtaining the heartbeat monitoring status of the first dedicated server includes: Based on the communication relationship between the service management server and the first dedicated server, calling the first dedicated server to monitor the heartbeat status of the service management server in N-1 cycles; The heartbeat monitoring status of the service management server is abnormal, including: In the N-1 cycles, the first dedicated server does not monitor the heartbeat status of the service management server.
9. A resource optimization system, characterized in that: include: A business logic server, a business management server and a first dedicated server, wherein: The business logic server receives an address query instruction sent by the client, wherein the address query instruction is used to instruct the business logic server to query the address information of the first dedicated server, the business logic server provides a logic driver for the target business, and the first dedicated server is used to provide a running environment for the target business; The service logic server or the service management server obtains the target address of the first dedicated server by querying according to the address query instruction; The service logic server or the service management server sends the target address of the first dedicated server to the client, so that the client connects to the first dedicated server according to the target address; In case of connection failure, the first dedicated server obtains the heartbeat monitoring status of the service management server, wherein the service management server has a communication relationship with the first dedicated server; When the heartbeat monitoring status of the service management server is abnormal, the first dedicated server releases resources.
10. A resource optimization device, characterized in that: include: A receiving module, configured to receive an address query instruction sent by a client, wherein the address query instruction is used to instruct the business logic server to query the address information of the first dedicated server, the business logic server provides a logic driver for a target business, and the first dedicated server is used to provide a running environment for the target business; A query module, configured to query and obtain a target address of the first dedicated server according to the address query instruction; A sending module, used for sending the target address of the first dedicated server to the client, so that the client connects to the first dedicated server according to the target address; an acquisition module, configured to acquire the heartbeat monitoring status of the service management server in case of a connection failure, wherein the service management server has a communication relationship with the first dedicated server; A release module is used to release the resources of the first dedicated server when an abnormality occurs in the heartbeat monitoring state of the business management server.
11. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the resource optimization method according to any one of claims 1 to 8 are implemented.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the resource optimization method according to any one of claims 1 to 8 are implemented.
13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the resource optimization method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Communication method, safety inspection system, server and computer storage medium
CN109194723A
Access control method and device, servers and storage medium
CN110354493A
Service server and dedicated server scheduling method
CN118819756A
System and method for managing communication sessions between clients and a server
US20190045014A1