CN110062199A - Load-balancing method, device and computer readable storage medium - Google Patents
Load-balancing method, device and computer readable storage medium Download PDFInfo
- Publication number
- CN110062199A CN110062199A CN201810054177.8A CN201810054177A CN110062199A CN 110062199 A CN110062199 A CN 110062199A CN 201810054177 A CN201810054177 A CN 201810054177A CN 110062199 A CN110062199 A CN 110062199A
- Authority
- CN
- China
- Prior art keywords
- video
- storage nodes
- plans
- storage
- storage node
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 64
- 238000012544 monitoring process Methods 0.000 claims abstract description 29
- 238000004364 calculation method Methods 0.000 claims description 9
- 238000004590 computer program Methods 0.000 claims description 5
- 238000012217 deletion Methods 0.000 claims description 5
- 230000037430 deletion Effects 0.000 claims description 5
- 238000007726 management method Methods 0.000 abstract description 138
- 230000000694 effects Effects 0.000 abstract description 7
- 238000013500 data storage Methods 0.000 abstract description 2
- 230000002123 temporal effect Effects 0.000 abstract 1
- 230000008569 process Effects 0.000 description 18
- 238000010586 diagram Methods 0.000 description 17
- 238000012545 processing Methods 0.000 description 15
- 230000002093 peripheral effect Effects 0.000 description 10
- 230000001133 acceleration Effects 0.000 description 9
- 238000004891 communication Methods 0.000 description 7
- 230000006870 function Effects 0.000 description 6
- 230000003287 optical effect Effects 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 4
- 238000013473 artificial intelligence Methods 0.000 description 2
- 239000000919 ceramic Substances 0.000 description 2
- 230000007423 decrease Effects 0.000 description 2
- 230000009467 reduction Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000012508 change request Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000004927 fusion Effects 0.000 description 1
- 230000001788 irregular Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 230000005055 memory storage Effects 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000009877 rendering Methods 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 230000006641 stabilisation Effects 0.000 description 1
- 238000011105 stabilization Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0668—Interfaces specially adapted for storage systems adopting a particular infrastructure
- G06F3/067—Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/231—Content storage operation, e.g. caching movies for short term storage, replicating data over plural servers, prioritizing data for deletion
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/231—Content storage operation, e.g. caching movies for short term storage, replicating data over plural servers, prioritizing data for deletion
- H04N21/23103—Content storage operation, e.g. caching movies for short term storage, replicating data over plural servers, prioritizing data for deletion using load balancing strategies, e.g. by placing or distributing content on different disks, different memories or different servers
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/24—Monitoring of processes or resources, e.g. monitoring of server load, available bandwidth, upstream requests
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/24—Monitoring of processes or resources, e.g. monitoring of server load, available bandwidth, upstream requests
- H04N21/2404—Monitoring of server processing errors or hardware failure
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/24—Monitoring of processes or resources, e.g. monitoring of server load, available bandwidth, upstream requests
- H04N21/2405—Monitoring of the internal components or processes of the server, e.g. server load
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N5/00—Details of television systems
- H04N5/76—Television signal recording
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N7/00—Television systems
- H04N7/18—Closed-circuit television [CCTV] systems, i.e. systems in which the video signal is not broadcast
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
- Closed-Circuit Television Systems (AREA)
Abstract
The invention discloses a kind of load-balancing method, device and computer readable storage mediums, belong to field of data storage.Applied to the management node in video monitoring system, the described method includes: determining the current Performance Score of multiple memory nodes in the video monitoring system, the Performance Score is obtained based on the scoring determination of each performance indicator of memory node, and for describing the ability that memory node currently runs resource;The Performance Score of number and the multiple memory node based on multiple video recording plans to be issued, determines the distribution number for distributing to the video recording plan of each memory node, and the video recording is designed for describing the temporal information of photographic device recorded video stream;According to the determining distribution number, the multiple video recording planned assignment is given to the multiple memory node.The present invention issues multiple video recording plans according to the Performance Score of each memory node, to improve the effect for realizing load balancing.
Description
Technical Field
The present invention relates to the field of data storage, and in particular, to a load balancing method and apparatus, and a computer-readable storage medium.
Background
With the development of the technology, the application of the video monitoring system is more and more extensive, for example, the video monitoring system can be applied to the fields of safety precaution, remote monitoring, remote teaching, remote conference and the like. At present, a video surveillance system generally includes a plurality of camera devices and a plurality of storage nodes, where one storage node may correspond to at least one camera device for storing a video stream recorded by the at least one camera device. However, when there are many image pickup devices corresponding to one storage node, the amount of data of a video stream stored in the storage node is large, and a burden is imposed on the operation of the storage node. Therefore, other storage nodes are required to share some of the video streams, that is, load balancing is required among the plurality of storage nodes.
When the load balance among the plurality of storage nodes is realized, a management node can be further included in the video monitoring system. In this way, when the management node receives a video recording instruction of any one of the image pickup devices, the management node may determine the usage rate of each storage node corresponding to the image pickup device among the plurality of storage nodes, and store the video stream recorded by the image pickup device through the storage node with the lowest usage rate, so as to implement load balancing.
However, when the video stream recorded by the image capturing device is stored by the storage node with the lowest usage rate, although the usage rate of the storage node is the lowest, when the hardware performance of the storage node is poor, the storage node continues to store the video stream, which also causes the storage node to run with heavy burden, and thus the load balancing is poor.
Disclosure of Invention
The embodiment of the invention provides a load balancing method, a load balancing device and a computer-readable storage medium, which are used for solving the problem of poor load balancing implementation effect in the prior art. The technical scheme is as follows:
in one aspect, a load balancing method is provided, which is applied to a management node in a video monitoring system, and the method includes:
determining the current performance scores of a plurality of storage nodes in the video monitoring system, wherein the performance scores are determined based on the scores of all performance indexes of the storage nodes and are used for describing the current running resource capacity of the storage nodes;
determining the distribution number of the video plans distributed to each storage node based on the number of the plurality of video plans to be issued and the performance scores of the plurality of storage nodes, wherein the video plans are used for describing the time information of video stream recorded by the camera device;
and distributing the video plans to the storage nodes according to the determined distribution number.
Optionally, the determining, based on the number of the plurality of video plans to be delivered and the performance scores of the plurality of storage nodes, the number of video plans allocated to each storage node includes:
dividing the performance score of each storage node by the total performance score of the plurality of storage nodes to obtain the score weight of each storage node, wherein the total performance score is the sum of the performance scores of the plurality of storage nodes;
and multiplying the number of the video plans by the scoring weight of each storage node to obtain the distribution number of the video plans distributed to each storage node.
Optionally, the allocating the plurality of video schedules to the plurality of storage nodes according to the determined allocation number includes:
acquiring the priorities of the video plans;
and distributing the video plans to the storage nodes according to the priority order of the video plans and the determined distribution number.
Optionally, the assigning the plurality of video recording plans to the plurality of storage nodes includes:
for any video recording plan in the plurality of video recording plans, acquiring a historical execution track of the video recording plan, wherein the historical execution track is used for describing a storage node for executing any video recording plan history and detailed information of the execution;
determining storage nodes which do not fail to execute any video recording plan from the plurality of storage nodes based on the historical execution track;
and allocating any video recording plan to the failed storage node.
Optionally, before determining the distribution number of the video plans distributed to each storage node based on the number of the multiple video plans to be delivered and the performance scores of the multiple storage nodes, the method further includes:
determining a plurality of video plans currently executed and not executed by at least one storage node with operation failure in the plurality of storage nodes as a plurality of video plans to be issued; and/or the presence of a gas in the gas,
and determining the plurality of video plans carried in the received and unprocessed video plan issuing request as a plurality of video plans to be issued.
Optionally, the method further comprises:
and deleting the video schedule carried in the received and unprocessed video schedule deletion request from the corresponding storage node.
Optionally, before determining the distribution number of the video plans distributed to each storage node based on the number of the multiple video plans to be delivered and the performance scores of the multiple storage nodes, the method further includes:
when detecting that any storage node in the plurality of storage nodes has an operation fault, executing the step of determining the distribution number of the video plans distributed to each storage node based on the number of the plurality of video plans to be issued and the performance scores of the plurality of storage nodes; or,
and executing the step of determining the distribution number of the video plans distributed to each storage node based on the number of the plurality of video plans to be issued and the performance scores of the plurality of storage nodes every other first preset time length.
Optionally, after determining the current performance scores of the plurality of storage nodes in the video monitoring system, the method further includes:
determining the total number of executing video plans currently being executed in the plurality of storage nodes;
determining a load state of each storage node in the plurality of storage nodes based on the total number of executions of the plurality of storage nodes and the performance scores of the plurality of storage nodes;
and when the storage nodes with the unbalanced load state exist in the plurality of storage nodes, redistributing the actual number of the video recording plans currently executed by the storage nodes in the unbalanced load state.
Optionally, the determining the load status of each storage node in the plurality of storage nodes based on the total number of executions of the plurality of storage nodes and the performance scores of the plurality of storage nodes includes:
dividing the performance score of each storage node by the total performance score of the plurality of storage nodes to obtain the score weight of each storage node, wherein the total performance score is the sum of the performance scores of the plurality of storage nodes;
respectively multiplying the total number of the executed storage nodes by the scoring weight of each storage node to obtain the theoretical number of the video plan currently executed by each storage node;
and when the actual number of the video recording plans currently being executed is different from the theoretical number of the storage nodes, determining that the storage nodes with the load state being the unbalanced state exist in the plurality of storage nodes.
Optionally, the redistributing the actual number of video recording plans currently being executed by the storage nodes in the unbalanced state includes:
determining the overload number or the underload number corresponding to any storage node in the storage nodes in the unbalanced state;
the number of the overloaded video programs refers to the number of the video programs currently being executed by any storage node, which is actually greater than the theoretical number of the video programs currently being executed by any storage node, and the number of the underloaded video programs refers to the number of the video programs currently being executed by any storage node, which is actually less than the theoretical number of the video programs currently being executed by any storage node;
and moving the video plans with the number of the video plans being the overload number out of the video plans currently executed by any storage node, or distributing the video plans with the number of the video plans being the underload number to any storage node based on the video plans moved out of other storage nodes in the unbalanced state.
Optionally, the determining the current performance score of the plurality of storage nodes in the video monitoring system includes:
for any storage node in the plurality of storage nodes, determining the scores of the plurality of performance indexes in the any storage node based on the detail information of the plurality of performance indexes reported by the any storage node;
when the scores of the performance indexes in any storage node are higher than the preset scores, adding the scores of the performance indexes to obtain the current performance score of any storage node;
when the scores of the performance indexes in any storage node are not all higher than the preset score, determining the score of the performance index with the lowest score in the performance indexes as the current performance score of any storage node.
Optionally, before determining the total number of executing video recording plans currently being executed in the plurality of storage nodes, the method further includes:
and executing the step of determining the total number of the currently executed video recording plans in the plurality of storage nodes every second preset time.
In another aspect, a load balancing apparatus is provided, where the apparatus is applied to a management node in a video monitoring system, and the apparatus includes:
the system comprises a first determination module, a second determination module and a third determination module, wherein the first determination module is used for determining the current performance scores of a plurality of storage nodes in the video monitoring system, and the performance scores are determined based on the scores of all performance indexes of the storage nodes and are used for describing the current running resource capacity of the storage nodes;
the second determining module is used for determining the distribution number of the video plans distributed to each storage node based on the number of the plurality of video plans to be issued and the performance scores of the plurality of storage nodes, wherein the video plans are used for describing the time information of the video stream recorded by the camera device;
and the first distribution module is used for distributing the video plans to the storage nodes according to the determined distribution number.
Optionally, the second determining module includes:
the first calculation submodule is used for dividing the performance score of each storage node by the total performance score of the plurality of storage nodes to obtain the score weight of each storage node, and the total performance score is the sum of the performance scores of the plurality of storage nodes;
and the second calculation submodule is used for multiplying the number of the video plans by the scoring weight of each storage node to obtain the distribution number of the video plans distributed to each storage node.
Optionally, the first distribution module comprises:
a first obtaining sub-module, configured to obtain priorities of the video schedules;
and the first distribution submodule is used for distributing the video plans to the storage nodes according to the priority order of the video plans and the determined distribution number.
Optionally, the first distribution module comprises:
a second obtaining sub-module, configured to obtain, for any video recording plan in the plurality of video recording plans, a historical execution trajectory of the any video recording plan, where the historical execution trajectory is used to describe a storage node where the any video recording plan is executed and details of the execution;
a first determining submodule, configured to determine, based on the historical execution trajectory, a storage node that has not failed in executing any of the video recording plans from the plurality of storage nodes;
and the second distribution submodule is used for distributing any video plan to the storage nodes which do not fail.
Optionally, the apparatus further comprises:
a third determining module, configured to determine, as multiple video plans to be delivered, multiple video plans that are currently executed and are not executed by at least one storage node that has an operation failure among the multiple storage nodes; and/or the presence of a gas in the gas,
and the fourth determining module is used for determining the plurality of video plans carried in the received and unprocessed video plan issuing request as the plurality of video plans to be issued.
Optionally, the apparatus further comprises:
and the deleting module is used for deleting the video plan carried in the received and unprocessed video plan deleting request from the corresponding storage node.
Optionally, the apparatus further comprises:
the first triggering module is used for triggering the first determining module to determine the distribution number of the video plans distributed to each storage node based on the number of the video plans to be issued and the performance scores of the storage nodes when the operation fault of any storage node in the storage nodes is detected; or,
and the second triggering module is used for triggering the second determining module to determine the distribution number of the video plans distributed to each storage node based on the number of the plurality of video plans to be issued and the performance scores of the plurality of storage nodes every other first preset time.
Optionally, the apparatus further comprises:
a fifth determining module, configured to determine a total number of executing video recording plans currently being executed in the plurality of storage nodes;
a sixth determining module, configured to determine a load state of each storage node in the plurality of storage nodes based on the total number of executions of the plurality of storage nodes and the performance scores of the plurality of storage nodes;
and the second distributing module is used for redistributing the actual number of the video recording plans currently executed by the storage nodes in the unbalanced state when the storage nodes with the unbalanced load state exist in the plurality of storage nodes.
Optionally, the sixth determining module includes:
the third computing submodule is used for dividing the performance score of each storage node by the total performance score of the plurality of storage nodes to obtain the score weight of each storage node, wherein the total performance score is the sum of the performance scores of the plurality of storage nodes;
the fourth calculation submodule is used for respectively multiplying the total number of the executed storage nodes by the scoring weight of each storage node to obtain the theoretical number of the video plan currently executed by each storage node;
a second determining submodule, configured to determine that a storage node whose load state is the unbalanced state exists in the plurality of storage nodes when the actual number of the currently-executed video recording plans is different from the theoretical number of the storage nodes.
Optionally, the second allocating module comprises:
a third determining submodule, configured to determine, for any storage node in the unbalanced state, an overload number or an underload number corresponding to the any storage node;
the number of the overloaded video programs refers to the number of the video programs currently being executed by any storage node, which is actually greater than the theoretical number of the video programs currently being executed by any storage node, and the number of the underloaded video programs refers to the number of the video programs currently being executed by any storage node, which is actually less than the theoretical number of the video programs currently being executed by any storage node;
and the moving submodule is used for moving the video plans of which the number is the overload number out of the video plans currently executed by any storage node, or distributing the video plans of which the number is the overload number to any storage node based on the video plans moved out of other storage nodes in the unbalanced state.
Optionally, the first determining module includes:
a fourth determining submodule, configured to determine, for any storage node in the plurality of storage nodes, scores of the plurality of performance indicators in the any storage node based on detail information of the plurality of performance indicators reported by the any storage node;
the fifth calculation submodule is used for adding the scores of the performance indexes when the scores of the performance indexes in any storage node are higher than the preset score to obtain the current performance score of any storage node;
and a fifth determining submodule, configured to determine, when the scores of the multiple performance indicators in any one of the storage nodes are not all higher than the preset score, a score of a performance indicator with a lowest score among the multiple performance indicators as a current performance score of the any one of the storage nodes.
Optionally, the apparatus further comprises:
and the third triggering module is used for triggering the fifth determining module to determine the total number of the currently executed video plans in the plurality of storage nodes at intervals of a second preset time length.
In another aspect, a computer-readable storage medium is provided, on which a computer program is stored, which when executed by a processor implements the steps of any of the methods provided in the first aspect above.
The technical scheme provided by the embodiment of the invention has the following beneficial effects:
in the embodiment of the present invention, the management node may determine the current performance scores of the plurality of storage nodes, and determine the distribution number of the video plans distributed to each storage node based on the number of the plurality of video plans to be delivered and the performance scores of the plurality of storage nodes. The performance score can describe the current resource operation capacity of the storage nodes, so that the distribution number of the video plans of each storage node determined by the performance score is the number which accords with the resource operation capacity of each storage node, and after the video plans are distributed to the storage nodes according to the determined distribution number, the storage nodes are in a load balancing state, so that the load balancing accuracy is ensured, and the load balancing effect is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic structural diagram of a load balancing system according to an embodiment of the present invention;
fig. 2 is a flowchart of a load balancing method according to an embodiment of the present invention;
fig. 3 is a flowchart of another load balancing method according to an embodiment of the present invention;
fig. 4A is a schematic structural diagram of a first load balancing apparatus according to an embodiment of the present invention;
fig. 4B is a schematic structural diagram of a second determining module according to an embodiment of the present invention;
fig. 4C is a schematic structural diagram of a first distribution module according to an embodiment of the present invention;
fig. 4D is a schematic structural diagram of another first distribution module according to an embodiment of the present invention;
fig. 4E is a schematic structural diagram of a second load balancing apparatus according to an embodiment of the present invention;
fig. 4F is a schematic structural diagram of a third load balancing apparatus according to an embodiment of the present invention;
fig. 4G is a schematic structural diagram of a fourth load balancing apparatus according to an embodiment of the present invention;
FIG. 4H is a block diagram of a sixth determining module according to an embodiment of the present invention;
fig. 4I is a schematic structural diagram of a second distribution module according to an embodiment of the present invention;
FIG. 4J is a schematic structural diagram of a first determining module according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a node according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of another node according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
Before explaining the embodiments of the present invention in detail, an application scenario and a system architecture related to the embodiments of the present invention are explained separately.
First, an application scenario related to the embodiment of the present invention is described.
Currently, in a video monitoring system, one storage node may generally correspond to a plurality of cameras, and the storage node may acquire and store video streams recorded by the plurality of cameras. However, when the number of the image capturing devices corresponding to the storage node is large, the operation burden of the storage node is too heavy, and the storage node is affected by acquiring the video stream from the image capturing devices. Therefore, load balancing is often required by a management node in the video surveillance system. However, currently, when load balancing is performed, the management node can only acquire and store the video stream recorded by the camera device through the storage node with the lowest utilization rate. When the hardware performance of the storage node is poor, the storage node continues to store the video stream, which also causes the operation burden of the storage node to be too heavy, and thus the implementation effect of load balancing is poor.
Based on such a scenario, the embodiment of the present invention provides a load balancing method capable of implementing load balancing and improving the success rate of implementing load balancing.
Next, a system architecture according to an embodiment of the present invention will be described.
Fig. 1 is a schematic architecture diagram of a load balancing system according to an embodiment of the present invention, and referring to fig. 1, the system includes a management node 1, a plurality of storage nodes 2, and a plurality of camera devices 3. For convenience of description, 3 storage nodes 2 and 6 cameras 3 are illustrated in fig. 1 as an example.
The management node 1 and the storage nodes 2 may be servers, or may also be terminals such as tablet computers, and the management node 1 may be any one of the storage nodes 2, or a node that is independent from the storage nodes 2 and can be used for load balancing. The plurality of image pickup devices 3 may be connected to the management node 1 and the plurality of storage nodes 2, respectively, and the management node 1 may be connected to the plurality of storage nodes 2. The management node 1 may manage the plurality of storage nodes 2, detect requests sent by the plurality of image capturing devices 3, and in order to manage the plurality of storage nodes 2 conveniently, each storage node 2 of the plurality of storage nodes 2 may report detailed information of the plurality of performance indicators to the management node 1, so that the management node 1 may determine current performance scores of the plurality of storage nodes 2 according to the detailed information of the plurality of performance indicators reported by each storage node 2. Meanwhile, in order to enable any storage node 2 of the plurality of storage nodes 2 to acquire and store the video stream from the corresponding image pickup device 3, the plurality of image pickup devices 3 may report the plurality of video recording plans to the management node 1. The management node 1 may store the plurality of video schedules reported by the plurality of image pickup devices 3 after detecting the plurality of video schedules, determine the number of allocation of the video schedules to each storage node 2 based on the number of the plurality of video schedules and the performance scores of the plurality of storage nodes 2, and allocate the plurality of video schedules to the plurality of storage nodes 2 according to the determined number of allocation.
It should be noted that, in the embodiment of the present invention, the load balancing system may include not only the management node 1, the plurality of storage nodes 2, and the plurality of camera apparatuses 3, but also other devices, such as a user terminal. The user terminal may be connected to the plurality of cameras 3 and the management node 1, and the user terminal may set the video recording schedules of the plurality of cameras 3 and may transmit the video recording schedules of the plurality of cameras 3 to the management node 1. That is, the user terminal can serve as a management device for the plurality of image pickup apparatuses 3, so that a recording schedule for the plurality of image pickup apparatuses 3 can be set.
In addition, in the embodiment of the present invention, the load balancing system may include only one management node 1, or may include a plurality of management nodes 1. When a plurality of management nodes 1 are included in the load balancing system, any one of the plurality of management nodes 1 may be determined as a master management node 1, and the other management nodes 1 of the plurality of management nodes 1 may be determined as a plurality of slave management nodes 1. The master management node 1 is configured to manage the detected video recording plans and the plurality of storage nodes 2, and the plurality of slave management nodes 1 are configured to synchronize information in the master management node 1 in real time. When the master management node 1 fails, any slave management node 1 in the plurality of slave management nodes 1 can quickly take over the currently executed process of the master management node 1, so that the realization of load balancing is ensured to be uninterrupted, and the reliability of realizing load balancing is improved.
Furthermore, in the embodiment of the present invention, the load balancing system may include a plurality of domains, or may include only one domain, and one camera and one storage node may only belong to one domain, and one domain may include a plurality of cameras and a plurality of storage nodes.
After the application scenario and the system architecture of the embodiment of the present invention are introduced, a detailed description will be given to a load balancing method provided by the embodiment of the present invention with reference to the accompanying drawings.
Fig. 2 is a flowchart illustrating a load balancing method according to an exemplary embodiment, referring to fig. 2, the method is applied to a management node in a video surveillance system, and includes the following steps.
Step 201: the management node determines the current performance scores of a plurality of storage nodes in the video monitoring system, wherein the performance scores are determined based on the scores of all performance indexes of the storage nodes and are used for describing the current operation resource capacity of the storage nodes.
Since the capability of operating resources of any storage node in the plurality of storage nodes is related to the scores of the performance indexes, in order to achieve load balancing among the plurality of storage nodes, the management node needs to determine the current performance scores of the plurality of storage nodes in the video monitoring system. And the operation of the management node for determining the current performance scores of the plurality of storage nodes in the video monitoring system may be: for any storage node in the plurality of storage nodes, determining the scores of the plurality of performance indexes in the any storage node based on the detail information of the plurality of performance indexes reported by the any storage node; when the scores of the performance indexes in any storage node are higher than the preset scores, adding the scores of the performance indexes to obtain the current performance score of any storage node; and when the scores of the performance indexes in any storage node are not all higher than the preset score, determining the score of the performance index with the lowest score in the performance indexes as the current performance score of any storage node.
It should be noted that, as can be seen from the foregoing, in order to manage multiple storage nodes, any storage node in the multiple storage nodes may report detail information of multiple performance indexes to a management node, and the management node may store the detail information of the multiple performance indexes reported by any storage node in the multiple storage nodes, so that the management node may determine current performance scores of the multiple storage nodes in the video monitoring system according to the detail information reported by each storage node.
The detailed information of the multiple performance indicators may include a utilization rate or an idle rate of a Central Processing Unit (CPU), a utilization rate or an idle rate of a memory, a utilization rate or an idle rate of a network channel, a utilization rate or an idle rate of an Input/Output (I/O), a storage capacity of a storage medium, and the like.
In addition, in the operation process of any storage node of the plurality of storage nodes, any performance index of the plurality of performance indexes of the any storage node may change, for example, a network channel may be affected and congested in the peak period of the internet, or the any storage node may generate additional operation information in the operation process, which causes increase of the memory utilization rate and reduction of the idle rate. Therefore, in order to ensure the accuracy of the current performance score of any storage node, the any storage node may report the detailed information of a plurality of performance indexes once every specified time length. The specified time period may be 20 seconds, 5 minutes, 30 minutes, and so on.
It should be further noted that, since the any storage node may report the detail information of the multiple performance indicators once every specified time length, the management node may determine the current performance score of the any storage node each time the management node receives the detail information of the multiple performance indicators reported by the any storage node. In addition, as can be seen from the above, the management node may receive a plurality of video recording plans reported by a plurality of image pickup devices, and in a normal case, the management node may issue a plurality of video recording plans reported by a plurality of image pickup devices, so that when a plurality of video recording plans need to be issued to a plurality of storage nodes, the management node may determine the current performance score of any storage node according to the detail information of a plurality of performance indexes of the storage node, which is stored last time.
The operation of the management node determining the scores of the multiple performance indexes in any storage node based on the detail information of the multiple performance indexes reported by any storage node may be: when the detail information of the multiple performance indexes includes the idle rate of each performance index, the management node may obtain a total weight score corresponding to each performance index, and multiply the total weight score of each performance index by the idle rate to obtain a score of each performance index. When the detail information of the multiple performance indexes includes the utilization rate of each performance index, the management node may subtract the utilization rate of each performance index from 1 to obtain the idle rate of each performance index, obtain the total weight score corresponding to each performance index, and multiply the total weight score of each performance index by the idle rate to obtain the score of each performance index.
It should be noted that the total weight scores corresponding to the multiple performance indexes may be set in advance, and the total weight scores corresponding to the multiple performance indexes may be the same, for example, the total weight scores corresponding to the CPU, the memory, the network channel, and the I/O may all be 20. However, since the plurality of performance indicators have different degrees of influence on the capability of the storage node to operate the resource, the total weight scores corresponding to the plurality of performance indicators may be different. For example, the total weight score for CPU may be 20, the total weight score for memory may be 30, the total weight score for network channel may be 10, the total weight score for I/O may be 15, and so on.
It should be further noted that the total weight scores corresponding to the multiple performance indexes may be stored in the management node, or may be included in the detailed information of the multiple performance indexes reported by any storage node. When the total weight scores corresponding to the multiple performance indexes of any storage node are included in the detailed information of the multiple performance indexes reported by any storage node, the management node may obtain the total weight scores corresponding to the multiple performance indexes from the detailed information of the multiple performance indexes.
For example, when the detail information of the performance indexes includes 60% of the idle rate of the CPU, 40% of the idle rate of the memory, 50% of the idle rate of the network channel, and 50% of the idle rate of the I/O, the management node may obtain that the total weight scores corresponding to the CPU, the memory, the network channel, the storage space, and the I/O are all 20. Multiplying the total weight score of the CPU by 60% of the idle rate of the CPU to obtain a score of the CPU of 12, multiplying the total weight score of the memory by the idle rate of the memory to obtain a score of the memory of 8, multiplying the total weight score 20 of the network channel by 50% of the idle rate of the network channel to obtain a score of the network channel of 10, and multiplying the total weight score of the I/O by 50% of the idle rate of the I/O to obtain a score of the I/O of 10.
In addition, when the idle rate of any one of the performance indexes is low, even if the idle rates of other performance indexes are high, the storage node may still be overloaded, and thus the operation of the storage node is affected. For example, when the idle rate of the CPU of the storage node B among the plurality of storage nodes is 9%, the storage node B is already overloaded and is difficult to operate, and even if the idle rate of I/O, memory, network channel, or the like is high, the storage node B cannot continue to operate. Therefore, the management node further needs to determine whether all of the performance indexes in the storage node B are higher than a preset score, and add the scores of the performance indexes when all of the scores of the performance indexes in the storage node B are higher than the preset score to obtain a current performance score of the storage node B; when the score of the performance indicators in the storage node B is not higher than the preset score, that is, when the score of at least one performance indicator in the performance indicators in the storage node B is lower than or equal to the preset score, the score of the performance indicator with the lowest score in the performance indicators may be determined as the current performance score of the storage node B. Of course, in practical applications, the preset score may also be determined as the current performance score of the storage node B. Therefore, the condition that the current actual resource operation capacity of the storage node is inconsistent with the resource operation capacity described by the performance score can be avoided, the accuracy of determining the performance score of each storage node by the management node is ensured, and the fault of the subsequent storage node due to the overload can be avoided.
It should be noted that the preset score may be set in advance, for example, the preset score may be 10 points, 5 points, 3 points, and so on.
It should be noted that, the scores of the performance indicators of any storage node may be determined one by one, so that when the management node determines that the score of any performance indicator of the performance indicators of any storage node is not higher than the preset score, it may be determined that there is a performance indicator whose performance score is not higher than the preset score in the performance indicators of any storage node, and at this time, the management node may directly determine the score of the determined performance indicator which is not higher than the preset score as the performance score of any storage node without determining the score of the remaining performance indicators.
For example, the management node determines scores of CPUs of the storage node bs, I/O scores, memory scores, and storage capacity scores of the storage media one by one, and when the preset score is 5, if the management node determines that the score of the CPU of the storage node B is 3, the management node may directly determine the 3 score as the performance score of the storage node B without continuously determining the scores of the I/O, the memory, and the storage capacity of the storage media.
It is worth noting that the management node can determine the performance score of the storage node without determining the scores of all the performance indexes of the storage node, so that the speed of determining the performance score of each storage node by the management node is increased, the calculation amount of the management node is reduced, and the waste of resources caused by determining the scores of a plurality of storage nodes by the management node is avoided.
Moreover, the detail information of the multiple performance indexes reported by any storage node may include not only the utilization rate or the idle rate of the CPU, the utilization rate or the idle rate of the memory, and the like, but also other information, for example, the detail request information of the multiple performance indexes may further include scores of the performance indexes. When the detailed request information of the multiple performance indexes includes the scores of the performance indexes, the management node may directly obtain the scores of the performance indexes from the detailed request information of the multiple performance indexes, and add the scores of the performance indexes to obtain the current performance score of any storage node.
Step 202: the management node determines the distribution number of the video plans distributed to each storage node based on the number of the plurality of video plans to be issued and the performance scores of the plurality of storage nodes, wherein the video plans are used for describing the time information of the video stream recorded by the camera device.
In order to achieve load balancing among the plurality of storage nodes in the process of issuing the video plan, the management node may determine the distribution number of the video plans distributed to each storage node based on the number of the plurality of video plans to be issued and the performance scores of the plurality of storage nodes. The operation of the management node determining the distribution number of the video plans distributed to each storage node based on the number of the multiple video plans to be issued and the performance scores of the multiple storage nodes may be: dividing the performance score of each storage node by the total performance score of the plurality of storage nodes to obtain the score weight of each storage node, wherein the total performance score is the sum of the performance scores of the plurality of storage nodes; and multiplying the number of the plurality of video plans by the scoring weight of each storage node to obtain the distribution number of the video plans distributed to each storage node.
The video recording plan is used to describe the time information of the video stream recorded by the camera device, that is, the video recording plan can describe when the storage node acquires and stores the video stream from the corresponding camera device, and when the acquisition and storage of the video stream are stopped. For example, the video recording schedule may be described as the storage node continuously acquiring and storing the video stream from the corresponding camera device for 24 hours, or may be described as the storage node starting to acquire and store the video stream from the corresponding camera device 6 points earlier and stopping to acquire and store the video stream from the corresponding camera device 10 points later.
It should be noted that, since the scoring weight of each storage node can reflect the proportional relationship of the capacity of running resources between the storage nodes, the management node can accurately determine the distribution number of the video plans distributed to each storage node according to the scoring weight of each storage node, thereby improving the accuracy of load balancing.
For example, when the number of the plurality of video recording plans is 100, the performance score of the storage node 1 is 50, the performance score of the storage node 2 is 30, and the performance score of the storage node 3 is 20, the performance scores of the storage node 1, the storage node 2, and the storage node 3 are added to obtain a total performance score of 100. Dividing the performance score 30 of the storage node 1 by the total performance score 100 to obtain the score weight of the storage node 1 as 0.5, dividing the performance score 30 of the storage node 2 by the total performance score 100 to obtain the score weight of the storage node 2 as 0.3, and dividing the performance score 20 of the storage node 3 by the total performance score 100 to obtain the score weight of the storage node 3 as 0.2. The number of video recording plans 100 is multiplied by the scoring weight of each storage node, and the assigned numbers of video recording plans assigned to the storage nodes 1, 2, and 3 are respectively 50, 30, and 20.
It should be noted that the plurality of video recording plans may be obtained from a video recording plan issuing request sent by the plurality of camera apparatuses when the management node detects the video recording plan issuing request, or may be obtained from a plurality of video recording plans currently being executed and not being executed by at least one storage node having an operation failure when the management node receives a failure message reported by at least one storage node having an operation failure in the plurality of storage nodes. That is, before the management node determines the distribution number of the video plans distributed to each storage node based on the number of the multiple video plans to be delivered and the performance scores of the multiple storage nodes, the multiple video plans currently executed and not executed by at least one storage node having an operation failure in the multiple storage nodes may be determined as the multiple video plans to be delivered; and/or determining the plurality of video plans carried in the received and unprocessed video plan issuing request as a plurality of video plans to be issued.
Since any storage node in the plurality of storage nodes may fail during operation, once the storage node fails, the storage node cannot acquire a video stream from the image pickup device, and thus important information may be missed. Therefore, in order to avoid missing information, when any storage node fails, the storage node may report a failure message to the management node, and when the management node receives the failure message, the management node may determine the video plans currently being executed and not being executed by the storage node as the video plans to be delivered, and execute the operation of step 202.
In addition, in a general case, after the plurality of camera apparatuses send the video recording plan issue request to the management node, the management node may not process the video recording plan issue request in time, but detects the request sent by the camera apparatus once every first preset time period, and issues the video recording plan carried in the video recording plan issue request when detecting the video recording plan issue request. That is, the management node may perform the operation of step 202 every first preset duration.
It should be noted that the first preset time period may be set in advance, for example, the first preset time period may be 5 minutes, 10 minutes, and so on.
In addition, the video schedule of any one of the plurality of image pickup apparatuses may be changed, and when the video schedule is changed, the image pickup apparatus may send a change request to the management node, for example, the video schedule may send a video schedule deletion request to the management node. When the management node detects the video schedule deletion request, the video schedule carried in the received and unprocessed video schedule deletion request may be deleted from the corresponding storage node.
Furthermore, as can be seen from the above description, a video surveillance system may include one domain or a plurality of domains, and one camera and one storage node may belong to only one domain, and one domain may include a plurality of cameras and a plurality of storage nodes. If the video monitoring system comprises a plurality of domains, when the management node determines the distribution number of the video plans distributed to each storage node, the management node needs to respectively determine the distribution number of the video plans of each storage node contained in each domain.
For any storage node in the plurality of storage nodes, the management node needs to determine all storage nodes belonging to the same domain as the any storage node from the plurality of storage nodes, and divide the performance score of the any storage node by the total performance score of all storage nodes belonging to the same domain as the any storage node to obtain the score weight of the any storage node, wherein the total performance score is the sum of the performance scores of all storage nodes belonging to the same domain as the any storage node.
In addition, since one camera and one storage node can only belong to one domain, and the video recording plan is used to describe the time information of the camera recording the video stream, one video recording plan can only belong to one domain, and a plurality of video recording plans can be included in one domain. Therefore, in order to accurately assign a plurality of video recording plans, the management node needs to determine all video recording plans belonging to the same domain as the any storage node from the plurality of video recording plans, and multiply the number of all video recording plans belonging to the same domain as the any storage node by the scoring weight of each storage node belonging to the same domain as the any storage node to obtain the assigned number of video recording plans assigned to each storage node belonging to the same domain as the any storage node.
Step 203: and the management node distributes the plurality of video plans to the plurality of storage nodes according to the determined distribution number.
The management node may directly allocate the plurality of video schedules to the plurality of storage nodes according to the determined allocation number. However, in some cases, when the number of the video recording plans is too large and the network condition does not allow the management node to transmit a large number of video recording plans at a time, the management node may be allocated only according to the preset number. At this time, the time when the management node allocates a plurality of video schedules to the storage node will be different, and some important video schedules may cause information omission due to untimely allocation. Therefore, when the management node allocates the plurality of video plans to the plurality of storage nodes according to the determined allocation number, the priority of the plurality of video plans can be obtained; and distributing the plurality of video plans to the plurality of storage nodes according to the priority order of the plurality of video plans and the determined distribution number.
For example, if the video surveillance system is a hotel video surveillance system, when the camera is a hotel corridor, the priority of the video recording plan sent by the camera is set to be high, when the camera is a hotel lobby camera, the priority of the video recording plan sent by the camera is set to be medium, and when the camera is a hotel door camera, the priority of the video recording plan sent by the camera is set to be low. Of course, in practical application, the setting may be performed according to the time for executing the video recording schedule, for example, when the time for executing the video recording schedule a is 24 hours without interruption, the priority of the video recording schedule a is set to high, when the time for executing the video recording schedule B is from 6 o 'clock to 10 o' clock, the priority of the video recording schedule B is set to medium, and when the time for executing the video recording schedule C is from 10 o 'clock at night to 6 o' clock on the next day, the priority of the video recording schedule C is set to low.
In addition, since a plurality of video schedules may not be allocated to the storage node for the first time, that is, a certain video schedule is executed before the current time, and a storage node executing the video schedule may also have a fault in the execution process, in order to ensure the normal operation of the storage node and avoid the problem that some video schedules fail to take streams from a specific storage node, the operation of allocating, by the management node, the plurality of video schedules to the plurality of storage nodes may further be: for any video recording plan in the plurality of video recording plans, acquiring a historical execution track of the video recording plan, wherein the historical execution track is used for describing a storage node for executing any video recording plan history and detailed execution information; determining storage nodes which do not fail when any video recording plan is executed from the plurality of storage nodes based on the historical execution track; and distributing any video plan to the failed storage nodes.
It should be noted that, because any video schedule in the plurality of video schedules is sent by the management node, and any storage node in the plurality of storage nodes can report a fault message to the management node when an operation fault occurs, the management node can easily know the historical execution track of the video schedule, and whether the storage node has a fault or not when the video schedule is executed in a storage node in the plurality of storage nodes, so as to ensure the security of the storage node when the management node allocates the video schedule.
Furthermore, since the video surveillance system may include a plurality of domains, when the management node assigns a video recording plan to each storage node, the management node assigns a video recording plan belonging to the same domain as each storage node to each storage node according to the determined number of assignments.
Further, when any storage node in the plurality of storage nodes receives the video recording plan assigned by the management node, the any storage node may determine time information described by the assigned video recording plan, and when it is detected that the current time reaches the time for executing the video recording plan, acquire and store the video stream from the image pickup device described by the video recording plan.
Furthermore, as can be seen from the above description, the video monitoring system may include a master management node and a plurality of slave management nodes, and the plurality of slave management nodes may synchronize information in the master management node in real time, so that when the master management node fails, any slave management node in the plurality of slave management nodes may take over a process currently executed by the master management node in time, thereby ensuring that load balancing is not interrupted, and improving reliability of load balancing.
In the embodiment of the present invention, the management node may determine the current performance scores of the plurality of storage nodes, and determine the distribution number of the video plans distributed to each storage node based on the number of the plurality of video plans to be delivered and the performance scores of the plurality of storage nodes. The performance score can describe the current resource operation capacity of the storage nodes, so that the distribution number of the video plans of each storage node determined by the performance score is the number which accords with the resource operation capacity of each storage node, and after the video plans are distributed to the storage nodes according to the determined distribution number, the storage nodes are in a load balancing state, so that the load balancing accuracy is ensured, and the effect of realizing the load balancing is improved.
It should be noted that the management node may implement load balancing in the process of issuing the video recording plan through the operations in steps 201 to 203. However, during the process of executing the video recording plan, the storage nodes may have unbalanced loads among the storage nodes for some reasons. Therefore, after determining the current performance scores of the plurality of storage nodes in the video monitoring system, the management node may further adjust the number of video recording plans currently being executed in the plurality of storage nodes, so as to implement load balancing. Referring to fig. 3, another load balancing method provided in the embodiment of the present invention specifically includes the following steps.
Step 301: the management node determines the total number of the video recording plans currently executed in the plurality of storage nodes.
It should be noted that the management node may actively determine the total number of executing video recording plans currently being executed in the plurality of storage nodes, or may passively determine the total number of executing video recording plans currently being executed in the plurality of storage nodes. The following describes operations for actively determining the total number of executions and passively determining the total number of executions, respectively.
Actively determining total number of executions
In order to load balance the video recording plans among the storage nodes, the management node needs to acquire the total number of execution of the video recording plans currently being executed by the storage nodes.
For example, in the process of executing a video recording plan, a network channel of the storage node 1 may be affected and jammed during an online peak, or the storage node 1 may generate additional operation information in the operation process, which causes an increase in memory utilization rate and a decrease in idle rate, and thus causes a load between the storage node and other storage nodes to be unbalanced.
The management node may determine, every second preset time, the total number of execution of the video recording plans currently being executed in the plurality of storage nodes. The second preset time period may be set in advance, for example, the second preset time period may be 10 minutes, 20 minutes, and the like.
Passively determining total number of executions
As shown in the step 202, there may be a storage node with a failure in operation in the plurality of storage nodes, and the management node may re-issue the video recording plans that are being executed and are not being executed by the failed storage node. Therefore, when the operation of the failed storage node is recovered to normal, the storage node whose operation is recovered to normal will not have an executable video recording plan, thereby causing load imbalance among the plurality of storage nodes. Therefore, in order to load balance the video recording plans among the plurality of storage nodes, the management node needs to acquire the total number of execution of the video recording plans currently being executed by the plurality of storage nodes.
When the storage node with the operation fault recovers to be normal, the storage node with the operation recovered to be normal can report a message of recovering to be normal to the management node, and when the management node receives the message of recovering to be normal, the total execution number of the video plans currently executed by the plurality of storage nodes can be obtained.
In addition, since the video monitoring system may include a plurality of domains, when the management node determines the total number of executions of the video recording plan currently being executed, it needs to determine the total number of executions of a plurality of storage nodes belonging to the same domain.
Step 302: and the management node determines the load state of each storage node in the plurality of storage nodes based on the total execution number of the plurality of storage nodes and the performance scores of the plurality of storage nodes.
When the loads of the plurality of storage nodes are unbalanced, only a part of the plurality of storage nodes may be in a load unbalanced state, and another part of the plurality of storage nodes may still be in a load balanced state. Therefore, in order to accurately adjust the video recording plan executed by the storage nodes in the state of unbalanced load, the management node needs to determine the load state of each of the storage nodes based on the total number of executions of the storage nodes and the performance scores of the storage nodes.
The operation of the management node determining the load state of each storage node in the plurality of storage nodes based on the total number of executions of the plurality of storage nodes and the performance scores of the plurality of storage nodes may be: dividing the performance score of each storage node by the total performance score of the plurality of storage nodes to obtain the score weight of each storage node, wherein the total performance score is the sum of the performance scores of the plurality of storage nodes; respectively multiplying the total number of the executed storage nodes by the scoring weight of each storage node to obtain the theoretical number of the video plan currently executed by each storage node; and when the actual number of the storage nodes which are currently executing the video recording plan is different from the theoretical number, determining that the storage nodes with the load state being the unbalanced state exist in the plurality of storage nodes.
For example, when the actual number of video recording schedules currently being executed by the storage nodes 1, 2, and 3 is 50, 20, and 30, respectively, the total number of executions of the storage nodes 1, 2, and 3 is 100. When the total performance score of the storage nodes 1, 2 and 3 is 100, the score of the storage node 1 is 50, the score of the storage node 2 is 30 and the score of the storage node 3 is 20, the performance scores of the storage nodes 1, 2 and 3 are divided by the total performance score 100 respectively, so that the score weights of the storage nodes 1, 2 and 3 are 0.5, 0.3 and 0.2 respectively. The total number of the video plans to be executed 100 is multiplied by the scoring weight of each storage node, and the theoretical numbers of the video plans currently being executed by the storage nodes 1, 2 and 3 are respectively 50, 30 and 20. Since the actual number of the video recording plans currently being executed by the storage nodes 2 and the storage nodes 3 is different from the theoretical number, it can be determined that a storage node with an unbalanced load state exists in the storage nodes 1, 2, and 3, that is, the storage nodes 2 and 3 are storage nodes with unbalanced load states.
It should be noted that, since the scoring weight of each storage node may reflect a proportional relationship of the capacity of running resources between the storage nodes, the management node multiplies the total number of the storage nodes to the scoring weight of each storage node, respectively, to obtain a theoretical number of each storage node, which is the number of video plans that each storage node should execute currently when the storage nodes are in a load balancing state. Therefore, when there are storage nodes in the plurality of storage nodes whose number of currently executed video recording plans is different from the theoretical number, it may be determined that there is a storage node in the plurality of storage nodes whose load state is the unbalanced state.
In addition, when the video monitoring system includes a plurality of domains, the management node needs to determine the load state of each storage node in the plurality of storage nodes belonging to the same domain based on the total number of executions of the plurality of storage nodes belonging to the same domain and the performance scores of the plurality of storage nodes.
Step 303: when a storage node with an unbalanced load state exists in the plurality of storage nodes, the management node redistributes the actual number of the video recording plans currently executed by the storage nodes in the unbalanced load state so as to realize load balance among the plurality of storage nodes.
The operation of redistributing the actual number of the video recording plans currently executed by the storage nodes in the unbalanced state by the management node may be: determining the overload number or the underload number corresponding to any storage node in the storage nodes in the unbalanced state; the number of the overload programs is the number that the actual number of the video plans currently executed by any storage node is more than the theoretical number of the video plans currently executed by any storage node, and the number of the overload programs is the number that the actual number of the video plans currently executed by any storage node is less than the theoretical number of the video plans currently executed by any storage node; and moving the video plans with the number of the video plans being the overload number from the video plans currently executed by any storage node, or distributing the video plans with the number of the video plans being the underload number to any storage node based on the video plans moved from other storage nodes in the unbalanced storage nodes.
It should be noted that the management node may subtract the theoretical number from the actual number of any storage node, and when the obtained result is a negative number, determine that the result is the number of the missing loads corresponding to any storage node; and when the obtained result is a positive number, determining that the result is the overload number corresponding to any storage node.
For example, when the actual number of video recording plans currently being executed by the storage node 2 is 20, the theoretical number is 30, the actual number of video recording plans currently being executed by the storage node 3 is 30, and the theoretical number is 20, the management node may determine that the number of the storage nodes 2 corresponding to the lack of load is 10, and determine that the number of the storage nodes 3 corresponding to the overload is 10. At this time, the management node may remove 10 recording plans from the storage node 3 and allocate the removed 10 recording plans to the storage node 2.
In addition, when the video monitoring system comprises a plurality of domains, the management node can only redistribute the actual number of video recording plans currently executed by the storage nodes which belong to the same domain and are in an unbalanced state.
It should be noted that, since the management node may respectively perform load balancing on the storage nodes included in each of the plurality of domains, each domain may be in a load balancing state, and thus the entire video monitoring system will also be in a load balancing state.
In an embodiment of the present invention, the management node may determine the current performance scores of the plurality of storage nodes, which, in turn, the load status of each storage node in the plurality of storage nodes can be determined based on the total number of executions of the plurality of storage nodes and the performance scores of the plurality of storage nodes, and when a storage node with unbalanced load status exists in the plurality of storage nodes, the actual number of the video plans currently executed by the storage nodes in the unbalanced state is redistributed, so that the load balance can be timely carried out when the load is unbalanced due to some reasons in the process of executing a plurality of video plans by a plurality of storage nodes, therefore, the load balance is realized in the video plan issuing process, the load balance can be realized in the video plan executing process, and the accuracy and the effect of realizing the load balance among the plurality of storage nodes are improved.
After explaining the load balancing method provided by the embodiment of the present invention, a load balancing apparatus provided by the present invention is described next.
Fig. 4A is a block diagram of a load balancing apparatus according to an embodiment of the present invention, and referring to fig. 4A, the load balancing apparatus may be implemented by software, hardware, or a combination of the two. The device includes: a first determining module 401, a second determining module 402 and a first allocating module 403.
A first determining module 401, configured to determine current performance scores of a plurality of storage nodes in the video monitoring system, where the performance scores are determined based on scores of performance indicators of the storage nodes, and are used to describe capabilities of the storage nodes in current operation;
a second determining module 402, configured to determine, based on the number of multiple video plans to be issued and the performance scores of the multiple storage nodes, the allocated number of the video plans allocated to each storage node, where the video plan is used to describe time information for a camera to record a video stream;
a first allocating module 403, configured to allocate the video schedules to the storage nodes according to the determined allocation number.
Optionally, referring to fig. 4B, the second determining module 402 includes:
the first computing submodule 4021 is configured to divide the performance score of each storage node by the total performance score of the plurality of storage nodes to obtain a score weight of each storage node, where the total performance score is the sum of the performance scores of the plurality of storage nodes;
the second calculating sub-module 4022 is configured to multiply the number of the video schedules by the scoring weight of each storage node to obtain the number of video schedules allocated to each storage node.
Optionally, referring to fig. 4C, the first allocating module 403 includes:
a first obtaining sub-module 4031, configured to obtain priorities of the video schedules;
a first allocating sub-module 4032, configured to allocate the video schedules to the storage nodes according to the priority order of the video schedules and the determined allocation number.
Optionally, referring to fig. 4D, the first distribution module 403 includes:
a second obtaining sub-module 4033, configured to obtain, for any video recording plan in the plurality of video recording plans, a historical execution trajectory of the any video recording plan, where the historical execution trajectory is used to describe a storage node where the any video recording plan is executed and details of execution;
a first determining submodule 4034, configured to determine, based on the historical execution trajectory, a storage node that has not failed in executing any of the video recording plans from the plurality of storage nodes;
a second distribution submodule 4035, configured to distribute the any video recording plan to the storage node that has not failed.
Optionally, referring to fig. 4E, the apparatus further comprises:
a third determining module 404, configured to determine, as multiple video recording plans to be delivered, multiple video recording plans that are currently executed and are not executed by at least one storage node that has an operation failure among the multiple storage nodes; and/or the presence of a gas in the gas,
a fourth determining module 405, configured to determine the multiple video plans carried in the received and unprocessed video plan issuing request as multiple video plans to be issued.
Optionally, the apparatus further comprises:
and the deleting module is used for deleting the video plan carried in the received and unprocessed video plan deleting request from the corresponding storage node.
Optionally, referring to fig. 4F, the apparatus further comprises:
a first triggering module 406, configured to, when it is detected that an operation failure occurs in any storage node of the multiple storage nodes, trigger the first determining module to determine, based on the number of multiple video schedules to be issued and the performance scores of the multiple storage nodes, the number of video schedules allocated to each storage node; or,
the second triggering module 407 is configured to trigger the second determining module to determine, every other first preset time, the allocated number of the video plans allocated to each storage node based on the number of the multiple video plans to be issued and the performance scores of the multiple storage nodes.
Optionally, referring to fig. 4G, the apparatus further comprises:
a fifth determining module 408, configured to determine a total number of executing video recording plans currently being executed in the plurality of storage nodes;
a sixth determining module 409, configured to determine a load state of each storage node in the plurality of storage nodes based on the total number of executions of the plurality of storage nodes and the performance scores of the plurality of storage nodes;
a second allocating module 410, configured to, when a storage node with a load state being an unbalanced state exists in the plurality of storage nodes, reallocate an actual number of video recording plans currently being executed by the storage node in the unbalanced state.
Optionally, referring to fig. 4H, the sixth determining module 409 includes:
a third calculating submodule 4091, configured to divide the performance score of each storage node by a total performance score of the plurality of storage nodes to obtain a score weight of each storage node, where the total performance score is a sum of the performance scores of the plurality of storage nodes;
a fourth calculating sub-module 4092, configured to multiply the total number of the storage nodes executed by the scoring weight of each storage node, respectively, to obtain a theoretical number of the video recording plans currently being executed by each storage node;
a second determining sub-module 4093, configured to determine that, when there are storage nodes in the plurality of storage nodes whose number of video recording plans currently being executed is different from the theoretical number, there is a storage node in the plurality of storage nodes whose load state is the unbalanced state.
Optionally, referring to fig. 4I, the second allocating module 410 includes:
a third determining submodule 4101, configured to determine, for any storage node in the unbalanced state, an overload number or an underload number corresponding to the any storage node;
the number of the overloaded video programs refers to the number of the video programs currently being executed by any storage node, which is actually greater than the theoretical number of the video programs currently being executed by any storage node, and the number of the underloaded video programs refers to the number of the video programs currently being executed by any storage node, which is actually less than the theoretical number of the video programs currently being executed by any storage node;
a moving submodule 4102, configured to move the video recording plans with the number equal to the overload number from the video recording plans currently executed by any storage node, or allocate the video recording plans with the number equal to the overload number to any storage node based on the video recording plans moved from other storage nodes in the unbalanced state.
Optionally, referring to fig. 4J, the first determining module 401 includes:
a fourth determining submodule 4011, configured to determine, for any storage node in the plurality of storage nodes, scores of the plurality of performance indicators in the any storage node based on detail information of the plurality of performance indicators reported by the any storage node;
a fifth calculating sub-module 4012, configured to add the scores of the multiple performance indicators to obtain a current performance score of the any storage node when the scores of the multiple performance indicators in the any storage node are higher than preset scores;
a fifth determining sub-module 4013, configured to determine, when the scores of the multiple performance indicators in any storage node are not all higher than the preset score, a score of a performance indicator with a lowest score among the multiple performance indicators as a current performance score of the any storage node.
Optionally, the apparatus further comprises:
and the third triggering module is used for triggering the fifth determining module to determine the total number of the currently executed video plans in the plurality of storage nodes at intervals of a second preset time length.
In summary, in the embodiment of the present invention, the management node may determine the current performance scores of the plurality of storage nodes, and then, the load status of each storage node in the plurality of storage nodes can be determined based on the total number of executions of the plurality of storage nodes and the performance scores of the plurality of storage nodes, and when a storage node with unbalanced load status exists in the plurality of storage nodes, the actual number of the video plans currently executed by the storage nodes in the unbalanced state is redistributed, so that the load balance can be timely carried out when the load is unbalanced due to some reasons in the process of executing a plurality of video plans by a plurality of storage nodes, therefore, the load balance is realized in the video plan issuing process, the load balance can be realized in the video plan executing process, and the accuracy and the effect of realizing the load balance among the plurality of storage nodes are improved.
It should be noted that: in the load balancing device provided in the above embodiment, only the division of the functional modules is illustrated when performing load balancing, and in practical applications, the function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the load balancing device and the load balancing method provided by the above embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiments and are not described herein again.
Fig. 5 is a block diagram illustrating a node 500 according to an exemplary embodiment of the present invention. The node 500 may be a management node, or may be any one of a plurality of storage nodes, and the node 500 may be: a tablet, laptop, or desktop computer. Node 500 may also be referred to by other names such as user equipment, portable terminals, laptop terminals, desktop terminals, etc.
In general, node 500 includes: a processor 501 and a memory 502.
The processor 501 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and so on. The processor 501 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable logic Array). The processor 501 may also include a main processor and a coprocessor, where the main processor is a processor for processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 501 may be integrated with a GPU (Graphics processing unit), which is responsible for rendering and drawing the content required to be displayed on the display screen. In some embodiments, processor 501 may also include an AI (Artificial Intelligence) processor for processing computational operations related to machine learning.
Memory 502 may include one or more computer-readable storage media, which may be non-transitory. Memory 502 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in memory 502 is used to store at least one instruction for execution by processor 501 to implement a load balancing method provided by method embodiments herein.
In some embodiments, the node 500 may further optionally include: a peripheral interface 503 and at least one peripheral. The processor 501, memory 502 and peripheral interface 503 may be connected by a bus or signal lines. Each peripheral may be connected to the peripheral interface 503 by a bus, signal line, or circuit board. Specifically, the peripheral device includes: at least one of radio frequency circuitry 504, touch screen display 505, camera 506, audio circuitry 507, positioning components 508, and power supply 509.
The peripheral interface 503 may be used to connect at least one peripheral related to I/O (Input/Output) to the processor 501 and the memory 502. In some embodiments, the processor 501, memory 502, and peripheral interface 503 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 501, the memory 502, and the peripheral interface 503 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
The Radio Frequency circuit 504 is used for receiving and transmitting RF (Radio Frequency) signals, also called electromagnetic signals. The radio frequency circuitry 504 communicates with communication networks and other communication devices via electromagnetic signals. The rf circuit 504 converts an electrical signal into an electromagnetic signal to transmit, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 504 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and so forth. The radio frequency circuitry 504 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocols include, but are not limited to: the world wide web, metropolitan area networks, intranets, generations of mobile communication networks (2G, 3G, 4G, and 5G), Wireless local area networks, and/or WiFi (Wireless Fidelity) networks. In some embodiments, the rf circuit 504 may further include NFC (Near Field Communication) related circuits, which are not limited in this application.
The display screen 505 is used to display a UI (user interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display screen 505 is a touch display screen, the display screen 505 also has the ability to capture touch signals on or over the surface of the display screen 505. The touch signal may be input to the processor 501 as a control signal for processing. At this point, the display screen 505 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display screen 505 may be one, providing the front panel of the node 500; in other embodiments, the display screens 505 may be at least two, respectively disposed on different surfaces of the node 500 or in a folded design; in still other embodiments, the display 505 may be a flexible display, disposed on a curved surface or on a folded surface of the node 500. Even more, the display screen 505 can be arranged in a non-rectangular irregular figure, i.e. a shaped screen. The Display screen 505 may be made of LCD (liquid crystal Display), OLED (Organic Light-Emitting Diode), and the like.
The camera assembly 506 is used to capture images or video. Optionally, camera assembly 506 includes a front camera and a rear camera. Generally, a front camera is disposed at a front panel of the terminal, and a rear camera is disposed at a rear surface of the terminal. In some embodiments, the number of the rear cameras is at least two, and each rear camera is any one of a main camera, a depth-of-field camera, a wide-angle camera and a telephoto camera, so that the main camera and the depth-of-field camera are fused to realize a background blurring function, and the main camera and the wide-angle camera are fused to realize panoramic shooting and VR (Virtual Reality) shooting functions or other fusion shooting functions. In some embodiments, camera assembly 506 may also include a flash. The flash lamp can be a monochrome temperature flash lamp or a bicolor temperature flash lamp. The double-color-temperature flash lamp is a combination of a warm-light flash lamp and a cold-light flash lamp, and can be used for light compensation at different color temperatures.
Audio circuitry 507 may include a microphone and a speaker. The microphone is used for collecting sound waves of a user and the environment, converting the sound waves into electric signals, and inputting the electric signals to the processor 501 for processing, or inputting the electric signals to the radio frequency circuit 504 to realize voice communication. For stereo acquisition or noise reduction purposes, the microphones may be multiple and disposed at different locations of the node 500. The microphone may also be an array microphone or an omni-directional pick-up microphone. The speaker is used to convert electrical signals from the processor 501 or the radio frequency circuit 504 into sound waves. The loudspeaker can be a traditional film loudspeaker or a piezoelectric ceramic loudspeaker. When the speaker is a piezoelectric ceramic speaker, the speaker can be used for purposes such as converting an electric signal into a sound wave audible to a human being, or converting an electric signal into a sound wave inaudible to a human being to measure a distance. In some embodiments, audio circuitry 507 may also include a headphone jack.
The positioning component 508 is operable to locate the current geographic location of the node 500 for navigation or LBS (location based Service). The positioning component 508 may be a positioning component based on the GPS (global positioning System) in the united states, the beidou System in china, or the galileo System in russia.
Power supply 509 is used to power the various components in node 500. The power source 509 may be alternating current, direct current, disposable or rechargeable. When power supply 509 includes a rechargeable battery, the rechargeable battery may be a wired rechargeable battery or a wireless rechargeable battery. The wired rechargeable battery is a battery charged through a wired line, and the wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery may also be used to support fast charge technology.
In some embodiments, node 500 also includes one or more sensors 510. The one or more sensors 510 include, but are not limited to: acceleration sensor 511, gyro sensor 512, pressure sensor 513, fingerprint sensor 514, optical sensor 515, and proximity sensor 516.
The acceleration sensor 511 may detect the magnitude of acceleration on three coordinate axes of the coordinate system established with the node 500. For example, the acceleration sensor 511 may be used to detect components of the gravitational acceleration in three coordinate axes. The processor 501 may control the touch screen 505 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 511. The acceleration sensor 511 may also be used for acquisition of motion data of a game or a user.
The gyro sensor 512 may detect a body direction and a rotation angle of the node 500, and the gyro sensor 512 may cooperate with the acceleration sensor 511 to acquire a 3D motion of the user on the node 500. The processor 501 may implement the following functions according to the data collected by the gyro sensor 512: motion sensing (such as changing the UI according to a user's tilting operation), image stabilization at the time of photographing, game control, and inertial navigation.
The pressure sensors 513 may be disposed on the side frames of the node 500 and/or underneath the touch screen display 505. When the pressure sensor 513 is disposed on the side frame of the node 500, the holding signal of the user to the node 500 can be detected, and the processor 501 performs left-right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 513. When the pressure sensor 513 is disposed at the lower layer of the touch display screen 505, the processor 501 controls the operability control on the UI interface according to the pressure operation of the user on the touch display screen 505. The operability control comprises at least one of a button control, a scroll bar control, an icon control and a menu control.
The fingerprint sensor 514 is used for collecting a fingerprint of the user, and the processor 501 identifies the identity of the user according to the fingerprint collected by the fingerprint sensor 514, or the fingerprint sensor 514 identifies the identity of the user according to the collected fingerprint. Upon recognizing that the user's identity is a trusted identity, the processor 501 authorizes the user to perform relevant sensitive operations including unlocking the screen, viewing encrypted information, downloading software, paying, and changing settings, etc. The fingerprint sensor 514 may be disposed on the front, back, or side of the node 500. When a physical key or vendor Logo is provided on the node 500, the fingerprint sensor 514 may be integrated with the physical key or vendor Logo.
The optical sensor 515 is used to collect the ambient light intensity. In one embodiment, the processor 501 may control the display brightness of the touch display screen 505 based on the ambient light intensity collected by the optical sensor 515. Specifically, when the ambient light intensity is high, the display brightness of the touch display screen 505 is increased; when the ambient light intensity is low, the display brightness of the touch display screen 505 is turned down. In another embodiment, processor 501 may also dynamically adjust the shooting parameters of camera head assembly 506 based on the ambient light intensity collected by optical sensor 515.
A proximity sensor 516, also known as a distance sensor, is typically disposed on the front panel of the node 500. The proximity sensor 516 is used to gather the distance between the user and the front of the node 500. In one embodiment, when the proximity sensor 516 detects that the distance between the user and the front surface of the node 500 gradually decreases, the processor 501 controls the touch display screen 505 to switch from the bright screen state to the dark screen state; when the proximity sensor 516 detects that the distance between the user and the front surface of the node 500 becomes gradually larger, the processor 501 controls the touch display screen 505 to switch from the screen-rest state to the screen-on state.
That is, not only is an embodiment of the present invention provide a node including a processor and a memory for storing processor-executable instructions, where the processor is configured to execute the method in the embodiments shown in fig. 2 and 3, but also an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored in the storage medium, and the computer program can implement the load balancing method in the embodiments shown in fig. 2 and 3 when the computer program is executed by the processor.
Those skilled in the art will appreciate that the architecture shown in FIG. 5 does not constitute a limitation of node 500, and may include more or fewer components than shown, or combine certain components, or employ a different arrangement of components.
Fig. 6 is a schematic structural diagram of a node 600 according to an embodiment of the present invention, where the node 600 may be a management node, or may be any storage node in a plurality of storage nodes, and the node 600 may be a server, and the server may be a server in a background server cluster. Specifically, the method comprises the following steps:
node 600 includes a Central Processing Unit (CPU)601, a system memory 604 including a Random Access Memory (RAM)602 and a Read Only Memory (ROM)603, and a system bus 605 connecting system memory 604 and central processing unit 601. The node 600 also includes a basic input/output system (I/O system) 606, which facilitates the transfer of information between various devices within the computer, and a mass storage device 607, which stores an operating system 613, application programs 614, and other program modules 615.
The basic input/output system 606 includes a display 608 for displaying information and an input device 609 such as a mouse, keyboard, etc. for user input of information. Wherein a display 608 and an input device 609 are connected to the central processing unit 601 through an input output controller 610 connected to the system bus 605. The basic input/output system 606 may also include an input/output controller 610 for receiving and processing input from a number of other devices, such as a keyboard, mouse, or electronic stylus. Similarly, input/output controller 610 may also provide output to a display screen, a printer, or other type of output device.
The mass storage device 607 is connected to the central processing unit 601 through a mass storage controller (not shown) connected to the system bus 605. The mass storage device 607 and its associated computer-readable media provide non-volatile storage for the node 600. That is, mass storage device 607 may include a computer-readable medium (not shown), such as a hard disk or CD-ROM drive.
Without loss of generality, computer readable media may comprise computer storage media and communication media. Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes RAM, ROM, EPROM, EEPROM, flash memory or other solid state memory technology, CD-ROM, DVD, or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that computer storage media is not limited to the foregoing. The system memory 604 and mass storage device 607 described above may be collectively referred to as memory.
According to various embodiments of the invention, node 600 may also operate as a remote computer connected to a network through a network, such as the Internet. That is, the node 600 may be connected to the network 612 through the network interface unit 611 connected to the system bus 605, or may be connected to another type of network or a remote computer system (not shown) using the network interface unit 611.
The memory further includes one or more programs, and the one or more programs are stored in the memory and configured to be executed by the CPU. The one or more programs are used for implementing the load balancing method provided by the embodiment of the invention and shown in the above-mentioned fig. 2 or fig. 3.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.
Claims (25)
1. A load balancing method is applied to a management node in a video monitoring system, and is characterized by comprising the following steps:
determining the current performance scores of a plurality of storage nodes in the video monitoring system, wherein the performance scores are determined based on the scores of all performance indexes of the storage nodes and are used for describing the current running resource capacity of the storage nodes;
determining the distribution number of the video plans distributed to each storage node based on the number of the plurality of video plans to be issued and the performance scores of the plurality of storage nodes, wherein the video plans are used for describing the time information of video stream recorded by the camera device;
and distributing the video plans to the storage nodes according to the determined distribution number.
2. The method of claim 1, wherein determining the allocated number of video plans allocated to each storage node based on the number of video plans to be delivered and the performance scores of the storage nodes comprises:
dividing the performance score of each storage node by the total performance score of the plurality of storage nodes to obtain the score weight of each storage node, wherein the total performance score is the sum of the performance scores of the plurality of storage nodes;
and multiplying the number of the video plans by the scoring weight of each storage node to obtain the distribution number of the video plans distributed to each storage node.
3. The method of claim 1, wherein said assigning said plurality of video recordings plans to said plurality of storage nodes according to said determined number of assignments comprises:
acquiring the priorities of the video plans;
and distributing the video plans to the storage nodes according to the priority order of the video plans and the determined distribution number.
4. The method of claim 1 or 3, wherein said assigning the plurality of video recording plans to the plurality of storage nodes comprises:
for any video recording plan in the plurality of video recording plans, acquiring a historical execution track of the video recording plan, wherein the historical execution track is used for describing a storage node for executing any video recording plan history and detailed information of the execution;
determining storage nodes which do not fail to execute any video recording plan from the plurality of storage nodes based on the historical execution track;
and allocating any video recording plan to the failed storage node.
5. The method of claim 1, wherein before determining the allocated number of video recording plans to be allocated to each storage node based on the number of video recording plans to be delivered and the performance scores of the storage nodes, the method further comprises:
determining a plurality of video plans currently executed and not executed by at least one storage node with operation failure in the plurality of storage nodes as a plurality of video plans to be issued; and/or the presence of a gas in the gas,
and determining the plurality of video plans carried in the received and unprocessed video plan issuing request as a plurality of video plans to be issued.
6. The method of claim 1, wherein the method further comprises:
and deleting the video schedule carried in the received and unprocessed video schedule deletion request from the corresponding storage node.
7. The method of any of claims 1-6, wherein prior to determining the allocated number of video recording plans to allocate to each storage node based on the number of video recording plans to be delivered and the performance scores of the storage nodes, further comprising:
when detecting that any storage node in the plurality of storage nodes has an operation fault, executing the step of determining the distribution number of the video plans distributed to each storage node based on the number of the plurality of video plans to be issued and the performance scores of the plurality of storage nodes; or,
and executing the step of determining the distribution number of the video plans distributed to each storage node based on the number of the plurality of video plans to be issued and the performance scores of the plurality of storage nodes every other first preset time length.
8. The method of claim 1, wherein after determining a current performance score for a plurality of storage nodes in the video surveillance system, further comprising:
determining the total number of executing video plans currently being executed in the plurality of storage nodes;
determining a load state of each storage node in the plurality of storage nodes based on the total number of executions of the plurality of storage nodes and the performance scores of the plurality of storage nodes;
and when the storage nodes with the unbalanced load state exist in the plurality of storage nodes, redistributing the actual number of the video recording plans currently executed by the storage nodes in the unbalanced load state.
9. The method of claim 8, wherein determining the load status of each of the plurality of storage nodes based on the total number of executions of the plurality of storage nodes and the performance scores of the plurality of storage nodes comprises:
dividing the performance score of each storage node by the total performance score of the plurality of storage nodes to obtain the score weight of each storage node, wherein the total performance score is the sum of the performance scores of the plurality of storage nodes;
respectively multiplying the total number of the executed storage nodes by the scoring weight of each storage node to obtain the theoretical number of the video plan currently executed by each storage node;
and when the actual number of the video recording plans currently being executed is different from the theoretical number of the storage nodes, determining that the storage nodes with the load state being the unbalanced state exist in the plurality of storage nodes.
10. The method of claim 8 or 9, wherein said redistributing the actual number of video recording schedules currently being executed by storage nodes in said unbalanced state comprises:
determining the overload number or the underload number corresponding to the storage node A for any one of the storage nodes in the unbalanced state;
the number of the overloaded video programs refers to the number of the video programs currently being executed by any storage node, which is actually greater than the theoretical number of the video programs currently being executed by any storage node, and the number of the underloaded video programs refers to the number of the video programs currently being executed by any storage node, which is actually less than the theoretical number of the video programs currently being executed by any storage node;
and moving the video plans with the number of the video plans being the overload number out of the video plans currently executed by any storage node, or distributing the video plans with the number of the video plans being the underload number to any storage node based on the video plans moved out of other storage nodes in the unbalanced state.
11. The method of any of claims 1-10, wherein said determining a current performance score for a plurality of storage nodes in said video surveillance system comprises:
for any storage node in the plurality of storage nodes, determining the scores of the plurality of performance indexes in the any storage node based on the detail information of the plurality of performance indexes reported by the any storage node;
when the scores of the performance indexes in any storage node are higher than the preset scores, adding the scores of the performance indexes to obtain the current performance score of any storage node;
when the scores of the performance indexes in any storage node are not all higher than the preset score, determining the score of the performance index with the lowest score in the performance indexes as the current performance score of any storage node.
12. The method of any of claims 8-11, wherein prior to determining the total number of executions of the video recording plan currently being executed in the plurality of storage nodes, further comprising:
and executing the step of determining the total number of the currently executed video recording plans in the plurality of storage nodes every second preset time.
13. A load balancing device is applied to a management node in a video monitoring system, and is characterized by comprising:
the system comprises a first determination module, a second determination module and a third determination module, wherein the first determination module is used for determining the current performance scores of a plurality of storage nodes in the video monitoring system, and the performance scores are determined based on the scores of all performance indexes of the storage nodes and are used for describing the current running resource capacity of the storage nodes;
the second determining module is used for determining the distribution number of the video plans distributed to each storage node based on the number of the plurality of video plans to be issued and the performance scores of the plurality of storage nodes, wherein the video plans are used for describing the time information of the video stream recorded by the camera device;
and the distribution module is used for distributing the video plans to the storage nodes according to the determined distribution number.
14. The apparatus of claim 13, wherein the second determining module comprises:
the first calculation submodule is used for dividing the performance score of each storage node by the total performance score of the plurality of storage nodes to obtain the score weight of each storage node, and the total performance score is the sum of the performance scores of the plurality of storage nodes;
and the second calculation submodule is used for multiplying the number of the video plans by the scoring weight of each storage node to obtain the distribution number of the video plans distributed to each storage node.
15. The apparatus of claim 13, wherein the first distribution module comprises:
a first obtaining sub-module, configured to obtain priorities of the video schedules;
and the first distribution submodule is used for distributing the video plans to the storage nodes according to the priority order of the video plans and the determined distribution number.
16. The apparatus of claim 13 or 15, wherein the first distribution module comprises:
a second obtaining sub-module, configured to obtain, for any video recording plan in the plurality of video recording plans, a historical execution trajectory of the any video recording plan, where the historical execution trajectory is used to describe a storage node where the any video recording plan is executed and details of the execution;
a first determining submodule, configured to determine, based on the historical execution trajectory, a storage node that has not failed in executing any of the video recording plans from the plurality of storage nodes;
and the second distribution submodule is used for distributing any video plan to the storage nodes which do not fail.
17. The apparatus of claim 13, wherein the apparatus further comprises:
a third determining module, configured to determine, as multiple video plans to be delivered, multiple video plans that are currently executed and are not executed by at least one storage node that has an operation failure among the multiple storage nodes; and/or the presence of a gas in the gas,
and the fourth determining module is used for determining the plurality of video plans carried in the received and unprocessed video plan issuing request as the plurality of video plans to be issued.
18. The apparatus of claim 13, wherein the apparatus further comprises:
and the deleting module is used for deleting the video plan carried in the received and unprocessed video plan deleting request from the corresponding storage node.
19. The apparatus of any of claims 13-18, wherein the apparatus further comprises:
the first trigger module is used for executing the step of determining the distribution number of the video plans distributed to each storage node based on the number of the video plans to be issued and the performance scores of the storage nodes when the operation fault of any storage node in the storage nodes is detected; or,
and the second triggering module is used for executing the step of determining the distribution number of the video plans distributed to each storage node based on the number of the plurality of video plans to be issued and the performance scores of the plurality of storage nodes every other first preset time.
20. The apparatus of claim 13, wherein the apparatus further comprises:
a fifth determining module, configured to determine a total number of executing video recording plans currently being executed in the plurality of storage nodes;
a sixth determining module, configured to determine a load state of each storage node in the plurality of storage nodes based on the total number of executions of the plurality of storage nodes and the performance scores of the plurality of storage nodes;
and the second distributing module is used for redistributing the actual number of the video recording plans currently executed by the storage nodes in the unbalanced state when the storage nodes with the unbalanced load state exist in the plurality of storage nodes.
21. The apparatus of claim 20, wherein the sixth determining module comprises:
the third computing submodule is used for dividing the performance score of each storage node by the total performance score of the plurality of storage nodes to obtain the score weight of each storage node, wherein the total performance score is the sum of the performance scores of the plurality of storage nodes;
the fourth calculation submodule is used for respectively multiplying the total number of the executed storage nodes by the scoring weight of each storage node to obtain the theoretical number of the video plan currently executed by each storage node;
a second determining submodule, configured to determine that a storage node whose load state is the unbalanced state exists in the plurality of storage nodes when the actual number of the currently-executed video recording plans is different from the theoretical number of the storage nodes.
22. The apparatus of claim 20 or 21, wherein the second allocation module comprises:
a third determining submodule, configured to determine, for any one of the storage nodes in the unbalanced state, an overload number or an underload number corresponding to the storage node a;
the number of the overloaded video programs refers to the number of the video programs currently being executed by any storage node, which is actually greater than the theoretical number of the video programs currently being executed by any storage node, and the number of the underloaded video programs refers to the number of the video programs currently being executed by any storage node, which is actually less than the theoretical number of the video programs currently being executed by any storage node;
and the moving submodule is used for moving the video plans of which the number is the overload number out of the video plans currently executed by any storage node, or distributing the video plans of which the number is the overload number to any storage node based on the video plans moved out of other storage nodes in the unbalanced state.
23. The apparatus of any of claims 13-22, wherein the first determining module comprises:
a fourth determining submodule, configured to determine, for any storage node in the plurality of storage nodes, scores of the plurality of performance indicators in the any storage node based on detail information of the plurality of performance indicators reported by the any storage node;
the fifth calculation submodule is used for adding the scores of the performance indexes when the scores of the performance indexes in any storage node are higher than the preset score to obtain the current performance score of any storage node;
and a fifth determining submodule, configured to determine, when the scores of the multiple performance indicators in any one of the storage nodes are not all higher than the preset score, a score of a performance indicator with a lowest score among the multiple performance indicators as a current performance score of the any one of the storage nodes.
24. The apparatus of any of claims 20-23, wherein the apparatus further comprises:
and the third triggering module is used for executing the step of determining the total number of the currently executed video plans in the plurality of storage nodes every other second preset time length.
25. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 12.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810054177.8A CN110062199B (en) | 2018-01-19 | 2018-01-19 | Load balancing method and device and computer readable storage medium |
PCT/CN2019/072376 WO2019141247A1 (en) | 2018-01-19 | 2019-01-18 | Load balance method and apparatus, and computer-readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810054177.8A CN110062199B (en) | 2018-01-19 | 2018-01-19 | Load balancing method and device and computer readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110062199A true CN110062199A (en) | 2019-07-26 |
CN110062199B CN110062199B (en) | 2020-07-10 |
Family
ID=67301686
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810054177.8A Active CN110062199B (en) | 2018-01-19 | 2018-01-19 | Load balancing method and device and computer readable storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN110062199B (en) |
WO (1) | WO2019141247A1 (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111401170A (en) * | 2020-03-06 | 2020-07-10 | 西安奥卡云数据科技有限公司 | Face detection method and device |
CN111428266A (en) * | 2019-09-05 | 2020-07-17 | 广州知弘科技有限公司 | Storage node space capacity and security evaluation method based on big data |
CN111580755A (en) * | 2020-05-09 | 2020-08-25 | 杭州海康威视系统技术有限公司 | Distributed data processing system and distributed data processing method |
CN113225506A (en) * | 2020-01-21 | 2021-08-06 | 杭州海康威视数字技术股份有限公司 | Video data analysis method and device |
CN114298489A (en) * | 2021-12-07 | 2022-04-08 | 国久大数据股份有限公司 | Intelligent monitoring method and system for different catering kitchens and storage medium |
CN116684664A (en) * | 2023-06-21 | 2023-09-01 | 杭州瑞网广通信息技术有限公司 | Scheduling method of streaming media cluster |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101005514A (en) * | 2006-12-27 | 2007-07-25 | 北京航空航天大学 | Multiple server organizing method for network game |
GB0915712D0 (en) * | 2008-11-03 | 2009-10-07 | Bridgeworks Ltd | Data transfer |
CN103905530A (en) * | 2014-03-11 | 2014-07-02 | 浪潮集团山东通用软件有限公司 | High-performance global load balance distributed database data routing method |
CN104113735A (en) * | 2014-07-30 | 2014-10-22 | 武汉烽火众智数字技术有限责任公司 | Distributed video monitoring storing system and method thereof |
GB2508403B (en) * | 2012-11-30 | 2016-01-27 | Xyratex Tech Ltd | Data communication method and apparatus |
CN105450964A (en) * | 2014-09-30 | 2016-03-30 | 杭州海康威视系统技术有限公司 | Method, system and management node for carrying out cloud storage on picture recording data |
CN106506665A (en) * | 2016-11-18 | 2017-03-15 | 郑州云海信息技术有限公司 | A kind of load-balancing method of distributed video monitoring system and platform |
CN106790726A (en) * | 2017-03-30 | 2017-05-31 | 电子科技大学 | A kind of priority query's dynamic feedback of load equilibrium resource regulating method based on Docker cloud platforms |
JP2017139634A (en) * | 2016-02-04 | 2017-08-10 | 京セラ株式会社 | Communication device, communication control method and program |
CN107196869A (en) * | 2017-07-14 | 2017-09-22 | 北京知道创宇信息技术有限公司 | The adaptive load balancing method, apparatus and system of Intrusion Detection based on host actual loading |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101365119B (en) * | 2008-09-25 | 2013-02-13 | 北京中星微电子有限公司 | Video recording balance equalizing method used for network video monitoring system |
CN102333120B (en) * | 2011-09-29 | 2014-05-21 | 高新兴科技集团股份有限公司 | Flow storage system for load balance processing |
US9154735B2 (en) * | 2013-03-15 | 2015-10-06 | Blue Jeans Network | Provision of video conferencing with load balancing |
EP3057287A4 (en) * | 2013-10-11 | 2016-09-14 | Zte Corp | Node allocation method, device and system |
-
2018
- 2018-01-19 CN CN201810054177.8A patent/CN110062199B/en active Active
-
2019
- 2019-01-18 WO PCT/CN2019/072376 patent/WO2019141247A1/en active Application Filing
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101005514A (en) * | 2006-12-27 | 2007-07-25 | 北京航空航天大学 | Multiple server organizing method for network game |
GB0915712D0 (en) * | 2008-11-03 | 2009-10-07 | Bridgeworks Ltd | Data transfer |
GB2508403B (en) * | 2012-11-30 | 2016-01-27 | Xyratex Tech Ltd | Data communication method and apparatus |
CN103905530A (en) * | 2014-03-11 | 2014-07-02 | 浪潮集团山东通用软件有限公司 | High-performance global load balance distributed database data routing method |
CN104113735A (en) * | 2014-07-30 | 2014-10-22 | 武汉烽火众智数字技术有限责任公司 | Distributed video monitoring storing system and method thereof |
CN105450964A (en) * | 2014-09-30 | 2016-03-30 | 杭州海康威视系统技术有限公司 | Method, system and management node for carrying out cloud storage on picture recording data |
JP2017139634A (en) * | 2016-02-04 | 2017-08-10 | 京セラ株式会社 | Communication device, communication control method and program |
CN106506665A (en) * | 2016-11-18 | 2017-03-15 | 郑州云海信息技术有限公司 | A kind of load-balancing method of distributed video monitoring system and platform |
CN106790726A (en) * | 2017-03-30 | 2017-05-31 | 电子科技大学 | A kind of priority query's dynamic feedback of load equilibrium resource regulating method based on Docker cloud platforms |
CN107196869A (en) * | 2017-07-14 | 2017-09-22 | 北京知道创宇信息技术有限公司 | The adaptive load balancing method, apparatus and system of Intrusion Detection based on host actual loading |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111428266A (en) * | 2019-09-05 | 2020-07-17 | 广州知弘科技有限公司 | Storage node space capacity and security evaluation method based on big data |
CN113225506A (en) * | 2020-01-21 | 2021-08-06 | 杭州海康威视数字技术股份有限公司 | Video data analysis method and device |
CN113225506B (en) * | 2020-01-21 | 2022-09-30 | 杭州海康威视数字技术股份有限公司 | Video data analysis method and device |
CN111401170A (en) * | 2020-03-06 | 2020-07-10 | 西安奥卡云数据科技有限公司 | Face detection method and device |
CN111401170B (en) * | 2020-03-06 | 2023-06-06 | 西安奥卡云数据科技有限公司 | Face detection method and device |
CN111580755A (en) * | 2020-05-09 | 2020-08-25 | 杭州海康威视系统技术有限公司 | Distributed data processing system and distributed data processing method |
CN111580755B (en) * | 2020-05-09 | 2022-07-05 | 杭州海康威视系统技术有限公司 | Distributed data processing system and distributed data processing method |
CN114298489A (en) * | 2021-12-07 | 2022-04-08 | 国久大数据股份有限公司 | Intelligent monitoring method and system for different catering kitchens and storage medium |
CN114298489B (en) * | 2021-12-07 | 2024-09-13 | 国久大数据股份有限公司 | Intelligent monitoring method, system and storage medium for different catering post-kitchen |
CN116684664A (en) * | 2023-06-21 | 2023-09-01 | 杭州瑞网广通信息技术有限公司 | Scheduling method of streaming media cluster |
CN116684664B (en) * | 2023-06-21 | 2024-07-05 | 杭州瑞网广通信息技术有限公司 | Scheduling method of streaming media cluster |
Also Published As
Publication number | Publication date |
---|---|
WO2019141247A1 (en) | 2019-07-25 |
CN110062199B (en) | 2020-07-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110062199B (en) | Load balancing method and device and computer readable storage medium | |
CN110134521B (en) | Resource allocation method, device, resource manager and storage medium | |
CN111090687B (en) | Data processing method, device and system and computer readable storage medium | |
CN110209488B (en) | Task execution method, device, equipment, system and storage medium | |
WO2020001564A1 (en) | Method, apparatus, and system for processing tasks | |
CN108762881B (en) | Interface drawing method and device, terminal and storage medium | |
CN109861966B (en) | Method, device, terminal and storage medium for processing state event | |
CN112836838B (en) | Reservation request processing method, device, equipment and storage medium | |
CN110119305B (en) | Task execution method and device, computer equipment and storage medium | |
CN111061550A (en) | Task processing method, device, equipment and storage medium | |
CN114339294B (en) | Method, device and equipment for confirming network jitter and storage medium | |
WO2020088542A1 (en) | Data management method, apparatus and system, and server, terminal and storage medium | |
CN113144622A (en) | Node switching method, device, equipment and computer readable storage medium | |
CN111580946A (en) | Port scanning method, device, equipment and storage medium | |
CN113069760A (en) | Resource allocation method, device, computing equipment and computer readable storage medium | |
CN110968815A (en) | Page refreshing method, device, terminal and storage medium | |
CN111813322A (en) | Method, device and equipment for creating storage pool and storage medium | |
CN110381155B (en) | Task management method, device, storage medium and terminal | |
CN111986227A (en) | Trajectory generation method and apparatus, computer device and storage medium | |
CN111682983A (en) | Interface display method and device, terminal and server | |
CN111131272A (en) | Scheduling method, device and system of stream server, computing equipment and storage medium | |
CN112995587B (en) | Electronic equipment monitoring method, system, computer equipment and storage medium | |
CN111080033B (en) | Method, device, computer equipment and storage medium for predicting service capacity | |
CN113949678A (en) | Flow control method and device, electronic equipment and computer readable storage medium | |
CN110365545B (en) | Distribution rate processing method, device, server and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |