Service data management method and apparatus
By detecting and updating the difference in service data in a multi-site active-active mechanism, the problem of data inconsistency between cross-data centers and within the same data center is solved, ensuring data consistency and improving business stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- VIPSHOP (GUANGZHOU) SOFTWARE CO LTD
- Filing Date
- 2022-11-29
- Publication Date
- 2026-05-19
AI Technical Summary
In the multi-site active-active mechanism, the problem of inconsistent service data across data centers and within the same data center has not been effectively resolved, which affects business stability.
By traversing the service dataset, obtaining data identifiers, calculating the absolute value of the difference in total data volume, and updating the service data in the data center when the difference exceeds a threshold, data consistency is ensured.
It enables consistency detection and correction of service data within the same data center and across data centers, shortening the latency period, reducing adverse effects, and lowering the consumption of human and material resources.
Smart Images

Figure CN115827655B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data management technology, and in particular to a service data management method and apparatus. Background Technology
[0002] With the development of the internet, various internet-based businesses are expanding, and their stability has become a major concern. Currently, the industry employs a multi-site active-active mechanism to ensure business stability. This mechanism involves deploying the same services in data centers located in different geographical areas, allowing them to provide services simultaneously. However, there is currently no technical solution to address data inconsistencies between services across data centers and within the same data center within this multi-site active-active mechanism.
[0003] Specifically, current service data is deployed across multiple data centers, with each data center containing multiple local caches, a central cache, and a database. To improve application performance, technicians typically pre-warm the service data from the local data center's database into the local and central caches using a full pre-warming method. However, the service data within the database is constantly changing. When the service data in the database changes, the corresponding service data needs to be updated in remote data centers, as well as in the local and central caches of the local data center. However, during the update process, service data update anomalies can occur, namely inconsistencies between service data centers and between the central cache, local cache, and database service data within the same data center.
[0004] Therefore, there is an urgent need to propose a service data management method and apparatus that can solve the problems of inconsistent service data among central cache, local cache and database services in the same data center, as well as inconsistent service data across data centers. Summary of the Invention
[0005] Therefore, it is necessary to provide a service data management method, apparatus, and computer equipment that can perform consistency detection and correction processing on service data within the same data center and across data centers, in order to address the aforementioned technical problems.
[0006] On the one hand, a service data management method is provided, the method being applied to service data management of a data center cluster, the data center cluster including a data center, the method comprising:
[0007] Traverse the preset service dataset, sequentially determine the service data within the service dataset as the target service data, and obtain the data identifier of the target service data;
[0008] Based on the data identifier of the target service data, obtain the absolute value of the difference in the total amount of target service data between any two data centers in the data center cluster;
[0009] When the absolute value of the total data difference exceeds a preset first threshold, the target service data of the data center is updated based on the data identifier of the target service data, and 1 is added to the preset total cross-data center data difference.
[0010] When the total difference between the data across data centers exceeds a preset second threshold, update all service data within the data center.
[0011] In one embodiment, after traversing a preset service dataset and sequentially determining service data within the service dataset as target service data, and obtaining the data identifier of the target service data, the method further includes: based on the data identifier of the target service data, obtaining the absolute value of the difference between the total data volume of the central cache and the database in the same data center, wherein the data center includes a central cache and a database; when the absolute value of the difference in the total data volume exceeds a preset first threshold, managing the target service data in the central cache based on the target service data in the database, and incrementing by 1 to a preset total data difference in the same data center; when the total data difference in the same data center exceeds a preset second threshold, updating all service data in the data center.
[0012] In one embodiment, obtaining the absolute value of the difference in the total amount of target service data between any two data centers based on the data identifier of the target service data includes: obtaining the total amount of data cached locally in any two data centers based on the data identifier of the target service data, wherein the data centers include local caches; and calculating the absolute value of the difference in the total amount of target service data between the two data centers based on the total amount of data cached locally in the two data centers.
[0013] In one embodiment, updating the target service data of the data center based on the data identifier of the target service data includes: querying the target service data in the database of the data center based on the data identifier of the target service data; and managing the target service data in the database of the data center to the central cache and local cache of the data center in sequence.
[0014] In one embodiment, updating all service data in the data center includes: traversing the data identifiers of all service data in the data center; querying the service data in the database of the data center based on the data identifier of each service data; and updating the service data to the central cache and local cache of the data center in sequence based on the service data in the database.
[0015] In one embodiment, the service data identifier includes: service data category, service data location, and data center code; based on the data identifier of the target service data, the total amount of data cached locally in any two data centers is obtained, including: based on the data center code, determining the difference between the total amount of data cached locally in any two data centers for obtaining the target service data; based on the service data category and the service data location, the total amount of data cached locally in any two data centers is obtained.
[0016] In one embodiment, the method further includes: pre-generating the first threshold; pre-generating the first threshold includes: obtaining the total amount of data of the target service data in the database of any of the data centers in the data center cluster based on the data identifier of the target service data; determining whether the total amount of data exceeds a third threshold; if the total amount of data exceeds the third threshold, taking one-tenth of the total amount of data as the absolute value of the first threshold; if the total amount of data does not exceed the third threshold, setting the first threshold to 0.
[0017] In one embodiment, the method further includes: pre-generating the service dataset; pre-generating the service dataset includes: periodically scanning all service data in each data center within the data center cluster to obtain data identifiers of the service data; and generating the service dataset based on the data identifiers of the service data.
[0018] In one embodiment, the total cross-data center data difference corresponds to the generation of any two data centers; the total cross-data center data difference is the sum of the absolute values of the differences in the total amount of service data in any two data centers.
[0019] On the other hand, a service data management device is provided, the device being used for service data management of a data center cluster, the data center cluster including a data center, the device comprising:
[0020] The traversal acquisition unit is used to traverse a preset service dataset, sequentially determine the service data within the service dataset as target service data, and obtain the data identifier of the target service data; it is also used to obtain the absolute value of the difference in the total amount of target service data between any two data centers based on the data identifier of the target service data.
[0021] The determination and accumulation unit is used to update the target service data of the data center based on the data identifier of the target service data when the absolute value of the total data difference exceeds a preset first threshold, and to accumulate 1 to the preset total cross-data center data difference.
[0022] The update unit is used to update all service data within the data center when the total difference between the cross-data center data exceeds a preset second threshold.
[0023] In another aspect, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:
[0024] Traverse the preset service dataset, sequentially determine the service data within the service dataset as the target service data, and obtain the data identifier of the target service data;
[0025] Based on the data identifier of the target service data, obtain the absolute value of the difference in the total amount of target service data between any two data centers in the data center cluster;
[0026] When the absolute value of the total data difference exceeds a preset first threshold, the target service data of the data center is updated based on the data identifier of the target service data, and 1 is added to the preset total cross-data center data difference.
[0027] When the total difference between the data across data centers exceeds a preset second threshold, update all service data within the data center.
[0028] In another aspect, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, performs the following steps:
[0029] Traverse the preset service dataset, sequentially determine the service data within the service dataset as the target service data, and obtain the data identifier of the target service data;
[0030] Based on the data identifier of the target service data, obtain the absolute value of the difference in the total amount of target service data between any two data centers in the data center cluster;
[0031] When the absolute value of the total data difference exceeds a preset first threshold, the target service data of the data center is updated based on the data identifier of the target service data, and 1 is added to the preset total cross-data center data difference.
[0032] When the total difference between the data across data centers exceeds a preset second threshold, update all service data within the data center.
[0033] The aforementioned service data management method, apparatus, and computer equipment, wherein the service data management method includes: traversing a preset service dataset, sequentially determining service data within the service dataset as target service data, and obtaining a data identifier for the target service data; based on the data identifier of the target service data, obtaining the absolute value of the difference in the total data volume of target service data between any two data centers in the data center cluster; when the absolute value of the total data volume difference exceeds a preset first threshold, updating the target service data in the data center based on the data identifier of the target service data, and incrementing by 1 to a preset total cross-data center data difference; when the total cross-data center data difference exceeds a preset second threshold, updating all service data within the data center. Through the above service data management method, consistency detection of service data within the data center can be achieved, effectively shortening the latency period of service data inconsistency problems and avoiding adverse effects caused by service data inconsistency.
[0034] Specifically, when the absolute value of the total data difference exceeds a preset first threshold, the target service data of the data center is updated based on the data identifier of the target service data, and 1 is added to the preset total cross-data center data difference. By setting the first threshold, a certain fault tolerance rate is allowed for service data without adversely affecting the actual application scenario, thereby reducing the resource consumption of service data consistency detection.
[0035] In addition, when the total difference between the data in different data centers exceeds a preset second threshold, all service data in the data center is updated. When the total difference between the data in different data centers exceeds the preset second threshold, all service data in the data center is updated in a timely manner, and the service data in the data center is corrected, which greatly reduces the adverse effects caused by inconsistent service data. Attached Figure Description
[0036] Figure 1 This is an application environment diagram of a service data management method in one embodiment;
[0037] Figure 2 This is a schematic diagram of the data center cluster structure in one embodiment;
[0038] Figure 3 This is a flowchart illustrating a service data management method in one embodiment;
[0039] Figure 4 This is a flowchart illustrating a service data management method in one embodiment;
[0040] Figure 5 This is a structural block diagram of a service data management device in one embodiment;
[0041] Figure 6 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0042] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0043] The service data management method provided in this application can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. Technicians send service data management requests to server 104 through terminal 102, and server 104 executes the following service data management method based on the service data management request. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices, and server 104 can be a standalone server or a server cluster consisting of multiple servers.
[0044] It's important to understand that the current data query service is deployed on a data center cluster, which includes multiple data centers, each with multiple implementation nodes (i.e., local caches). The front end distributes traffic to these local caches via a load balancing gateway, such as... Figure 2 As shown, this is a data center cluster. Each data center has its own independent central cache and database. When technicians send a service data management request to server 104, server 104 first retrieves the service data from its local cache. If the local cache does not contain the service data, it then searches the central cache. If the central cache still does not contain the service data, it continues searching the database. Furthermore, to improve service data management performance, operations personnel pre-warm all service data from the local data center database into the local and central caches using a full-scale preheating process.
[0045] However, the service data of the database in the data center is constantly changing. Therefore, when the service data of the database in any data center changes, it will be notified to each data center through a preset message channel. The service data in the database will be updated to the central cache and the local cache in the order of first the central cache and then the local cache.
[0046] In view of this, in one embodiment, a service data management method is provided, which is applied to Figure 1 Taking server 104 as an example, this explains how to manage the service data of a data center cluster, including the following steps:
[0047] It manages service data in the central cache and database of the same data center, and manages service data in multiple data centers; the management of service data includes service data consistency detection and handling of service data inconsistencies.
[0048] In one embodiment, the service data is defined as products for sale, and the products for sale are managed based on the central cache and the total number of products in the database within the same data center, including the following steps:
[0049] Step S11: Scan all available products. Scanning all available products can be done at a set time.
[0050] Step S12: Based on the product identifiers of the products for sale scanned in step S11, obtain the total number of products for sale in the central cache of the same data center, Data1, and the total number of products for sale in the database of the same data center, Data2.
[0051] Step S13: Determine whether Data1 and Data2 are consistent, obtain the absolute value of the difference between Data1 and Data2, and determine whether the absolute value of the difference is not greater than a preset first threshold; when the absolute value of the difference is not greater than the preset first threshold, continue to execute step S12 based on the next product identifier; when the absolute value of the difference is greater than the preset first threshold, mark the product identifier and increment it by 1 to the preset total difference of data in the same data center; it should be understood that in actual application scenarios, a small error between Data1 and Data2 is allowed, that is, when the number of Data1 or Data2 is greater than or equal to 20, an error of plus or minus 2 is allowed, and when the number of Data1 and Data2 is less than 20, no error is allowed.
[0052] Step S14: Determine whether the total difference in data within the same data room is greater than a preset second threshold. If the total difference in data within the same data room is not greater than the preset second threshold, then update the product data Data2 in the database within the same data room to the central cache via an asynchronous thread, overwriting the product data Data1 in the central cache, thereby ensuring the consistency of data between the central cache and the database within the same data room. Simultaneously, continue to execute step S12 based on the next product identifier. If the total difference in data within the same data room is greater than the preset second threshold, then execute step S15.
[0053] Step S15: Interrupt the management of products for sale in the central cache and database of the same data center, notify the developers via SMS, email or WeChat, and simultaneously execute step S16 to update all product data in the data center.
[0054] Step S16: Scan all available products. Based on the product identifier of each available product, update the product data in the database to the central cache in the same data center, overwriting the original product data in the central cache.
[0055] In one embodiment, the service data is defined as products for sale, and the products for sale are managed based on the number of products in the local cache of multiple data centers, including the following steps:
[0056] Step S21: Scan all available products. Scanning all available products can be done at a set time.
[0057] Step S22: Based on the product identifiers of the products for sale scanned in step S21, obtain the product category, product location, and data center code of the product identifier. The product category refers to the specific type of the product, such as whether it's a mobile phone or a charger. The product location refers to the sales location restrictions of the product, such as whether the customer's order for a mobile phone is delivered to Guangzhou or Zhengzhou. The data center code is the location of the data center, such as data center A located in Xi'an and data center B located in Nanjing. It should be understood that the total number of products for sale in any product category will be different when the product location is different. For example, when the delivery address is Guangzhou, the total number of mobile phones may be 100, while when the delivery address is Zhengzhou, the total number of mobile phones may be 50. The product category is represented by lowercase letters, the product location by numbers, and the data center code by uppercase letters. For example, when the product category is mobile phones, its product category is defined as 'a', and when the product location is Guangzhou, its product location is defined as '1'.
[0058] Step S23: Based on the same product category and product location, obtain the absolute value of the difference in the total data volume of product data between any two data centers; for example: when the product category is c, the product location is 1, and the two data centers are data center A and data center B, obtain the absolute value of the difference in the total data volume between DatacA1 and DatacB1, and determine whether the absolute value of the difference is not greater than a preset first threshold; when the absolute value of the difference is not greater than the preset first threshold, continue to execute step S22 based on the next product identifier; when the absolute value of the difference is greater than the preset first threshold, mark the product identifier and increment it by 1 to the preset total data difference in the same data center; it should be understood that in actual application scenarios, a small error is allowed between DatacA1 and DatacB1, that is, when the number of DatacA1 and DatacB1 is greater than or equal to 20, an error of ±2 is allowed, and when the number of DatacA1 and DatacB1 is less than 20, no error is allowed;
[0059] Step S24: Determine whether the total difference in data within the same data room is greater than a preset second threshold. If the total difference in data within the same data room is not greater than the preset second threshold, then update the product data in the database of the same data room to the central cache of data room A through an asynchronous thread, overwriting the product data in the central cache, and notify all local caches of data room A through message broadcasting. At the same time, update the product data in the database of the same data room to the central cache of data room B, overwriting the product data in the central cache, and notify all local caches of data room B through message broadcasting. This ensures the consistency of data between the central cache and the database in the same data room. Then, continue to execute step S22 based on the next product identifier. If the total difference in data within the same data room is greater than the preset second threshold, then execute step S25.
[0060] S25. Interrupt the management of products for sale in multiple data centers, notify the developers via SMS, email or WeChat, and simultaneously execute step S26 to update all product data in the data centers.
[0061] Step S26: Scan all available products. Based on the product identifier of each available product, update the product data in the database of each data center to the central cache of the same data center, overwriting the original product data in the central cache. Then, notify all local caches in the same data center through message broadcasting to update the product data in the local cache, overwriting the original product data in the local cache.
[0062] Based on the aforementioned service data management method, by continuously comparing detected service data, it can automatically complete the consistency detection and processing of service data in the central cache and database within the same data center, as well as the consistency detection and processing of service data across data centers. When inconsistencies in service data within the same or across data centers are detected, operations personnel are notified through various alarm methods. On the one hand, this shortens the latency period of problems and reduces the incidence of customer complaints caused by insufficient inventory. On the other hand, through automatic system updates, unattended operation is possible, reducing the consumption of manpower and resources, minimizing the problem of service data inconsistencies caused by various unclear reasons, and reducing the adverse effects of the problem to the lowest possible level.
[0063] In one embodiment, such as Figure 3 As shown, this application provides a service data management method, which is applied to the service data management of a data center cluster, wherein the data center cluster includes a data center, and the method includes:
[0064] Traverse the preset service dataset, sequentially determine the service data within the service dataset as the target service data, and obtain the data identifier of the target service data;
[0065] Based on the data identifier of the target service data, obtain the absolute value of the difference in the total amount of target service data between any two data centers in the data center cluster;
[0066] When the absolute value of the total data difference exceeds a preset first threshold, the target service data of the data center is updated based on the data identifier of the target service data, and 1 is added to the preset total cross-data center data difference.
[0067] When the total difference between the data across data centers exceeds a preset second threshold, update all service data within the data center.
[0068] In one embodiment, such as Figure 4 As shown, after traversing a preset service dataset and sequentially determining the service data within the service dataset as target service data, and obtaining the data identifier of the target service data, the method further includes: based on the data identifier of the target service data, obtaining the absolute value of the difference between the total data volume of the central cache and the database in the same data center, wherein the data center includes a central cache and a database; when the absolute value of the difference in the total data volume exceeds a preset first threshold, managing the target service data in the central cache based on the target service data in the database, and accumulating 1 to a preset total difference in data volume within the same data center; when the total difference in data volume within the same data center exceeds a preset second threshold, updating all service data in the data center.
[0069] It should be understood that when the absolute value of the difference in the total amount of target service data between any two data centers exceeds a preset first threshold, the difference in the total amount of data can be directly accumulated to a preset total cross-data center data difference. Similarly, when the difference in the total amount of target service data in the central cache and the target service data in the database of the same data center exceeds a preset first threshold, the difference in the total amount of data can also be directly accumulated to a preset total intra-data center data difference. When directly accumulating the total amount of data difference to the preset cross-data center data difference / intra-data center data difference, those skilled in the art can adaptively adjust the size of the preset second threshold based on the actual application scenario.
[0070] In one embodiment, obtaining the absolute value of the difference in the total amount of target service data between any two data centers based on the data identifier of the target service data includes: obtaining the total amount of data cached locally in any two data centers based on the data identifier of the target service data, wherein the data centers include local caches; and calculating the absolute value of the difference in the total amount of target service data between the two data centers based on the total amount of data cached locally in the two data centers.
[0071] In one embodiment, updating the target service data of the data center based on the data identifier of the target service data includes: querying the target service data in the database of the data center based on the data identifier of the target service data; and managing the target service data in the database of the data center to the central cache and local cache of the data center in sequence.
[0072] In one embodiment, updating all service data in the data center includes: traversing the data identifiers of all service data in the data center; querying the service data in the database of the data center based on the data identifier of each service data; and updating the service data to the central cache and local cache of the data center in sequence based on the service data in the database.
[0073] In one embodiment, the service data identifier includes: service data category, service data location, and data center code; based on the data identifier of the target service data, the total amount of data cached locally in any two data centers is obtained, including: based on the data center code, determining the difference between the total amount of data cached locally in any two data centers for obtaining the target service data; based on the service data category and the service data location, the total amount of data cached locally in any two data centers is obtained.
[0074] In one embodiment, the method further includes: pre-generating the first threshold; pre-generating the first threshold includes: obtaining the total amount of data of the target service data in the database of any of the data centers in the data center cluster based on the data identifier of the target service data; determining whether the total amount of data exceeds a third threshold; if the total amount of data exceeds the third threshold, taking one-tenth of the total amount of data as the absolute value of the first threshold; if the total amount of data does not exceed the third threshold, setting the first threshold to 0.
[0075] In one embodiment, the method further includes: pre-generating the service dataset; pre-generating the service dataset includes: periodically scanning all service data in each data center within the data center cluster to obtain data identifiers of the service data; and generating the service dataset based on the data identifiers of the service data.
[0076] In one embodiment, the total cross-data center data difference corresponds to the generation of any two data centers; the total cross-data center data difference is the sum of the absolute values of the differences in the total amount of service data in any two data centers.
[0077] It should be understood that, although Figure 3-4The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 3-4 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.
[0078] In one embodiment, such as Figure 5 As shown, a service data management device is provided. This device is applied to service data management in a data center cluster, which includes a data center. The device includes: a traversal acquisition unit, a judgment accumulation unit, and a judgment update unit, wherein:
[0079] The traversal acquisition unit is used to traverse a preset service dataset, sequentially determine the service data within the service dataset as target service data, and obtain the data identifier of the target service data; it is also used to obtain the absolute value of the difference in the total amount of target service data between any two data centers based on the data identifier of the target service data.
[0080] The determination and accumulation unit is used to update the target service data of the data center based on the data identifier of the target service data when the absolute value of the total data difference exceeds a preset first threshold, and to accumulate 1 to the preset total cross-data center data difference.
[0081] The update unit is used to update all service data within the data center when the total difference between the cross-data center data exceeds a preset second threshold.
[0082] It should be understood that the total cross-data center data difference corresponds to the generation of any two data centers; the total cross-data center data difference is the sum of the absolute values of the differences in the total amount of service data within any two data centers.
[0083] In one embodiment, the traversal acquisition unit is further configured to acquire the absolute value of the difference between the total data volume of the central cache and the database in the same data center based on the data identifier of the target service data, wherein the data center includes a central cache and a database; the judgment accumulation unit is further configured to manage the target service data in the central cache based on the target service data in the database when the absolute value of the total data volume difference exceeds a preset first threshold, and accumulate 1 to a preset total data volume difference in the same data center; the judgment update unit is further configured to update all service data in the data center when the total data volume difference in the same data center exceeds a preset second threshold.
[0084] In one embodiment, the traversal acquisition unit is further configured to acquire the total amount of data cached locally in any two data centers based on the data identifier of the target service data, wherein the data centers include local caches; and to calculate the absolute value of the difference between the total amount of data cached locally in the two data centers based on the total amount of data cached locally in the two data centers.
[0085] In one embodiment, the traversal acquisition unit is further configured to query the target service data in the database of the data center based on the data identifier of the target service data; and based on the target service data in the database of the data center, sequentially manage the target service data to the central cache and local cache of the data center.
[0086] In one embodiment, the determination and update unit is further configured to traverse the data identifiers of all service data in the data center; query the service data in the database of the data center based on the data identifier of each service data; and update the service data to the central cache and local cache of the data center in sequence based on the service data in the database.
[0087] In one embodiment, the service data identifier includes: service data category, service data location, and data center code; the traversal acquisition unit is further configured to determine, based on the data center code, any two data centers for acquiring the difference in the total amount of target service data; and to acquire, based on the service data category and the service data location, the total amount of data cached locally in the two data centers respectively.
[0088] In one embodiment, the traversal acquisition unit is further configured to acquire the total amount of data of the target service data in the database of any of the data centers in the data center cluster based on the data identifier of the target service data.
[0089] In one embodiment, the device further includes a threshold setting unit for determining whether the total amount of data exceeds a third threshold; if the total amount of data exceeds the third threshold, then taking the absolute value of one-tenth of the total amount of data as the first threshold; if the total amount of data does not exceed the third threshold, then setting the first threshold to 0.
[0090] In one embodiment, the apparatus further includes a service dataset generation unit for periodically scanning all service data in each data center within the data center cluster to obtain data identifiers of the service data; and generating the service dataset based on the data identifiers of the service data.
[0091] Specific limitations regarding the service data management device can be found in the limitations of the service data management method described above, and will not be repeated here. Each module in the aforementioned service data management device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0092] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 6 As shown, the computer device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements a service data management method. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.
[0093] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0094] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:
[0095] Traverse the preset service dataset, sequentially determine the service data within the service dataset as the target service data, and obtain the data identifier of the target service data;
[0096] Based on the data identifier of the target service data, obtain the absolute value of the difference in the total amount of target service data between any two data centers in the data center cluster;
[0097] When the absolute value of the total data difference exceeds a preset first threshold, the target service data of the data center is updated based on the data identifier of the target service data, and 1 is added to the preset total cross-data center data difference.
[0098] When the total cross-data center data difference exceeds a preset second threshold, all service data within the data center is updated; wherein, the total cross-data center data difference corresponds to any two data centers; the total cross-data center data difference is the sum of the absolute values of the differences in the total data volume of all service data within any two data centers.
[0099] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0100] Based on the data identifier of the target service data, the absolute value of the difference between the total data volume of the central cache and the database in the same data center is obtained, wherein the data center includes the central cache and the database; when the absolute value of the difference in the total data volume exceeds a preset first threshold, the target service data in the central cache is managed based on the target service data in the database, and 1 is added to the preset total data difference in the same data center; when the total data difference in the same data center exceeds a preset second threshold, all service data in the data center is updated.
[0101] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0102] Based on the data identifier of the target service data, the total amount of data cached locally in any two data centers is obtained respectively, wherein the data centers include local caches; based on the total amount of data cached locally in any two data centers, the absolute value of the difference between the total amount of target service data in the two data centers is calculated.
[0103] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0104] Based on the data identifier of the target service data, query the target service data in the database of the data center respectively; based on the target service data in the database of the data center, manage the target service data to the central cache and local cache of the data center in sequence.
[0105] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0106] The system iterates through the data identifiers of all service data within the data center; it queries the service data in the data center's database based on the data identifier of each service data; and it updates the service data to the central cache and local cache of the data center in sequence based on the service data in the database.
[0107] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0108] Based on the data center code, determine any two data centers for obtaining the difference in the total amount of data for the target service data; based on the service data category and the service data location, obtain the total amount of data cached locally in the two data centers respectively; wherein, the service data identifier includes: service data category, service data location and data center code.
[0109] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0110] Based on the data identifier of the target service data, obtain the total amount of the target service data in the database of any of the data centers in the data center cluster; determine whether the total amount of data exceeds a third threshold; if the total amount of data exceeds the third threshold, take one-tenth of the total amount of data as the absolute value of the first threshold; if the total amount of data does not exceed the third threshold, set the first threshold to 0.
[0111] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0112] Periodically scan all service data in each data center within the data center cluster to obtain the data identifier of the service data; generate the service dataset based on the data identifier of the service data.
[0113] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0114] Traverse the preset service dataset, sequentially determine the service data within the service dataset as the target service data, and obtain the data identifier of the target service data;
[0115] Based on the data identifier of the target service data, obtain the absolute value of the difference in the total amount of target service data between any two data centers in the data center cluster;
[0116] When the absolute value of the total data difference exceeds a preset first threshold, the target service data of the data center is updated based on the data identifier of the target service data, and 1 is added to the preset total cross-data center data difference.
[0117] When the total cross-data center data difference exceeds a preset second threshold, all service data within the data center is updated; wherein, the total cross-data center data difference corresponds to any two data centers; the total cross-data center data difference is the sum of the absolute values of the differences in the total data volume of all service data within any two data centers.
[0118] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0119] Based on the data identifier of the target service data, the absolute value of the difference between the total data volume of the central cache and the database in the same data center is obtained, wherein the data center includes the central cache and the database; when the absolute value of the difference in the total data volume exceeds a preset first threshold, the target service data in the central cache is managed based on the target service data in the database, and 1 is added to the preset total data difference in the same data center; when the total data difference in the same data center exceeds a preset second threshold, all service data in the data center is updated.
[0120] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0121] Based on the data identifier of the target service data, the total amount of data cached locally in any two data centers is obtained respectively, wherein the data centers include local caches; based on the total amount of data cached locally in any two data centers, the absolute value of the difference between the total amount of target service data in the two data centers is calculated.
[0122] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0123] Based on the data identifier of the target service data, query the target service data in the database of the data center respectively; based on the target service data in the database of the data center, manage the target service data to the central cache and local cache of the data center in sequence.
[0124] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0125] The system iterates through the data identifiers of all service data within the data center; it queries the service data in the data center's database based on the data identifier of each service data; and it updates the service data to the central cache and local cache of the data center in sequence based on the service data in the database.
[0126] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0127] Based on the data center code, determine any two data centers for obtaining the difference in the total amount of target service data; based on the service data category and the service data location, obtain the total amount of data cached locally in the two data centers respectively; wherein, the service data identifier includes the service data category, the service data location and the data center code.
[0128] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0129] Based on the data identifier of the target service data, obtain the total amount of the target service data in the database of any of the data centers in the data center cluster; determine whether the total amount of data exceeds a third threshold; if the total amount of data exceeds the third threshold, take one-tenth of the total amount of data as the absolute value of the first threshold; if the total amount of data does not exceed the third threshold, set the first threshold to 0.
[0130] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0131] Periodically scan all service data in each data center within the data center cluster to obtain the data identifier of the service data; generate the service dataset based on the data identifier of the service data.
[0132] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0133] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0134] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A service data management method, characterized in that, The method is applied to service data management of a data center cluster, wherein the data center cluster includes a data center, and the method includes: Traverse the preset service dataset, sequentially determine the service data within the service dataset as the target service data, and obtain the data identifier of the target service data; Based on the data identifier of the target service data, obtain the absolute value of the difference in the total amount of target service data between any two data centers in the data center cluster; When the absolute value of the total data difference exceeds a preset first threshold, the target service data of the data center is updated based on the data identifier of the target service data, and incremented by 1 to the total cross-data center data difference. The total cross-data center data difference is generated for any two corresponding data centers. During the process of traversing the service dataset, the target service data whose absolute value of the total data difference between any two data centers exceeds the first threshold is statistically analyzed item by item to form the cumulative number. When the total difference between the data across data centers exceeds a preset second threshold, update all service data within the data center.
2. The service data management method according to claim 1, characterized in that, After traversing a preset service dataset, sequentially identifying service data within the service dataset as target service data, and obtaining the data identifier of the target service data, the method further includes: Based on the data identifier of the target service data, obtain the absolute value of the difference between the total data volume of the central cache and the database in the same data center, wherein the data center includes the central cache and the database; When the absolute value of the total data difference exceeds a preset first threshold, the target service data in the central cache is managed based on the target service data in the database, and 1 is added to the total data difference in the same data room. When the total difference in data within the same data center exceeds a preset second threshold, all service data within the data center is updated.
3. The service data management method according to claim 2, characterized in that, Based on the data identifier of the target service data, obtain the absolute value of the difference in the total amount of target service data between any two data centers, including: Based on the data identifier of the target service data, the total amount of data cached locally in any two data centers is obtained respectively, wherein the data centers include local caches; Based on the total amount of data cached locally in any two data centers, calculate the absolute value of the difference in the total amount of target service data obtained in the two data centers.
4. The service data management method according to claim 3, characterized in that, Updating the target service data of the data center based on the data identifier of the target service data includes: Based on the data identifier of the target service data, query the target service data in the database of the computer room respectively; Based on the target service data in the database of the data center, the target service data is managed sequentially to the central cache and local cache of the data center.
5. The service data management method according to claim 4, characterized in that, Update all service data within the data center, including: Data identifiers that iterate through all service data within the data center; Based on the data identifier of each of the service data, query the service data in the database of the computer room; Based on the service data in the database, the service data is sequentially updated to the central cache and local cache of the data center.
6. The service data management method according to claim 5, characterized in that, The service data identifier includes: service data category, service data location, and data center code; Based on the data identifier of the target service data, the total amount of data cached locally in any two data centers is obtained, including: Based on the data center code, determine any two data centers that are used to obtain the difference in the total amount of data for the target service data; Based on the service data category and the service data location, obtain the total amount of data cached locally in any two data centers.
7. The service data management method according to claim 6, characterized in that, The method further includes: pre-generating the first threshold; pre-generating the first threshold includes: Based on the data identifier of the target service data, obtain the total amount of the target service data in the database of any of the data centers in the data center cluster; Determine whether the total amount of data exceeds the third threshold. If the total amount of data exceeds the third threshold, then take the absolute value of one-tenth of the total amount of data as the first threshold. If the total amount of data does not exceed the third threshold, then the first threshold is set to 0.
8. The service data management method according to claim 7, characterized in that, The method further includes: pre-generating the service dataset; The service dataset is pre-generated, including: Periodically scan all service data in each data center within the data center cluster to obtain the data identifier of the service data; The service dataset is generated based on the data identifier of the service data.
9. A service data management apparatus for the service data management method according to any one of claims 1-8, characterized in that, The device is used for service data management in a data center cluster, the data center cluster including a data center, and the device includes: The traversal acquisition unit is used to traverse the preset service dataset, sequentially determine the service data in the service dataset as the target service data, and obtain the data identifier of the target service data; It is also used to obtain the absolute value of the difference in the total amount of target service data between any two data centers based on the data identifier of the target service data; The determination and accumulation unit is used to update the target service data of the data center based on the data identifier of the target service data when the absolute value of the total data difference exceeds the first threshold, and to accumulate 1 to the preset total cross-data center data difference. The update unit is used to update all service data within the data center when the total difference between the cross-data center data exceeds a preset second threshold.