A data processing method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202311201981.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-15
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2043-09-15
AI Technical Summary
随着游戏的长线运营,游戏服务器的数量也不断增加,但许多旧游戏服务器中的玩家数量和活跃度不断降低,不仅造成了大量服务器的资源浪费,也提升了服务器的管理成本及复杂度
[0016] The embodiments disclosed herein have the following advantages:
Smart Images

Figure CN117221318B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a data processing method, a data processing apparatus, an electronic device, and a computer-readable storage medium. Background Technology
[0002] With the widespread use of smartphones, tablets, and other mobile devices, people can play games anytime, anywhere. As people's living standards and consumption concepts improve, players' demands for games are constantly changing; they are no longer satisfied with simple leisure and entertainment, but are paying more attention to game quality and experience. To provide better service to players, games typically adopt a client-server (C / S) architecture, where the game client and game server communicate via a network. Furthermore, to create a healthy player ecosystem and ensure a good growth environment for players at different life stages, many games adopt a rolling server model. This operational method requires a server-segmented architecture, using a PHP (Hypertext Preprocessor)-based web server, with one physical server corresponding to one game server (different game servers correspond to different game environments, player groups, game rules, etc.). As games operate over a long period, the number of game servers continues to increase, but the number of players and activity levels on many older game servers decline, resulting in significant waste of server resources and increased server management costs and complexity. Summary of the Invention
[0003] In view of the above problems, embodiments of the present disclosure are proposed to provide a data processing method and a corresponding data processing apparatus, an electronic device, and a computer-readable storage medium that overcome or at least partially solve the above problems.
[0004] This disclosure provides a data processing method, the method comprising:
[0005] In response to a logical server migration request sent by the first physical server, the access domain name corresponding to the first logical server requesting migration is adjusted from its original mapping to the first physical server to its mapping to the second physical server, thus obtaining the adjusted mapping relationship between the access domain name and the physical server. The logical server migration request is used to request the migration of the first logical server from the first physical server to the second physical server.
[0006] Based on the adjusted mapping relationship between the access domain name and the physical server, the resource access request is received through the second physical server, according to the access domain name information carried in the resource access request sent by the client.
[0007] The second physical server provides the resource requested by the resource access request through the first logical server and sends the resource to the client;
[0008] The logic server is a collection of corresponding operating logic, and the second physical server stores at least two sets of independent operating logic.
[0009] This disclosure also discloses a data processing apparatus, the apparatus comprising:
[0010] The adjustment module is used to respond to the logical server migration request sent by the first physical server, and adjust the access domain name corresponding to the first logical server that is requested to be migrated from the original mapping with the first physical server to the mapping with the second physical server, so as to obtain the mapping relationship between the adjusted access domain name and the physical server. The logical server migration request is used to request the migration of the first logical server from the first physical server to the second physical server.
[0011] The receiving module is used to receive the resource access request carried in the resource access request sent by the client through the second physical server based on the adjusted mapping relationship between the access domain name and the physical server.
[0012] The providing and sending module is used for the second physical server to provide the resource requested by the resource access request through the first logical server, and to send the resource to the client;
[0013] The logic server is a collection of corresponding operating logic, and the second physical server stores at least two sets of independent operating logic.
[0014] This disclosure also discloses an electronic device, including: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements a data processing method as described above.
[0015] This disclosure also discloses a computer-readable storage medium storing a computer program that, when executed by a processor, implements a data processing method as described above.
[0016] The embodiments disclosed herein have the following advantages:
[0017] In this embodiment, in response to a logical server migration request sent by a first physical server, the first logical server requesting migration can be determined. The first logical server corresponds to an access domain name. The access domain name of the first logical server can be adjusted from its original mapping to the first physical server to its mapping to the second physical server, resulting in the adjusted mapping relationship between the access domain name and the physical servers. Based on this adjusted mapping relationship, the second physical server can receive resource access requests for the first logical server, and the first logical server can provide the requested resources to the client. By adopting the above method, the migration of logical servers can be performed without the player's awareness, smoothly switching the one-server-per-machine design (one physical server includes only one logical server) to one-server-per-machine design (one physical server can include multiple logical servers), thereby reducing server costs and improving server resource utilization. This disclosure only requires adjusting the mapping relationship between the access domain name and the physical server to guide resource access requests for the first logical server to the correct physical server, requiring minimal modifications. Furthermore, corresponding identification information can be configured for the logical servers to distinguish them from other logical servers on the same physical server. This achieves business logic and data storage isolation between multiple logical servers on the same physical server, while allowing multiple logical servers to share the computing resources of that physical server. The logical data of the migrated logical servers remains essentially unchanged, minimizing changes to business logic, ensuring data stability and security, and without affecting the operation and ecosystem of the entire system. Attached Figure Description
[0018] Figure 1 This is a flowchart of the steps of a data processing method provided in an embodiment of this disclosure;
[0019] Figure 2 This is a flowchart of another data processing method provided in an embodiment of the present disclosure;
[0020] Figure 3 This is a schematic diagram of the data layer design according to an embodiment of the present disclosure;
[0021] Figure 4 This is a schematic diagram of the timed task execution process according to an embodiment of the present disclosure;
[0022] Figure 5 This is a schematic diagram of the system design of the data processing method according to an embodiment of the present disclosure;
[0023] Figure 6 This is a structural block diagram of a data processing device provided in an embodiment of the present disclosure. Detailed Implementation
[0024] To make the above-mentioned objects, features, and advantages of this disclosure more apparent and understandable, the disclosure will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments in this disclosure, all other embodiments obtained by those skilled in the art are within the scope of protection of this disclosure.
[0025] In related technologies, for online games with a server-based architecture, when the player activity on a single game server decreases while the total number of game servers continues to increase, the following methods are generally adopted to save server resources and management costs:
[0026] (1) Data merge: Merge multiple game servers into one large game server, allowing player data from different game servers to be shared, directly reducing the number of game servers;
[0027] (2) Shut down the server: shut down the game server with low activity and low revenue, and abandon the players of the game server;
[0028] (3) Downgrade: Reduce the configuration of the game server to maintain basic operation.
[0029] The above solutions can all address the issue of high server maintenance costs to some extent in specific scenarios, but they also each have their own drawbacks, namely:
[0030] (1) Data merge: For games operated through the rolling server model, the player ecosystems in different game servers are very different. Data merge will directly break the original player ecosystem, and the risk of losing top players in the original game server will increase significantly, which may cause significant losses to the game. At the same time, online games are very sensitive to data and need to pay special attention to data security and integrity during the data merge process. The data merge solution has certain risks and a huge workload for the development team.
[0031] (2) Shutting down the server: On the one hand, after shutting down the server, it is necessary to compensate players or allow them to migrate to other game servers. This operation is very complicated and may affect other game servers that are in operation. On the other hand, shutting down the server will send a dangerous signal to players, which will have a great impact on the game's reputation and player confidence, and may lead to a decrease in players' willingness to pay, resulting in losses to the game.
[0032] (3) Downgrading: This can only reduce a portion of the game server maintenance costs, with limited effect; it will also lead to a decrease in the stability of the game server and an increase in risk. Under long-term operation, this solution cannot play its due role.
[0033] Based on this, this disclosure relates to a multi-server design scheme based on a web server under a distributed server architecture, which smoothly switches the single-server design to multi-server design without the player's awareness, thereby reducing server costs and improving server resource utilization.
[0034] In this embodiment, in response to a logical server migration request sent by a first physical server, the first logical server requesting migration can be determined. The first logical server corresponds to an access domain name. The access domain name of the first logical server can be adjusted from its original mapping to the first physical server to its mapping to a second physical server, resulting in a new mapping relationship between the access domain name and the physical servers. Based on this adjusted mapping relationship, the second physical server can receive resource access requests for the first logical server, and the first logical server can provide the requested resources to the client. By employing this method, logical server migration can be performed without the player's awareness, smoothly switching from a one-server-per-machine design (one physical server includes only one logical server) to a multi-server design (one physical server can include multiple logical servers), thereby reducing server costs and improving server resource utilization. This disclosure only requires adjusting the mapping relationship between the access domain name and the physical server to guide resource access requests for the first logical server to the correct physical server, requiring minimal modifications. Furthermore, corresponding identification information can be configured for the logical servers to distinguish them from other logical servers on the same physical server. This achieves business logic and data storage isolation between multiple logical servers on the same physical server, while allowing multiple logical servers to share the computing resources of that physical server. The logical data of the migrated logical servers remains essentially unchanged, minimizing changes to business logic, ensuring data stability and security, and without affecting the operation and ecosystem of the entire system.
[0035] Reference Figure 1 The diagram illustrates a flowchart of a data processing method provided in an embodiment of this disclosure, which may specifically include the following steps:
[0036] Step 101: In response to the logical server migration request sent by the first physical server, the access domain name corresponding to the first logical server requesting migration is adjusted from being mapped to the first physical server to being mapped to the second physical server, thus obtaining the adjusted mapping relationship between the access domain name and the physical server.
[0037] A physical server refers to an independent server, that is, a physical, standalone server. The components of a physical server include a processor, hard drive, memory, system bus, etc., and are similar to a general computer architecture.
[0038] A logical server is a collection of corresponding running logics, and different collections of running logics divide the physical server into different logical servers.
[0039] As an example, a logical server can be a game server. Games operating under a rolling server model can include multiple game servers. Rolling servers, as the name suggests, involve "rolling server openings." In the early stages of game development or after a game server update, to attract more new players, game operators will conduct rolling server activities, opening new game servers and offering more favorable benefits and activities to attract player participation. Different game servers typically represent different game environments, player groups, game rules, and trading environments. Players can choose a server that suits their personal preferences and gaming needs to obtain a better gaming experience and social interaction.
[0040] In this embodiment of the disclosure, the logical server migration request is used to request the migration of a first logical server from a first physical server to a second physical server. The first logical server corresponds to an access domain name, and the access domain name of the first logical server can be adjusted from being mapped to the first physical server to being mapped to the second physical server.
[0041] As an example, the mapping between access domain names and physical servers can be stored in a proxy server. The proxy server acts as an intermediary between the client and the physical server, forwarding requests from the client to the correct target physical server. After receiving a logical server migration request from the first physical server, the second physical server can send a request to the proxy server to adjust the mapping between the access domain names and physical servers. The proxy server then adjusts the mapping between the access domain names and physical servers according to this request.
[0042] Step 102: Based on the access domain name information carried in the resource access request sent by the client, and the mapping relationship between the adjusted access domain name and the physical server, the resource access request is received through the second physical server.
[0043] The access domain name information carried in the resource access request sent by the client is the access domain name information of the first logical server. Therefore, based on the access domain name information carried in the resource access request sent by the client, the second physical server that is mapped to the access domain name information can be found from the mapping relationship between the adjusted access domain name and the physical server, and the resource access request is forwarded to the second physical server.
[0044] Step 103: The second physical server provides the resource requested by the resource access request through the first logical server and sends the resource to the client.
[0045] Among them, the logic server is a set of corresponding running logic. Different sets of running logic divide the physical server into different logic servers. The second physical server stores at least two sets of independent running logic.
[0046] Optionally, identification information can be configured for each logical server to uniquely identify it. For example, assuming the second physical server contains two sets of independent operating logic, i.e., it includes two logical servers, identification information A can be set for one logical server and identification information B can be set for the other logical server.
[0047] The identification information is used to distinguish the various logical servers located on the same physical server. Based on the identification information, the business logic layer and data layer of each logical server can be isolated. In other words, the business logic layers of various logical servers located on the same physical server are isolated from each other; the data layers of various logical servers located on the same physical server are isolated from each other, and the isolation is achieved based on the identification information.
[0048] In summary, in this embodiment, the migration of logic servers can be performed without the player's awareness, smoothly switching from a one-server-per-machine design (one physical server includes only one logic server) to a multi-server-per-machine design (one physical server can include multiple logic servers), thereby reducing server costs and improving server resource utilization. This disclosure only requires adjusting the mapping relationship between access domain names and physical servers to guide resource access requests for the first logic server to the correct physical server, requiring minimal modifications. Furthermore, corresponding identification information can be configured for the logic servers to distinguish them from other logic servers on the same physical server, achieving business logic and data storage isolation for multiple logic servers on the same physical server, while allowing multiple logic servers to share the computing resources of that physical server. The logical data of the migrated logic servers remains essentially unchanged, minimizing changes to business logic, ensuring data stability and security, and not affecting the operation and ecosystem of the entire system.
[0049] Reference Figure 2 The diagram illustrates a flowchart of another data processing method provided in this embodiment, which may specifically include the following steps:
[0050] Step 201: In response to the logical server migration request sent by the first physical server, migrate the logical data of the first logical server from the first physical server to the second physical server.
[0051] The first physical server sends a logical server migration request to the second physical server. After confirming that its own storage space meets the storage requirements, the second physical server migrates the logical data of the first logical server from the first physical server to the second physical server.
[0052] In an optional embodiment of this disclosure, before migrating the logical data of the first logical server from the first physical server to the second physical server, the data processing method of this disclosure may further include the following steps:
[0053] The first logical server is selected from multiple logical servers as the migration target, and the second physical server is selected from multiple physical servers as the storage target.
[0054] In this embodiment of the disclosure, before migrating the logical server, it is determined which logical server will be the target of migration and which physical server will be the target of storage.
[0055] In one optional embodiment of this disclosure, the logic server is a game server; the first logic server is the logic server with the smallest number of players among multiple game servers, where the number of players is less than a preset threshold; or, the first logic server is the logic server with the lowest activity level among multiple game servers, where the activity level is lower than a preset activity level threshold; or, the first logic server is the logic server with the lowest resource utilization rate among multiple game servers, where the resource utilization rate is lower than a preset resource utilization rate threshold.
[0056] For games operating in a rolling server model, all game servers can be identified, and the specific game server to be migrated can be determined based on the server's operational status.
[0057] For example, if the number of players on a game server is less than a preset threshold and the number of players on that game server is the smallest among all game servers, then that game server can be considered for migration; or, if the activity level of a game server is lower than a preset activity level threshold and the activity level on that game server is the lowest among all game servers, then that game server can be considered for migration; or, if the resource utilization rate of a game server is lower than a preset resource utilization rate threshold and the resource utilization rate on that game server is the lowest among all game servers, then that game server can be considered for migration.
[0058] The three scenarios described above involve migration when the game server is not performing well. In practice, migration conditions can also be set according to actual needs. For example, migration can be allowed even when the game server is performing well, but the performance of the physical server hosting it is insufficient to meet the game server's operational requirements. These migration conditions can be set according to actual needs, and this disclosure does not impose specific restrictions on them.
[0059] Step 202: Adjust the access domain name corresponding to the first logical server requesting migration from the original mapping to the first physical server to the mapping to the second physical server, and obtain the adjusted mapping relationship between the access domain name and the physical server.
[0060] In this embodiment of the disclosure, in response to a logical server migration request, the logical server is migrated, and the mapping relationship between the access domain name and the physical server is adjusted.
[0061] In practice, after the migration is completed, the first logical server that has been migrated to the second physical server can be configured with corresponding identification information to distinguish it from other logical servers stored in the second physical server.
[0062] Step 203: Based on the access domain name information carried in the resource access request sent by the client, and the mapping relationship between the adjusted access domain name and the physical server, the resource access request is received through the second physical server.
[0063] The access domain name information carried in the resource access request sent by the client is the access domain name information of the first logical server.
[0064] In this embodiment of the disclosure, requests from a specified access domain can be dynamically configured to be sent to a specified physical server. For example, an access domain may initially be configured to direct requests to physical server A. By dynamically modifying the domain configuration, requests from that domain can be directed to physical server B. This allows control over whether a client's request for that domain is handled by physical server A or physical server B.
[0065] Step 204: The second physical server provides the resource requested by the resource access request through the first logical server and sends the resource to the client.
[0066] In one optional embodiment of this disclosure, the second physical server stores a first mapping relationship between the identifier of the logical server and the access domain name of the logical server, and stores a second mapping relationship between the identifier of the logical server and the database of the logical server. The step of providing the resource requested by the resource access request through the first logical server may specifically include the following sub-steps:
[0067] Based on the access domain name information carried in the request protocol header of the resource access request, the identifier of the first logical server mapped to the access domain name information is retrieved from the first mapping relationship.
[0068] The database of the first logical server, which maps to the identifier of the first logical server, is retrieved from the second mapping relationship.
[0069] The database of the first logical server is responsible for providing the resources requested by the resource access request.
[0070] In practical implementation, a first mapping relationship between the logical server's identification information and its access domain name, and a second mapping relationship between the logical server's identification information and its database can be established by configuring `¥CFG`. Furthermore, a third mapping relationship can be established between the logical server's identification information and its domain name and port information. See the following example for details:
[0071]
[0072] The above ¥CFG configuration includes three items:
[0073] HOST_ID_MAP: Used to configure the first mapping relationship between the identification information of the logical server and the access domain name of the logical server;
[0074] ALIAS_HOST_ID_MAP: Used to configure a third mapping relationship between the identification information of the logical server and the domain name and port information of the logical server;
[0075] ROUTE_DB_MAP: Used to configure the second mapping relationship between the identification information of the logical server and the database of the logical server, and is used to implement data layer isolation of the logical server.
[0076] In one optional embodiment of this disclosure, the data processing method may further include the following steps:
[0077] When a resource access request includes a data caching request, a cache primary key is set using the identifier of the first logical server, and the requested cached data is bound to the cache primary key and cached on the first logical server; or,
[0078] When a resource access request includes a persistent storage request, the persistent storage database corresponding to the first logical server is created by setting the persistent storage database name through the identifier of the first logical server, and the requested storage data is stored in the persistent storage database of the first logical server.
[0079] Reference Figure 3The diagram shown is a schematic of the data layer design of an embodiment of this disclosure. The data layer of the physical server may include a caching layer and a data persistence layer. The caching layer includes a cache database (identifier 1_Cache) of the logical server identified by identifier 1 and a cache database (identifier 2_Cache) of the logical server identified by identifier 2. The data persistence layer includes a persistent storage database (identifier 1_DB) of the logical server identified by identifier 1 and a persistent storage database (identifier 2_DB) of the logical server identified by identifier 2.
[0080] In practice, the caching layer uses Redis. Within the business logic, different instances are configured to cache different content based on different business scenarios. For example, instance 1 caches player information, instance 2 caches configuration table information, and so on. When caching data, Redis needs to set a primary key. When a physical server has multiple logical servers (i.e., game servers, each corresponding to a set of game logic), data from different logical servers may be stored in the same Redis instance. For example, physical server A has three logical servers: A, B, and C. Instance 1 is used to cache player information. When player information from all three logical servers is cached in instance 1, differentiation is needed. The method is to add a unique identifier of the logical server as a prefix when setting the primary key. For example, if the original cached primary key is "user_info", then the primary key after adding the prefix becomes: A: user_info, B: user_info, C: user_info, achieving the purpose of isolating cached data from different logical servers.
[0081] The persistence layer uses MySQL. Within the same MySQL instance, different databases can be created to achieve data isolation. Using the example above, if there is a database named 'b', and there are multiple logical servers on a physical server, the persistent storage data of the three logical servers can be isolated by creating three databases: A_b, B_b, and C_b. This method also facilitates data migration without affecting other logical servers.
[0082] In one optional embodiment of this disclosure, the data processing method may further include the following steps:
[0083] Check whether the execution conditions of the scheduled task are met;
[0084] If the conditions for executing the scheduled task are met, then all logical servers of the second physical server are traversed, and the scheduled task is executed separately for each logical server.
[0085] Reference Figure 4The diagram shown illustrates the execution process of a scheduled task according to an embodiment of this disclosure. A scheduled task that executes every minute can be configured on the scheduled task system built into the physical server, serving as the entry point for the scheduled task execution proposed in this disclosure. The scheduled task execution logic can specifically include the following steps:
[0086] (1) The scheduled task information in the scheduled task system is parsed through the pre-configured file to obtain the scheduled tasks that the physical server needs to execute.
[0087] (2) Determine the execution environment of the physical server, that is, determine the game servers contained within the physical server. Specifically, you can iterate through "HOST_ID_MAP" to determine all game servers.
[0088] (3) Determine whether the execution conditions are met. If so, execute the scheduled task separately for each game server.
[0089] (4) Determine if the scheduled task is currently being executed. If it is, cancel the execution; otherwise, execute normally.
[0090] (5) Record the execution of scheduled tasks, handle tasks that are executed incorrectly, attempt to retry the execution, and perform monitoring.
[0091] In practice, physical servers typically use UNIX / LINUX operating systems. On these systems, scheduled tasks are configured using crontab, a command in Linux used to execute tasks on a schedule. For example, here is a simple crontab example:
[0092] 0 1*** / path / to / command arg1arg2
[0093] The example above indicates that the command ' / path / to / command' is executed every day at 1:00 AM, where 'arg1' and 'arg2' are the parameters of the command.
[0094] When a physical server has multiple logical servers 1, 2, and 3, and you need to execute tasks on all three logical servers simultaneously, the above configuration should be modified as follows:
[0095] 0 1*** / path / to / command arg1arg2--host_id 1
[0096] 0 1*** / path / to / command arg1arg2--host_id 2
[0097] 0 1*** / path / to / command arg1arg2--host_id 3
[0098] As the number of scheduled tasks and logic servers increases, a large number of scheduled tasks need to be configured. Their only difference is the unique identifier of the server, yet the configuration cost is high and error-prone.
[0099] The scheduled task execution logic disclosed herein does not require the operating system's crontab layer to know the number of scheduled tasks or the number of logical servers on the physical server; it only needs to configure one scheduled task.
[0100] ***** / path / to / command arg1arg2
[0101] This scheduled task is responsible for calling a script every minute to execute the scheduled task execution logic proposed in this disclosure. The scheduled task execution logic proposed in this disclosure will parse the scheduled task to be executed through a pre-set configuration file. When there is a scheduled task that meets the execution conditions, it can query the HOST_ID_MAP in the above ¥CFG to uniformly execute the scheduled task for all logical servers on the physical server.
[0102] parameter Figure 5 The diagram shown is a system design schematic of the data processing method according to an embodiment of this disclosure. After the physical server starts, it reads the multi-server configuration and starts different game servers according to their unique identifiers. Different game servers run different game logic. The descriptions of the interaction with the game client, the data layer, and the scheduled task have been mentioned above and will not be repeated here.
[0103] In summary, in this embodiment, the migration of logic servers can be performed without the player's awareness, smoothly switching from a one-server-per-machine design (one physical server includes only one logic server) to a multi-server-per-machine design (one physical server can include multiple logic servers), thereby reducing server costs and improving server resource utilization. This disclosure only requires adjusting the mapping relationship between access domain names and physical servers to guide resource access requests for the first logic server to the correct physical server, requiring minimal modifications. Furthermore, corresponding identification information can be configured for the logic servers to distinguish them from other logic servers on the same physical server, achieving business logic and data storage isolation for multiple logic servers on the same physical server, while allowing multiple logic servers to share the computing resources of that physical server. The logical data of the migrated logic servers remains essentially unchanged, minimizing changes to business logic, ensuring data stability and security, and not affecting the operation and ecosystem of the entire system.
[0104] In gaming scenarios, based on a PHP, MySQL, and Redis technology stack, this design achieves isolation between different game servers at the business logic and data layers through three levels: business logic layer, data persistence layer, and caching layer, thus enabling multiple servers on a single machine. Using this disclosed technical solution, games operating in a rolling server manner under a split-server architecture can automatically and securely split and merge the number of logic servers running on a single physical machine without player awareness, based on operational needs. This achieves low server maintenance costs and high resource utilization with minimal manpower and complexity.
[0105] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of this disclosure are not limited to the described order of actions, because according to the embodiments of this disclosure, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of this disclosure.
[0106] Reference Figure 6 The diagram shows a structural block diagram of a data processing apparatus provided in an embodiment of the present disclosure, which may specifically include the following modules:
[0107] The adjustment module 601 is used to respond to the logical server migration request sent by the first physical server, and adjust the access domain name corresponding to the first logical server that is requested to be migrated from the original mapping with the first physical server to the mapping with the second physical server, so as to obtain the mapping relationship between the adjusted access domain name and the physical server. The logical server migration request is used to request the migration of the first logical server from the first physical server to the second physical server.
[0108] The receiving module 602 is used to receive the resource access request through the second physical server based on the adjusted mapping relationship between the access domain name and the physical server, in response to the access domain name information carried in the resource access request sent by the client.
[0109] The providing and sending module 603 is used for the second physical server to provide the resource requested by the resource access request through the first logical server, and to send the resource to the client;
[0110] The logic server is a collection of corresponding operating logic, and the second physical server stores at least two sets of independent operating logic.
[0111] In this embodiment of the disclosure, the apparatus further includes:
[0112] The migration module is used to migrate the logical data of the first logical server from the first physical server to the second physical server.
[0113] In this embodiment of the disclosure, before migrating the logical data of the first logical server from the first physical server to the second physical server, the apparatus further includes:
[0114] The selection module is used to select the first logical server as the migration object from multiple logical servers, and the second physical server as the storage object from multiple physical servers.
[0115] In this embodiment of the disclosure, the logical server is a game server; the first logical server is the logical server with the smallest number of players among multiple game servers, where the number of players is less than a preset threshold; or, the first logical server is the logical server with the lowest activity level among multiple game servers, where the activity level is lower than a preset activity level threshold; or, the first logical server is the logical server with the lowest resource utilization rate among multiple game servers, where the resource utilization rate is lower than a preset resource utilization rate threshold.
[0116] In this embodiment of the disclosure, the second physical server stores a first mapping relationship between the identifier of the logical server and the access domain name of the logical server, and stores a second mapping relationship between the identifier of the logical server and the database of the logical server; the providing and sending module includes:
[0117] The first query submodule is used to query the identifier of the first logical server that is mapped to the access domain name information from the first mapping relationship based on the access domain name information carried in the request protocol header of the resource access request.
[0118] The second query submodule is used to query the database of the first logical server that is mapped to the identifier of the first logical server from the second mapping relationship;
[0119] A submodule is provided for providing the resource requested by the resource access request, which is handled by the database of the first logical server.
[0120] In this embodiment of the disclosure,
[0121] When the resource access request includes a data caching request, the apparatus further includes:
[0122] The caching module is used to set a cache primary key based on the identifier of the first logical server, and bind the requested cached data to the cache primary key and cache it in the first logical server; or,
[0123] When the resource access request includes a persistent data storage request, the apparatus further includes:
[0124] The storage module is used to create a persistent storage database corresponding to the first logical server by setting the persistent storage database name through the identifier of the first logical server, and to store the requested storage data in the persistent storage database of the first logical server.
[0125] In this embodiment of the disclosure, the apparatus further includes:
[0126] The detection module is used to detect whether the execution conditions of the scheduled task are met.
[0127] The traversal and execution module is used to traverse all logical servers of the second physical server and execute the scheduled task individually for each logical server if the execution conditions of the scheduled task are met.
[0128] In summary, in this embodiment, the migration of logic servers can be performed without the player's awareness, smoothly switching from a one-server-per-machine design (one physical server includes only one logic server) to a multi-server-per-machine design (one physical server can include multiple logic servers), thereby reducing server costs and improving server resource utilization. This disclosure only requires adjusting the mapping relationship between access domain names and physical servers to guide resource access requests for the first logic server to the correct physical server, requiring minimal modifications. Furthermore, corresponding identification information can be configured for the logic servers to distinguish them from other logic servers on the same physical server, achieving business logic and data storage isolation for multiple logic servers on the same physical server, while allowing multiple logic servers to share the computing resources of that physical server. The logical data of the migrated logic servers remains essentially unchanged, minimizing changes to business logic, ensuring data stability and security, and not affecting the operation and ecosystem of the entire system.
[0129] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0130] This disclosure also provides an electronic device, including: a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, it implements the various processes of the above-described data processing method embodiment and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0131] This disclosure also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described data processing method embodiment and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0132] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0133] Those skilled in the art will understand that embodiments of this disclosure can be provided as methods, apparatus, or computer program products. Therefore, embodiments of this disclosure can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, embodiments of this disclosure can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0134] This disclosure describes embodiments of methods, terminal devices (systems), and computer program products according to embodiments of this disclosure with reference to flowchart illustrations and / or block diagrams. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0135] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0136] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0137] While preferred embodiments of the present disclosure have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the present disclosure.
[0138] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0139] The foregoing has provided a detailed description of a data processing method, a data processing apparatus, an electronic device, and a computer-readable storage medium provided by this disclosure. Specific examples have been used to illustrate the principles and implementation methods of this disclosure. The descriptions of the above embodiments are only for the purpose of helping to understand the method and its core ideas. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this disclosure. Therefore, the content of this specification should not be construed as a limitation of this disclosure.
Claims
1. A data processing method, characterized in that, The method includes: In response to a logical server migration request sent by a first physical server, the logical data of the first logical server is migrated from the first physical server to the second physical server. The access domain name corresponding to the first logical server that is requested to be migrated is adjusted from being mapped to the first physical server to being mapped to the second physical server, thereby obtaining the adjusted mapping relationship between the access domain name and the physical server. The logical server migration request is used to request the migration of the first logical server from the first physical server to the second physical server. Based on the adjusted mapping relationship between the access domain name and the physical server, the resource access request is received through the second physical server, according to the access domain name information carried in the resource access request sent by the client. The second physical server provides the resource requested by the resource access request through the first logical server and sends the resource to the client; The logic server is a collection of corresponding operating logics. The logic server is a game server. The game operating in the rolling server mode includes multiple game servers. Different game servers represent different game environments, player groups, game rules and trading environments. The second physical server stores at least two sets of mutually independent operating logics.
2. The method according to claim 1, characterized in that, Before migrating the logical data of the first logical server from the first physical server to the second physical server, the method further includes: The first logical server is selected from multiple logical servers as the migration target, and the second physical server is selected from multiple physical servers as the storage target.
3. The method according to claim 2, characterized in that, The logical server is a game server; the first logical server is the logical server with the smallest number of players among multiple game servers, where the number of players is less than a preset threshold; or, the first logical server is the logical server with the lowest activity level among multiple game servers, where the activity level is lower than a preset activity level threshold; or, the first logical server is the logical server with the lowest resource utilization rate among multiple game servers, where the resource utilization rate is lower than a preset resource utilization rate threshold.
4. The method according to claim 1, characterized in that, The second physical server stores a first mapping relationship between the identifier of the logical server and the access domain name of the logical server, and stores a second mapping relationship between the identifier of the logical server and the database of the logical server. The resource requested by the resource access request provided through the first logical server includes: Based on the access domain name information carried in the request protocol header of the resource access request, the identifier of the first logical server mapped to the access domain name information is obtained from the first mapping relationship. The database of the first logical server that maps to the identifier of the first logical server is retrieved from the second mapping relationship; The database of the first logical server is responsible for providing the resource requested by the resource access request.
5. The method according to claim 1, characterized in that, When the resource access request includes a data caching request, the method further includes: By setting the cache primary key using the identifier of the first logical server, the requested cached data is bound to the cache primary key and cached in the first logical server; or, When the resource access request includes a persistent data storage request, the method further includes: The persistent storage database corresponding to the first logical server is created by setting the persistent storage database name through the identifier of the first logical server, and the data to be stored is stored in the persistent storage database of the first logical server.
6. The method according to claim 1, characterized in that, The method further includes: Check whether the execution conditions of the scheduled task are met; If the execution conditions of the scheduled task are met, then all logical servers of the second physical server are traversed, and the scheduled task is executed individually for each logical server.
7. A data processing apparatus, characterized in that, The device includes: The adjustment module is used to respond to a logical server migration request sent by the first physical server, migrate the logical data of the first logical server from the first physical server to the second physical server, and adjust the access domain name corresponding to the first logical server to be migrated from the original mapping with the first physical server to the mapping with the second physical server, thereby obtaining the adjusted mapping relationship between the access domain name and the physical server. The logical server migration request is used to request the migration of the first logical server from the first physical server to the second physical server. The receiving module is used to receive the resource access request carried in the resource access request sent by the client through the second physical server based on the adjusted mapping relationship between the access domain name and the physical server. The providing and sending module is used for the second physical server to provide the resource requested by the resource access request through the first logical server, and to send the resource to the client; The logic server is a collection of corresponding operating logics. The logic server is a game server. The game operating in the rolling server mode includes multiple game servers. Different game servers represent different game environments, player groups, game rules and trading environments. The second physical server stores at least two sets of mutually independent operating logics.
8. An electronic device, characterized in that, include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the steps of a data processing method as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the steps of a data processing method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
A method and apparatus for responding to a service request
CN109308223A
Game playing method matching method and device, computer equipment and storage medium
CN112843675A