Redis hot data migration method

By monitoring and migrating high-access-pressure data in the Redis cluster in real time, the cluster pressure problem caused by high-hot-data access was solved, and the stability and performance of the system were improved.

CN113760523BActive Publication Date: 2026-03-17BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-16
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

Existing technologies are unable to effectively cope with the cluster pressure when internet companies experience high-volume data access, leading to issues such as slave devices and cluster crashes.

Method used

By collecting raw request information from the master to the slave in the Redis cluster, asynchronously parsing and reassembling the data, real-time monitoring of access pressure, and migrating high-access-pressure data to a standby slave when the load reaches a predetermined standard, the automatic migration is achieved using aspect-oriented programming and message middleware technology.

Benefits of technology

It enables efficient migration of high-frequency data, avoids single-machine and cluster crashes, and improves system stability and performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113760523B_ABST
    Figure CN113760523B_ABST
Patent Text Reader

Abstract

The application provides a Redis high-hot data migration method, which comprises the following steps: counting original request information sent from a host to one or more slaves corresponding to the host in a Redis cluster, asynchronously analyzing the original request information and pushing the analyzed request information; recombining the pushed analyzed request information to count the access pressure of each data in the one or more slaves; and obtaining the load condition of the host, and when it is determined that the load of the host meets the predetermined standard of the host, migrating the data with the top N access pressures in all data in all slaves to a backup slave, wherein N is a positive integer. The application can realize automatic migration of high-hot data in a Redis cluster, and avoid the slave crash and cluster crash caused by all access quantities hitting the same slave in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and more specifically, to a method and apparatus for migrating Redis high-hotspot data. Furthermore, this invention also provides an electronic device for migrating Redis high-hotspot data and a computer-readable medium capable of storing a program for executing the Redis high-hotspot data migration method of this invention. Background Technology

[0002] In recent years, large internet companies have experienced explosive growth in data volume. Consequently, they have placed increasing emphasis on building Redis (Remote Dictionary Server) caching systems, employing Redis Cluster master-slave architectures to achieve distributed master-slave switching and distribute user access requests across different slaves for faster queries. This allows the cluster to collectively process data requests, reducing the load on individual machines. However, under current circumstances, the concentrated access to high-frequency data on the internet renders existing solutions inadequate for the needs of modern internet companies. Summary of the Invention

[0003] In view of this, a method for migrating Redis high-hot-data and an apparatus for implementing Redis high-hot-data migration are provided. Furthermore, the present invention also provides an electronic device for migrating Redis high-hot-data and a computer-readable medium capable of storing a program for executing the Redis high-hot-data migration method of the present invention.

[0004] Specifically, this invention provides a method for migrating Redis data that is frequently accessed, the method comprising:

[0005] The system collects raw request information from the host to one or more slaves corresponding to the host in the Redis cluster, performs asynchronous parsing on the raw request information, and pushes the parsed request information.

[0006] The parsed request information being pushed is reassembled to calculate the access pressure of each data item in the one or more slave devices; and

[0007] The load status of the host is obtained, and when the load of the host meets the host's predetermined standard, the top N data with the highest access pressure from all data in all slaves are migrated to the standby slave, where N is a positive integer.

[0008] According to one aspect of the present invention, the original request information is statistically analyzed using aspect-oriented programming.

[0009] According to one aspect of the present invention, the parsed request information includes at least one of the user-requested data point, slot name, and slave IP.

[0010] According to one aspect of the present invention, the parsed request information is pushed asynchronously.

[0011] According to one aspect of the present invention, the host pre-defined criteria include one of the following:

[0012] The current storage pressure of the host is greater than the maximum host pressure capacity.

[0013] The average time for a single request on the host is greater than the average time for the maximum single request.

[0014] The host's CPU utilization is greater than the maximum CPU utilization, and

[0015] The host's read capability is less than the minimum read capability.

[0016] According to one aspect of the present invention, when it is determined that the load of the host does not meet the predetermined standard of the host, it is further determined whether the access pressure of each data in the one or more slave machines is greater than the maximum carrying capacity, and

[0017] When it is determined that the access pressure of any one of the data exceeds the maximum carrying capacity, the data is migrated to the standby slave.

[0018] According to one aspect of the present invention, when it is determined that the load of the host does not meet the host predetermined standard, it is further determined whether the load of the one or more slave devices meets the slave predetermined standard.

[0019] When it is determined that the load of any one of the slave devices meets the predetermined slave device standard, it is further determined whether the access pressure of each data of that slave device is greater than the maximum capacity value, and

[0020] When it is determined that the access pressure of any one of the data exceeds the maximum carrying capacity, the data is migrated to the standby slave.

[0021] According to one aspect of the present invention, when it is determined that the load of the host does not meet the host predetermined standard, it is further determined whether the load of the one or more slave devices meets the slave predetermined standard.

[0022] When it is determined that the load of any one of the slave devices meets the predetermined slave device standard, it is further determined whether the access pressure of each data of the slave device is greater than the maximum carrying value. When it is determined that the access pressure of all data in the slave device is equal to or less than the maximum carrying value, the data with the first M access pressures in the slave device is migrated to the standby slave device, where M is a positive integer.

[0023] According to one aspect of the present invention, the slave device predetermined standard includes one of the following:

[0024] The current storage pressure of any one of the slave devices is greater than the maximum master pressure limit.

[0025] The average time of a single request from any one of the more than one slave devices is greater than the average time of the maximum single request.

[0026] The CPU utilization of any one of the more than one slave devices is greater than the maximum CPU utilization, and

[0027] The read capability of any one of the more than one slave devices is less than the minimum read capability.

[0028] According to one aspect of the present invention, an apparatus for migrating high-hotspot data in Redis is provided, the apparatus comprising:

[0029] The statistics module is used to count the original request information sent from the host to one or more slaves corresponding to the host in the Redis cluster, asynchronously parse the original request information and push the parsed request information.

[0030] The resource configuration module is used to reassemble the parsed request information being pushed to the slave devices to calculate the access pressure of each data item in the slave devices; and

[0031] The high-access data migration module is used to obtain the load status of the host, and when it is determined that the load of the host meets the host's predetermined standard, migrate the top N data with the highest access pressure from all the data in all the slaves to the standby slave, where N is a positive integer.

[0032] According to one aspect of the present invention, an electronic device for migrating high-hotspot data in Redis is provided, comprising:

[0033] One or more processors; and

[0034] Storage device for storing one or more programs.

[0035] When the one or more programs are executed by the one or more processors, the one or more processors implement the Redis high-hotspot data migration method of the present invention.

[0036] According to one aspect of the present invention, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the Redis high-hotspot data migration method of the present invention.

[0037] One embodiment of the present invention has the following advantages or beneficial effects: Based on a Redis Cluster, the present invention statistically analyzes access traffic, captures high-frequency data in real time, and provides the ability to automatically migrate high-frequency data. This avoids the scenario in existing technologies where all access traffic is directed to the same slave device, leading to slave device and cluster crashes.

[0038] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description

[0039] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:

[0040] Figure 1 This is a schematic diagram of one embodiment of the apparatus for migrating high-hotspot data in Redis according to the present invention;

[0041] Figure 2 This is a schematic diagram showing the location of the access statistics module of the present invention;

[0042] Figure 3 This is a schematic diagram of a high-access data migration step according to an embodiment of the present invention;

[0043] Figure 4 This is a schematic diagram of a high-access data migration step according to another embodiment of the present invention;

[0044] Figure 5 This is a schematic diagram of a high-access data migration step according to another embodiment of the present invention;

[0045] Figure 6 This is an exemplary system architecture diagram in which embodiments of the present invention can be applied;

[0046] Figure 7 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Detailed Implementation

[0047] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0048] like Figure 1 As shown, the apparatus 100 for migrating high-access Redis data according to the present invention includes an access statistics module 101, a resource configuration module 102, and a high-access data migration module 103.

[0049] Preferably, the apparatus 100 for migrating high-hot data in Redis according to the present invention further includes a message middleware (ActiveMQ) 104.

[0050] In one embodiment of the present invention, the Redis high-hotspot data migration method of the present invention includes the following steps:

[0051] The system collects raw request information from the master to one or more slaves corresponding to the master in the Redis cluster, performs asynchronous parsing of the raw request information, and pushes the parsed request information.

[0052] The parsed request information is reassembled to assess the access pressure of various data points across one or more slave devices; and

[0053] Obtain the load status of the host, and when the host load meets the host's predetermined standard, migrate the top N data with the highest access pressure from all slaves to the standby slave, where N is a positive integer.

[0054] The following will describe in detail the Redis high-hotspot data migration method of the present invention with reference to the accompanying drawings.

[0055] like Figure 2 As shown, in a distributed Redis Cluster, the Redis Cluster 105 maintains the continuous existence of the master machine through an election mechanism. Each master machine is configured with multiple corresponding slave machines. The master machine receives all data requests and queries its maintained slots mapping table to determine which slave machine contains the data point for the current operation request's slot. It then sends the read request to the corresponding slave machine for processing. Upon receiving the request, the slave machine quickly queries its local data and returns it to the requesting end.

[0056] Access statistics steps

[0057] like Figure 2As shown, the access statistics module is located between the host and the slave devices. It collects the original request information sent from the host to the slave device corresponding to the host, performs asynchronous parsing on the original request information, and then sends the parsed request information to the resource configuration module. Specifically, the access statistics module 101 of this invention is located between the host and the slave devices, and performs statistics on the data forwarded by the host to different slave device requests. There is no particular limitation on the specific method of performing the statistics, but it is preferred to perform the statistics through aspect-oriented programming (hereinafter referred to as "AOP"). For example, after the host forwards a request, the access statistics module 101 first obtains the user's original request information through AOP. After obtaining the original request information, the access statistics module will use asynchronous parsing to parse the original request information and send the parsed request information to the resource configuration module 102.

[0058] In one embodiment of the present invention, the parsed request information may include the data point requested by the user, the slot name, and the slave IP.

[0059] In one embodiment of the present invention, preferably, after parsing the user's request information into a message, the access statistics module 101 sends the message to the message queue of the message middleware (ActiveMQ) 104. After receiving the parsed request information, the message middleware 104 asynchronously pushes the parsed request information to the resource configuration module 102.

[0060] Resource configuration steps

[0061] In the resource configuration step of this invention, after the resource configuration module 102 obtains the parsed request information pushed by the message middleware, it reassembles the parsed request information and stores the reassembled request information in the tree structure of the resource configuration module. Subsequently, the resource configuration module 102 calculates the access volume (access pressure) of each data in all slave machines within a specific time period based on the reassembled request information stored in the tree structure.

[0062] For example, in one embodiment of the present invention, after receiving the parsed request information sent by the access statistics module 101 or asynchronously pushed via activeMQ 104, the resource configuration module 102 obtains the slave IP and slot data from it, locates the current data in the data node corresponding to the configuration module, and places the param data, including the request time, under that data node. Subsequently, the resource configuration module 102 counts the access volume of slots in all slaves within 5 minutes.

[0063] In one embodiment of the present invention, the resource configuration module 102 sets a maximum capacity value for data access pressure in the slave device. This maximum capacity value is not particularly limited and can be set according to actual conditions. The predetermined time is not particularly limited and can be set according to actual permissions; for example, the predetermined time can be set to 5 minutes.

[0064] High-access data migration steps

[0065] In one embodiment of the present invention, the high-access data migration module 103 is a timed task, and its execution time can be configured by the resource configuration module 102. For example, if the resource configuration module configures the time to 5 minutes, then the high-access data migration module will execute once every 5 minutes.

[0066] In the high-access data migration step, the high-access data migration module 103 can obtain the host load information. There are no particular limitations on the method of obtaining the host load information; for example, the high-access data migration module 103 can obtain the host load information by obtaining the host's storage pressure or read capability, or it can obtain the current host load information by reading the host's CPU performance. On the other hand, in the high-access data migration step, the high-access data migration module 103 can also use the access statistics module to analyze the parsed request information passed in from 101 and obtain the average time for a single request on the current host.

[0067] In one embodiment of the present invention, when the host load meets the host's predetermined standard, the high-access data migration module 103 can determine that the host load is too high and that high-hot data in the slave needs to be migrated to a standby slave. This standby slave is not the slave corresponding to the host in the Redis Cluster 105, but rather another slave outside the Redis Cluster 105.

[0068] In one embodiment of the present invention, the host pre-set criteria can be preset by the resource configuration module 102. There are no particular limitations on the host pre-set criteria, but they may include one of the following: the host storage pressure is greater than the host's maximum load capacity, the host's read capability is less than the host's minimum read capability, the average time of a single request is less than or equal to the host's maximum average time of a single request, and the host's CPU utilization is greater than the host's maximum CPU utilization.

[0069] In one embodiment of the present invention, preset values ​​such as the host's maximum load capacity, the host's minimum read capability, the host's maximum average time for a single request, and the host's maximum CPU utilization can be preset by the resource configuration module 102 according to the actual situation.

[0070] During the high-access data migration step, when the host load is determined to be too high, the high-access data migration module 103 will read all slots from all slave machines counted by the resource configuration module 102 to obtain the top N (N is a positive integer) hotspot data with the highest host call count (access pressure). The system will automatically use the "redis-cli add-node" command to add the standby slave machine to the Redis Cluster. At this time, the slots allocated to the host are empty.

[0071] For example, such as Figure 3 As shown, in one embodiment of the present invention, the top ten data entries with the highest access pressure among all slave devices include the slots node numbered 15256. The system then executes the following process:

[0072] 1. Send the command "cluster setslot 15256 importing sourceNodeId" (host cluster Id) to the target node to instruct the target node to prepare the data to be imported into the slot;

[0073] 2. Send the command `cluster setslot 15256 migrating new host cluster Id (host cluster Id)` to the source node to prepare the source node to migrate the data out of the slot.

[0074] Repeat the above process ten times to migrate the top ten most accessed data to the new standby slave, thereby reducing the load on the master machine.

[0075] On the other hand, if the host's load does not meet predetermined standards—for example, if the host's current storage pressure is less than or equal to the host's maximum load capacity, the host's average time per request is less than or equal to the host's maximum average time per request, the host's CPU utilization is less than or equal to the host's maximum CPU utilization, and the host's read capability is greater than or equal to the host's minimum read capability—then the host's load is considered normal. Subsequently, it is further determined whether the access pressure of each data item on all slave devices corresponding to the host exceeds the maximum load capacity. If the access pressure of any data item exceeds the maximum load capacity, then the access pressure of that data item is considered too high, and processes 1 and 2 above are executed to migrate the data to a standby slave device. If the access pressure of all data items on all slave devices is less than or equal to the maximum load capacity, then the data access pressure is considered normal, and no operation is performed.

[0076] In one embodiment of the present invention, such as Figure 4As shown, when the host load is determined to be normal, the high-access data migration module 103 can obtain the load status of all slave devices corresponding to the host in the Redis Cluster 105. There are no particular limitations on the method for obtaining slave device load status; it can be obtained in a similar way to obtaining host load status. For example, the high-access data migration module 103 can obtain slave device load status by obtaining the slave device's storage pressure or read capability, or it can obtain slave device load status by reading the slave device's CPU performance. On the other hand, the high-access data migration module 103 can also use the access statistics module to analyze the parsed request information passed from 101 and obtain the average time for a single request from the current slave device.

[0077] In one embodiment of the present invention, the slave device pre-set criteria can be preset by the resource configuration module 102. There are no particular limitations on the slave device pre-set criteria, but they may include one of the following: the slave device's storage pressure is greater than the slave device's maximum withstand pressure value; the slave device's read capability is less than the slave device's minimum read capability; the average time of a single request by the slave device is less than or equal to the maximum average time of a single request by the slave device; and the slave device's CPU utilization rate is greater than the slave device's maximum CPU utilization rate.

[0078] In one embodiment of the present invention, preset values ​​such as the maximum load capacity of the slave device, the minimum read capability of the slave device, the average time of the maximum single request of the slave device, and the maximum CPU utilization of the slave device can be preset by the resource configuration module 102 according to the actual situation.

[0079] In one embodiment of the present invention, such as Figure 4 As shown, when it is determined that the load on a slave device is too high, it is further determined whether the access pressure of each data on that slave device exceeds the maximum capacity. If the access pressure of a certain data exceeds the maximum capacity, it is determined that the access pressure of that data is too high, and thus processes 1 and 2 above are executed to migrate the data to a standby slave device. On the other hand, when it is determined that the load on the slave device is normal, no operation is performed.

[0080] In one embodiment of the present invention, such as Figure 5 As shown, when a slave device is determined to be overloaded and the access pressure of each data in the slave device is less than or equal to the maximum carrying value, that is, when the access pressure of all data in the slave device is normal, the high access data migration module 103 migrates the top M (M is a positive integer) hot data with the highest access pressure in the slave device to the standby slave device.

[0081] According to the Redis high-access data migration method of the present invention, after the data node migration is completed, the high-access data migration module 103 will quickly update the IP-slotId mapping table maintained by the resource configuration module 102, remove the migrated slot node from the original slave IP node, create a standby slave IP node, and add the data to the current slave IP data node. Furthermore, after the scheduled task is completed, the high-access data migration module 103 will reset the data of all data nodes to zero.

[0082] Figure 6 An exemplary system architecture 600 is shown that can be applied to the Redis high-hotspot data migration method or Redis high-hotspot data migration apparatus of the present invention.

[0083] like Figure 6 As shown, system architecture 600 may include terminal devices 601, 602, and 603, a network 604, and a server 605. Network 604 serves as the medium for providing communication links between terminal devices 601, 602, and 603 and server 605. Network 604 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc.

[0084] Users can use terminal devices 601, 602, and 603 to interact with server 605 via network 604 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 601, 602, and 603, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).

[0085] Terminal devices 601, 602, and 603 can be various electronic devices with displays and web browsing capabilities, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0086] Server 605 can be a server that provides various services, such as a backend management server that supports shopping websites browsed by users using terminal devices 601, 602, and 603 (this is just an example). The backend management server can analyze and process data such as received request information, and feed back the processing results (such as the result of data reassembly of the parsed request information) to the terminal device.

[0087] It should be noted that, Figure 6 The Redis high-hotspot data migration method provided in the illustrated embodiment is generally executed by server 605. Accordingly, in this embodiment, the Redis high-hotspot data migration device is generally set in server 605.

[0088] It should be understood that Figure 6 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0089] The following is for reference. Figure 7 It shows a schematic diagram of the structure of a computer system 700 suitable for implementing a terminal device of the present invention. Figure 7 The terminal device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.

[0090] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 702 or programs loaded from storage section 708 into random access memory (RAM) 703. The RAM 703 also stores various programs and data required for the operation of the system 700. The CPU 701, ROM 702, and RAM 703 are interconnected via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0091] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, mouse, etc.; an output section 707 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 710 as needed so that computer programs read from it can be installed into the storage section 708 as needed.

[0092] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 709, and / or installed from removable medium 711. When the computer program is executed by central processing unit (CPU) 701, it performs the functions defined above in the system of this invention.

[0093] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0094] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0095] The modules described in the embodiments of the present invention can be implemented in software or hardware. The described modules can also be housed in a processor; for example, a processor may be described as including a statistics module, a resource configuration module, and a high-access data migration module. The names of these modules do not necessarily limit the module itself; for example, the resource configuration module may also be described as "a module that reassembles parsed request information."

[0096] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs, which, when executed by the device, cause the device to include:

[0097] The system collects raw request information from the master to one or more slaves corresponding to the master in the Redis cluster, performs asynchronous parsing of the raw request information, and pushes the parsed request information.

[0098] The parsed request information is reassembled to assess the access pressure of various data points across one or more slave devices; and

[0099] Obtain the load status of the host, and when the host load meets the host's predetermined standard, migrate the top N data with the highest access pressure from all slaves to the standby slave, where N is a positive integer.

[0100] According to the technical solution of this invention, based on a Redis Cluster, access traffic is statistically analyzed, high-frequency data is captured in real time, and the ability to automatically migrate high-frequency data is provided. This avoids the scenario in existing technologies where all access traffic is directed to the same slave device, leading to slave device and cluster crashes.

[0101] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A Redis high-hotspot data migration method, characterized in that, The method comprises: statistically counting original request information sent from a master to one or more slaves corresponding to the master in a Redis cluster, asynchronously analyzing the original request information, sending the analyzed request information to a message queue of a message middleware, and asynchronously pushing the analyzed request information by the message middleware after receiving the analyzed request information; reorganizing the pushed analyzed request information, and storing the reorganized request information in a tree structure to statistically count access pressures of each data in the one or more slaves according to the reorganized request information stored in the tree structure; and obtaining a load condition of the master, and migrating data with a top N access pressure from all data in all the slaves to a backup slave when it is determined that the load of the master meets a master predetermined standard, wherein N is a positive integer; when it is determined that the load of the master does not meet the master predetermined standard, the method further comprises any one of the following: further determining whether the access pressure of each data in the one or more slaves is greater than a maximum bearing value, and migrating any one data to a backup slave when it is determined that the access pressure of any one data is greater than the maximum bearing value; further determining whether the load of the one or more slaves meets a slave predetermined standard, and further determining whether the access pressure of each data in any one slave meeting the slave predetermined standard is greater than a maximum bearing value when it is determined that the load of the any one slave meets the slave predetermined standard, and migrating any one data to a backup slave when it is determined that the access pressure of any one data is greater than the maximum bearing value; further determining whether the load of the one or more slaves meets a slave predetermined standard, and further determining whether the access pressure of each data in any one slave meeting the slave predetermined standard is greater than a maximum bearing value when it is determined that the load of the any one slave meets the slave predetermined standard, and migrating data with a top M access pressure from the any one slave to a backup slave when it is determined that the access pressures of all data in the any one slave are equal to or less than the maximum bearing value, wherein M is a positive integer.

2. The method of claim 1, wherein, The original request information is counted by aspect-oriented programming.

3. The method of claim 1, wherein, The analyzed request information comprises at least one of a data point requested by a user, a Slot name, and a slave IP.

4. The method of claim 1, wherein, The master predetermined standard comprises one of the following conditions: a current storage pressure of the master is greater than a maximum master bearing value, an average time of a single request of the master is greater than a maximum average time of a single request, a CPU usage rate of the master is greater than a maximum CPU usage rate, and a reading capability of the master is less than a minimum reading capability.

5. The method of claim 1, wherein, The slave predetermined standard comprises one of the following conditions: a current storage pressure of any one slave in the one or more slaves is greater than a maximum master bearing value, an average time of a single request of the any one slave in the one or more slaves is greater than a maximum average time of a single request, a CPU usage rate of the any one slave in the one or more slaves is greater than a maximum CPU usage rate, and a reading capability of the any one slave in the one or more slaves is less than a minimum reading capability. The reading capability of any one of the one or more slaves is less than the minimum reading capability.

6. An apparatus (100) for Redis hotspot data migration, characterized in that, The device comprises: A statistics module (101) is configured to count original request information sent from a master to one or more slaves corresponding to the master in a Redis cluster, to perform asynchronous analysis on the original request information, to send the analyzed request information to a message queue of a message middleware, and to perform asynchronous pushing of the analyzed request information after the message middleware receives the analyzed request information; A resource configuration module (102) is configured to perform data reorganization on the pushed analyzed request information, to store the reorganized request information in a tree structure, and to count access pressure of each data in the one or more slaves according to the reorganized request information stored in the tree structure; and A high-access data migration module (103) is configured to obtain a load condition of the master, to migrate data with a top N access pressure in all data in the one or more slaves to a backup slave when it is determined that the load of the master meets a predetermined standard of the master, where N is a positive integer, and to perform any one of the following when it is determined that the load of the master does not meet the predetermined standard of the master: further determine whether the access pressure of each data in the one or more slaves is greater than a maximum bearing value, and to migrate any one of the data to the backup slave when it is determined that the access pressure of the any one of the data is greater than the maximum bearing value; further determine whether the load of any one of the one or more slaves meets a predetermined standard of the slave, to further determine whether the access pressure of each data in the slave is greater than a maximum bearing value when it is determined that the load of the slave meets the predetermined standard of the slave, and to migrate any one of the data to the backup slave when it is determined that the access pressure of the any one of the data is greater than the maximum bearing value; further determine whether the load of the one or more slaves meets a predetermined standard of the slave, to further determine whether the access pressure of each data in any one of the one or more slaves is greater than a maximum bearing value when it is determined that the load of the slave meets the predetermined standard of the slave, and to migrate data with a top M access pressure in the slave to the backup slave when it is determined that the access pressure of all data in the slave is equal to or less than the maximum bearing value, where M is a positive integer.

7. An electronic device for Redis high hotspot data migration, characterized in that, comprise: one or more processors; and a memory device storing one or more programs, when the one or more programs are executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-5.

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

Citation Information

Patent Citations

  • Hot spot data management method, device and system

    CN110569233A