Data fragmentation processing method and device, computer equipment and storage medium
By calculating and sorting the comprehensive load weight of the target node and dynamically adjusting the allocation of data shards, the problem that simple shard count balance cannot reflect the actual load of the node is solved, and more efficient load balancing and performance improvement are achieved.
Patent Information
- Application Number
- CN202411624151.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-02-18
AI Technical Summary
In scenarios where node load changes greatly, simple shard count balance cannot fully reflect the actual load conditions of the node, resulting in performance bottlenecks and idle resources, affecting the overall performance of the data processing cluster.
By obtaining the node load data of multiple target nodes, the comprehensive load weight of each node is calculated and sorted from small to large according to the weight. When a new data shard to be allocated is obtained, it is distributed to the preset number of target nodes in the sorting result, and the shard allocation is recalculated and updated when the load data changes exceed the threshold.
More accurate load balancing is achieved, performance bottlenecks and idle resources are avoided, and the overall performance of data processing clusters is improved, especially in scenarios where load changes are large.
Smart Images

Figure CN119473616A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data technology, and in particular to a data sharding processing method, apparatus, computer equipment, storage medium and computer program product. Background Art
[0002] Currently, when creating an index, Elasticsearch distributes data shards evenly to each node in the cluster by default to achieve load balancing. In related solutions, maintaining a balanced number of shards can alleviate the problem of uneven load to a certain extent.
[0003] However, in the face of scenarios where node loads vary greatly, simply balancing the number of shards cannot fully reflect the actual load of the nodes. In this case, some nodes may experience performance bottlenecks due to large changes in processor and memory resource consumption, while other nodes may have idle resources. The actual load balancing of each node is poor, which will lead to a decline in the overall performance of the data processing cluster. Summary of the invention
[0004] Based on this, it is necessary to provide a data sharding processing method, apparatus, computer equipment, computer-readable storage medium and computer program product that can improve the actual load balancing of data sharding in response to the above technical problems.
[0005] In a first aspect, the present application provides a data sharding processing method, comprising:
[0006] Obtain node load data of multiple target nodes;
[0007] Calculate the comprehensive load weight of each target node according to the node load data, and sort the target nodes from small to large according to the comprehensive load weight;
[0008] When new data shards to be allocated are obtained, the data shards to be allocated are distributed to a preset number of target nodes in the sorting result;
[0009] Monitor the node load data, and when a change value of the node load data exceeds a preset change threshold, recalculate the comprehensive load weight based on the current node load data, and reallocate the data slices to be allocated based on the new comprehensive load weight.
[0010] In one embodiment, the node load data includes at least one parameter data of processor usage, memory occupancy, disk interface usage or network bandwidth occupancy; and calculating the comprehensive load weight of each target node according to the node load data includes:
[0011] Obtaining a calculation adjustment coefficient corresponding to each parameter data in the node load data; calculating a comprehensive load weight according to the parameter data in the node load data of the target node and the calculation adjustment coefficient corresponding to the parameter data.
[0012] In one embodiment, the step of obtaining the calculation adjustment coefficient of the load data of each node includes:
[0013] Obtaining the historical adjustment coefficient of the load data of each of the nodes and the historical load data of the target node;
[0014] The adjustment coefficient is determined and calculated according to the historical adjustment coefficient and the historical load data.
[0015] In one embodiment, the calculating the comprehensive load weight of each target node according to the node load data includes:
[0016] Calculate the initial load weight of each target node according to the current node load data;
[0017] Predicting a load data change trend based on the historical node load data;
[0018] The initial load weight is modified according to the load data change trend to obtain a comprehensive load weight.
[0019] In one of the embodiments, when a new data shard to be allocated is obtained, distributing the data shard to be allocated to a preset number of target nodes in the sorting result includes:
[0020] When a new data shard to be allocated is obtained, determining the shard type of the data shard to be allocated;
[0021] In the case where the data shard to be allocated is a primary shard, distributing the primary shard to a preset number of target nodes in the sorting result;
[0022] In the case where the data shard to be allocated is a replica shard, determining the target node to which the primary shard corresponding to the replica shard belongs;
[0023] The replica shard is distributed to the target node different from the target node to which the primary shard belongs.
[0024] In one embodiment, the method further comprises:
[0025] Detecting the node operation status of the target node according to the node load data;
[0026] When the node operation status indicates that the target node has failed, the steps of recalculating the comprehensive load weight according to the current node load data and reallocating the data slices to be allocated according to the new comprehensive load weight are performed.
[0027] In a second aspect, the present application also provides a data sharding processing device, including:
[0028] A data acquisition module, used to acquire node load data of multiple target nodes;
[0029] A weight calculation module, used to calculate the comprehensive load weight of each of the target nodes according to the node load data, and sort the target nodes from small to large according to the comprehensive load weight;
[0030] A data distribution module is used to distribute the data slices to be distributed to the target nodes of the first preset number in the sorting result when new data slices to be distributed are obtained;
[0031] A monitoring and processing module is used to monitor the node load data. When the change value of the node load data exceeds a preset change threshold, the comprehensive load weight is recalculated based on the current node load data, and the data slices to be allocated are reallocated based on the new comprehensive load weight.
[0032] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0033] Obtain node load data of multiple target nodes;
[0034] Calculate the comprehensive load weight of each target node according to the node load data, and sort the target nodes from small to large according to the comprehensive load weight;
[0035] When new data shards to be allocated are obtained, the data shards to be allocated are distributed to a preset number of target nodes in the sorting result;
[0036] Monitor the node load data, and when a change value of the node load data exceeds a preset change threshold, recalculate the comprehensive load weight based on the current node load data, and reallocate the data slices to be allocated based on the new comprehensive load weight.
[0037] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0038] Obtain node load data of multiple target nodes;
[0039] Calculate the comprehensive load weight of each target node according to the node load data, and sort the target nodes from small to large according to the comprehensive load weight;
[0040] When new data shards to be allocated are obtained, the data shards to be allocated are distributed to a preset number of target nodes in the sorting result;
[0041] Monitor the node load data, and when a change value of the node load data exceeds a preset change threshold, recalculate the comprehensive load weight based on the current node load data, and reallocate the data slices to be allocated based on the new comprehensive load weight.
[0042] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0043] Obtain node load data of multiple target nodes;
[0044] Calculate the comprehensive load weight of each target node according to the node load data, and sort the target nodes from small to large according to the comprehensive load weight;
[0045] When new data shards to be allocated are obtained, the data shards to be allocated are distributed to a preset number of target nodes in the sorting result;
[0046] Monitor the node load data, and when a change value of the node load data exceeds a preset change threshold, recalculate the comprehensive load weight based on the current node load data, and reallocate the data slices to be allocated based on the new comprehensive load weight.
[0047] The above-mentioned data sharding processing method, device, computer equipment, storage medium and computer program product obtain node load data of multiple target nodes, calculate the comprehensive load weight of each target node according to the node load data, and sort the target nodes from small to large according to the comprehensive load weight, so that when a new data shard to be allocated is obtained, the data shard to be allocated is distributed to the first preset number of target nodes in the sorting result, and then the new data shard to be allocated is distributed to the target nodes with smaller comprehensive load weight as much as possible to achieve load balancing. During the data processing of the cluster, the node load data of the target node is continuously monitored. When the change value of the node load data exceeds the preset change threshold, the comprehensive load weight is recalculated according to the current node load data, and the data shard to be allocated is redistributed according to the new comprehensive load weight. Therefore, the distribution of data shards can be continuously updated according to the comprehensive load data. In the scenario where the actual load changes greatly, the frame allocation scheme can be dynamically skipped according to the load change situation, which can improve the actual load balancing of the data shards. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0049] FIG1 is an application environment diagram of a data sharding processing method in one embodiment;
[0050] FIG2 is a schematic diagram of a flow chart of a data sharding processing method in one embodiment;
[0051] FIG3 is a schematic diagram of a flow chart of step S204 of a data sharding processing method in one embodiment;
[0052] FIG4 is a structural block diagram of a data slicing processing device in one embodiment;
[0053] FIG5 is a diagram showing the internal structure of a computer device in one embodiment;
[0054] FIG. 6 is a diagram showing the internal structure of a computer device in another embodiment. DETAILED DESCRIPTION
[0055] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0056] The data slicing processing method provided in the embodiment of the present application can be applied to the application environment shown in Figure 1. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The data storage system can be used to store the node load data of multiple target nodes, and calculate the comprehensive load weight. Among them, the terminal 102 can be but is not limited to various personal computers, laptops, smart phones, tablets, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. Server 104 can be implemented with an independent server or a server cluster consisting of multiple servers.
[0057] In an exemplary embodiment, as shown in FIG2 , a data sharding processing method is provided, which is described by taking the method applied to the server 104 in FIG1 as an example, and includes the following steps S202 to S208 . Among them:
[0058] Step S202, obtaining node load data of multiple target nodes.
[0059] The node load data may include at least one parameter data of processor usage, memory occupancy, disk interface usage or network bandwidth occupancy.
[0060] Among them, the processor utilization rate indicates the proportion of tasks currently being executed by the processor, which can be expressed as a percentage. The higher the utilization rate, the busier the processor is. The memory utilization rate reflects the amount of memory that has been used in the system. It is also expressed as a percentage and is used to indicate the consumption of memory resources by the current program. The disk interface utilization rate measures the frequency of disk read and write operations and reflects the disk load. It is displayed as a percentage and shows the proportion of disk data access occupied by the current system. The network bandwidth utilization rate indicates the current data transmission load of the network interface. It is expressed as a percentage or bits per second (bps) to measure the usage of network resources. The higher the utilization rate, the greater the network transmission load.
[0061] For example, the server 104 may set a monitoring task to monitor the node load data of each target node, and store the monitored node load data in correspondence with the target node. Further, the monitoring task may be executed in real time or at a fixed time, or may be executed periodically or by certain trigger conditions, wherein the trigger condition may be a node failure or a significant change in the actual load data.
[0062] Step S204, calculating the comprehensive load weight of each target node according to the node load data, and sorting the target nodes from small to large according to the comprehensive load weight.
[0063] Exemplarily, server 104 can perform standardized processing on different types of node load data, and preset data normalization methods according to the data types of different node load data, such as reassigning the node load data according to the numerical range of the node load data, and then adding up the reassigned node load data to obtain a comprehensive load data weight, and then sorting the target nodes from small to large according to the weight to obtain a weight order.
[0064] Furthermore, the server 104 can also calculate the initial load weight of each target node according to the current node load data, predict the load data change trend according to the historical node load data, and correct the initial load weight according to the load data change trend to obtain the comprehensive load weight. The introduction of the load prediction algorithm can predict the node load change trend based on historical data and trend analysis, and dynamically adjust the shard redistribution strategy in combination with the load prediction results, reduce the number of shard migrations, improve the efficiency of shard redistribution, and improve the efficiency and accuracy of shard redistribution, thereby reducing performance problems caused by load fluctuations.
[0065] Step S206: when new data shards to be allocated are obtained, the data shards to be allocated are distributed to a preset number of target nodes in the sorting result.
[0066] Among them, data shard is the basic unit for storing and managing data in Elasticsearch. Each index can be composed of one or more primary shards, and each primary shard can have one or more replica shards. Sharding allows Elasticsearch to process query and index operations in parallel on multiple nodes to achieve high performance and high availability. A node is a single server or instance in an Elasticsearch cluster. Each node stores data and participates in the indexing and search functions of the cluster. A cluster is a collection of Elasticsearch instances consisting of one or more nodes. The nodes in a cluster work together to provide distributed search and indexing functions. The cluster manages metadata and node status by electing a master node to ensure data consistency and high availability. An index is a logical collection of data in Elasticsearch, similar to a table in a traditional database. Each index consists of one or more shards, which are distributed and stored on multiple nodes. Indexes are often used to store and organize similar types of data, such as log records or product catalogs.
[0067] Exemplarily, in a log analysis scenario, when each log file passes through a log distribution cluster, server 104 may treat the new log file as new data to be distributed, and distribute the data shards to a preset number of target nodes in the sorting result according to the above weight order.
[0068] Exemplarily, when the server 104 obtains a new data shard to be allocated, it can determine the shard type of the data shard to be allocated; when the data shard to be allocated is a primary shard, it can distribute the primary shard to a preset number of target nodes in the sorting result; when the data shard to be allocated is a replica shard, it can determine the target node to which the primary shard corresponding to the replica shard belongs; and distribute the replica shard to a target node different from the target node to which the primary shard belongs.
[0069] Step S208, monitoring the node load data, when the change value of the node load data exceeds the preset change threshold, recalculating the comprehensive load weight according to the current node load data, and reallocating the data slices to be allocated according to the new comprehensive load weight.
[0070] Exemplarily, the server 104 can monitor the node load data of each target node in real time or periodically. When the monitoring results show that the value of one or several node load data has changed significantly, the recalculation task is triggered, and the comprehensive load weight is recalculated according to the current node load data, so as to redistribute the data shards to be allocated according to the new comprehensive load weight, perform the above-mentioned step of sorting the comprehensive load weight, and allocate the subsequent new data to be processed according to the new weight order. Furthermore, the server 104 can also redistribute the allocated data according to the new weight order.
[0071] Exemplarily, server 104 can also detect the node operation status of the target node based on the node load data; when the node operation status indicates that the target node has a failure, it executes the steps of recalculating the comprehensive load weight based on the current node load data, and reallocating the data shards to be allocated based on the new comprehensive load weight.
[0072] In the above data sharding processing method, by obtaining the node load data of multiple target nodes, the comprehensive load weight of each target node is calculated according to the node load data, and the target nodes are sorted from small to large according to the comprehensive load weight, so that when a new data shard to be allocated is obtained, the data shard to be allocated is distributed to the first preset number of target nodes in the sorting result, and then the new data shard to be allocated is distributed to the target nodes with smaller comprehensive load weight as much as possible to achieve load balancing. During the data processing of the cluster, the node load data of the target node is continuously monitored. When the change value of the node load data exceeds the preset change threshold, the comprehensive load weight is recalculated according to the current node load data, and the data shard to be allocated is redistributed according to the new comprehensive load weight. Therefore, the distribution of data shards can be continuously updated according to the comprehensive load data. In the scenario where the actual load changes greatly, the frame allocation scheme can be dynamically skipped according to the load change situation, which can improve the actual load balancing of the data shards.
[0073] In an exemplary embodiment, as shown in FIG3 , step S204 includes steps S302 to S304. In which:
[0074] Step S302, obtaining the calculation adjustment coefficient corresponding to each parameter data in the node load data.
[0075] The node load data may include at least one parameter data of processor usage, memory usage, disk interface usage or network bandwidth usage;
[0076] Exemplarily, the server 104 may obtain the historical adjustment coefficient of the load data of each node and the historical load data of the target node; and determine the calculation adjustment coefficient according to the historical adjustment coefficient and the historical load data.
[0077] Step S304, calculating the comprehensive load weight according to the parameter data in the node load data of the target node and the calculation adjustment coefficient corresponding to the parameter data.
[0078] For example, the calculation formula of the comprehensive load weight can be weight= Among them, α, β, γ, δ are calculated adjustment coefficients.
[0079] In another exemplary embodiment, the server 104 obtains at least one node load data of the processor usage rate, memory occupancy rate, disk interface usage rate or network bandwidth occupancy rate of multiple target nodes, and obtains the historical adjustment coefficient of each node load data and the historical load data of the target node, determines the calculation adjustment coefficient according to the historical adjustment coefficient and the historical load data, and then calculates the comprehensive load weight according to the parameter data in the node load data of the target node and the calculation adjustment coefficient corresponding to the parameter data, and sorts the target nodes from small to large according to the comprehensive load weight. In this process, the server 104 calculates the initial load weight of each target node according to the current node load data, and then predicts the load data change trend according to the historical node load data, and can correct the initial load weight according to the load data change trend to obtain the comprehensive load weight.
[0080] Next, when the server 104 obtains a new data shard to be allocated, it determines the shard type of the data shard to be allocated. When the data shard to be allocated is a primary shard, it distributes the primary shard to the target nodes of the preset number in the sorting result. When the data shard to be allocated is a replica shard, it determines the target node to which the primary shard corresponding to the replica shard belongs, distributes the replica shard to a target node different from the target node to which the primary shard belongs, and continuously monitors the node load data. When the change value of the node load data exceeds the preset change threshold, it recalculates the comprehensive load weight based on the current node load data, and redistributes the data shard to be allocated based on the new comprehensive load weight. At the same time, the server 104 detects the node operation status of the target node based on the node load data; when the node operation status indicates that the target node has a fault, it executes the steps of recalculating the comprehensive load weight based on the current node load data, and redistributing the data shard to be allocated based on the new comprehensive load weight.
[0081] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0082] Based on the same inventive concept, the embodiment of the present application also provides a data sharding processing device for implementing the data sharding processing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the one or more data sharding processing device embodiments provided below can refer to the limitations on the data sharding processing method above, and will not be repeated here.
[0083] In an exemplary embodiment, as shown in FIG4 , a data sharding processing device is provided, including: a data acquisition module 402, a weight calculation module 404, a data allocation module 406 and a monitoring processing module 408, wherein:
[0084] A data acquisition module 402 is used to acquire node load data of multiple target nodes;
[0085] The weight calculation module 404 is used to calculate the comprehensive load weight of each target node according to the node load data, and sort the target nodes from small to large according to the comprehensive load weight;
[0086] The data distribution module 406 is used to distribute the data shards to be distributed to a preset number of target nodes in the sorting result when new data shards to be distributed are obtained;
[0087] The monitoring processing module 408 is used to monitor the node load data. When the change value of the node load data exceeds the preset change threshold, the comprehensive load weight is recalculated according to the current node load data, and the data slices to be allocated are reallocated according to the new comprehensive load weight.
[0088] In one embodiment, the node load data includes at least one parameter data of processor usage, memory occupancy, disk interface usage or network bandwidth occupancy; the weight calculation module 404 includes:
[0089] A coefficient calculation unit, used to obtain the calculation adjustment coefficient corresponding to each parameter data in the node load data;
[0090] The weight calculation unit is used to calculate the comprehensive load weight according to the parameter data in the node load data of the target node and the calculation adjustment coefficient corresponding to the parameter data.
[0091] In one of the embodiments, the coefficient calculation unit is specifically used to: obtain the historical adjustment coefficient of each node load data and the historical load data of the target node; and determine the calculation adjustment coefficient according to the historical adjustment coefficient and the historical load data.
[0092] In one embodiment, the weight calculation module 404 is specifically used to: calculate the initial load weight of each target node based on the current node load data; predict the load data change trend based on the historical node load data; and correct the initial load weight based on the load data change trend to obtain a comprehensive load weight.
[0093] In one of the embodiments, the data allocation module 406 is specifically used to: determine the shard type of the data shard to be allocated when a new data shard to be allocated is obtained; when the data shard to be allocated is a primary shard, distribute the primary shard to a preset number of target nodes in the sorting result; when the data shard to be allocated is a replica shard, determine the target node to which the primary shard corresponding to the replica shard belongs; distribute the replica shard to a target node different from the target node to which the primary shard belongs.
[0094] In one embodiment, the device further comprises:
[0095] The operation status monitoring module is used to detect the node operation status of the target node according to the node load data;
[0096] The fault redistribution module is used to execute the steps of recalculating the comprehensive load weight according to the current node load data and redistributing the data slices to be distributed according to the new comprehensive load weight when the node operation status indicates that the target node has a fault.
[0097] Each module in the above-mentioned data slicing processing device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0098] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG5. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store node load data of multiple target nodes, and to calculate data such as comprehensive load weight. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a data slicing processing method is implemented.
[0099] In an exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be shown in FIG6. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, the memory, and the input / output interface are connected via a system bus, and the communication interface, the display unit, and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner may be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a data slicing processing method is implemented. The display unit of the computer device is used to form a visually visible picture, which may be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0100] Those skilled in the art will understand that the structure shown in FIG. 6 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0101] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the following steps when executing the computer program: obtaining node load data of multiple target nodes; calculating the comprehensive load weight of each target node based on the node load data, and sorting the target nodes from small to large according to the comprehensive load weight; when a new data slice to be allocated is obtained, distributing the data slice to be allocated to a preset number of target nodes in the sorting result; monitoring the node load data, and when the change value of the node load data exceeds a preset change threshold, recalculating the comprehensive load weight based on the current node load data, and reallocating the data slice to be allocated according to the new comprehensive load weight.
[0102] In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining the calculation adjustment coefficient corresponding to each parameter data in the node load data; calculating the comprehensive load weight according to the parameter data in the node load data of the target node and the calculation adjustment coefficient corresponding to the parameter data.
[0103] In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining the historical adjustment coefficient of each node load data and the historical load data of the target node; and determining the calculation adjustment coefficient according to the historical adjustment coefficient and the historical load data.
[0104] In one embodiment, the processor also implements the following steps when executing the computer program: calculate the initial load weight of each target node based on the current node load data; predict the load data change trend based on the historical node load data; correct the initial load weight based on the load data change trend to obtain a comprehensive load weight.
[0105] In one embodiment, the processor further implements the following steps when executing the computer program: when a new data shard to be allocated is obtained, the shard type of the data shard to be allocated is determined; when the data shard to be allocated is a primary shard, the primary shard is distributed to a preset number of target nodes in the sorting result; when the data shard to be allocated is a replica shard, the target node to which the primary shard corresponding to the replica shard belongs is determined; and the replica shard is distributed to a target node different from the target node to which the primary shard belongs.
[0106] In one embodiment, when the processor executes the computer program, the following steps are also implemented: detecting the node operation status of the target node based on the node load data; when the node operation status indicates that the target node has a fault, recalculating the comprehensive load weight based on the current node load data, and reallocating the data shards to be allocated based on the new comprehensive load weight.
[0107] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: obtaining node load data of multiple target nodes; calculating the comprehensive load weight of each target node based on the node load data, and sorting the target nodes from small to large according to the comprehensive load weight; when new data slices to be allocated are obtained, distributing the data slices to be allocated to a preset number of target nodes in the sorting result; monitoring the node load data, and when the change value of the node load data exceeds a preset change threshold, recalculating the comprehensive load weight based on the current node load data, and reallocating the data slices to be allocated according to the new comprehensive load weight.
[0108] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining the calculation adjustment coefficient corresponding to each parameter data in the node load data; calculating the comprehensive load weight based on the parameter data in the node load data of the target node and the calculation adjustment coefficient corresponding to the parameter data.
[0109] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining the historical adjustment coefficient of each node load data and the historical load data of the target node; and determining the calculation adjustment coefficient based on the historical adjustment coefficient and the historical load data.
[0110] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: calculating the initial load weight of each target node based on the current node load data; predicting the load data change trend based on the historical node load data; and correcting the initial load weight based on the load data change trend to obtain a comprehensive load weight.
[0111] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: when a new data shard to be allocated is obtained, the shard type of the data shard to be allocated is determined; when the data shard to be allocated is a primary shard, the primary shard is distributed to a preset number of target nodes in the sorting result; when the data shard to be allocated is a replica shard, the target node to which the primary shard corresponding to the replica shard belongs is determined; and the replica shard is distributed to a target node different from the target node to which the primary shard belongs.
[0112] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: detecting the node operation status of the target node based on the node load data; when the node operation status indicates that the target node has a fault, recalculating the comprehensive load weight based on the current node load data, and reallocating the data shards to be allocated based on the new comprehensive load weight.
[0113] In one embodiment, a computer program product is provided, including a computer program, which implements the following steps when executed by a processor: obtaining node load data of multiple target nodes; calculating the comprehensive load weight of each target node based on the node load data, and sorting the target nodes from small to large according to the comprehensive load weight; when new data slices to be allocated are obtained, distributing the data slices to be allocated to a preset number of target nodes in the sorting result; monitoring the node load data, and when the change value of the node load data exceeds a preset change threshold, recalculating the comprehensive load weight based on the current node load data, and reallocating the data slices to be allocated according to the new comprehensive load weight.
[0114] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining the calculation adjustment coefficient corresponding to each parameter data in the node load data; calculating the comprehensive load weight based on the parameter data in the node load data of the target node and the calculation adjustment coefficient corresponding to the parameter data.
[0115] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining the historical adjustment coefficient of each node load data and the historical load data of the target node; and determining the calculation adjustment coefficient based on the historical adjustment coefficient and the historical load data.
[0116] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: calculating the initial load weight of each target node based on the current node load data; predicting the load data change trend based on the historical node load data; and correcting the initial load weight based on the load data change trend to obtain a comprehensive load weight.
[0117] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: when a new data shard to be allocated is obtained, the shard type of the data shard to be allocated is determined; when the data shard to be allocated is a primary shard, the primary shard is distributed to a preset number of target nodes in the sorting result; when the data shard to be allocated is a replica shard, the target node to which the primary shard corresponding to the replica shard belongs is determined; and the replica shard is distributed to a target node different from the target node to which the primary shard belongs.
[0118] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: detecting the node operation status of the target node based on the node load data; when the node operation status indicates that the target node has a fault, recalculating the comprehensive load weight based on the current node load data, and reallocating the data shards to be allocated based on the new comprehensive load weight.
[0119] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0120] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0121] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, 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.
[0122] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A data sharding processing method, characterized in that: The method comprises: Obtain node load data of multiple target nodes; Calculate the comprehensive load weight of each target node according to the node load data, and sort the target nodes from small to large according to the comprehensive load weight; When new data shards to be allocated are obtained, the data shards to be allocated are distributed to a preset number of target nodes in the sorting result; Monitor the node load data, and when a change value of the node load data exceeds a preset change threshold, recalculate the comprehensive load weight based on the current node load data, and reallocate the data slices to be allocated based on the new comprehensive load weight.
2. The method according to claim 1, characterized in that The node load data includes at least one parameter data of processor usage, memory occupancy, disk interface usage or network bandwidth occupancy; the calculating the comprehensive load weight of each target node according to the node load data includes: Obtaining a calculation adjustment coefficient corresponding to each parameter data in the node load data; The comprehensive load weight is calculated according to the parameter data in the node load data of the target node and the calculation adjustment coefficient corresponding to the parameter data.
3. The method according to claim 2, characterized in that The step of obtaining the calculation adjustment coefficient of the load data of each node includes: Obtaining the historical adjustment coefficient of the load data of each of the nodes and the historical load data of the target node; The adjustment coefficient is determined and calculated according to the historical adjustment coefficient and the historical load data.
4. The method according to claim 1, characterized in that: Calculating the comprehensive load weight of each target node according to the node load data includes: Calculate the initial load weight of each target node according to the current node load data; Predicting a load data change trend based on the historical node load data; The initial load weight is modified according to the load data change trend to obtain a comprehensive load weight.
5. The method according to any one of claims 1 to 4, characterized in that: When a new data shard to be allocated is obtained, distributing the data shard to be allocated to a preset number of target nodes in the sorting result includes: When a new data shard to be allocated is obtained, determining the shard type of the data shard to be allocated; In the case where the data shard to be allocated is a primary shard, distributing the primary shard to a preset number of target nodes in the sorting result; In the case where the data shard to be allocated is a replica shard, determining the target node to which the primary shard corresponding to the replica shard belongs; The replica shard is distributed to the target node different from the target node to which the primary shard belongs.
6. The method according to claim 1, characterized in that The method further comprises: Detecting the node operation status of the target node according to the node load data; When the node operation status indicates that the target node has failed, the steps of recalculating the comprehensive load weight according to the current node load data and reallocating the data slices to be allocated according to the new comprehensive load weight are performed.
7. A data sharding processing device, characterized in that: The device comprises: A data acquisition module, used to acquire node load data of multiple target nodes; A weight calculation module, used to calculate the comprehensive load weight of each of the target nodes according to the node load data, and sort the target nodes from small to large according to the comprehensive load weight; A data distribution module is used to distribute the data slices to be distributed to the target nodes of the first preset number in the sorting result when new data slices to be distributed are obtained; A monitoring and processing module is used to monitor the node load data. When the change value of the node load data exceeds a preset change threshold, the comprehensive load weight is recalculated based on the current node load data, and the data slices to be allocated are reallocated based on the new comprehensive load weight.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Cited By
Medical DRG data processing method and system and storage medium
CN120973529A
A medical DRG data processing method, system and storage medium
CN120973529B