A resource optimization method, related system, related device, equipment and storage medium

By monitoring the heartbeat status of dedicated servers and releasing resources when abnormalities occur, the problem of excessive resource consumption and instability caused by long-term operation of dedicated servers is solved, achieving efficient resource allocation and stable business operation, and reducing user churn.

CN119865523BActive Publication Date: 2025-12-12TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510038706.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-09
Publication Date
2025-12-12
Estimated Expiration
2045-01-09

AI Technical Summary

Technical Problem

Dedicated servers running for extended periods can lead to excessive resource consumption and instability, affecting data transmission efficiency and stability, and potentially causing user churn.

Method used

The business management server and the first dedicated server monitor each other's heartbeat status, and release resources and optimize resource allocation when the heartbeat status is abnormal.

Benefits of technology

It enables efficient allocation of resources, avoids resource idleness caused by poor connectivity, ensures stable business operation, reduces user churn, and prevents network congestion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119865523B_ABST
    Figure CN119865523B_ABST
Patent Text Reader

Abstract

The application discloses a resource optimization method, which belongs to the technical field of server resource optimization. The method is applied to a resource optimization system, and the resource optimization system comprises a business logic server, a business management server and a first special server. The method comprises the following steps: firstly, the system receives an address query instruction sent by a client and used for instructing the business logic server to query address information of the first special server, queries a target address according to the instruction and sends the target address to the client, so that the client is connected with the first special server. If the connection fails, the system acquires a heartbeat monitoring state of the business management server which has a communication relationship with the first special server, and releases resources of the first special server once an exception is monitored. The method provided in the application embodiment has a response mechanism based on heartbeat monitoring in the face of connection failure, can timely release the resources of the first special server which is in an exception, avoids that the first special server continuously occupies a large amount of resources, and guarantees the sustainability of business.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computers, and in particular to a resource optimization method, a related system, a related device, equipment and a storage medium. BACKGROUND

[0002] In many scenarios, such as online games, large network applications, etc., a dedicated server (DS) needs to run uninterruptedly for a long time. This is because these services need to continuously provide services for users, and once the server stops running, users will not be able to normally use related services, which may cause serious business interruption and user loss.

[0003] A long-running DS may continuously occupy a large amount of hardware resources such as CPU, memory, disk I / O, etc. For example, as the number of users increases and the complexity of user operations improves, the DS needs to handle more computing tasks and data storage / reading operations, thereby causing the CPU to be in a high load state for a long time and the memory occupancy to continuously rise. In addition, the DS needs to maintain continuous network connection with the client during long-period running and process a large number of network data packets. If network resources are not properly managed, the network bandwidth will be excessively occupied, network congestion will occur, and the efficiency and stability of data transmission will be affected.

[0004] At present, the problem of excessive resource consumption and instability faced by the long-period running of the DS needs an effective method to solve such problems. SUMMARY

[0005] The embodiments of the present application provide a resource optimization method, a related system, a related device, equipment and a storage medium. In the case that a client cannot connect to a first dedicated server according to a target address of the first dedicated server sent by a business management server, the business management server and the first dedicated server monitor the heartbeat state of each other, and in the case that the heartbeat state of either one of the two is abnormal, the resources of the first dedicated server are released.

[0006] The present application provides a resource optimization method, which is applied to a resource optimization system including a business logic server, a business management server and a first dedicated server. The method comprises the following steps:

[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 address information of the first dedicated server, the business logic server provides logical driving for a target business, and the first dedicated server is used to provide a running environment for the target business;

[0008] querying the target address of the first dedicated server according to the address query instruction;

[0009] send the target address of the first dedicated server to the client, so that the client connects with the first dedicated server according to the target address;

[0010] In the case of connection failure, the heartbeat monitoring state of the service management server is obtained, wherein the service management server has a communication relationship with the first dedicated server;

[0011] In the case of abnormal heartbeat monitoring state of the service management server, the resources of the first dedicated server are released.

[0012] Another aspect of the present application provides a resource optimization system, comprising a service logic server, a service management server and a first dedicated server, wherein,

[0013] The service logic server receives an address query instruction sent by the client, wherein the address query instruction is used to instruct the service logic server to query the address information of the first dedicated server, the service logic server provides logical driving for a target service, and the first dedicated server is used to provide a running environment for the target service;

[0014] The service logic server or the service management server queries 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 with the first dedicated server according to the target address;

[0016] In the case of connection failure, the first dedicated server obtains the heartbeat monitoring state of the service management server, wherein the service management server has a communication relationship with the first dedicated server;

[0017] In the case of abnormal heartbeat monitoring state of the service management server, the first dedicated server releases resources.

[0018] Another aspect of the present application provides a resource optimization device, comprising:

[0019] The receiving module is used to receive an address query instruction sent by the client, wherein the address query instruction is used to instruct the service logic server to query the address information of the first dedicated server, the service logic server provides logical driving for a target service, and the first dedicated server is used to provide a running environment for the target service;

[0020] The querying module is used to query the target address of the first dedicated server according to the address query instruction;

[0021] The sending module is used to send the target address of the first dedicated server to the client, so that the client connects with the first dedicated server according to the target address;

[0022] The acquisition module is configured to acquire a heartbeat monitoring state of the service management server in the case of connection failure, wherein the service management server has a communication relationship with the first dedicated server.

[0023] The release module is configured to release the resources of the first dedicated server in the case of an abnormal heartbeat monitoring state of the service management server.

[0024] Another aspect of the present application provides a computer device, comprising a memory and a processor, the memory stores a computer program, and the processor implements the method of the above aspects when executing the computer program.

[0025] Another aspect of the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the method of the above aspects.

[0026] Another aspect of the present application provides a computer program product, comprising a computer program, and the computer program is executed by a processor to implement the method of the above aspects.

[0027] From the above technical solutions, the embodiments of the present application have the following advantages:

[0028] In the embodiments of the present application, a resource optimization method is provided, which is applied to a resource optimization system including a service logic server, a service management server and a first dedicated server. The method comprises the following steps: first, the system receives an address query instruction sent by a client and used to instruct the service logic server to query address information of the first dedicated server, and the system sends the target address queried according to the instruction to the client, so that the client is connected with the first dedicated server. When the connection fails, the system acquires a heartbeat monitoring state of the service management server which has a communication relationship with the first dedicated server, and releases the resources of the first dedicated server once an abnormality is monitored. The method provided by the embodiments of the present application, on the one hand, avoids the resource idling caused by poor connection through the orderly address query and connection process, realizes efficient allocation of resources, and enables the business such as online games to be stably and efficiently operated, thereby reducing the user loss caused by server problems; on the other hand, the fast response mechanism based on heartbeat monitoring in the face of connection failure can timely release the resources of the first dedicated server which may be abnormal, avoid the continuous occupation of a large amount of hardware resources such as CPU, memory, disk I / O and network bandwidth, resolve the network congestion risk, and effectively solve the problems of large resource consumption and instability of DS in long-period operation, thereby guaranteeing the sustainability of the business. BRIEF DESCRIPTION OF DRAWINGS

[0029] Figure 1 The interface diagram of the application scenario of the resource optimization method provided by the embodiments of the present application.

[0030] Figure 2 An architecture diagram of an application scenario of a resource optimization method provided by an embodiment of the present application;

[0031] Figure 3 An architecture diagram of an application scenario of another resource optimization method provided by an embodiment of the present application;

[0032] Figure 4 A flowchart of a resource optimization method provided by an embodiment of the present application;

[0033] Figure 5 A schematic diagram of a resource optimization system provided by an embodiment of the present application;

[0034] Figure 6 A schematic diagram of heartbeat keep-alive of a dedicated server and a service management server provided by an embodiment of the present application;

[0035] Figure 7 A timing diagram of a resource optimization method provided by an embodiment of the present application;

[0036] Figure 8 A timing diagram of another resource optimization method provided by an embodiment of the present application;

[0037] Figure 9 A structural diagram of a resource optimization system provided by an embodiment of the present application;

[0038] Figure 10 A structural diagram of a resource optimization apparatus provided by an embodiment of the present application. DETAILED DESCRIPTION

[0039] The embodiment of the present application provides a resource optimization method, which realizes efficient deployment of resources, enables stable and efficient operation of a service, reduces user loss caused by server problems, and releases the first dedicated server resource that may be in an abnormal state in time based on a heartbeat monitoring rapid response mechanism, thereby solving the problems of excessive consumption and instability of DS resources in long-period operation and guaranteeing sustainability of the service.

[0040] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.

[0041] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0042] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.

[0043] Before introducing the specific methods of this application, we will first provide an illustrative example of the application scenarios for the resource optimization methods in this application. It should be understood that the following application scenarios are merely examples and are not limited to these.

[0044] In one possible implementation, the method provided in this application embodiment is applied to a game scene; please refer to [link / reference]. Figure 1 , Figure 1 (A) shows a diagram of the game interface after the client connects to the dedicated server; Figure 1 (B) shows a screenshot of the game interface after the client disconnects from the dedicated server.

[0045] In some games, multiple servers are required to support the game's operation, including: a game business logic server (Gamesvr), a business management server (StarPSvr), and a dedicated server (DS); among them,

[0046] Gamesvr: On the one hand, it is like the "brain" of the game, responsible for controlling the entire game process. For example, in a role-playing game, when the player reaches a certain level, the Gamesvr will unlock the corresponding new plot, open a new map, or give new skills according to the preset rules, guiding the player to gradually deepen the game world. In addition, the Gamesvr is responsible for the operation of the task system and achievement system in the game. For tasks, it will record the player's task acceptance in detail and obtain the task completion progress in real time. On the other hand, the Gamesvr strictly controls various behaviors between players in the game to maintain the fairness and normal operation of the in-game economic system, avoid data anomalies or unfair situations, and ensure the stability of the game environment.

[0047] StarPSvr: Mainly responsible for coordinating the connection between various servers. During game operation, it ensures smooth communication and data interaction between business logic servers, dedicated servers, and other related servers, ensuring stable operation of the entire game service system. For example, when the player enters the specific game world from the game lobby, StarPSvr coordinates all parties to enable the player to smoothly access the corresponding server environment to play the game. In addition, it is also responsible for the management functions related to the game world, such as allowing players to pull the list of different game worlds and select the appropriate world 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 a dedicated game world under certain conditions. In addition, it does a good job of data interaction, resource cleaning, and other management work during the player's entry and exit from the game world, maintaining the normal operation order of the game world.

[0048] DS: Responsible for executing the most core logic rules of the game to ensure that the game runs in an orderly manner according to the established rules. It provides long-term stable operation for the game, has strong hardware resource support capability, uses its 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 stable network modules to ensure fast and accurate data transmission, meeting the needs of players to log in and play smoothly at any time. Even in the case of a large number of players online and frequent operations, it can maintain stability and prevent the game from appearing lagging, interruption, and other issues affecting the experience. It stores key data of players in the game, including basic attributes of the character, such as level, health, and magic, as well as equipment information and skill mastery of the player, and continuously updates and saves these data according to the player's operation in the game, ensuring that the player can recover to the state at the last exit each time they log in. At the same time, it is also responsible for managing the basic data of the game world itself, such as map layout, resource distribution, and monster refresh points, to ensure the normal operation and continuous development of the game world and provide a solid data foundation for the long-term operation of the game.

[0049] Please refer to Figure 2 , Figure 2 An architecture diagram of a method for resource optimization provided by an embodiment of the present application applied to a game scenario is shown. In an implementation manner, the scenario includes a terminal 201, a client 202, a network 203, a server 204, and a database 205.

[0050] The terminal 201 includes a human-computer interaction screen, a processor, and a memory. The human-computer interaction screen is configured to display a game client interface. The human-computer interaction screen is further configured to provide a human-computer interaction interface to receive a human-computer interaction operation of a user in game playing, and the like.

[0051] The terminal 201 includes, but is not limited to, a mobile phone, a tablet computer, a notebook computer, a desktop computer, a smart voice interaction device, a virtual reality device, a smart home appliance, a vehicle-mounted terminal, an aircraft, and the like.

[0052] The client 202 is run in the terminal 201. The client 202 takes the game client as an example. 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 can be run on the terminal 201 in the form of an independent application (application, APP) or a mini program, and the like.

[0053] The network 203 uses standard communication technologies and / or protocols, and is usually the Internet, but can also be any network, including but not limited to any combination of Bluetooth, a local area network (local area network, LAN), a metropolitan area network (metropolitan area network, MAN), a wide area network (wide area network, WAN), mobile, a private network, or a virtual private network. In some embodiments, the above-mentioned data communication technologies can be replaced or supplemented by customized or dedicated data communication technologies.

[0054] The server 204 includes a processor for performing storage or reading operations on the database 204. The server 204 involved in the present application can be a standalone physical server, a server cluster or a distributed system composed of multiple physical servers, a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and basic cloud computing services such as big data and artificial intelligence (AI) platforms. The server 204 includes a module running a game business logic server, a module running a game business management server, and a module running a first dedicated server. The server 204 runs a resource optimization system, which 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 with the dedicated server:

[0057] As shown in step S211, if the client cannot connect with the dedicated server through the locally stored address of the dedicated server, the client sends an address query instruction to the server 204.

[0058] As shown 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 logical driving for the target game business, and the first dedicated server is used to provide a running environment for the target game business.

[0059] As shown in step S213, the resource optimization system in the server 204 queries the target address of the first dedicated server according to the address query instruction.

[0060] As shown 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 with the first dedicated server according to the target address.

[0061] As shown in step S215, the resource optimization system in the server 204 acquires the heartbeat monitoring state of the game business management server in the case of connection failure, wherein the game business management server has a communication relationship with the first dedicated server.

[0062] If the heartbeat monitoring state of the game service management server is abnormal, the resource optimization system in the server 204 releases the resources of the first dedicated server.

[0063] Referring to Figure 3 , Figure 3 Another architecture diagram in which the resource optimization method provided by the embodiments of the present application is applied to a game scenario is shown. In an implementation, the scenario includes a terminal 301, a client 302, a network 303, a network connection management server (Tconnd) 304, a game service logic server (Gamesvr) 305, a game service 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 connection with the dedicated server 307.

[0065] In step S311, the client 302 obtains the address information of the dedicated server 307 from the local cache, initiates connection with the dedicated server 307 through the address information in the local cache, and sends an address query instruction to the network connection management server 304 in the case of connection failure.

[0066] In step S312, the network connection management server 304 sends the address query instruction to the game service logic server 305.

[0067] In the case of entering a game copy, the address information of the dedicated server 305 is stored in the game service logic server 305.

[0068] In step S313, the game service logic server 305 sends the address information of the dedicated server 305 to the client 302.

[0069] In the case of entering a game main line task, the address information of the dedicated server 305 is stored in the game service management server 306.

[0070] In step S314, the game service management server 306 sends the target address of the dedicated server 305 to the client 302.

[0071] In step S315, the client 302 connects with the dedicated server 305 through the target address.

[0072] In step S316, in the case of connection failure, the dedicated server 307 and the game service management server 306 monitor the heartbeat state of each other,

[0073] If the heartbeat state of the game service management server 306 is abnormal, the resources of the dedicated server 307 are released.

[0074] The method provided by the embodiments of the present application has the following advantages when applied to a game scenario. On the one hand, the address query and connection process is used to efficiently allocate resources, so that the client can quickly access the service, the waiting time is reduced, and the operation efficiency is improved. On the other hand, when a connection fault occurs, the heartbeat monitoring is used to handle the exception in a timely manner, prevent the problem from spreading, enhance the stability and reliability of the system in a complex network environment, create a smooth experience for the user, facilitate subsequent system maintenance, and reduce the maintenance cost.

[0075] Please refer to Figure 4 , Figure 4 A flowchart of a method for resource optimization 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, and the method includes the following steps.

[0076] S410, receiving 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, and the business logic server provides logical driving for a target service, and the first dedicated server is used to provide an operation environment for the target service.

[0078] It can be understood that when a player starts a 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. The 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 logical driving for the game as a target service, and the first dedicated server (DS) is responsible for providing a specific operation environment for the game, such as storing and updating related data such as game maps and character states in real time, to ensure the game experience of the player.

[0079] S420, querying a target address of the first dedicated server according to the address query instruction.

[0080] It can be understood that the resource optimization system receives the address query instruction, and preferentially calls the business logic server (Gamesvr). If the player is in a specific game copy or the like, the address information of the first dedicated server (DS) is stored in the game business logic server (Gamesvr), so that 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 according to the game progress 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 queried in the business logic server (Gamesvr), the system will continue to call the business management server (StarPSvr). The business management server (StarPSvr) has a player world management function and the like, and 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 performs a main task of the game or the like, the address information of the first dedicated server (DS) can be stored in the business management server (StarPSvr), and at this time the business management server (StarPSvr) can provide the corresponding target address.

[0082] S430, the target address of the first dedicated server is sent to the client, so that the client connects with the first dedicated server according to the target address.

[0083] It can be understood that the system sends the target address of the first dedicated server (DS) obtained by querying to the client. After receiving the target address, the client attempts to connect with the first dedicated server (DS) again according to the address. This process is designed to ensure that the client can accurately and quickly connect to the first dedicated server (DS) that provides a running environment for the game, so as to ensure that the player can smoothly enter the game.

[0084] S440, in the case of connection failure, the heartbeat monitoring state of the business management server is obtained.

[0085] The business management server and the first dedicated server have a communication relationship.

[0086] It can be understood that if the connection between the client and the first dedicated server (DS) still fails, the system will start a troubleshooting mechanism at this time. Since the business management server (StarPSvr) and the first dedicated server (DS) have a communication relationship, the system will obtain the heartbeat monitoring state of the business management server (StarPSvr).

[0087] In the game system, a heartbeat mechanism is adopted between the service management server (StarPSvr) and the first dedicated server (DS). For example, the two parties agree to send heartbeat signals to each other at fixed time intervals (such as 10s) to confirm the running state of the other party. If the heartbeat monitoring state of the service management server (StarPSvr) is abnormal in a plurality of consecutive heartbeat periods, for example, the first dedicated server (DS) does not receive the heartbeat signal of the service management server (StarPSvr) in the set N heartbeat periods, or the service management server (StarPSvr) does not receive the heartbeat signal of the first dedicated server (DS) (according to the actual system monitoring direction), it indicates that there may be server failure or network problem.

[0088] S450, in the case that the heartbeat monitoring state of the service management server is abnormal, the resources of the first dedicated server are released.

[0089] It can be understood that once it is determined that the heartbeat monitoring state of the service management server (StarPSvr) is abnormal, the system will perform the operation of releasing the resources of the first dedicated server (DS). Based on the communication relationship between the service management server (StarPSvr) and the first dedicated server (DS), the first dedicated server (DS) will send a shutdown request instruction to the service management server (StarPSvr), which is used to instruct to stop the service of the first dedicated server (DS). After receiving the shutdown request instruction, the service management server (StarPSvr) will perform related checks to confirm whether the first dedicated server (DS) meets the shutdown condition. If the condition is met, the service management server (StarPSvr) will coordinate to store the data in the first dedicated server (DS) to a pre-set standby storage location (such as a 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 recycling 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 ease of understanding, please refer to Figure 5 , Figure 5 A schematic diagram of a resource optimization system provided by an 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 service logic server (Gamesvr) 522, a game service management server (StarPSvr) 523, a game account management server (StarPaccountsvr) 524, and a dedicated server (DS) 525.

[0091] Specifically:

[0092] Cilent 510 is the interface for players to interact with the game system, responsible for sending player operation requests to the server and receiving server feedback data to present game pictures and states. Its functions include: 1. Store DS address: locally cache DS address, when reconnecting, first try to use the locally cached DS address to connect. 2. Initiate connection request: when the locally cached DS address connection fails, send a request to the network connection management server (Tconnd) through the TCP protocol to obtain the latest DS address. 3. Process connection results: reconnect according to the latest DS address obtained from the server, if multiple reconnections fail, perform corresponding processing 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. Receive client request: receive the request of the client to request the latest DS address. 2. Forward request: forward the request of the client to the game business logic server (Gamesvr) or 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 core game play related logic of in-game battles, tasks, and prop usage. Its functions include: 1. Process DS address query: receive requests from Tconnd, check if the latest DS address corresponding to the client can be obtained. 2. Address feedback: if the DS address of the client can be obtained, return it to Tconnd, and then pass it 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 of game operation. 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), which is used to detect the running state of the DS to ensure the stability and availability of the server. 3. Data migration management: when DS resources are recycled or migrated, it is responsible for coordinating related operations, such as starting a new DS and migrating data, etc.

[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 operations related to the account. Its functions include: 1. Account management: processing the creation of the player's account, login verification, and other operations. 2. Player state management: managing the account state and related data of the player when switching between different DSs (such as returning from the copy corresponding DS to the main game corresponding DS).

[0097] The dedicated server (DS) 525 is responsible for processing the game operations and data storage of specific groups of players, and provides corresponding game services according to different game scenarios (such as game mainline DS and game copy DS). Its functions include: 1. Game service provision: providing game scenario related services for players connected to the server, such as game world rendering, player operation processing, etc. 2. Data storage: storing the game data of players connected to the server, such as character state, game progress, etc. 3. Heartbeat response: responding to the heartbeat detection of StarPSvr to indicate its running state. At the same time, in certain situations (such as heartbeat timeout), resource recycling or self-destruction operations are performed to optimize resource utilization.

[0098] The flow of the resource optimization method provided by the embodiment of the application is described below:

[0099] As step S511, the client (Cilent) 510 first attempts to reconnect from the local cache to the stored address of the dedicated server (DS) 525. 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 step S512, the client will send a BattleGetOngoingDsAddr request to the game business logic server (Gamesvr) 522 through the network connection management server (Tconnd) 521 to request the latest address of the 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] In the case of the player entering the game copy, the address information of the dedicated server (DS) 525 is stored in the game business logic server (Gamesvr) 522.

[0102] As step S513, if the game business logic server (Gamesvr) 522 cannot find the relevant address, it continues to request the latest dedicated server (DS) address from the game business management server (StarPSvr) 523.

[0103] If the game service logic server (Gamesvr) finds the latest dedicated server (DS) address, the BattleGetOngoingDsAddr protocol request is returned to the client as step S514; if not, the latest dedicated server (DS) address is returned to the client by the game service management server (StarPSvr).

[0104] The client uses the latest acquired dedicated server (DS) address to attempt reconnection again as step S515. If the reconnection is unsuccessful for multiple times (more than n times): if the player is in the mainline task of the game, the player is returned to the game lobby; if the player is in the game copy, the player is returned to the dedicated server (DS) corresponding to the mainline of the game. The whole process mainly revolves around how the client acquires and connects to the appropriate dedicated server (DS) address, ensuring that the player can smoothly enter the game or switch between different servers.

[0105] The game service management server (StarPSvr) and the DS maintain the active state of the connection through the heartbeat mechanism as step S516.

[0106] The method provided by the embodiments of the application can effectively solve the problems of resource waste and system instability caused by server connection problems and failures in actual game scenarios, and realize efficient resource allocation and reliable system operation.

[0107] In an optional embodiment of the resource optimization method provided by the above embodiments of the application, the target address of the first dedicated server is queried according to the address query instruction, including:

[0108] The business logic server is called to query the target address of the first dedicated server from the business logic server according to the address query instruction.

[0109] It can be understood that after the player starts the game client, the client will first attempt to establish a connection with the DS using the locally cached first dedicated server (DS) address. 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 role in driving the entire game running process, and provides support at the logic level for the game as the target service; and the first dedicated server (DS) is responsible for creating an actual running environment for the game, such as bearing game map data, managing player role states, and processing various interaction logics in the game.

[0110] The resource optimization system will call the business logic server (Gamesvr) according to the established process after receiving the address query instruction sent by the client. In the actual running scene of the game, there are many cases that enable the business logic server (Gamesvr) to store the address information of the first dedicated server (DS).

[0111] For example, when the player enters some specific game copies, the business logic server (Gamesvr) will know the first dedicated server (DS) corresponding to the copy according to the rules and logic pre-set by the game. After receiving the address query instruction, the business logic server (Gamesvr) will search and match in the data stored by it according to the related information in the instruction (such as the current game progress of the player, the area where the player is located, 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 the address information library stored by it.

[0112] In this process, the business logic server (Gamesvr) is like an intelligent dispatching center, which clearly understands the correspondence between each part of the game and the first dedicated server (DS). It can quickly judge which specific first dedicated server (DS) the player should connect to according to the real-time game state of the player, and prepare the target address of the server 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 according to the 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 target address of the first dedicated server (DS) is queried by calling the business logic server (Gamesvr), which fully utilizes the deep understanding of the game logic and the control ability of the game progress of the business logic server (Gamesvr). This way can quickly and accurately provide the required server address for the client in the game scene, guarantee the continuity and stability of the game service, and also meet the design intention of the resource optimization system to efficiently and orderly allocate resources.

[0115] The method provided in the embodiments of the present application can utilize the deep understanding and control of the business logic server over game logic and processes when the system calls the business logic server to query the target address of the first dedicated server according to the address query instruction. For example, in a game scenario, the business logic server is clear about the correspondence between each copy, task, etc. and the dedicated server, can quickly locate and provide the target address, avoids a complex lookup process, significantly improves the efficiency of address query, enables the client to obtain the required server address more quickly, reduces the waiting time of the player, and improves the game experience. This query method is based on the familiarity of the business logic server with the overall logic of the game, and the accuracy of the query result is higher. 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 looking up the address between multiple servers, this method reduces the waste of system resources in the address query link, so that the system can use more resources for the key part of game running, such as processing player interaction and rendering game pictures, realizes reasonable allocation and efficient use of resources, and improves the system performance as a whole.

[0116] In an optional embodiment of the method for resource optimization provided in the above embodiments of the present application, the target address of the first dedicated server is obtained according to the address query instruction, comprising:

[0117] In the case where the target address of the dedicated server is not obtained from the business logic server, the business management server is called to obtain the target address of the first dedicated server from the business management server according to the address query instruction.

[0118] It can be understood that after the player starts the game client, the client will first try to connect the first dedicated server (DS) using the locally cached DS address. If the connection operation fails, the client will send an address query instruction to the resource optimization system. The instruction clearly indicates that the business logic server (Gamesvr) queries the address information of the first dedicated server (DS). The business logic server (Gamesvr) undertakes the key responsibility of providing logical driving for the target service of the game, and controls the process, task system and interaction logic between players of the game; and the first dedicated server (DS) is the actual running environment carrier of the game, and is responsible for carrying various real-time data in the game, such as player character information and game scene state.

[0119] The resource optimization system receives the address query instruction, and first calls the business logic server (Gamesvr) to perform address query according to a conventional process. However, in some specific game scenarios, the business logic server (Gamesvr) can not be able to query the target address of the first dedicated server (DS). For example, when the player is participating in a mainline task of the game and the task involves complex server allocation logic, the business logic server (Gamesvr) does not directly store the corresponding first dedicated server (DS) address. At this time, the system determines that the business logic server (Gamesvr) query fails, and then starts a backup query path.

[0120] When the system determines that the business logic server (Gamesvr) query is unsuccessful, the business management server (StarPSvr) is called. The business management server (StarPSvr) undertakes important tasks of coordinating connections between various servers and managing the game world in the game system. It has comprehensive information about the game world, the player's active area, and the corresponding first dedicated server (DS).

[0121] After receiving the address query instruction, the business management server (StarPSvr) performs accurate retrieval in the data stored by itself according to the key information such as the current game state, the area where the player is located, and the task progress of the player contained in the instruction. For example, when the player is in a specific stage of the mainline task of the game, the business management server (StarPSvr) locates the first dedicated server (DS) to which the player should be connected according to the pre-set rules and data storage structure, and obtains the target address thereof.

[0122] When the system determines that the business logic server (Gamesvr) query is unsuccessful, the business management server (StarPSvr) is called. The business management server (StarPSvr) undertakes important tasks of coordinating connections between various servers and managing the game world in the game system. It has comprehensive information about the game world, the player's active area, and the corresponding first dedicated server (DS).

[0123] After receiving the address query instruction, the business management server (StarPSvr) performs accurate retrieval in the data stored by itself according to the key information such as the current game state, the area where the player is located, and the task progress of the player contained in the instruction. For example, when the player is in a specific stage of the mainline task of the game, the business management server (StarPSvr) locates the first dedicated server (DS) to which the player should be connected according to the pre-set rules and data storage structure, and obtains the target address thereof.

[0124] After the business management server (StarPSvr) successfully queries the target address of the first dedicated server (DS), it feeds back the address to the resource optimization system. Upon receiving the target address, the resource optimization system quickly sends it to the client. After obtaining the target address, the client attempts to establish a connection with the first dedicated server (DS) again based on the address, expecting to successfully connect and allow the player to normally enter the game world for game activities.

[0125] Throughout the process, when the business logic server (Gamesvr) fails to complete the address query task, the target address of the first dedicated server (DS) is queried by calling the business management server (StarPSvr), realizing the cooperative coordination between different servers in the resource optimization system. This mechanism ensures that the client can still obtain the accurate address of the first dedicated server (DS) even in complex game scenarios, effectively guaranteeing the continuity and stability of game services. It fully utilizes the advantages of the business management server (StarPSvr) in server management and game world information integration, providing a reliable backup path for the connection between the client and the first dedicated server (DS), and improving the system's ability to cope with complex scenarios.

[0126] The method provided by the embodiments of the present application switches to the business management server for querying when the business logic server fails to query, which is a quick and effective backup query strategy that can reduce connection problems caused by address query failure. The client can obtain the target address in time and attempt to establish a connection with the first dedicated server, thereby avoiding the adverse experience of users caused by long-time inability to obtain the address or connection failure, reducing the risk of user loss. At the same time, it also guarantees the stable operation of the entire game or related business system, so that the system can still maintain a good service state when facing complex and variable business scenarios.

[0127] In an optional embodiment of the resource optimization method provided by the above embodiments of the present application, the resource optimization system further includes a second dedicated server, and the method further includes:

[0128] In the case of connection failure, obtaining the heartbeat monitoring state 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 to 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 can be understood that when a connection failure occurs, the first dedicated server (DS) is checked by checking the heartbeat monitoring state of the first dedicated server (DS) to determine whether the first dedicated server (DS) is abnormal. If abnormal, a series of measures are taken to ensure data security and optimize resources, including migrating data to a 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 can be determined whether the server is in a normal operating state. For example, in a game scenario, the server may be abnormal due to hardware failure, network problems or software errors. In the case of connection failure, the heartbeat monitoring state of the first dedicated server is triggered. This triggering mechanism can check when the server problem may occur, avoiding unnecessary monitoring overhead.

[0132] When the heartbeat monitoring state of the first dedicated server is abnormal, the data in it is stored to the second dedicated server to ensure the safety and availability of the data. For example, in a game server scenario, if the player's game data (character level, equipment, game progress, etc.) is lost, it will greatly affect the player's experience. By migrating data, 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, 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 structure 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 waste 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, ensuring that the server no longer receives and processes new requests.

[0134] Clearing data is to completely release the resources of the first dedicated server. When the server is abnormal and the data has been migrated, the data stored in it has no need to be retained, and clearing the data can restore the server to its initial state, facilitating subsequent reconfiguration or other purposes. This step may involve deleting game data files, temporary cache files and other related data storage contents in the first dedicated server.

[0135] The method provided by the embodiments of the present application protects important data resources by timely data migration, avoids data loss caused by server failure. The data of the abnormal server is stopped and cleared, the server resources are released, the resource utilization of the whole system is improved, and resource waste on the fault server is avoided. The abnormal server can be processed in time, the further interference of the fault server on the operation of the whole system is prevented, and the stability and reliability of the system are ensured.

[0136] In an optional embodiment of the resource optimization method provided by the above embodiments of the present application, the heartbeat monitoring state of the first dedicated server is obtained, comprising:

[0137] Based on the communication relationship between the business management server and the first dedicated server, the heartbeat state of the first dedicated server in N cycles is monitored by the business management server;

[0138] The heartbeat monitoring state of the first dedicated server is abnormal, comprising:

[0139] The heartbeat state of the first dedicated server is not monitored by the business management server in N cycles.

[0140] It can be understood that the player tries to establish a connection with the first dedicated server (DS) through the game client. When the client fails to connect the first dedicated server (DS) for multiple times according to the target address obtained from the business logic server (Gamesvr) or the business management server (StarPSvr), the system will determine that the connection fails, and then trigger a series of subsequent operations to ensure the stable operation of the system and the reasonable 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 monitor the heartbeat of the first dedicated server (DS). In actual application, the business management server (StarPSvr) and the first dedicated server (DS) will send heartbeat signals to each other at a predetermined 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, it is assumed that N is 5, that is, the business management server (StarPSvr) will continuously monitor within 5 heartbeat cycles. If the business management server (StarPSvr) does not receive the heartbeat signal of the first dedicated server (DS) within the 5 cycles, it is determined that the heartbeat monitoring state of the first dedicated server (DS) is abnormal.

[0142] When it is determined that the heartbeat monitoring state of the first dedicated server (DS) is abnormal, the system will start a series of operations such as data storage, service stop and data clearing:

[0143] The system calls the first dedicated server (DS) to extract the service data corresponding to all clients currently connected to the server. These data cover the key information of players in the game, such as character level, equipment condition, task progress, and coordinates of the game scene. Taking a role-playing game as an example, various activities of players in the game are recorded as corresponding service data. After the system packages these data, it transmits and stores them to the second dedicated server, ensuring that the data will not be lost after the first dedicated server (DS) stops running, and providing support for possible data recovery or business continuation in the future.

[0144] In order to ensure the smooth progress of data migration and server stop service process, the system will forcibly disconnect all clients currently connected to the first dedicated server (DS). In actual operation, the system will send a disconnection notification to the client, informing the player that he needs to disconnect temporarily due to abnormal server conditions. Then, the system will actively disconnect the connection with the client, ensuring that all clients are disconnected from the first dedicated server (DS).

[0145] After all clients are disconnected, the system will stop all processes of the first dedicated server (DS). This includes game core logic processing processes, data storage and reading processes, network communication processes, etc. By stopping these processes, the first dedicated server (DS) will no longer occupy system computing resources, memory resources, and network bandwidth, etc., realizing the release of resources.

[0146] In order to completely recycle resources and avoid interference caused by residual data, the system will clean up the data storage area of the first dedicated server (DS). All previously stored player service data, game world state data, etc. are deleted, so that the first dedicated server (DS) returns to the initial state, in order to be reconfigured and used later.

[0147] The method provided by the embodiments of the present application can effectively deal with abnormal situations of the first dedicated server (DS), realize proper saving of data, reasonable recycling of server resources, and stable operation of the system, and provide strong guarantee for the normal operation of the entire resource optimization system.

[0148] In one optional embodiment of the resource optimization method provided by the above-mentioned embodiments of the present application, the heartbeat monitoring state of the first dedicated server is obtained, comprising:

[0149] Based on the communication relationship between the service management server and the first dedicated server, the heartbeat state of the service management server in N-1 cycles is called by the first dedicated server;

[0150] The heartbeat monitoring state of the service management server is abnormal, comprising:

[0151] In N-1 cycles, the first dedicated server does not monitor the heartbeat state of the service management server.

[0152] It can be understood that during the game running process, when the client fails to connect with the first dedicated server (DS), the system starts to pay attention to the heartbeat monitoring state between servers to determine whether the server is running healthily. At this time, based on the communication relationship established between the service management server (StarPSvr) and the first dedicated server (DS), the system will start a specific process to obtain the heartbeat monitoring state of the first dedicated server (DS) to the service management server (StarPSvr).

[0153] The system will call the first dedicated server (DS) to monitor the heartbeat of the service management server (StarPSvr) according to the preset rule. The monitoring period set here is N-1 cycles, and the length of each cycle is defined in the system, for example, it may be related to the regular heartbeat detection frequency between servers in the game scene. Assuming that the regular heartbeat detection frequency is 10s / time, then each cycle is 10s (the cycle length is determined according to the system design in actual application).

[0154] The first dedicated server (DS) starts to continuously monitor the heartbeat signal sent by the service management server (StarPSvr) in these N-1 cycles. It will start a special monitoring thread or use the existing communication monitoring module to wait for and detect whether the heartbeat signal from the service management server (StarPSvr) is received 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 to record these additional information). These records are helpful for subsequent comprehensive judgment of the heartbeat state of the service management server (StarPSvr).

[0156] If no heartbeat signal is received in a certain cycle, the first dedicated server (DS) will also accurately record the situation that no signal is received in the cycle.

[0157] After the monitoring of N-1 cycles is completed, the first dedicated server (DS) will determine whether the heartbeat monitoring state of the service management server (StarPSvr) is abnormal according to the recorded information. The specific judgment condition is: if the first dedicated server (DS) does not monitor the heartbeat state of the service management server (StarPSvr) in these N-1 cycles, that is, no valid heartbeat signal is received, it is determined that the heartbeat monitoring state of the service management server (StarPSvr) is abnormal.

[0158] Assuming N-1 = 4 (i.e. set monitoring 4 cycles), each cycle 10s. In the 40s monitoring time, if the first dedicated server (DS) has not received the heartbeat signal of the service management server (StarPSvr) all the time, the abnormal judgment condition is met.

[0159] Once it is determined that the heartbeat monitoring state of the service management server (StarPSvr) is abnormal, the result is fed back to the system. The system will trigger a series of related operations according to the pre-set strategy, such as further checking other states of the system, or starting resource recycling and server adjustment process, to ensure the stability and reliability of the entire game system.

[0160] For ease of understanding, please refer to Figure 6 , Figure 6 The schematic diagram of the DS resource optimization mechanism is shown. The service management server (StarPSvr) performs heartbeat keep-alive with the dedicated server (DS). Specifically, the service management server (StarPSvr) receives the heartbeat signal of the dedicated server (DS). If the service management server (StarPSvr) does not receive the heartbeat signal of the dedicated server (DS) for N cycles (i.e. the dedicated server (DS) is out of connection for N cycles), the service 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 service management server (StarPSvr). If the dedicated server (DS) does not receive the heartbeat signal of the service management server (StarPSvr) for N-1 cycles (i.e. the service management server (StarPSvr) is out of connection for N-1 cycles), the data of the dedicated server (DS) is archived in whole, and then the network connection between the first dedicated server (DS) and the clients is actively cut off, ensuring that all clients can be disconnected from the server in time, avoiding data transmission interruption or conflict during server stop running.

[0161] In an optional embodiment of the resource optimization method provided in the above embodiments of the application, storing the data in the first dedicated server to the second dedicated server comprises:

[0162] calling the first dedicated server to obtain the service data corresponding to all clients currently connected to the first dedicated server;

[0163] stopping the service of the first dedicated server, comprising:

[0164] forcibly logging off all clients currently connected to the first dedicated server;

[0165] Stopping all processes of the first dedicated server.

[0166] It can be understood that during the game running, a specific communication relationship is established between the business management server (StarPSvr) and the first dedicated server (DS). The system will start the monitoring process of the heartbeat state of the first dedicated server (DS) according to this communication relationship. Specifically, the business management server (StarPSvr) and the first dedicated server (DS) will interact with the heartbeat signal at a fixed time interval according to the pre-set rule, for example, maintaining a heartbeat detection frequency of 10s / time, so as to keep the connection between the two parties alive and monitor the running state of the other party in real time.

[0167] When it is necessary to obtain the heartbeat monitoring state of the first dedicated server (DS), the system will call the business management server (StarPSvr) to perform the monitoring task. The business management server (StarPSvr) will strictly monitor the heartbeat state of the first dedicated server (DS) within N cycles according to the set time interval.

[0168] For example, it is assumed that the set N value is 6, that is, the business management server (StarPSvr) will closely monitor whether the heartbeat signal sent by the first dedicated server (DS) can be received within the next 6 heartbeat cycles (10s per cycle, 60s in total). During this period, the business management server (StarPSvr) will accurately record the reception condition in each cycle.

[0169] After the monitoring process of N cycles is completed, the business management server (StarPSvr) will determine whether the heartbeat monitoring state of the first dedicated server (DS) is abnormal according to the recorded information.

[0170] If the business management server (StarPSvr) does not monitor the heartbeat state of the first dedicated server (DS) within the N cycles, that is, does not receive any heartbeat signal from the first dedicated server (DS), the system will determine that the heartbeat monitoring state of the first dedicated server (DS) is abnormal.

[0171] Taking the case of the just assumed N as 6 as an example, if the business management server (StarPSvr) does not receive the heartbeat signal sent by the first dedicated server (DS) within the 6 10s cycles, it meets the determination condition of heartbeat monitoring abnormality.

[0172] Once the system determines that the heartbeat monitoring state of the first dedicated server (DS) is abnormal, a series of subsequent operations related to resource optimization are triggered. These operations include: storing the data in the first dedicated server (DS) to the second dedicated server, forcibly disconnecting all clients currently connected to the first dedicated server (DS), 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 and ensure the stable operation of the entire game system, while reasonably recycling and optimizing system resources.

[0173] Through the above specific implementation, the mechanism of acquiring the heartbeat monitoring state of the first dedicated server and determining the abnormality is effectively implemented in the actual game environment, providing key monitoring and judgment basis for the entire resource optimization system to deal with server abnormal situations, which is an important link to ensure system stability and reasonable use of resources.

[0174] It can be understood that, please refer to Figure 7 , Figure 7 The timing diagram of DS resource optimization is shown. After the data migration of the first dedicated server to the second dedicated server is completed, the first dedicated server needs to be requested to enter the resource optimization process. As Figure 7 (A) in the related art, the strong kill process of the first dedicated server includes: 1. When the DS needs to be migrated, StarSvr will initiate a "terminateDs strong kill" operation. 2. After receiving the "terminateDs strong kill" instruction from StarSvr, the DS will perform a "kick back write start" operation, and the DS will start the player data back write operation to ensure that the data can be saved. 3. If the DS side exceeds the g6 component rpc timeout duration during data back write, the g6 component will intervene and perform a "terminate timeout g6 strong kill" operation. In this case, since the data back write operation is not completed, there is a risk of data loss. 4. If there is no timeout, the DS will complete the "kick back write end" operation to ensure complete data back write. The existing self-destruction process uses the active terminateDs strong kill method, which can achieve DS migration and shutdown, but there is a risk of data loss. When the DS is back writing data, if it exceeds the g6 component rpc timeout duration, the g6 component will forcibly terminate the DS, resulting in incomplete data back write and thus causing data loss. This hidden danger is particularly prominent in high load or unstable network conditions, which may have a serious impact on user experience and data security.

[0175] As Figure 7In the middle (B), 1, the service management server initiates a "kick all offline start" operation, which is to ensure that all users connected to the first dedicated server can be safely kicked offline before the DS self-destruction. After receiving the "kick all offline start" instruction, the first dedicated server will perform corresponding processing. 2, after receiving the instruction from the service management server, the first dedicated server will perform a "kick back write 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 a "kick back write end" operation to indicate that the data write-back has been completed. 4, after the first dedicated server completes the data write-back, the service management server will initiate a "kick all offline end" operation to ensure that all users have successfully logged off. 5, the service management server will perform a "terminateDs force kill" operation to forcefully kill the first dedicated server, completing the DS self-destruction process. The DS self-destruction mechanism of the present application is divided into two stages: the first stage is to actively kick users to ensure that user data can be safely written back; the second stage is to actively force kill, which forcefully kills the first dedicated server after confirming that the users are logged off and the data write-back is completed. This mechanism ensures the safety of the data during the DS self-destruction process through the orderly interaction between the service management server, the second dedicated server and the first dedicated server, avoiding the risk of data loss.

[0176] The method provided by the embodiments of the present application includes a first stage and a second stage for resource optimization of the DS. In the first stage, all clients currently connected to the first dedicated server are forcibly logged off, and the TCAplus module is used for forcibly logging off and writing back. When the write-back is completed, the forcibly logging off of all clients currently connected to the first dedicated server is completed. In the second stage, the first dedicated server is forcefully killed using terminateDs to stop all processes of the first dedicated server.

[0177] The method provided by the embodiments of the present application is crucial for resource optimization in the game scene. If the service management server (StarPSvr) heartbeat is abnormal, it may mean that the communication between servers has a problem, and the first dedicated server (DS) may not be able to normally receive instructions or data from the service 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 attempt to re-establish the communication connection between servers, or start a backup server to take over part of the functions, in order to minimize the impact on game players and ensure the continuous normal operation of the game.

[0178] In an optional embodiment of the resource optimization method provided by the above-mentioned embodiments of the present application, releasing the resources of the first dedicated server includes:

[0179] Based on the communication relationship between the service management server and the first dedicated server, the first dedicated server sends 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 service management server is called, and in the case that the service management server confirms that the first dedicated server meets the shutdown condition, the data in the first dedicated server is stored to 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 can be understood that when the system determines that the heartbeat monitoring state 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] The first dedicated server is called to obtain service data: the system will actively call the first dedicated server (DS). In the process of game running, the first dedicated server (DS) undertakes the important responsibilities of game core logic execution and data storage management, 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 service data corresponding to all clients connected to the server through a specific interface and instruction.

[0183] For example, in the game, these service data include detailed information of the player's role, such as level, health, magic value, skill situation, etc.; there are also equipment data owned by the player, including equipment name, attribute addition, strengthening level, etc.; at the same time, it also covers the task progress being carried out by the player, such as completed task steps, remaining task objectives, etc.; and the position coordinates of the game scene where the player is located, the map related state data of the game world, etc. These data are crucial to the game experience of the player, and record the real-time state of the player in the game.

[0184] After receiving the instruction, the first dedicated server (DS) will arrange and package these service data according to the preset data structure and format, form a complete data set, and prepare to transmit 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 the data can be transmitted safely and accurately. Using stable network connection and reliable data transmission protocol, the packaged service data is sent from the first dedicated server (DS) to the second dedicated server.

[0186] The second dedicated server, upon receiving the data, will store these service data in appropriate storage locations according to pre-set data storage rules. For example, the data is stored by player ID for quick and accurate retrieval and extraction when needed to restore player data.

[0187] After completing the data storage operation, the system will proceed to stop running the first dedicated server (DS), with the following specific steps:

[0188] Force client offline: To ensure the smoothness of the server stop running process and the integrity of the data, the system will force all clients currently connected to the first dedicated server (DS) to go offline.

[0189] The system will send offline notifications to all connected clients through the network, which may briefly explain that due to abnormal server conditions, temporary disconnection is required, and remind players to try logging in again later.

[0190] Subsequently, the system will actively cut off the network connection between the first dedicated server (DS) and these clients, ensuring that all clients can timely disconnect from the server, avoiding data transmission interruption or conflict during the server stop running process.

[0191] Stop all processes of the server: 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 game running, including game core logic processing process, which is responsible for processing various operation instructions of players such as attack, movement, interaction, etc.; data storage and reading process, used to manage game data storage and extraction; network communication process, responsible for data interaction with clients and other servers; game scene rendering and updating 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 pausing the data storage and reading process to ensure data stability; then stopping the game core logic processing process and scene rendering and updating process, etc., finally making the first dedicated server (DS) completely stop running, no longer occupying system computing resources, memory resources, network bandwidth, etc.

[0194] It can be understood that please refer to Figure 8 , Figure 8Another timing diagram of the DS resource optimization is shown. Before the first dedicated server performs the resource optimization, the first dedicated server sends a shutdown request instruction to the service management server to inquire whether the service management server can shut down the first dedicated server. In the case that the service management server confirms that the first dedicated server meets the shutdown condition, the first dedicated server enters the shutdown process. Also including two stages, the embodiments of the present application do not repeat.

[0195] The method provided by the embodiments of the present application stores the data of the first dedicated server to the second dedicated server and stops the operation of the first dedicated server, which can be orderly and reliably performed in the actual game scenario, and guarantees the data security and the reasonable recycling of resources of the game system when the server is abnormal.

[0196] Please refer to Figure 9 , Figure 9 In FIG. A, a resource optimization system 910 is shown, which includes a service logic server 9101, a service management server 9102 and a first dedicated server 9103, wherein,

[0197] The service logic server 9101 receives an address query instruction sent by a client, wherein the address query instruction is used to instruct the service logic server to query the address information of the first dedicated server, the service logic server provides logical driving for a target service, and the first dedicated server is used to provide a running environment for the target service;

[0198] The service logic server 9101 or the service management server 9102 queries 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 with the first dedicated server according to the target address;

[0200] In the case of connection failure, the first dedicated server 9103 acquires the heartbeat monitoring state of the service management server, wherein the service management server has a communication relationship with the first dedicated server;

[0201] In the case that the heartbeat monitoring state of the service management server 9101 is abnormal, the first dedicated server releases resources.

[0202] In an optional embodiment of the resource optimization system provided by the above embodiments of the present application, the service logic server 9101 queries the target address of the first dedicated server from the service logic server according to the address query instruction.

[0203] In an optional embodiment of the resource optimization system provided in the above embodiments of the present application, in the case where the target address of the dedicated server is not queried by the business logic server 9101, the target address of the first dedicated server is queried from the business management server by the business management server 9102 according to the address query instruction.

[0204] In an optional embodiment of the resource optimization system provided in the above embodiments of the present application, as shown in (B), the resource optimization system 910 further comprises a second dedicated server 9104, Figure 9

[0205] In the case of connection failure, the business management server 9102 acquires the heartbeat monitoring state of the first dedicated server;

[0206] If the heartbeat monitoring state of the first dedicated server is abnormal, the data of the first dedicated server 9103 is stored to 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 embodiments of the present application, based on the communication relationship between the business management server and the first dedicated server, the business management server 9102 monitors the heartbeat state of the first dedicated server 9103 in N cycles;

[0208] In the N cycles, the business management server does not monitor the heartbeat state of the first dedicated server, which indicates that the heartbeat monitoring state of the first dedicated server 9103 is abnormal

[0209] In an optional embodiment of the resource optimization system provided in the above embodiments of the present application, the business data corresponding to all the clients currently connected to the first dedicated server 9103 is acquired;

[0210] All the clients currently connected to the first dedicated server 9103 are forced to be offline;

[0211] All the processes of the first dedicated server 9103 are stopped.

[0212] In an optional embodiment of the resource optimization system provided in the above embodiments of the present application,

[0213] The first dedicated server 9103 sends a shutdown request instruction to the business management server 9102, wherein the shutdown request instruction is used to indicate to stop the service of the first dedicated server;

[0214] ​In a case where the service management server 9103 confirms that the first dedicated server 9103 meets the shutdown condition, data in the first dedicated server 9103 is stored to the second dedicated server 9104, and 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 embodiments of the present application,

[0216] The first dedicated server 9103 monitors the heartbeat state of the service management server 9102 in N-1 periods.

[0217] In the N-1 periods, the first dedicated server 9103 does not monitor the heartbeat state of the service management server 9102, indicating that the heartbeat monitoring state of the service management server 9102 is abnormal.

[0218] Please refer to Figure 10 , Figure 10 A resource optimization apparatus 1010 is shown, comprising:

[0219] The receiving module 10101 is configured to receive an address query instruction sent by a client, wherein the address query instruction is used to instruct a service logic server to query address information of a first dedicated server, the service logic server provides logical driving for a target service, and the first dedicated server is used to provide a running environment for the target service.

[0220] The querying module 10102 is configured to query a target address of the first dedicated server according to the address query instruction.

[0221] The sending module 10103 is configured to send the target address of the first dedicated server to the client, so that the client connects with the first dedicated server according to the target address.

[0222] The acquiring module 10104 is configured to acquire a heartbeat monitoring state of a service management server in a case of connection failure, wherein the service management server has a communication relationship with the first dedicated server.

[0223] The releasing module 10105 is configured to release resources of the first dedicated server in a case where the heartbeat monitoring state of the service management server is abnormal.

[0224] In an optional embodiment of the resource optimization apparatus provided in the above embodiments of the present application, the querying module 10102 is further configured to call a service logic server, and query the target address of the first dedicated server from the service logic server according to the address query instruction.

[0225] In an optional embodiment of the resource optimization apparatus provided in the above-mentioned embodiments of the present application, the query module 10102 is further configured to, in the case where the target address of the dedicated server is not obtained from the service logic server, invoke the service management server, and obtain the target address of the first dedicated server from the service management server according to the address query instruction.

[0226] In an optional embodiment of the resource optimization apparatus provided in the above-mentioned embodiments of the present application, the resource optimization system further comprises a second dedicated server,

[0227] The acquisition module 10104 is further configured to, in the case where the connection fails, acquire the heartbeat monitoring state of the first dedicated server.

[0228] The release module 10105 is further configured to, if the heartbeat monitoring state of the first dedicated server is abnormal, 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.

[0229] In an optional embodiment of the resource optimization apparatus provided in the above-mentioned embodiments of the present application, the acquisition module 10104 is further configured to, based on the communication relationship between the service management server and the first dedicated server, invoke the service management server to monitor the heartbeat state of the first dedicated server in N cycles; and the service management server does not monitor the heartbeat state of the first dedicated server in the N cycles.

[0230] In an optional embodiment of the resource optimization apparatus provided in the above-mentioned embodiments of the present application, the release module 10105 is further configured to invoke the first dedicated server to acquire the service data corresponding to all the clients currently connected to the first dedicated server; forcibly disconnect all the clients currently connected to the first dedicated server; and stop all the processes of the first dedicated server.

[0231] In an optional embodiment of the resource optimization apparatus provided in the above-mentioned embodiments of the present application, the release module 10105 is further configured to, based on the communication relationship between the service management server and the first dedicated server, invoke 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.

[0232] In the case where the service management server confirms that the first dedicated server meets the shutdown condition, the release module 10105 is further configured 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.

[0233] In an optional embodiment of the resource optimization apparatus provided in the above-mentioned embodiments of the present application,

[0234] The acquisition module 10104 is further configured to invoke the first special-purpose server to monitor the heartbeat state of the business management server in N-1 cycles based on the communication relationship between the business management server and the first special-purpose server; and the first special-purpose server does not monitor the heartbeat state of the business management server in the N-1 cycles.

[0235] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the system, device and unit described above can refer to the corresponding processes in the foregoing method embodiments, which will not be described 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 target, and can be implemented entirely or partially by using software, hardware (such as a processing circuit or a memory) or a combination thereof. Similarly, one 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 a part of an overall module or unit that includes the functions of the module or unit.

[0237] In several embodiments provided in the present application, it should be understood that the disclosed system, device and method 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, and actual implementation can have another division manner. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interface, device or unit, and can be electrical, mechanical or other forms.

[0238] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e. they can be located in one place or distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiments.

[0239] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0240] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application or the entire or part of the technical solutions that essentially contribute to the prior art can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a server or a terminal device, etc.) to execute all or part of the steps of the method described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various computer program storage media.

[0241] The above-described embodiments are merely used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for some of the technical features; and these modifications or replacements do not cause the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method of resource optimization, characterized by, The method is applied to a resource optimization system, the resource optimization system comprising a business logic server, a business management server and a first dedicated server, and the method comprises: receiving an address query instruction sent by a client, wherein the address query instruction is used to instruct the business logic server to query address information of the first dedicated server, the business logic server provides logical driving for a target business, and the first dedicated server is used to provide a running environment for the target business; querying a 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 with the first dedicated server according to the target address; in the case of connection failure, acquiring a heartbeat monitoring state of the business management server, wherein the business management server has a communication relationship with the first dedicated server; in the case that the heartbeat monitoring state of the business management server is abnormal, releasing resources of the first dedicated server.

2. The method for resource optimization of claim 1, wherein, The method comprises: calling the business logic server to query the target address of the first dedicated server from the business logic server according to the address query instruction.

3. The method for resource optimization according to any of claims 1-2, characterized in that, The method comprises: in the case that the target address of the first dedicated server is not queried from the business logic server, calling the business management server to query the target address of the first dedicated server from the business management server according to the address query instruction.

4. The method for resource optimization of claim 1, wherein, The resource optimization system further comprises a second dedicated server, and the method further comprises: in the case of connection failure, acquiring a heartbeat monitoring state of the first dedicated server; if the heartbeat monitoring state of the first dedicated server is abnormal, storing data in the first dedicated server to the second dedicated server, stopping running the first dedicated server, and clearing data of the first dedicated server.

5. The method for resource optimization of claim 4, wherein, The method comprises: based on the communication relationship between the business management server and the first dedicated server, calling the business management server to monitor heartbeat states of the first dedicated server in N cycles, N being an integer greater than 1; The heartbeat monitoring state of the first dedicated server is abnormal, which comprises: in the N cycles, the business management server does not monitor the heartbeat state of the first dedicated server.

6. The method for resource optimization of claim 4, wherein, The method comprises: calling the first dedicated server to acquire business data corresponding to all clients currently connected to the first dedicated server; The method comprises: forcibly disconnecting all clients currently connected to the first dedicated server; stopping running all processes of the first dedicated server.

7. The method for resource optimization of claim 1, wherein, The releasing the resource of the first dedicated server comprises: Based on the communication relationship between the service management server and the first dedicated server, the first dedicated server is called 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 service management server is called to store the data in the first dedicated server to the second dedicated server and stop the service of the first dedicated server and clear the data of the first dedicated server in the case that the service management server confirms that the first dedicated server meets the shutdown condition.

8. The method for resource optimization of claim 1, wherein, The obtaining the heartbeat monitoring state of the service management server comprises: Based on the communication relationship between the service management server and the first dedicated server, the first dedicated server is called to monitor the heartbeat state of the service management server in N-1 periods; The heartbeat monitoring state of the service management server is abnormal, comprising: In the N-1 periods, the first dedicated server does not monitor the heartbeat state of the service management server.

9. A resource optimization system, characterized by, Comprise: Business logic server, service management server and first dedicated server, wherein, The business logic server receives 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 logical drive for a target service, and the first dedicated server is used to provide running environment for the target service; The business logic server or the service management server queries the target address of the first dedicated server according to the address query instruction; The business logic server or the service management server sends the target address of the first dedicated server to the client, so that the client connects with the first dedicated server according to the target address; In the case of connection failure, the first dedicated server obtains the heartbeat monitoring state of the service management server, wherein the service management server has a communication relationship with the first dedicated server; In the case that the heartbeat monitoring state of the service management server is abnormal, the first dedicated server releases resources.

10. A resource optimization apparatus, characterized by, Comprise: The receiving module is used for 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 logical drive for a target service, and the first dedicated server is used to provide running environment for the target service; The query module is used for querying the target address of the first dedicated server according to the address query instruction; The sending module is used for sending the target address of the first dedicated server to the client, so that the client connects with the first dedicated server according to the target address; The obtaining module is used for obtaining the heartbeat monitoring state of the service management server in the case of connection failure, wherein the service management server has a communication relationship with the first dedicated server; A releasing module is configured to release the resource of the first dedicated server if the heartbeat monitoring state of the service management server is abnormal. 11.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-10. The computer program is executed by the processor to implement the steps of the resource optimization method in any one of claims 1 to 8.

12. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the resource optimization method in any one of claims 1 to 8.

13. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the resource optimization method in any one of claims 1 to 8. The computer program is executed by the processor to implement the steps of the resource optimization method in any one of claims 1 to 8.

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