Redis key dynamic management method, device, server and storage medium

By detecting division instructions in the Redis cluster and collecting node information, performing secondary division operations, the data access skew caused by Redis key allocation is solved, and the cluster's response capability and resource utilization are improved.

CN119030984BActive Publication Date: 2025-04-11SHENZHEN MINGTANG NEW ENERGY TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411132764.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-19
Publication Date
2025-04-11
Estimated Expiration
2044-08-19

AI Technical Summary

Technical Problem

The existing Redis key allocation method causes the keys of high-frequency access to be concentrated on the same node, causing the problem of data access skew.

Method used

When detecting the division instructions, the Redis cluster nodes are collected, the first and second node information is obtained, and the secondary division operation is performed based on this information, and the distribution of the Redis keys is dynamically adjusted to balance the node load.

Benefits of technology

It effectively reduces the skew of data access, improves overall response capabilities, reduces access latency, and improves the resource utilization of Redis cluster.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119030984B_ABST
    Figure CN119030984B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of data processing, and discloses a dynamic management method, device, server and storage medium of Redis keys. The method comprises: when a partition instruction is detected, performing an information collection operation on a node in a Redis cluster to obtain first node information, and performing a partition operation on a Redis key corresponding to the node; when the partition operation is completed, performing an information collection operation on the node again to obtain second node information; and performing a secondary partition operation on the Redis key according to the first node information and the second node information. In an embodiment of the present invention, after the partition operation of the Redis key is completed, information is collected on the node again, and according to the information changes before and after the two times, the Redis keys that may cause data access skew are screened out. Performing a secondary partition operation on these Redis keys can further balance the load between nodes, improve the overall response capability, and reduce access delays.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and in particular to a Redis key dynamic management method, device, server and storage medium. Background Art

[0002] A Redis cluster has 16384 hash slots, and a Redis cluster has multiple host nodes. 16384 hash slots are allocated to each node. If a cluster has 4 nodes, 16384 hash slots will be evenly allocated to each node, and each node will have multiple keys (Redis keys).

[0003] The current key allocation method uses the key name as an input parameter and uses a specific algorithm to allocate the node to which the key belongs. Under this allocation method, most of the frequently accessed keys may be concentrated on the same node, which will cause data access skew on the node. A new technical means is needed to solve the above technical problems. Summary of the invention

[0004] The main purpose of the present invention is to solve the technical problem that under the conventional Key distribution method, most of the frequently accessed Keys are concentrated on the same node, which will cause data access skew on the node.

[0005] A first aspect of the present invention provides a dynamic management method for Redis keys, the dynamic management method for Redis keys comprising:

[0006] When a partition instruction is detected, an information collection operation is performed on the nodes in the Redis cluster to obtain first node information, and a partition operation is performed on the Redis key corresponding to the node;

[0007] When the division operation is completed, the information collection operation is performed on the node again to obtain second node information;

[0008] Perform a secondary partitioning operation on the Redis key according to the first node information and the second node information

[0009] Optionally, in a first implementation manner of the first aspect of the present invention, the step of performing a secondary partitioning operation on the Redis key according to the first node information and the second node information includes:

[0010] Calling a preset resource occupancy segmentation method and a preset Redis cluster resource occupancy trend prediction method, and predicting trend information of the Redis key in the future according to the first node information and the second node information, wherein the trend information represents a demand trend of the Redis key for resources in the future, and the resources include computing resources and / or storage resources;

[0011] The secondary partitioning operation is performed on the Redis key according to the trend information.

[0012] Optionally, in a second implementation of the first aspect of the present invention, the step of performing the secondary partitioning operation on the Redis key according to the trend information includes:

[0013] The preset dynamic splitting method is called, and the secondary splitting operation is performed on the Redis key according to the trend information.

[0014] Optionally, in a third implementation of the first aspect of the present invention, the step of calling a preset dynamic splitting method according to the trend information to perform the secondary splitting operation on the Redis key includes:

[0015] According to the trend information, a target key having a periodic access number reaching a preset number is selected from the Redis keys;

[0016] Splitting the target key into a plurality of subkeys;

[0017] The sub-keys are redistributed to the nodes to complete the secondary partitioning operation.

[0018] Optionally, in a fourth implementation of the first aspect of the present invention, when the resource utilization ratio in the node is greater than a preset ratio, the step of performing the secondary partitioning operation on the Redis key according to the trend information includes:

[0019] When the resource utilization ratio in the node is greater than a preset ratio, the secondary partitioning operation is performed on the Redis key according to the trend information.

[0020] Optionally, in a fifth implementation of the first aspect of the present invention, the step of calling the resource occupancy segmentation method and the Redis cluster resource occupancy trend prediction method to predict the trend information of the Redis key in the future according to the first node information and the second node information includes:

[0021] Calling the subdivided resource occupation method, and calculating the resource occupation growth rate of the Redis key according to the first node information and the second node information;

[0022] The Redis cluster resource occupancy trend prediction method is called to predict the trend information of the Redis key in the future according to the resource occupancy growth rate.

[0023] Optionally, in a sixth implementation of the first aspect of the present invention, the information collection operation includes collecting CPU status information, memory status information, QPS information, and connection number status information.

[0024] A second aspect of the present invention provides a dynamic management device for Redis keys, comprising a memory and a processor, wherein the processor is used to execute program instructions stored in the memory so that the dynamic management device for Redis keys executes the above-mentioned dynamic management method for Redis keys.

[0025] A third aspect of the present invention provides a server, characterized in that it includes a memory and a processor, and the processor is used to execute program instructions stored in the memory so that the server executes the above-mentioned dynamic management method of Redis keys.

[0026] A fourth aspect of the present invention provides a computer-readable storage medium, in which instructions are stored, and when the computer-readable storage medium is run on a computer, the computer executes the above-mentioned dynamic management method of Redis keys.

[0027] In an embodiment of the present invention, when a partition instruction is detected, an information collection operation is performed on the nodes in the Redis cluster to obtain the first node information, and a partition operation is performed on the Redis key corresponding to the node; when the partition operation is completed, the information collection operation is performed on the node again to obtain the second node information; based on the first node information and the second node information, a secondary partition operation is performed on the Redis key. After the partition operation of the Redis key is completed, information is collected from the node again, and based on the information changes before and after the two times, the Redis keys that may cause data access skew are screened out. Performing a secondary partition operation on these Redis keys can further balance the load between nodes, improve the overall response capability, and reduce access delays. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 A schematic diagram of an embodiment of a dynamic management method for Redis keys in an embodiment of the present invention;

[0029] Figure 2 A schematic diagram of a specific embodiment of step 103 of the dynamic management method of Redis keys in an embodiment of the present invention;

[0030] Figure 3This is a schematic diagram of a specific embodiment of step 1031 of the dynamic management method of Redis keys in an embodiment of the present invention;

[0031] Figure 4 A schematic diagram of an embodiment of a dynamic management device for Redis keys in an embodiment of the present invention;

[0032] Figure 5 FIG. 1 is a schematic diagram of an embodiment of a server in an embodiment of the present invention. DETAILED DESCRIPTION

[0033] The embodiments of the present invention provide a Redis key dynamic management method, device, server and storage medium.

[0034] The embodiments disclosed in the present invention will be described in more detail below with reference to the accompanying drawings. Although certain embodiments disclosed in the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present invention. It should be understood that the drawings and embodiments disclosed in the present invention are only for exemplary purposes and are not intended to limit the scope of protection disclosed in the present invention.

[0035] In the description of the embodiments disclosed in the present invention, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc. may refer to different or the same objects. Other explicit and implicit definitions may also be included below.

[0036] The terms involved in the dynamic management method of Redis keys include but are not limited to:

[0037] Redis Cluster: is a distributed database solution for Redis.

[0038] Redis key: In Redis, a key is a unique identifier for stored data and is used to access values ​​stored in the Redis database. Redis keys can be data types such as strings, hashes, lists, sets, and ordered sets.

[0039] Partition instruction: In the dynamic management method of Redis keys, the partition instruction refers to the instruction or signal that triggers the Redis key repartition operation.

[0040] Information collection operation: Information collection operation refers to the process of collecting node status information in the Redis cluster. It can include CPU usage, memory usage, query processing volume (QPS), number of connections, etc., which are used to evaluate node performance and resource usage.

[0041] CPU status information: refers to data reflecting the CPU working status, such as CPU usage, load, and idle time. In Redis cluster management, this information is used to evaluate the computing resource usage of the node.

[0042] Memory status information: Memory status information refers to data that reflects memory resource usage, such as memory usage, remaining memory, and swapping. In a Redis cluster, memory status information is critical for evaluating the storage resource usage of a node.

[0043] QPS (Queries Per Second): QPS refers to the query rate per second, which is an important indicator for measuring the server's processing capacity. In a Redis cluster, QPS information is used to evaluate the query processing capacity and load of a node.

[0044] Connection status information: The connection status information refers to the number of connections currently established with the Redis node. This information is important for evaluating the concurrent processing capabilities and resource usage of the node.

[0045] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 , an embodiment of the dynamic management method of Redis keys in an embodiment of the present invention includes:

[0046] 101. When a partition instruction is detected, an information collection operation is performed on the nodes in the Redis cluster to obtain first node information, and a partition operation is performed on the Redis key corresponding to the node;

[0047] Specifically, the dynamic management device of the Redis key listens to or receives partitioning instructions triggered by an administrator, an automated script, or a scheduled task.

[0048] When a partition instruction is detected, the information collection program is started to perform information collection operations on each node in the Redis cluster.

[0049] Optionally, the information collection operation may include collecting preset types of information such as CPU status information, memory status information, QPS (query rate per second) information, and connection number status information of each node.

[0050] The collected node information is aggregated into the first node information.

[0051] According to the first node information and the distribution of the Redis key, an initial Redis key partitioning operation is performed. It is easy to understand that for business needs, the partitioning method usually takes the name of the Redis key as an input parameter and distributes the Redis key to the target node in the Redis cluster through a specific algorithm.

[0052] 102. When the division operation is completed, perform the information collection operation on the node again to obtain second node information;

[0053] Specifically, wait for the initial partitioning operation to complete and ensure that all necessary resource adjustments and Redis key migrations have been completed.

[0054] Start the information collection program again and perform information collection operations on each node in the Redis cluster to obtain the latest node status.

[0055] The node information collected this time is aggregated as the second node information for subsequent analysis and prediction.

[0056] 103. Perform a secondary partitioning operation on the Redis key according to the first node information and the second node information.

[0057] Specifically, the first node information and the second node information are compared to analyze the load changes of the Redis cluster and the access patterns of the Redis keys. The situation that may cause data access skew is identified, that is, the access volume of the Redis keys in some nodes is significantly higher than that of the Redis keys in other nodes, resulting in excessive load on the related nodes.

[0058] If there are situations that may cause excessive load, perform a secondary partitioning operation on the Redis key.

[0059] In an embodiment of the present invention, when a partition instruction is detected, an information collection operation is performed on the nodes in the Redis cluster to obtain the first node information, and a partition operation is performed on the Redis key corresponding to the node; when the partition operation is completed, the information collection operation is performed on the node again to obtain the second node information; based on the first node information and the second node information, a secondary partition operation is performed on the Redis key. After the partition operation of the Redis key is completed, information is collected from the node again, and based on the information changes before and after the two times, the Redis keys that may cause data access skew are screened out. Performing a secondary partition operation on these Redis keys can further balance the load between nodes, improve the overall response capability, and reduce access delays.

[0060] Traditional Redis cluster configuration is often based on a fixed resource allocation strategy, which cannot dynamically adjust resource allocation according to changes in actual application scenarios, resulting in low resource utilization and limited cluster performance. Most existing Redis key management methods rely on real-time monitoring and manual intervention, lack the ability to predict future resource requirements, and are difficult to cope with the challenges brought by sudden traffic and long-term growth trends. In order to solve the above technical problems, the present invention proposes an optional embodiment.

[0061] Optional, Figure 2 This is a schematic diagram of a specific embodiment of step 103 of the dynamic management method of Redis keys in an embodiment of the present invention. Step 103 also includes the following specific implementation methods:

[0062] 1031. Calling a preset resource occupancy segmentation method and a preset Redis cluster resource occupancy trend prediction method, and predicting trend information of the Redis key in the future according to the first node information and the second node information, wherein the trend information represents a demand trend of the Redis key for resources in the future, and the resources include computing resources and / or storage resources;

[0063] Specifically, the preset resource occupancy segmentation method is called to analyze the current resource usage of the Redis key (such as the number of read and write times, data size, etc.) and the performance indicators of the node to perform a fine-grained evaluation of the resource occupancy of the Redis key. For example, through the information data collected by the nodes in the Redis cluster (first node information, second node information), the trend information of the Redis key in the future can be predicted through the resource occupancy segmentation method of the key and the cluster resource occupancy trend prediction method.

[0064] 1032. Perform the secondary partitioning operation on the Redis key according to the trend information.

[0065] Specifically, based on the predicted trend information, the pressure that Redis keys may cause on cluster resources in the future is evaluated, and a secondary partitioning operation is performed on the Redis keys accordingly, including but not limited to reallocating Redis keys to more appropriate nodes, adjusting the storage structure or strategy of keys, etc., to further optimize the overall performance and resource utilization of the cluster.

[0066] In steps 1031-1032, through refined resource occupancy prediction and secondary partitioning operations, the supply and demand relationship between Redis keys and cluster resources can be more accurately matched, resource waste can be reduced, and resource utilization can be improved. Adjusting the distribution of Redis keys according to node status and resource demand trends can effectively avoid hot spots and resource bottlenecks and improve the overall performance of the cluster.

[0067] Redis cluster management faces the challenge of effective resource allocation and efficient utilization. The increase in data volume and access leads to high pressure on node resources. Traditional static configuration and post-adjustment methods have limitations, such as difficulty in adapting to changes, delayed response and lack of scientific prediction, which increases the uncertainty of operation and maintenance. In order to solve the above technical problems, the present invention proposes an optional embodiment.

[0068] Optional, Figure 3 This is a schematic diagram of a specific embodiment of step 1031 of the dynamic management method of Redis keys in an embodiment of the present invention. Step 1031 also includes the following specific implementation methods:

[0069] 10311. Call the resource occupation subdivision method to calculate the resource occupation growth rate of the Redis key according to the first node information and the second node information.

[0070] 10312. Call the Redis cluster resource occupancy trend prediction method to predict the trend information of the Redis key in the future according to the resource occupancy growth rate.

[0071] Specifically, define method 1-method 3:

[0072] Method 1: Subdivided resource occupancy method (single key resource occupancy statistics method): Before increasing or decreasing the key: node1 resource information:

[0073] CPU: N1C1: RAM: N1R1;

[0074] QPS: N1Q1;

[0075] Number of links; N1L1;

[0076] After increasing or decreasing KEY:

[0077] Node1 resource information:

[0078] CPU: N1C2: RAM: N1R2;

[0079] QPS: N1Q2;

[0080] Number of links: N1L2;

[0081] If node 1 adds or reduces Key1, the resource information occupied by Key1 is determined by subtracting the resource information before and after deployment and taking the absolute value. For example, the result of ABS(N1C1-N1C2) is Key1-C, and Key1-C is the CPU resource information occupied by Key1. (ABS means taking the absolute value). The results are obtained in sequence:

[0082] Key1-C,

[0083] Memory: Key1-R;

[0084] QPS: Key1-Q;

[0085] Number of links: Key1-L.

[0086] Method 2: Subdivided resource usage method (single key resource statistics method in different time periods): Based on method 1, the CPU resource usage of each key in each time period is calculated in hours. For example:

[0087] CPU: Key1-C-time1,Key1-C-ime2,Key1-C-time3.

[0088] Memory: Key1-R-time1, Key1-R-time2, Key1-R-time3. QPS: Key1-Q-time1, Key1-Q-time2, Key1-Q-time3.

[0089] Number of links: Key1-L-time1, Key1-L-time2, Key1-L-time3.

[0090] Method 3: Redis cluster resource usage trend prediction method is based on method 2. The unit of hours is changed to 10 days to obtain the growth rate of key resource usage, such as:

[0091] The CPU utilization rate of Key1 increases: ▲Key1-C;

[0092] Key1 memory utilization rate increase rate: ▲Key1-R;

[0093] Key1's QPS increase rate: ▲Key1-Q;

[0094] The speed at which the number of links of Key1 increases: ▲Key1-L.

[0095] By using the growth rate, we can predict the indicator status of the Redis cluster in the future, that is, the trend information.

[0096] Specifically, the preset resource occupancy segmentation method is called to analyze the current resource usage of the Redis key (such as the number of read and write times, data size, etc.) and the performance indicators of the node to perform a fine-grained evaluation of the resource occupancy of the Redis key. For example, through the information data collected by the nodes in the Redis cluster (first node information, second node information), through the Key resource occupancy segmentation method (method 1:, method 2), and the cluster resource occupancy trend prediction method (method 3), the trend information of the Redis key in the future is predicted.

[0097] In the optional embodiment including steps 10311-10312, by combining the subdivided resource occupancy method and the trend prediction method, the resource demand trend of the Redis key in the future can be predicted more accurately, providing strong support for the resource allocation and expansion of the cluster. Based on the prediction results, the expansion and optimization strategy of the Redis cluster can be planned in advance to avoid emergency processing when resource bottlenecks occur, thereby improving the stability of the management device.

[0098] As the complexity of applications and services increases, the number and types of keys in Redis clusters surge, and resource requirements fluctuate greatly. Traditional management methods are based on fixed sharding or simple load balancing, which makes it difficult to accurately predict and respond to changes in resource requirements, resulting in uneven resource allocation, with a few nodes overloaded due to the concentration of popular keys, while other nodes are idle, and low resource utilization. In order to solve the above technical problems, the present invention proposes an optional embodiment.

[0099] Optionally, step 1032 also includes the following specific implementations:

[0100] 10321. Call a preset dynamic splitting method, and perform the secondary splitting operation on the Redis key according to the trend information.

[0101] Specifically, method 4 (Redis key dynamic splitting method) is defined as follows: when it is detected that the resource utilization ratio of a node in the Redis cluster reaches the preset alarm threshold or a node fails, the Redis key is automatically split. The monitoring server can quickly configure the Redis keys in the server cluster within milliseconds through the TCP connection established between the monitoring server and the high-concurrency server cluster, thereby solving the problem of high resource utilization ratio of a single node or node failure in the Redis cluster.

[0102] Optionally, when the resource utilization ratio in the node is greater than the preset ratio, the secondary division operation is performed on the Redis key according to the trend information. For example, the key of node 1 is: Node1Key, the CPU utilization (resource utilization ratio), and the alarm threshold (preset ratio) is: 80%. When the alarm threshold is reached, the dynamic splitting method (method 4) is called, and the Redis key needs to be divided twice.

[0103] In an optional embodiment including step 10321, by predicting the resource demand trend of Redis keys in the future and performing secondary partitioning operations accordingly, refined management of cluster resources is achieved. Excessive concentration of resources on a few nodes is avoided. Furthermore, by dynamically adjusting the distribution of Redis keys, the load of the cluster can be better balanced and the overall performance can be improved.

[0104] As the volume of business increases, the access frequency of specific keys in the Redis cluster will increase. Traditional resource allocation is uneven, the performance of high-load nodes decreases, and resources of low-load nodes are wasted. Post-adjustment response is slow, affecting business. Simple re-sharding is difficult to accurately solve resource imbalance and ignores key access characteristics and demand changes. In order to solve the above technical problems, the present invention proposes an optional embodiment.

[0105] Step 10321 also includes the following specific implementations:

[0106] 103211. According to the trend information, select target keys whose periodic access times reach a preset number from the Redis keys;

[0107] Specifically, the Redis keys whose periodic access times are expected to reach or exceed the preset times in the future are identified as target keys. The target keys are frequently accessed and will cause great pressure on cluster resources, so they are the objects of secondary division.

[0108] 103212. Split the target key into multiple subkeys;

[0109] Specifically, the selected target keys are split according to data size and access mode. The split subkeys can better adapt to the resource distribution and load of the cluster.

[0110] 103213. Redistribute the subkeys to the nodes to complete the secondary partitioning operation.

[0111] Specifically, the split subkeys are redistributed to the nodes in the Redis cluster. The division can be based on the node load, resource utilization, network latency, etc. to ensure that the subkeys can be reasonably allocated to the optimal nodes.

[0112] In an optional embodiment including steps 103211-103212, by accurately identifying and splitting the frequently accessed Redis keys, cluster resources can be effectively utilized to avoid excessive concentration of resources on a few nodes. The split sub-keys can be more evenly distributed in the cluster, reducing the load pressure of a single node, thereby improving the overall performance of the cluster.

[0113] Optionally, a series of trend information thresholds are preset, which represent the acceptable upper limit of the resource demand of Redis keys at different time points or time periods. They can be set according to actual conditions and performance requirements.

[0114] The predicted trend information of each Redis key is compared with the preset trend information threshold.

[0115] If the trend information of a Redis key exceeds the corresponding preset threshold at a certain time point or time period in the future, it is considered that the resource demand of the Redis key in the future will exceed the carrying capacity, and it will be identified as the target Redis key. The filtered target Redis key list is output for subsequent secondary partitioning operations.

[0116] Optionally, the first node information and the second node information are input into a neural network prediction model, and the model performs calculations based on the input data and internally learned parameters, and outputs the demand trend of the Redis key for resources in the future. The output results of the model are post-processed, such as parsing and formatting, to facilitate use in subsequent steps.

[0117] Optionally, during the operation of the Redis cluster, node information at multiple time points is continuously collected as training information, including but not limited to CPU status, memory status, QPS, and number of connections, with a timestamp to indicate the time point of collection.

[0118] The preset neural network model is trained using the training information. During the training process, the prediction error is minimized by adjusting the parameters of the model until the model achieves satisfactory performance.

[0119] Use an independent test set to evaluate the trained model to verify its predictive performance. Evaluation metrics can include accuracy, recall, F1 score, etc.

[0120] Deploy the trained neural network prediction model to the Redis cluster so that it can be used to predict the future resource demand of Redis keys during actual runtime.

[0121] Optionally, read a list of all currently stored Redis keys from the nodes of the Redis cluster. Filter out the target Redis key from all Redis keys according to preset filtering conditions (such as access frequency, resource occupancy, etc.). At the same time, mark the remaining keys that are not filtered as target Redis keys as non-target Redis keys. According to the status information of the current node (such as CPU load, memory usage, etc.), select the dynamic split algorithm that best suits the current environment from the preset algorithm library as the target dynamic split algorithm. Call the selected target dynamic split algorithm to split each filtered target Redis key to generate multiple subkeys. The split strategy may vary depending on the specific algorithm, but usually needs to consider the balance and access efficiency of the data. By selecting a dynamic split algorithm that matches the current node status (i.e., the second node information) from the preset algorithm library and configuring the algorithm parameters according to real-time information, the pertinence of the algorithm call is greatly improved, and a target dynamic split algorithm for the target Redis key can be generated. Different node states may require different processing strategies, and the dynamic selection algorithm can ensure that each operation can achieve the best effect.

[0122] Furthermore, considering that the access frequency of non-target Redis keys is low, they are extracted first, the target Redis keys are allocated first, and then the non-target Redis keys are redistributed to the nodes in a load-balanced manner. By giving priority to and allocating target Redis keys with high access frequencies (i.e., keys that are predicted to have resource requirements exceeding a preset threshold in the future), requests for high-load keys can be responded to more quickly, thereby improving the overall response speed and throughput. After processing the high-load target Redis keys, the load balancing algorithm is used to redistribute the non-target Redis keys to the nodes, which can ensure the load balancing of the system and reduce the system bottleneck problem caused by overloading of individual nodes.

[0123] Reference Figure 4, the embodiment of the present disclosure provides a dynamic management device 400 for Redis keys, including a dynamic management device body for Redis keys, and a dynamic management device 405 for Redis keys. The dynamic management device 405 for Redis keys includes a processor (processor) 404 and a memory (memory) 401 storing program instructions. Optionally, the device may also include a communication interface (Communication Interface) 402 and a bus 403. Among them, the processor 404, the communication interface 402, and the memory 401 can complete mutual communication through the bus 403. The communication interface 402 can be used for information transmission. The processor 404 can call the program instructions in the memory 401 to execute the dynamic management method of the Redis key of the above embodiment. In addition, the logical instructions in the above-mentioned memory 401 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. The memory 401, as a computer-readable storage medium, can be used to store software programs, computer executable programs, such as program instructions / modules corresponding to the method in the embodiment of the present disclosure. The processor 404 executes the functional application and data processing by running the program instructions / modules stored in the memory 401, that is, the dynamic management method of the Redis key in the above embodiment is realized. The memory 401 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 401 may include a high-speed random access memory and may also include a non-volatile memory.

[0124] Reference Figure 5 , the embodiment of the present disclosure provides a server 500, including a processor (processor) 504 and a memory (memory) 501 storing program instructions. Optionally, the server may also include a communication interface (CommunicationInterface) 502 and a bus 503. Among them, the processor 504, the communication interface 502, and the memory 501 can communicate with each other through the bus 503. The communication interface 502 can be used for information transmission. The processor 504 can call the program instructions in the memory 501 to execute the dynamic management method of the Redis key of the above embodiment.

[0125] In addition, the logic instructions in the above-mentioned memory 501 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. The memory 501, as a computer-readable storage medium, can be used to store software programs, computer executable programs, such as program instructions / modules corresponding to the method in the embodiment of the present disclosure. The processor 504 executes functional applications and data processing by running the program instructions / modules stored in the memory 501, that is, the dynamic management method of Redis keys in the above-mentioned embodiment is implemented. The memory 501 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 501 may include a high-speed random access memory and may also include a non-volatile memory.

[0126] The technical solution of the embodiment of the present disclosure can be embodied in the form of a software product, which is stored in a storage medium and includes one or more instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in the embodiment of the present disclosure. The aforementioned storage medium may be a non-transient storage medium, including: a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk, and other media that can store program codes, or a transient storage medium.

[0127] The above description and the accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent only possible changes. Unless explicitly required, separate components and functions are optional, and the order of operations may vary. Parts and features of some embodiments may be included in or replace parts and features of other embodiments. Moreover, the words used in this application are only used to describe the embodiments and are not used to limit the claims. As used in the description of the embodiments and the claims, unless the context clearly indicates, the singular forms of "a", "an" and "the" are intended to include plural forms as well. Similarly, the term "and / or" as used in this application refers to any and all possible combinations of one or more associated listings. In addition, when used in this application, the term "comprise" and its variants "comprises" and / or comprising refer to the presence of stated features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the presence of other identical elements in the process, method or device including the elements. In this article, each embodiment may focus on the differences from other embodiments, and the same and similar parts between the embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.

[0128] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software may depend on the specific application and design constraints of the technical solution. The technicians may use different methods for each specific application to implement the described functions, but such implementations should not be considered to exceed the scope of the embodiments of the present disclosure. The technicians may clearly understand that, for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above may refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.

[0129] In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units can be only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit.

[0130] The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and the block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.

Claims

1. A dynamic management method for Redis keys, characterized in that: The dynamic management method of the Redis key includes: When a partition instruction is detected, an information collection operation is performed on the nodes in the Redis cluster to obtain first node information, and a partition operation is performed on the Redis key corresponding to the node; When the division operation is completed, the information collection operation is performed on the node again to obtain second node information; Calling a preset resource occupancy segmentation method and a preset Redis cluster resource occupancy trend prediction method, and predicting trend information of the Redis key in the future according to the first node information and the second node information, wherein the trend information represents a demand trend of the Redis key for resources in the future, and the resources include computing resources and / or storage resources; According to the trend information, a secondary partitioning operation is performed on the Redis key.

2. The dynamic management method of Redis keys according to claim 1, characterized in that: The step of performing a secondary partitioning operation on the Redis key according to the trend information comprises: The preset dynamic splitting method is called to perform the secondary splitting operation on the Redis key according to the trend information.

3. The dynamic management method of Redis keys according to claim 2, characterized in that: The step of calling a preset dynamic splitting method according to the trend information and performing the secondary splitting operation on the Redis key includes: According to the trend information, a target key having a periodic access number reaching a preset number is selected from the Redis keys; Splitting the target key into a plurality of subkeys; The sub-keys are redistributed to the nodes to complete the secondary partitioning operation.

4. The dynamic management method of Redis keys according to claim 1, characterized in that: The step of performing a secondary partitioning operation on the Redis key according to the trend information includes: When the resource utilization ratio in the node is greater than a preset ratio, the secondary partitioning operation is performed on the Redis key according to the trend information.

5. The dynamic management method of Redis keys according to claim 1, characterized in that: The calling of the resource occupancy segmentation method and the Redis cluster resource occupancy trend prediction method, and the step of predicting the trend information of the Redis key in the future according to the first node information and the second node information, comprises: Calling the subdivided resource occupation method, and calculating the resource occupation growth rate of the Redis key according to the first node information and the second node information; The Redis cluster resource occupancy trend prediction method is called to predict the trend information of the Redis key in the future according to the resource occupancy growth rate.

6. The dynamic management method of Redis keys according to claim 1, characterized in that: The information collection operation includes collecting CPU status information, memory status information, QPS information and connection number status information.

7. A dynamic management device for Redis keys, characterized in that: It comprises a memory and a processor, wherein the processor is used to execute program instructions stored in the memory to implement any one of the Redis key dynamic management methods of claims 1 to 6.

8. A server, characterized in that: It comprises a memory and a processor, wherein the processor is used to execute program instructions stored in the memory to implement any one of the Redis key dynamic management methods of claims 1 to 6.

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 dynamic management method of Redis keys according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Data management method and device in Redis cluster, medium and electronic equipment

    CN111639061A

  • Redis cluster memory balancing method and device, electronic equipment and readable storage medium

    CN115470004A