A method, device and electronic device for adjusting cluster nodes
By introducing a node sleep mechanism in the video cloud service cluster, the problems of resource waste and energy consumption when business traffic is low are solved, and the effect of reducing cluster power consumption while ensuring business normality is achieved.
Patent Information
- Application Number
- CN202411379934.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2044-09-30
AI Technical Summary
In video cloud service clusters, the existing technology will lead to a large amount of resource waste and energy consumption when the service traffic is low, because all nodes equalize the traffic, causing nodes to be on standby.
By introducing a node sleep mechanism, the system traffic volume is monitored in real time. When the traffic volume is 0, all nodes are transferred to the node sleep pool for sleeping; when the traffic volume is small, some activation nodes are retained to meet the business needs and the excess nodes are transferred to the node sleep pool.
It reduces the power consumption of distributed clusters, achieves energy saving effects, and ensures normal service processing and avoids energy losses caused by frequent wake-up of dormant nodes.
Smart Images

Figure CN118939433B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of distributed storage technology, and in particular to a method, device and electronic device for adjusting cluster nodes. Background Art
[0002] The common business of large-scale video cloud service clusters is the access of videos and pictures. In actual scenarios, business traffic will change within a day. For example, during the morning and evening rush hours on weekdays, the amount of video and picture writing at each traffic checkpoint will surge, even dozens of times that of off-peak hours.
[0003] In the common design of distributed cloud storage, based on the design point of load balancing, all nodes in a cluster are usually on standby to carry read and write services at any time. Even if the number of nodes far exceeds the amount of business to be carried, the overall business data is still evenly distributed to each node for execution. However, the scale of distributed clusters in video cloud business scenarios is often large, ranging from a dozen devices to thousands of devices. Therefore, when the business traffic to be carried is small, the design of all nodes evenly carrying the business volume will cause a lot of resource waste and energy consumption. Summary of the invention
[0004] The present application provides a method, device and electronic device for adjusting cluster nodes, so as to reduce the power consumption of a distributed cluster and achieve energy saving effect.
[0005] In a first aspect, the present application provides a method for adjusting a cluster node, the method comprising:
[0006] In response to the node sleep detection mechanism being turned on, determining a current system traffic volume;
[0007] Determine whether the current system traffic volume is greater than 0;
[0008] When the current system traffic volume is equal to 0, all nodes in the cluster are transferred to the node sleep pool.
[0009] A node sleep mechanism is designed to monitor the system traffic in real time. When there is no traffic, all nodes in the cluster are transferred to the node sleep pool for sleep, which can reduce the power consumption of the entire cluster and achieve energy-saving effect.
[0010] In one possible design, the method also includes: when the current system traffic is greater than 0, determining the number of target nodes P required to carry the current system traffic, wherein P is an integer greater than 0; calculating the remaining capacity of each target node based on P, the current system traffic and the capacity coefficient, wherein the capacity coefficient represents the storage duration of the current system traffic; determining a first node set whose capacity is greater than or equal to the remaining capacity from all currently activated nodes; when the number of nodes in the first node set is greater than or equal to P, selecting P activated nodes from the first node set and using the P activated nodes as the target nodes; retaining the target nodes, and transferring other activated nodes except the target nodes to the node sleep pool.
[0011] Monitor the system business volume in real time. When the business volume is small, retain some nodes to meet the current business, and transfer the excess nodes to the node dormancy pool for dormancy. This can not only ensure the current business services, but also reduce the power consumption of the entire cluster to achieve energy-saving effects. When retaining service nodes, give priority to selecting them from activated nodes to avoid energy loss caused by frequently waking up dormant nodes.
[0012] In a possible design, after determining the first node set whose capacity is greater than or equal to the remaining capacity from all currently activated nodes, it also includes: when the number of nodes in the first node set is less than P, retaining all activated nodes in the first node set; determining a second node set whose capacity is greater than or equal to the remaining capacity from the node sleep pool, and waking up all sleep nodes in the second node set, wherein the number of nodes in the second node set is P minus the number of nodes in the first node set; taking all activated nodes of the first node set and all sleep nodes in the awakened second node set as the target nodes; retaining the target nodes, and transferring other activated nodes except the target nodes to the node sleep pool.
[0013] When the currently activated nodes cannot meet the business service requirements, waking up nodes from the dormant node pool to perform operations can ensure normal processing of the business while reducing energy consumption.
[0014] In one possible design, determining the current system traffic volume includes: obtaining all current video channels, the bitstream of each video channel, the size of the picture, and the writing speed of the picture; and calculating the current system traffic volume based on all current video channels, the bitstream of each video channel, the size of the picture, and the writing speed of the picture.
[0015] All video channels are detected in real time. The real-time write traffic of the system can be calculated based on the bit rate, write picture size, write picture speed and other information of each video channel, so as to facilitate the subsequent adjustment of cluster nodes according to the write traffic size.
[0016] In a possible design, after transferring all nodes in the cluster to the node hibernation pool, it also includes: determining whether the business of all nodes has been terminated; if there is a first node whose business has not been terminated, waiting for the business of the first node to be terminated; if there is a second node whose business has been terminated, stopping the business service of the second node, stopping the hard disk link maintenance of the second node, and adjusting the hard disk of the second node to enter hibernation.
[0017] By temporarily shutting down some business services of the nodes that enter the node sleep pool and stopping the hard disk link maintenance of the nodes in the sleep pool, the hard disk of the node enters sleep mode, thereby reducing the energy consumption of the node and saving energy for the entire cluster.
[0018] In a possible design, waking up all the dormant nodes in the second node set includes: starting a business service of each dormant node in the second node set; and enabling a hard disk link detection function of each dormant node.
[0019] When the dormant node needs to work again, the dormant node can be awakened by enabling its business services and hard disk link detection functions, thus ensuring timely business operations.
[0020] In a possible design, after retaining the target node and transferring other activated nodes except the target node to the node hibernation pool, it also includes: obtaining the current usage capacity of the target node; when the current usage capacity is 0, retaining a preset number of hard disks, and transferring the remaining hard disks except the reserved hard disks to the hard disk hibernation pool, wherein the hard disks in the hard disk hibernation pool are offline; when the current usage capacity exceeds a preset percentage of the total capacity of the reserved hard disks, waking up the preset number of hard disks from the hard disk hibernation pool.
[0021] A hard disk hibernation mechanism is designed. When the node usage capacity does not exceed the preset percentage of the current hard disk capacity, the remaining hard disks are transferred to the hard disk hibernation pool. The hard disks in the hard disk hibernation pool are offline and do not consume extra energy, thus reducing the energy consumption of the node. At the same time, in order to ensure the normal operation of the node, when the node usage capacity exceeds the preset percentage of the current hard disk capacity, the hard disks in the hard disk hibernation pool are awakened to maintain normal service.
[0022] In a second aspect, the present application provides a device for adjusting a cluster node, the device comprising:
[0023] A service determination module, in response to the node sleep detection mechanism being turned on, determines the current system service volume;
[0024] A business judgment module determines whether the current system business volume is greater than 0;
[0025] The node transfer module transfers all nodes in the cluster to the node sleep pool when the current system traffic volume is equal to 0.
[0026] In one possible design, the device further includes:
[0027] A quantity determination module, when the current system traffic is greater than 0, determines the number P of target nodes required to carry the current system traffic, wherein P is an integer greater than 0;
[0028] A capacity calculation module, which calculates the remaining capacity of each target node according to P, the current system traffic and a capacity coefficient, wherein the capacity coefficient represents the storage duration of the current system traffic;
[0029] A set determination module, which determines a first set of nodes whose capacity is greater than or equal to the remaining capacity from all currently activated nodes;
[0030] a node selection module, which selects P activated nodes from the first node set when the number of nodes in the first node set is greater than or equal to the P, and uses the P activated nodes as the target nodes;
[0031] The node reservation module reserves the target node and transfers other activated nodes except the target node to the node dormant pool.
[0032] In one possible design, the device is also used to: when the number of nodes in the first node set is less than the P, retain all activated nodes in the first node set; determine a second node set whose capacity is greater than or equal to the remaining capacity from the node sleep pool, and wake up all sleep nodes in the second node set, wherein the number of nodes in the second node set is the P minus the number of nodes in the first node set; use all activated nodes of the first node set and all awakened sleep nodes in the second node set as the target nodes; retain the target nodes, and transfer other activated nodes except the target nodes to the node sleep pool.
[0033] In one possible design, the service determination module is specifically used to: obtain all current video channels, the bitstream of each video channel, the size of the picture, and the writing speed of the picture; calculate the current system service volume based on all current video channels, the bitstream of each video channel, the size of the picture, and the writing speed of the picture.
[0034] In one possible design, the device is also used to: determine whether the services of all the nodes have been terminated; if there is a first node whose services have not been terminated, wait for the services of the first node to be terminated; if there is a second node whose services have been terminated, stop the business services of the second node, stop the hard disk link maintenance of the second node, and adjust the hard disk of the second node to enter sleep mode.
[0035] In a possible design, the device is also used to: start the business service of each dormant node in the second node set; and enable the hard disk link detection function of each dormant node.
[0036] In one possible design, the device is also used to: obtain the current usage capacity of the target node; when the current usage capacity is 0, retain a preset number of hard disks, and transfer the remaining hard disks except the reserved hard disks to a hard disk hibernation pool, wherein the hard disks in the hard disk hibernation pool are offline; when the current usage capacity exceeds a preset percentage of the total capacity of the reserved hard disks, wake up the preset number of hard disks from the hard disk hibernation pool.
[0037] In a third aspect, the present application provides an electronic device, the electronic device comprising:
[0038] Memory, used to store computer programs;
[0039] The processor is used to implement the above-mentioned method steps for adjusting cluster nodes when executing the computer program stored in the memory.
[0040] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the computer program implements the above-mentioned method steps for adjusting cluster nodes.
[0041] For each aspect from the second to the fourth aspect and the technical effects that may be achieved by each aspect, please refer to the above description of the technical effects that can be achieved by the first aspect or various possible schemes in the first aspect, and no further details will be given here. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 A flowchart of a method for adjusting cluster nodes provided in this application;
[0043] Figure 2 A flowchart of a method for determining a sleeping or waking node provided in the present application;
[0044] Figure 3 A schematic diagram of a device for adjusting cluster nodes provided in the present application;
[0045] Figure 4 A schematic diagram of the structure of an electronic device provided in this application. DETAILED DESCRIPTION
[0046] In order to make the purpose, technical solution and advantages of the present application more clear, the present application will be further described in detail below in conjunction with the accompanying drawings. The specific operation method in the method embodiment can also be applied to the device embodiment or the system embodiment.
[0047] In the description of this application, "multiple" is understood to be "at least two". "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent three situations: A exists alone, A and B exist at the same time, and B exists alone. A is connected to B, which can represent two situations: A is directly connected to B and A is connected to B through C. In addition, in the description of this application, words such as "first" and "second" are only used for the purpose of distinguishing descriptions, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying order.
[0048] See also Figure 1 FIG. 1 is a flow chart of a method for adjusting cluster nodes provided in an embodiment of the present application. The specific implementation process of the method is as follows:
[0049] Step 101: In response to the node sleep detection mechanism being turned on, determining the current system traffic volume;
[0050] In the embodiment of the present application, the node sleep detection mechanism includes three detection mechanisms, namely, a periodic detection mechanism, a service wake-up detection mechanism and an emergency wake-up detection mechanism.
[0051] The periodic detection mechanism means that the system detects whether the nodes in the node dormancy pool need to be adjusted according to the real-time business traffic according to the preset period. For example, every hour, it detects whether the nodes in the node dormancy pool need to be adjusted according to the current business traffic changes. The periodic detection mechanism can ensure the smooth processing of the current business. When the traffic volume increases or decreases, or as time goes by, the remaining capacity of the current working node cannot meet the business requirements, the periodic detection mechanism can wake up the dormant nodes in real time or put some nodes to sleep. Under the condition of ensuring the business, the energy consumption of the entire cluster system can be reduced by dormant nodes.
[0052] The business wake-up detection mechanism triggers the adjustment of nodes in the node dormancy pool according to the fluctuation of business traffic. For example, when it is detected that the business traffic of the cluster fluctuates by 20% and lasts for 5 minutes (the relevant fluctuation range and maintenance time can be set according to the business volume), the system triggers the business wake-up detection and detects whether the nodes in the node dormancy pool need to be adjusted according to the real-time business traffic. The business wake-up detection mechanism is mainly to prevent the sudden increase or decrease of system business volume, but when the periodic detection mechanism has not been triggered, the system node dormancy pool is adjusted in time to ensure the normal processing of business.
[0053] The emergency wake-up detection mechanism performs real-time detection on activated nodes. When it is detected that an activated node is offline or has other abnormalities, a corresponding number of nodes are promptly awakened from the node sleep pool to ensure the normal fault tolerance of the system.
[0054] It is worth noting that the above three detection mechanisms are carried out simultaneously to jointly ensure the normal processing of system services.
[0055] In response to the node sleep detection mechanism being turned on, the current system traffic volume is determined. Specifically, information such as the number of all current video channels, the bitstream of each video channel, the size of the picture, and the writing speed of the picture are obtained, and the current system traffic volume is calculated based on the above information.
[0056] By detecting all video channels in real time, the real-time write traffic of the system can be calculated based on information such as the bit rate, write image size, and write image speed of each video channel, so as to facilitate the subsequent adjustment of cluster nodes according to the write traffic size.
[0057] Step 102: Determine whether the current system traffic volume is greater than 0; after determining the current system traffic volume, first determine whether the current system traffic volume is greater than 0.
[0058] In a possible implementation manner, if the current system traffic volume is equal to 0, the following step 103 is performed.
[0059] In a possible implementation, if the current system traffic volume is greater than 0, the following step 104 is performed.
[0060] Step 103: If the current system traffic volume is equal to 0, all nodes in the cluster are transferred to the node dormancy pool;
[0061] If the current system business volume is equal to 0, indicating that there is no business that needs to be processed by the node, all nodes in the cluster are transferred to the node sleep pool, and the nodes in the node sleep pool are in a sleep state.
[0062] In the embodiment of the present application, the nodes transferred to the node sleep pool will perform the following actions. It is worth noting that in order to prevent the nodes added to the node sleep pool from being frequently awakened and put into sleep, a start time identifier can be added to each node entering the sleep pool to record the time when the node starts to sleep. When it is detected that the sleep time of the node reaches a preset time from the start time, the system will issue a sleep notification to the node, and the node that receives the sleep notification will perform the following actions:
[0063] 1) Determine whether the node's business has ended. If the node's business has not ended, continue to wait for the business to end;
[0064] 2) After the business of the node is completed, the business service of the node is stopped. The business service may be some unnecessary services and functions, such as user maintenance connection and business-related detection services, and the main service enters the dormant mode;
[0065] 3) Stop the node's hard disk link maintenance, stop checking the hard disk status, and put the hard disk into hibernation;
[0066] 4) No longer listens to the write port, no longer actively supports write services, and only guarantees data acquisition requests;
[0067] 5) Switch the CPU to sleep mode and reduce the fan speed.
[0068] Because the services are dormant and shut down during the node dormancy process, the resource consumption of the entire cluster is reduced, such as CPU, memory, and network resources, which reduces the energy consumption of the entire cluster and achieves energy-saving effects.
[0069] Step 104: If the current system traffic volume is greater than 0, determine whether to transfer nodes to the node sleep pool or wake up nodes from the node sleep pool according to the current system traffic volume and all currently activated nodes.
[0070] Specifically, according to the current system traffic and all currently activated nodes, the specific process of determining whether to transfer nodes to the node sleep pool or wake up nodes from the node sleep pool is as follows: Figure 2 As shown, the following steps are included:
[0071] Step 201: If the current system traffic volume is greater than 0, determine the target number of nodes P required to carry the current system traffic volume;
[0072] According to the current system service capacity and the performance indicators of each node, the required target number of nodes P is calculated. The specific calculation formula is as follows:
[0073]
[0074] Wherein, P is an integer greater than 0, For the current system traffic, the service node capacity is determined according to the node's performance indicators.
[0075] Step 202: Calculate the remaining capacity of each target node according to the number of target nodes P, the current system traffic volume and the capacity factor;
[0076] Specifically, according to the target node number P obtained above, combined with the current system traffic and capacity coefficient, the remaining capacity of each target node is calculated. The specific calculation formula is as follows:
[0077]
[0078] Among them, C is the remaining capacity of each target node, that is, the capacity required by each target node to process the current system business; K is the capacity coefficient, which is used to indicate the length of time the current system business volume needs to be stored; N+M / N is the redundancy rule of the system, which is related to the N+M hard disks initially set up for the node, that is, the capacity that each node needs to burn and store is N+M / N times the actual required storage capacity.
[0079] The remaining capacity of each target node is calculated to serve as the basis for selecting nodes from the activated nodes. Only nodes with a capacity greater than the remaining capacity C can process the current system business, and unselected nodes are transferred to the node dormancy pool. This can accurately ensure normal business and save cluster energy consumption.
[0080] Step 203: Determine a first node set whose capacity is greater than or equal to the remaining capacity from all currently activated nodes;
[0081] In the embodiment of the present application, nodes whose capacity satisfies the above-mentioned remaining capacity C are preferentially selected from the activated nodes, so as to avoid frequently waking up the dormant nodes and causing energy waste.
[0082] Specifically, from all currently activated nodes, select activated nodes whose capacity is greater than or equal to the remaining capacity, and form these nodes into a first node set. Then compare the number of nodes in the first node set with the target node number P.
[0083] Step 204: Determine whether the number of nodes in the first node set is less than the target number of nodes P;
[0084] In a possible implementation, if the number of nodes in the first node set is not less than the target number of nodes P, the operation of the following step 205 is performed.
[0085] In a possible implementation, if the number of nodes in the first node set is less than the target number of nodes P, the operation of the following step 207 is performed.
[0086] Step 205: When the number of nodes in the first node set is greater than or equal to P, select P activated nodes from the first node set and use the P activated nodes as target nodes;
[0087] If the number of nodes in the first node set is greater than or equal to P, it means that the first node set contains enough activated nodes to handle the current system business, and there is no need to wake up the dormant nodes from the node dormant pool to handle the business. In this case, P activated nodes are directly selected from the first node set and these P activated nodes are used as target nodes.
[0088] In the embodiment of the present application, the method of selecting P activation nodes can be arbitrarily selected, and can be selected in order from large to small according to capacity size, or can be selected in order from small to large according to capacity size, without specific limitation.
[0089] Step 206: retain the target node, and transfer other activated nodes except the target node to the node dormant pool.
[0090] The selected P target nodes are retained, and all remaining activated nodes except the P target nodes are transferred to the node dormant pool.
[0091] By real-time monitoring of the system business volume, when the business volume is small, some nodes are retained to meet the current business, and the excess nodes are transferred to the node dormancy pool for dormancy. This can not only ensure the current business services, but also reduce the power consumption of the entire cluster to achieve energy-saving effects; and when retaining service nodes, they are selected from the active nodes first, which can avoid energy loss caused by frequently waking up dormant nodes.
[0092] Step 207: When the number of nodes in the first node set is less than P, retain all activated nodes in the first node set; then execute the operation of step 208.
[0093] Step 208: determining a second node set whose capacity is greater than or equal to the remaining capacity from the node sleep pool, and waking up all sleep nodes in the second node set;
[0094] In an embodiment of the present application, the number of nodes in the second node set is the target node number P minus the number of nodes in the above-mentioned first node set.
[0095] When the number of nodes in the first node set is less than P, it indicates that the currently activated nodes cannot meet the current system traffic, and some dormant nodes need to be awakened from the node dormancy pool to support the current traffic. Specifically, select dormant nodes whose number is P minus the number of nodes in the first node set from the node dormancy pool, and whose capacity is greater than or equal to the remaining capacity C, form these dormant nodes into a second node set, and awaken all dormant nodes in the second node set. Then perform the operation of step 209.
[0096] In the embodiment of the present application, after receiving the wake-up instruction, the sleeping node performs the following actions:
[0097] 1) Restart the previously stopped business services;
[0098] 2) Adjust system parameters, increase fan speed, and switch the CPU to high-performance mode;
[0099] 3) Enable the hard disk link detection function and hard disk link maintenance to keep the node in optimal performance state.
[0100] Step 209: All activated nodes in the first node set and all awakened dormant nodes in the second node set are taken as target nodes. Then the operation of the above step 206 is performed.
[0101] By monitoring the system business volume in real time, when the business volume is large and the currently activated nodes cannot meet the business service needs, waking up the nodes from the dormant node pool to perform operations can ensure the normal processing of the business while reducing energy consumption.
[0102] Furthermore, a hard disk hibernation mechanism is designed for cluster nodes. For nodes that are in an activated state and providing services, the current usage capacity of the node is obtained.
[0103] If the current used capacity of the node is 0, a preset number of hard disks is retained, which may be N+M, such as 4+1 hard disks. The remaining hard disks are transferred to the hard disk hibernation pool, and the hard disks in the hibernation pool are taken offline.
[0104] The used capacity is monitored in real time. When the used capacity exceeds a preset percentage of the total capacity of the currently reserved hard disks, for example, 50% of the total capacity of the reserved hard disks, a preset number of hard disks are awakened from the hard disk hibernation pool and added to the storage array.
[0105] In addition, it is also necessary to detect the hard disk status. If a hard disk is damaged, it is also necessary to wake up the hard disk from the hard disk hibernation pool to maintain normal service.
[0106] By taking some hard disks offline through the hard disk hibernation mechanism, the number of hard disks in standby state is reduced, so that the fan speed of the server (node) will also be reduced accordingly, thereby reducing the energy consumption of a single server and achieving energy-saving effects.
[0107] Based on the same inventive concept, the present application also provides a device for adjusting cluster nodes to reduce the energy consumption of the entire cluster and achieve energy saving effect, see Figure 3 , the device comprises:
[0108] The service determination module 301 determines the current system service volume in response to the node sleep detection mechanism being turned on;
[0109] The service judgment module 302 judges whether the current system service volume is greater than 0;
[0110] The node transfer module 303 transfers all nodes in the cluster to the node sleep pool when the current system traffic volume is equal to 0.
[0111] In one possible design, the device further includes:
[0112] A quantity determination module, when the current system traffic is greater than 0, determines the number P of target nodes required to carry the current system traffic, wherein P is an integer greater than 0;
[0113] A capacity calculation module, which calculates the remaining capacity of each target node according to P, the current system traffic and a capacity coefficient, wherein the capacity coefficient represents the storage duration of the current system traffic;
[0114] A set determination module, which determines a first set of nodes whose capacity is greater than or equal to the remaining capacity from all currently activated nodes;
[0115] a node selection module, which selects P activated nodes from the first node set when the number of nodes in the first node set is greater than or equal to the P, and uses the P activated nodes as the target nodes;
[0116] The node reservation module reserves the target node and transfers other activated nodes except the target node to the node dormant pool.
[0117] In one possible design, the device is also used to: when the number of nodes in the first node set is less than the P, retain all activated nodes in the first node set; determine a second node set whose capacity is greater than or equal to the remaining capacity from the node sleep pool, and wake up all sleep nodes in the second node set, wherein the number of nodes in the second node set is the P minus the number of nodes in the first node set; use all activated nodes of the first node set and all awakened sleep nodes in the second node set as the target nodes; retain the target nodes, and transfer other activated nodes except the target nodes to the node sleep pool.
[0118] In one possible design, the service determination module 301 is specifically used to: obtain the current number of all video channels, the bitstream of each video channel, the size of the picture, and the writing speed of the picture; and calculate the current system service volume based on the current number of all video channels, the bitstream of each video channel, the size of the picture, and the writing speed of the picture.
[0119] In one possible design, the device is also used to: determine whether the services of all the nodes have been terminated; if there is a first node whose services have not been terminated, wait for the services of the first node to be terminated; if there is a second node whose services have been terminated, stop the business services of the second node, stop the hard disk link maintenance of the second node, and adjust the hard disk of the second node to enter sleep mode.
[0120] In a possible design, the device is also used to: start the business service of each dormant node in the second node set; and enable the hard disk link detection function of each dormant node.
[0121] In one possible design, the device is also used to: obtain the current usage capacity of the target node; when the current usage capacity is 0, retain a preset number of hard disks, and transfer the remaining hard disks except the reserved hard disks to a hard disk hibernation pool, wherein the hard disks in the hard disk hibernation pool are offline; when the current usage capacity exceeds a preset percentage of the total capacity of the reserved hard disks, wake up the preset number of hard disks from the hard disk hibernation pool.
[0122] Based on the above device, the system business volume is monitored in real time. When the business volume is small, some nodes are retained to meet the current business, and the redundant nodes are transferred to the node dormancy pool for dormancy. This can not only ensure the current business services, but also reduce the power consumption of the entire cluster, achieving energy-saving effects. When the business volume is large and the currently activated nodes cannot meet the business service needs, the nodes are awakened from the dormant node pool to perform operations, which can ensure the normal processing of the business while reducing energy consumption.
[0123] Based on the same inventive concept, an electronic device is also provided in an embodiment of the present application, and the electronic device can implement the function of the aforementioned device for adjusting cluster nodes, referring to Figure 4 , the electronic device comprises:
[0124] At least one processor 401, and a memory 402 connected to the at least one processor 401. The specific connection medium between the processor 401 and the memory 402 is not limited in the embodiment of the present application. Figure 4 In the example, the processor 401 and the memory 402 are connected via the bus 400. The bus 400 is Figure 4The connection between other components is shown by bold lines, and is not intended to be limiting. The bus 400 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. Alternatively, the processor 401 can also be called a controller, and there is no limitation on the name.
[0125] In the embodiment of the present application, the memory 402 stores instructions that can be executed by at least one processor 401. The at least one processor 401 can execute the method for adjusting the cluster nodes discussed above by executing the instructions stored in the memory 402. The processor 401 can implement Figure 3 The functions of each module in the device shown.
[0126] Among them, the processor 401 is the control center of the device, and can use various interfaces and lines to connect the various parts of the entire control device. By running or executing instructions stored in the memory 402 and calling the data stored in the memory 402, the various functions of the device and process data, the device can be monitored as a whole.
[0127] In one possible design, the processor 401 may include one or more processing units, and the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor 401. In some embodiments, the processor 401 and the memory 402 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on separate chips.
[0128] Processor 401 may be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and may implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the method for adjusting the cluster nodes disclosed in the embodiments of the present application may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0129] The memory 402 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 402 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 402 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 402 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.
[0130] By programming the processor 401, the code corresponding to the method for adjusting the cluster nodes described in the above embodiment can be fixed into the chip, so that the chip can execute the code when running. Figure 1 The steps of the method for adjusting cluster nodes in the embodiment shown are as follows: How to design and program the processor 401 is a technology well known to those skilled in the art and will not be described in detail here.
[0131] Based on the same inventive concept, an embodiment of the present application further provides a storage medium, which stores computer instructions. When the computer instructions are executed on a computer, the computer executes the method for adjusting cluster nodes discussed above.
[0132] In some possible implementations, various aspects of the method for adjusting cluster nodes provided in the present application may also be implemented in the form of a program product, which includes a program code. When the program product is run on an apparatus, the program code is used to enable the control device to execute the steps of the method for adjusting cluster nodes according to various exemplary implementations of the present application described above in this specification.
[0133] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0134] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0135] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0136] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0137] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A method for adjusting cluster nodes, characterized in that: The method comprises: In response to the node sleep detection mechanism being turned on, obtaining all current video channels, the bit stream of each video channel, the size of the picture, and the writing speed of the picture; Calculate the current system traffic according to the number of all current video channels, the bit stream of each video channel, the size of the picture, and the writing speed of the picture; Determine whether the current system traffic volume is greater than 0; When the current system traffic volume is equal to 0, all nodes in the cluster are transferred to the node dormancy pool; When the previous system traffic volume is greater than 0, determining whether to transfer a node to a node sleep pool or to wake up a node from a node sleep pool according to the current system traffic volume and all currently activated nodes; The step of determining whether to transfer a node to a node sleep pool or to wake up a node from a node sleep pool according to the current system traffic and all currently activated nodes includes: When the current system traffic is greater than 0, determine the number of target nodes P required to carry the current system traffic, where P is an integer greater than 0 and satisfies the following expression: ; The remaining capacity of each target node is calculated according to P, the current system traffic and the capacity coefficient, wherein the capacity coefficient represents the storage duration of the current system traffic, and the remaining capacity satisfies the following expression: , the N+M / N is the redundancy rule of the system, which is related to the N+M hard disks initially set for the node, that is, the capacity of each node that needs to be burned and stored is N+M / N times the actual required storage capacity, and the K is the capacity coefficient; Determine, from all currently activated nodes, a first node set whose capacity is greater than or equal to the remaining capacity; When the number of nodes in the first node set is greater than or equal to P, selecting P activated nodes from the first node set and using the P activated nodes as the target nodes; The target node is retained, and other activated nodes except the target node are transferred to the node dormant pool.
2. The method according to claim 1, characterized in that After determining, from all currently activated nodes, a first set of nodes whose capacity is greater than or equal to the remaining capacity, the method further includes: When the number of nodes in the first node set is less than P, retaining all activated nodes in the first node set; Determine a second node set whose capacity is greater than or equal to the remaining capacity from the node sleep pool, and wake up all sleep nodes in the second node set, wherein the number of nodes in the second node set is P minus the number of nodes in the first node set; Taking all activated nodes in the first node set and all awakened dormant nodes in the second node set as the target nodes; The target node is retained, and other activated nodes except the target node are transferred to the node dormant pool.
3. The method according to claim 1, characterized in that After transferring all nodes in the cluster to the node dormancy pool, the method further includes: Determine whether the services of all the nodes are terminated; If there is a first node whose service has not been completed, wait for the service of the first node to be completed; If there is a second node whose service has ended, the service of the second node is stopped, the hard disk link maintenance of the second node is stopped, and the hard disk of the second node is adjusted to enter sleep mode.
4. The method according to claim 2, characterized in that Waking up all the sleeping nodes in the second node set includes: Starting the business service of each dormant node in the second node set; Enable the hard disk link detection function of each of the sleep nodes.
5. The method according to claim 1, characterized in that After retaining the target node and transferring other activated nodes except the target node to the node dormancy pool, the method further includes: Obtaining the current usage capacity of the target node; When the current used capacity is 0, a preset number of hard disks are reserved, and the remaining hard disks except the reserved hard disks are transferred to a hard disk hibernation pool, wherein the hard disks in the hard disk hibernation pool are offline; When the currently used capacity exceeds a preset percentage of the total capacity of the reserved hard disks, a preset number of hard disks are awakened from the hard disk hibernation pool.
6. A device for adjusting cluster nodes, characterized in that: The device comprises: The service determination module, in response to the node sleep detection mechanism being turned on, obtains all current video channels, the bit stream of each video channel, the size of the picture, and the writing speed of the picture; calculates the current system service volume according to all current video channels, the bit stream of each video channel, the size of the picture, and the writing speed of the picture; A business judgment module determines whether the current system business volume is greater than 0; A node transfer module, when the current system traffic is equal to 0, transfers all nodes in the cluster to the node sleep pool; when the previous system traffic is greater than 0, determines whether to transfer nodes to the node sleep pool or wake up nodes from the node sleep pool according to the current system traffic and all currently activated nodes; Wherein, the node transfer module is specifically used for: When the current system traffic is greater than 0, determine the number of target nodes P required to carry the current system traffic, where P is an integer greater than 0 and satisfies the following expression: ; The remaining capacity of each target node is calculated according to P, the current system traffic and the capacity coefficient, wherein the capacity coefficient represents the storage duration of the current system traffic, and the remaining capacity satisfies the following expression: , the N+M / N is the redundancy rule of the system, which is related to the N+M hard disks initially set for the node, that is, the capacity of each node that needs to be burned and stored is N+M / N times the actual required storage capacity, and the K is the capacity coefficient; Determine, from all currently activated nodes, a first node set whose capacity is greater than or equal to the remaining capacity; When the number of nodes in the first node set is greater than or equal to P, selecting P activated nodes from the first node set and using the P activated nodes as the target nodes; The target node is retained, and other activated nodes except the target node are transferred to the node dormant pool.
7. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to implement the method steps of any one of claims 1 to 5 when executing the computer program stored in the memory.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Data processing method and device based on edge calculation and readable storage medium
CN113485841A