Security monitoring system based on master-slave controller mode
Through the security monitoring system in master-slave controller mode, video processing tasks are dynamically assigned, and a single point of failure risk and expansion problem in single server mode is solved, achieving efficient and stable operation of the system and computing power coordination.
Patent Information
- Application Number
- CN202510746093.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-05
- Publication Date
- 2025-08-12
AI Technical Summary
The existing security monitoring system adopts a single server mode, which is prone to the risk of single point failure, it is difficult to expand the server, and the computing power utilization rate is low.
The security monitoring system based on the master-slave controller mode is adopted, and the master controller is elected through the election mechanism. Each slave controller processes video processing tasks and calculates the computing power load. The master controller dynamically allocates tasks to achieve task migration between overload and low-load slave controllers to ensure the stability and efficient operation of the system.
Reduce response delay, avoid system crashes, realize computing power coordination between slave controllers, and improve overall system performance and stability.
Smart Images

Figure CN120475032A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of security monitoring technology, and in particular to a security monitoring system based on a master-slave controller mode. Background Art
[0002] Most existing security monitoring systems use a single-server model, where a single algorithm server is responsible for back-end algorithm logic processing and status monitoring of all video surveillance devices. The following problems are prone to occur when using a single-server model:
[0003] 1. Single point of failure risk: The computing server is the core node of the backend algorithm. Once it goes offline or overloaded, the entire system will be paralyzed.
[0004] 2. Difficulty in server expansion: When the computing server reaches its maximum load, the only option is to increase the number of servers in hardware. However, due to the lack of cluster management between servers, data cannot be shared between the added servers and the existing servers.
[0005] 3. Low computing power utilization: The computing power server is unable to expand or reduce computing power according to customer site needs to fully utilize computing power resources. Summary of the Invention
[0006] The purpose of this application is to solve at least one of the above-mentioned technical defects, especially the technical defects that the security monitoring system in the existing technology adopts a single-server mode, which is prone to single point failure risks, is difficult to expand the server, and has low computing power utilization.
[0007] The present application provides a security monitoring system based on a master-slave controller mode, the system comprising a master controller pre-elected through an election mechanism, and a plurality of slave controllers communicatively connected to the master controller;
[0008] Each slave controller receives and processes video processing tasks sent by the video surveillance device bound to it, and regularly calculates the current computing load based on the number of video frames that the local controller can process and output per second, the number of objects that need to be processed in each frame, and the number of tasks waiting to be processed in the task queue, and sends the current computing load to the master controller;
[0009] The master controller determines an overloaded slave controller and a low-loaded slave controller according to the current computing load sent by each slave controller, and allocates part of the video processing tasks in the overloaded slave controller to the low-loaded slave controller.
[0010] Optionally, the system further comprises:
[0011] The master controller periodically sends heartbeat signals to each slave controller, and when it is determined according to the heartbeat signals that one or more slave controllers are offline, all video processing tasks in the offline slave controllers are allocated to other online slave controllers.
[0012] Optionally, the process of the master controller allocating all video processing tasks in the offline slave controller to other online slave controllers includes:
[0013] The master controller selects a slave controller whose current computing load is lower than a preset maximum load threshold from other online slave controllers as a designated slave controller, and assigns all video processing tasks in the offline slave controllers to the designated slave controller.
[0014] Optionally, the system further comprises:
[0015] When one of the slave controllers detects that the master controller is abnormal, each slave controller re-elects a new master controller through the election mechanism.
[0016] Optionally, the process of each slave controller re-electing a new master controller through the election mechanism includes:
[0017] The Bully algorithm is used between the slave controllers to select the slave controller with the largest ID as the master controller among all the living slave controllers.
[0018] Optionally, each slave controller periodically calculates the current computing load based on the number of video frames that the local controller can process and output per second, the number of targets that need to be processed in each frame, and the number of tasks waiting to be processed in the task queue, including:
[0019] For each slave controller:
[0020] Regularly determine the number of video frames that the machine can process and output per second, the number of targets that need to be processed in each frame, and the number of tasks waiting to be processed in the task queue;
[0021] Normalize the number of video frames that the machine can process and output per second, the number of objects that need to be processed in each frame, and the number of tasks waiting to be processed in the task queue;
[0022] The current computing load of the slave controller is obtained by taking the weighted sum of the normalized number of video frames that the local machine can process and output per second, the number of targets that need to be processed in each frame, and the number of tasks waiting to be processed in the task queue.
[0023] Optionally, the process of the master controller determining an overloaded slave controller and an underloaded slave controller according to current computing loads sent by each slave controller includes:
[0024] The master controller compares the current computing power load sent by each slave controller with the preset maximum load threshold, and regards the slave controller whose current computing power load is lower than the preset maximum load threshold as a low-load slave controller, and regards the slave controller whose current computing power load is not lower than the preset maximum load threshold as an overload slave controller.
[0025] Optionally, the process of the master controller allocating part of the video processing tasks in the overloaded slave controller to the underloaded slave controller includes:
[0026] The main controller determines the part of the video processing tasks that need to be migrated from the overloaded slave controller and the target slave controller that receives the video processing tasks from the low-loaded slave controller according to a preset task allocation strategy, and migrates the part of the video processing tasks that need to be migrated from the overloaded slave controller to the target slave controller.
[0027] Optionally, the process of the master controller determining, according to a preset task allocation strategy, a portion of the video processing tasks that need to be migrated from the overloaded slave controller and a target slave controller from which the underloaded slave controller receives the video processing tasks includes:
[0028] The master controller determines, based on the priority of each task in the overloaded slave controller, the computational complexity of each task, the dependency of each task, or the load reduction target, a portion of the video processing tasks that need to be migrated from the overloaded slave controller;
[0029] The master controller determines a target slave controller that receives a video processing task from at least one of the low-load slave controllers according to a load status, network delay and bandwidth, or processing capability of at least one of the low-load slave controllers.
[0030] Optionally, the master controller migrates part of the video processing tasks that need to be migrated from the overloaded slave controller to the target slave controller, including:
[0031] The main controller sends the IP address, channel ID and Token of the target slave controller to the overloaded slave controller, and sends the IP address and channel ID of the overloaded slave controller to the target slave controller, so that the overloaded slave controller transparently transmits part of the video processing tasks that need to be migrated to the target slave controller, and the target slave controller synchronizes the processing results to the overloaded slave controller and the main controller.
[0032] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0033] The present application provides a security monitoring system based on a master-slave controller mode, which includes a master controller elected in advance through an election mechanism, and multiple slave controllers communicatively connected to the master controller; each slave controller receives and processes video processing tasks sent by the video surveillance device bound to it, and calculates the current computing power load based on the number of video frames that the local machine can process and output per second, the number of targets that need to be processed in each frame image, and the number of tasks waiting to be processed in the task queue, and sends the current computing power load to the master controller, so that the master controller can determine the overloaded slave controller and the underloaded slave controller based on the current computing power load sent by each slave controller, and allocate part of the video processing tasks in the overloaded slave controller to the underloaded slave controller, which can not only reduce response delay, but also avoid system crash, and realize computing power coordination between slave controllers, thereby effectively improving the overall performance of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0035] Figure 1 A system architecture diagram of the security monitoring system provided in an embodiment of the present application;
[0036] Figure 2 A schematic diagram of an offline detection process from a controller provided in an embodiment of the present application;
[0037] Figure 3 A schematic diagram of the process of migrating part of the video processing tasks in the overloaded controller to the target slave controller provided in an embodiment of the present application. DETAILED DESCRIPTION
[0038] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0039] In one embodiment, Figure 1 As shown, Figure 1A system architecture diagram of a security monitoring system provided in an embodiment of the present application; the present application provides a security monitoring system based on a master-slave controller mode, the system may include a master controller pre-elected through an election mechanism, and multiple slave controllers communicatively connected to the master controller.
[0040] Each slave controller receives and processes the video processing tasks sent by the video surveillance device bound to it, and regularly calculates the current computing load based on the number of video frames that the local machine can process and output per second, the number of targets that need to be processed in each frame image, and the number of tasks waiting to be processed in the task queue, and sends the current computing load to the master controller.
[0041] The master controller determines an overloaded slave controller and a low-loaded slave controller according to the current computing load sent by each slave controller, and allocates part of the video processing tasks in the overloaded slave controller to the low-loaded slave controller.
[0042] In this embodiment, Figure 1 As shown, the security monitoring system of the present application may include a master controller and multiple slave controllers in communication with the master controller, and each slave controller may be bound to one or more video monitoring devices, such as Figure 1 The IPC (Internet Protocol Camera) device in the network is a digital, networked video surveillance device that can digitize images and transmit them through IP networks (such as local area networks and the Internet).
[0043] Among them, the master controller of the present application is obtained in advance after election through an election mechanism. If it is detected that the current master controller has an abnormality or is disconnected from the network, the system can automatically elect a new master controller through the election mechanism, thereby ensuring the normal execution of task scheduling and business functions. The election mechanism of the present application can be based on a variety of factors, such as processing performance, stability, connection speed, etc. The present application can comprehensively consider these factors during the election process and communicate with other slave controllers to determine which slave controller is most suitable for the role of the master controller. Once the election is completed, the device selected as the master controller will assume the task of managing and coordinating the entire security monitoring system, while the other slave controllers operate according to the instructions of the master controller. This election mechanism can ensure the stability and efficiency of the security monitoring system. Even if a slave controller fails or its performance degrades, a new master controller can be quickly elected to replace it, thereby ensuring the continuous operation of the system.
[0044] Each slave controller in this application can receive and process video processing tasks sent by the video surveillance device bound to it, and calculate the current computing power load based on the number of video frames that the local machine can process and output per second, the number of targets that need to be processed in each frame image, and the number of tasks waiting to be processed in the task queue, and then send the current computing power load to the main controller so that the main controller can regularly maintain the global load status table and dynamically allocate tasks to each slave controller based on the global load status table.
[0045] After the master controller receives the current computing load sent periodically by each slave controller, it can first determine the overloaded slave controller and the low-loaded slave controller based on the current computing load of each slave controller, and then allocate part of the video processing tasks in the overloaded slave controller to the low-loaded slave controller. Furthermore, during the task allocation process, the master controller can comprehensively consider the network connection status between the slave controllers to ensure smooth and efficient task migration. Specifically, when determining the low-loaded slave controller corresponding to the overloaded slave controller, the master controller can give priority to the low-loaded slave controller with a shorter network distance and better network condition to the overloaded slave controller. This can reduce the data transmission delay and packet loss risk, and increase the rate of task migration.
[0046] Furthermore, the time interval for each slave controller to periodically report the current computing load in this application can be considered from multiple aspects. For example, this application can consider the real-time requirements of the system. If the system has high real-time requirements for computing power allocation, the reporting interval can be shortened so that the master controller can obtain the computing power load of the slave controller in a timely manner and make corresponding adjustments. This application can also consider network bandwidth and load. Since frequent reporting will increase the network bandwidth usage and may cause additional load on the network, therefore, under the premise of ensuring system real-time, this application can set the reporting interval as reasonably as possible to reduce the network burden. This application can also consider the processing capacity of the slave controller. Since reporting the computing power load requires the slave controller to perform certain calculations and processing, if the reporting interval is too short, it may increase the processing burden of the slave controller. Taking into account the above multiple considerations, this application can set the reporting interval of each slave controller to a few seconds to tens of seconds, depending on the system requirements and network conditions. For example, in a system with high real-time requirements, it can be set to 5 seconds or 10 seconds; in a system with relatively low real-time requirements, it can be set to 30 seconds or longer.
[0047] Furthermore, to enhance system stability and reliability, the security monitoring system of this application also features dynamic fault response and load balancing. For example, if the master controller detects a failure or performance degradation in a slave controller, it can immediately activate a fault response mechanism to transfer tasks from that slave controller to another, functioning slave controller, thereby ensuring continuous system operation.
[0048] In the above embodiment, the system includes a master controller that is pre-elected through an election mechanism, and multiple slave controllers that are communicatively connected to the master controller; each slave controller receives and processes video processing tasks sent by the video surveillance device bound to it, and calculates the current computing power load based on the number of video frames that the local machine can process and output per second, the number of targets that need to be processed in each frame image, and the number of tasks waiting to be processed in the task queue, and sends the current computing power load to the master controller. In this way, the master controller can determine the overloaded slave controller and the underloaded slave controller based on the current computing power load sent by each slave controller, and allocate part of the video processing tasks in the overloaded slave controller to the underloaded slave controller. This can not only reduce response delays, but also avoid system crashes, and achieve computing power coordination between slave controllers, thereby effectively improving the overall performance of the system.
[0049] In one embodiment, Figure 2 As shown, Figure 2 A schematic diagram of an offline detection process from a controller provided in an embodiment of the present application; the system may further include:
[0050] The master controller periodically sends heartbeat signals to each slave controller, and when it is determined according to the heartbeat signals that one or more slave controllers are offline, all video processing tasks in the offline slave controllers are allocated to other online slave controllers.
[0051] In this embodiment, the master controller is not only responsible for dynamic task allocation, but also bears the responsibility of system health monitoring. For example, in order to ensure the online status and normal operation of each slave controller, the master controller of this application can periodically send heartbeat signals to each slave controller. When the master controller does not receive a response from a slave controller within a certain period of time, it will be determined that the heartbeat signal is lost and the slave controller is offline. Alternatively, when the master controller does not receive a heartbeat signal from a slave controller for multiple consecutive times, it can also be determined that the slave controller is offline. At this time, the master controller can immediately reallocate all its tasks to other online slave controllers.
[0052] Specifically, in this application, once the master controller confirms that a slave controller is offline, the master controller can quickly start the emergency processing process. For example, the master controller can first identify all video processing tasks that the offline slave controller is currently responsible for. These tasks may involve monitoring of critical areas, so timely reallocation is crucial. The master controller can then intelligently select the most suitable slave controller to take over these tasks based on the computing load and status of the current online slave controller. During this process, the master controller will comprehensively consider factors such as the processing power of the online slave controller, network latency, and task urgency to ensure that tasks can be transferred quickly and efficiently, thereby minimizing the impact of the slave controller being offline on the overall system performance.
[0053] Furthermore, the present application can also set the time interval for the master controller to detect the heartbeat signal of the slave controller. The setting process can be considered from the aspects of system availability requirements, network delay and stability. The heartbeat detection interval of the present application can be set to a few seconds to tens of seconds, depending on the system's requirements for availability and network conditions. For example, in a system that requires high availability, it can be set to 5 seconds or 10 seconds; in a system where the network conditions are relatively stable and the availability requirements are not particularly high, it can be set to 30 seconds or longer. At the same time, the present application can also set a timeout period. If the heartbeat signal of the slave controller is not received within the timeout period, the slave controller is considered to have failed.
[0054] In this way, the security monitoring system of this application not only achieves flexible scheduling and efficient utilization of computing resources, but also significantly enhances the stability and reliability of the system. Even in the face of emergencies such as slave controller failure, the system can respond quickly, thereby ensuring the uninterrupted execution of monitoring tasks and providing a solid guarantee for security prevention.
[0055] In one embodiment, the process of the master controller allocating all video processing tasks in the offline slave controller to other online slave controllers may include:
[0056] The master controller selects a slave controller whose current computing load is lower than a preset maximum load threshold from other online slave controllers as a designated slave controller, and assigns all video processing tasks in the offline slave controllers to the designated slave controller.
[0057] In this embodiment, when the master controller detects that a slave controller is offline, all video processing tasks in the offline slave controller can be assigned to other online slave controllers. This ensures that the tasks can be transferred quickly and efficiently, thereby minimizing the impact of the slave controller being offline on the overall system performance.
[0058] Specifically, in this application, when the master controller reallocates tasks of offline slave controllers, it can first evaluate the current computing load of other online slave controllers. In order to ensure that the tasks can be taken over smoothly and efficiently, the master controller can select a slave controller whose current computing load is lower than the preset maximum load threshold as the designated slave controller. This preset maximum load threshold is pre-set based on the overall performance of the system and the processing power of each slave controller. It aims to ensure that the designated slave controller can maintain a stable operating state after taking over the new task, avoiding performance degradation or task processing delays caused by excessive load. After determining the designated slave controller, the master controller can assign all video processing tasks in the offline slave controller to the designated slave controller, thereby achieving rapid task transfer and continuous and stable operation of the system.
[0059] In one embodiment, the system may further include:
[0060] When one of the slave controllers detects that the master controller is abnormal, each slave controller re-elects a new master controller through the election mechanism.
[0061] In this embodiment, to ensure the stability and efficient operation of the security monitoring system, this application also designs a master controller exception handling mechanism. When one of the slave controllers detects an anomaly in the master controller, such as a master controller downtime, network interruption, hardware damage, or other conditions that render it inaccessible for an extended period of time, or severe performance degradation, each slave controller can quickly initiate an election mechanism to re-elect a new master controller to replace the original master controller.
[0062] During the master reelection process, the slave controllers communicate and negotiate with each other based on pre-defined election rules and algorithms, taking into account factors such as processing performance, stability, and connection speed of candidate slaves. The selected slave controller immediately assumes management and coordination of the entire security monitoring system, while the other slave controllers operate according to the instructions of the new master controller.
[0063] Furthermore, the present application can also set a time interval for the slave controller to detect whether the master controller is abnormal. This allows the slave controller to promptly detect abnormalities in the master controller and take appropriate measures (such as switching to a backup master controller or re-electing a master controller), thereby ensuring system stability and reliability.
[0064] In addition, considering that detecting whether the main controller is abnormal may require a certain amount of computing and communication overhead. Therefore, when setting the detection interval, a balance can be struck between detection accuracy and system overhead. Specifically, the detection interval of this application can be set to be similar to or slightly longer than the time interval for reporting computing power load, for example, ranging from 10 seconds to 1 minute. This can ensure that main controller anomalies are detected in a timely manner while reducing unnecessary detection overhead.
[0065] Through this master controller exception handling mechanism, the security monitoring system of the present application can quickly elect a new master controller to replace it if the master controller fails or its performance degrades, thereby ensuring the continuous operation of the system and the normal execution of task scheduling. This greatly improves the stability and reliability of the system and provides a more solid guarantee for security prevention.
[0066] In one embodiment, the process of each slave controller re-electing a new master controller through the election mechanism may include:
[0067] The Bully algorithm is used between the slave controllers to select the slave controller with the largest ID as the master controller among all the living slave controllers.
[0068] In this embodiment, during the re-election of the master controller, the application can employ the Bully algorithm to ensure efficiency and fairness. The Bully algorithm is a leader election algorithm in distributed systems. It selects the node with the largest ID based on its unique identifier (ID). In the security monitoring system of this application, each slave controller is a node participating in the election, and they communicate with each other to execute the Bully algorithm.
[0069] Specifically, when a slave controller detects a master failure, it broadcasts an election request to all other slave controllers. Each slave controller that receives the election request checks whether its ID is greater than the requester's ID. If so, it forwards the request to slave controllers with smaller IDs. If not, it ignores the request. This process continues until a slave controller with the highest ID is found and elected as the new master.
[0070] The slave controller selected as the master controller immediately assumes management and coordination of the entire security monitoring system, including receiving and processing computing load information reported by each slave controller and dynamically allocating video processing tasks. The other slave controllers then operate according to the instructions of the new master controller to ensure the continued stable operation of the system.
[0071] Furthermore, to ensure the smooth progress of the election process, this application also incorporates several additional mechanisms. For example, to prevent network congestion and message loss during the election process, this application also incorporates a message confirmation and retransmission mechanism. Specifically, after a slave controller sends an election request or response, it waits for a period of time to receive a confirmation message from the other party. If no confirmation message is received within the specified time, the request or response is resent until a confirmation message is received.
[0072] By utilizing this Bully algorithm and the additional election mechanism, the security monitoring system of this application can quickly and fairly elect a new master controller to replace it if the master controller fails or its performance degrades, thereby ensuring system stability and efficient operation. This significantly improves system reliability and security, providing a more robust safeguard for security.
[0073] In one embodiment, the process of each slave controller periodically calculating the current computing load based on the number of video frames that the slave controller can process and output per second, the number of targets that need to be processed in each frame, and the number of tasks waiting to be processed in the task queue may include:
[0074] For each slave controller:
[0075] Regularly determine the number of video frames that the machine can process and output per second, the number of targets that need to be processed in each frame, and the number of tasks waiting to be processed in the task queue.
[0076] Normalize the number of video frames that the machine can process and output per second, the number of targets that need to be processed in each frame, and the number of tasks waiting to be processed in the task queue.
[0077] The current computing load of the slave controller is obtained by taking the weighted sum of the normalized number of video frames that the local machine can process and output per second, the number of targets that need to be processed in each frame, and the number of tasks waiting to be processed in the task queue.
[0078] In this embodiment, when each slave controller periodically reports the current computing load, it can periodically obtain the number of video frames that the local machine can process and output per second, the number of targets that need to be processed in each frame image, and the number of tasks waiting to be processed in the task queue. In this way, the current computing load can be calculated regularly and the calculation results can be reported to the main controller.
[0079] Specifically, this application can express the number of video frames that the machine can process and output per second as FPS, the number of targets that need to be processed in each frame (such as pedestrians, vehicles, objects, etc.) as TPF, and the number of tasks waiting to be processed in the task queue as QWC. Among them, FPS = number of frames successfully processed / time interval (seconds), TPF = total number of targets detected in the current frame / current number of frames, and QWC can directly count the current length of the task queue, and the number of waiting tasks is the same. Furthermore, since FPS, TPF and QWC have different dimensions and numerical ranges, they need to be normalized in order to unify the calculation load. The specific normalization process is as follows:
[0080] 1. FPS normalization
[0081] Goal: Map FPS to the interval [0, 1], where 1 represents maximum processing power.
[0082] method: , The theoretical maximum processing frame rate of the slave controller (e.g. 60 FPS).
[0083] 2. TPF normalization
[0084] Objective: Map TPF to the interval [0, 1], where 1 indicates that the number of targets per frame reaches the maximum value.
[0085] method: , The maximum number of targets that the slave controller can handle per frame (e.g. 100).
[0086] 3. QWC normalization
[0087] Goal: Map QWC to the interval [0, 1], where 1 indicates the queue is full (reaches the maximum number of waits).
[0088] method: , The maximum capacity of the task queue (such as 100).
[0089] Next, the present application can perform weighted summation of the normalized FPS, TPF, and QWC to obtain the current computing power load (Load) of the slave controller. During this process, the present application can first assign weights to the normalized FPS, TPF, and QWC. Among them, the FPS weight (WFPS) reflects the impact of processing speed on the load, the TPF weight (WTPF) reflects the impact of single-frame task complexity on the load, and the QWC weight (WQWC) reflects the impact of task backlog on the load. The present application calculates the current computing power load of the slave controller through the normalized FPS, TPF, and QWC and their respective weights, and sends it to the master controller so that the master controller can dynamically allocate tasks according to the current computing power load of each slave controller.
[0090] To ensure the accuracy and real-time nature of computing load assessment, the present application can also set a time interval for the slave controller to periodically calculate computing load. The setting of this time interval can comprehensively consider factors such as the system's real-time requirements, the frequency of task changes, and the consumption of computing resources. Through this flexible time interval setting, the security monitoring system of the present application can achieve accurate monitoring and dynamic adjustment of the computing load of each slave controller, thereby ensuring efficient operation and stable performance of the system.
[0091] At the same time, in order to further improve the system's response speed to changes in computing power load, this application can also introduce a dynamic adjustment mechanism. Specifically, when a slave controller detects a significant change in its own computing power load, it can immediately trigger the process of recalculating the current computing power load and report the latest calculation results to the master controller. In this way, the master controller can obtain the latest computing power load status of each slave controller in a timely manner, thereby more accurately performing task allocation and computing power scheduling.
[0092] In addition, considering that the processing capabilities of different slave controllers may vary in actual applications, this application can also set different reporting thresholds based on the actual performance of the slave controllers. For example, for slave controllers with stronger processing capabilities, a higher reporting threshold can be set to reduce the number of unnecessary reports; while for slave controllers with weaker processing capabilities, a lower reporting threshold can be set to ensure that the system can obtain changes in its computing load in a timely manner.
[0093] Through this comprehensive computing load reporting and dynamic adjustment mechanism, the security monitoring system of this application can achieve precise management and efficient utilization of the computing resources of each slave controller. This not only improves the overall performance of the system, but also enhances the system's stability and reliability, providing a more solid guarantee for security prevention.
[0094] In one embodiment, the process of the master controller determining an overloaded slave controller and an underloaded slave controller based on the current computing load sent by each slave controller may include:
[0095] The master controller compares the current computing power load sent by each slave controller with the preset maximum load threshold, and regards the slave controller whose current computing power load is lower than the preset maximum load threshold as a low-load slave controller, and regards the slave controller whose current computing power load is not lower than the preset maximum load threshold as an overload slave controller.
[0096] In this embodiment, the master controller can use a preset maximum load threshold as a basis for determining whether a slave controller is overloaded or underloaded. This threshold is pre-set based on the overall system performance and the processing capabilities of each slave controller. It aims to ensure stable system operation under high load conditions while avoiding performance bottlenecks caused by excessive concentration of tasks on certain slave controllers.
[0097] By comparing the current computing load reported by each slave controller with the preset maximum load threshold, the master controller of this application can quickly identify which slave controllers are in an overloaded state and which slave controllers have sufficient remaining processing capacity. For overloaded slave controllers, the master controller can take corresponding measures, such as reducing the number of tasks assigned to it, or guiding it to offload some tasks to low-load slave controllers. For low-load slave controllers, the master controller can consider assigning more tasks to them to make full use of system resources and improve overall processing efficiency. This dynamic task allocation mechanism based on computing load enables the security monitoring system of this application to flexibly adjust the task distribution according to actual conditions, thereby ensuring the continuous efficient operation and stable performance of the system.
[0098] In one embodiment, the process of the master controller allocating part of the video processing tasks in the overloaded slave controller to the underloaded slave controller may include:
[0099] The main controller determines the part of the video processing tasks that need to be migrated from the overloaded slave controller and the target slave controller that receives the video processing tasks from the low-loaded slave controller according to a preset task allocation strategy, and migrates the part of the video processing tasks that need to be migrated from the overloaded slave controller to the target slave controller.
[0100] In this embodiment, the master controller can follow a preset task allocation strategy when dynamically allocating tasks. This strategy comprehensively considers various factors, such as the task type, urgency, and processing complexity, as well as the processing capabilities and current load status of the slave controllers. Through this strategy, the master controller can ensure that tasks are appropriately allocated to the most suitable slave controllers, thereby achieving optimal resource allocation.
[0101] Specifically, after the master controller identifies overloaded and underloaded slave controllers, it analyzes the tasks currently being executed by the overloaded slave controllers and determines which tasks can be migrated, along with their priority, based on their urgency and complexity. The master controller also considers the processing capacity and current load status of underloaded slave controllers to determine which slave controllers should receive migration tasks.
[0102] Once the task to be migrated and the target slave controller are determined, the master controller triggers the task migration process. This process involves sending a task migration command to the overloaded slave controller and a task acceptance command to the target slave controller. Upon receiving the command, the overloaded slave controller packages the specified task data and sends it to the target slave controller. Upon receiving the task data, the target slave controller unpacks it, loads the task, and then begins executing the new task.
[0103] In this way, the security monitoring system of the present application can achieve dynamic task allocation and load balancing while ensuring system stability and efficient operation. This not only improves the overall performance of the system, but also enhances the system's flexibility and scalability, providing more comprehensive and reliable security protection.
[0104] In one embodiment, the process of the master controller determining, according to a preset task allocation strategy, a portion of video processing tasks that need to be migrated from the overloaded slave controller and a target slave controller from which the underloaded slave controller receives video processing tasks may include:
[0105] The master controller determines part of the video processing tasks that need to be migrated in the overloaded slave controller according to the priority of each task in the overloaded slave controller, the computational complexity of each task, the dependency of each task, or the load reduction target.
[0106] The master controller determines a target slave controller that receives a video processing task from at least one of the low-load slave controllers according to a load status, network delay and bandwidth, or processing capability of at least one of the low-load slave controllers.
[0107] In this embodiment, the main controller can comprehensively consider multiple factors when determining the part of the video processing tasks that need to be migrated. For example, for tasks in the overloaded slave controller, the main controller can sort them according to their priority. Tasks with high priority are usually more urgent or more important, so the main controller can consider retaining these tasks and migrating tasks with lower priority to ensure that the key functions of the system are not affected. At the same time, the computational complexity and dependencies of the tasks are also factors that the main controller needs to consider. Tasks with high computational complexity will consume more computing resources, and dependencies determine the execution order between tasks. By comprehensively considering these factors, the main controller can select the most suitable tasks for migration to achieve load balancing and resource optimization.
[0108] In a specific implementation, the application may determine the portion of video processing tasks that need to be migrated by considering any of the following factors:
[0109] 1. Task Priority
[0110] Purpose: To ensure that high-priority tasks are processed first.
[0111] Method: First assign priorities to tasks (such as high, medium, and low), and then push low-priority tasks first.
[0112] 2. Task complexity
[0113] Purpose: Ensures that the target slave controller is able to handle the assigned tasks.
[0114] Method: First estimate the computational complexity of the task (such as the number of targets, resolution), and then prioritize tasks with lower complexity.
[0115] 3. Task dependencies
[0116] Purpose: To avoid processing delays caused by task dependencies.
[0117] Method: Prioritize pushing independent tasks and avoid pushing tasks that require subsequent processing by the overload controller (such as tasks that require the overload controller to aggregate results).
[0118] 4. Reduce the load target from the controller
[0119] Purpose: To ensure that the load on the overload controller drops below the maximum load.
[0120] Method: Calculate the amount of tasks that need to be migrated based on the current load and maximum load of the overload controller. The specific formula is as follows:
[0121] Tasks_to_Migrate=Total_TasksA×[(Current_LoadA−Max_LoadA) / Current_LoadA]
[0122] Where Total_TasksA is the total number of tasks of overload controller A, Current_LoadA is the current load of overload controller A, and Max_LoadA is the maximum load of overload controller A.
[0123] When this application determines which video processing tasks need to be migrated based on the load reduction goal of the slave controller, the master controller gradually migrates the tasks and monitors the load changes of the overloaded controller in real time. If the load of the overloaded server remains above the threshold after migration, the migration of the task continues; if it is below the threshold, the migration is stopped.
[0124] Furthermore, when determining the target slave controller, the master controller of this application will evaluate the load status, network latency and bandwidth, and processing power of the low-load slave controller. The load status reflects the current workload of the slave controller, while network latency and bandwidth determine the efficiency and feasibility of task migration. The processing power determines whether the slave controller is capable of handling the new task. By comprehensively considering these factors, the master controller can select the slave controller that is most suitable to receive the migration task, ensuring that the task can be smoothly migrated and effectively executed.
[0125] In a specific implementation, when there are multiple slave controllers whose loads are all lower than a preset maximum load threshold, the master controller can select the optimal slave controller through comprehensive evaluation. The specific strategy is as follows:
[0126] 1. Load balancing priority
[0127] Purpose: Select the slave controller with the lowest current load to minimize the load pressure on the target slave controller.
[0128] Method: A. The master controller maintains a load status table to record the current load of all slave controllers (such as status%); B. Traverse the load status table and select the slave controller with the lowest load.
[0129] 2. Comprehensively consider network latency and bandwidth
[0130] Purpose: To reduce network overhead and latency during task migration.
[0131] Method: Select based on load and network performance (such as latency and bandwidth). The formula is as follows:
[0132] Scorei = w1.(1-Loadi) + w2.(1 / Latencyi)
[0133] Where Loadi is the current load of slave controller i, Latencyi is the network delay of slave controller i, and w1 and w2 are weights.
[0134] Based on the above calculations, this application can select the slave controller with the highest score as the target slave controller.
[0135] 3. Consider the processing power of the slave controller
[0136] Purpose: To ensure that the target slave controller has sufficient processing power to complete the task.
[0137] Method: Combine the load and hardware performance (such as CPU, GPU, and memory) to make a selection. The formula is as follows:
[0138] Scorei = w1.(1-Loadi) + w2.Capabilityi
[0139] Capabilityi is the hardware performance score of slave controller i (e.g., 0-1).
[0140] Based on the above calculations, this application can select the slave controller with the highest score as the target slave controller.
[0141] 4. Dynamic weight adjustment
[0142] Purpose: Dynamically adjust the weight of the selection strategy according to the system status.
[0143] Method: A. If the network condition is poor, increase w2 (network delay weight); B. If the task complexity is high, increase w2 (hardware performance weight).
[0144] In summary, the security monitoring system of the present application can achieve dynamic allocation of tasks and load balancing while ensuring system stability and efficient operation.
[0145] In one embodiment, Figure 3 As shown, Figure 3 A schematic diagram of a process for migrating part of the video processing tasks in an overloaded controller to a target slave controller is provided in an embodiment of the present application; the master controller migrating part of the video processing tasks that need to be migrated from the overloaded slave controller to the target slave controller may include:
[0146] The main controller sends the IP address, channel ID and Token of the target slave controller to the overloaded slave controller, and sends the IP address and channel ID of the overloaded slave controller to the target slave controller, so that the overloaded slave controller transparently transmits part of the video processing tasks that need to be migrated to the target slave controller, and the target slave controller synchronizes the processing results to the overloaded slave controller and the main controller.
[0147] In this embodiment, the master controller implements transparent task migration by sending the target slave controller's IP address, channel ID, and token to the overloaded slave controller, and vice versa. This mechanism ensures that the overloaded slave controller can accurately send the portion of video processing tasks that need to be migrated to the target slave controller. Furthermore, after completing the task, the target slave controller can synchronize the processing results back to the overloaded slave controller and the master controller.
[0148] Specifically, once the master controller determines the video processing task to be migrated and the target slave controller, it generates a corresponding migration instruction. This instruction includes information such as the IP address, channel ID, and token of the target slave controller. The master controller can send this information to the overloaded slave controller. After receiving the instruction, the overloaded slave controller can transparently transmit the specified task data to the target slave controller through a secure channel based on the provided information. At the same time, the master controller will also send the IP address and channel ID of the overloaded slave controller to the target slave controller so that after processing the task, the target slave controller can transmit the processing results back to the overloaded slave controller and the master controller.
[0149] In this way, the security monitoring system of this application not only achieves dynamic task allocation and load balancing, but also ensures data security and transmission efficiency during task migration. This further improves the overall performance and stability of the system, providing a more comprehensive and reliable guarantee for security prevention.
[0150] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.
[0151] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referenced to each other.
[0152] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments shown herein, but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A security monitoring system based on a master-slave controller mode, characterized in that: The system includes a master controller pre-elected through an election mechanism, and a plurality of slave controllers communicatively connected to the master controller; Each slave controller receives and processes video processing tasks sent by the video surveillance device bound to it, and regularly calculates the current computing load based on the number of video frames that the local controller can process and output per second, the number of objects that need to be processed in each frame, and the number of tasks waiting to be processed in the task queue, and sends the current computing load to the master controller; The master controller determines an overloaded slave controller and a low-loaded slave controller according to the current computing load sent by each slave controller, and allocates part of the video processing tasks in the overloaded slave controller to the low-loaded slave controller.
2. The security monitoring system based on the master-slave controller mode according to claim 1 is characterized in that: The system further comprises: The master controller periodically sends heartbeat signals to each slave controller, and when it is determined according to the heartbeat signals that one or more slave controllers are offline, all video processing tasks in the offline slave controllers are allocated to other online slave controllers.
3. The security monitoring system based on the master-slave controller mode according to claim 2 is characterized in that: The process of the master controller allocating all video processing tasks in the offline slave controller to other online slave controllers includes: The master controller selects a slave controller whose current computing load is lower than a preset maximum load threshold from other online slave controllers as a designated slave controller, and assigns all video processing tasks in the offline slave controllers to the designated slave controller.
4. The security monitoring system based on the master-slave controller mode according to claim 1 is characterized in that: The system further comprises: When one of the slave controllers detects that the master controller is abnormal, each slave controller re-elects a new master controller through the election mechanism.
5. The security monitoring system based on the master-slave controller mode according to claim 4 is characterized in that: The process of each slave controller re-electing a new master controller through the election mechanism includes: The Bully algorithm is used between the slave controllers to select the slave controller with the largest ID as the master controller among all the living slave controllers.
6. The security monitoring system based on the master-slave controller mode according to any one of claims 1 to 5, characterized in that: Each slave controller periodically calculates the current computing load based on the number of video frames it can process and output per second, the number of objects that need to be processed in each frame, and the number of tasks waiting to be processed in the task queue. This process includes: For each slave controller: Regularly determine the number of video frames that the machine can process and output per second, the number of targets that need to be processed in each frame, and the number of tasks waiting to be processed in the task queue; Normalize the number of video frames that the machine can process and output per second, the number of objects that need to be processed in each frame, and the number of tasks waiting to be processed in the task queue; The current computing load of the slave controller is obtained by taking the weighted sum of the normalized number of video frames that the local machine can process and output per second, the number of targets that need to be processed in each frame, and the number of tasks waiting to be processed in the task queue.
7. The security monitoring system based on the master-slave controller mode according to any one of claims 1 to 5, characterized in that: The process of the master controller determining an overloaded slave controller and an underloaded slave controller based on the current computing load sent by each slave controller includes: The master controller compares the current computing power load sent by each slave controller with the preset maximum load threshold, and regards the slave controller whose current computing power load is lower than the preset maximum load threshold as a low-load slave controller, and regards the slave controller whose current computing power load is not lower than the preset maximum load threshold as an overload slave controller.
8. The security monitoring system based on the master-slave controller mode according to any one of claims 1 to 5, characterized in that: The process of the master controller allocating part of the video processing tasks in the overloaded slave controller to the underloaded slave controller includes: The main controller determines the part of the video processing tasks that need to be migrated from the overloaded slave controller and the target slave controller that receives the video processing tasks from the low-loaded slave controller according to a preset task allocation strategy, and migrates the part of the video processing tasks that need to be migrated from the overloaded slave controller to the target slave controller.
9. The security monitoring system based on the master-slave controller mode according to claim 8, characterized in that: The process of the master controller determining, according to a preset task allocation strategy, a portion of the video processing tasks that need to be migrated from the overloaded slave controller and a target slave controller from which the underloaded slave controller receives the video processing tasks includes: The master controller determines, based on the priority of each task in the overloaded slave controller, the computational complexity of each task, the dependency of each task, or the load reduction target, a portion of the video processing tasks that need to be migrated from the overloaded slave controller; The master controller determines a target slave controller that receives a video processing task from at least one of the low-load slave controllers according to a load status, network delay and bandwidth, or processing capability of at least one of the low-load slave controllers.
10. The security monitoring system based on the master-slave controller mode according to claim 8, characterized in that: The master controller migrates part of the video processing tasks that need to be migrated from the overloaded slave controller to the target slave controller, including: The main controller sends the IP address, channel ID and Token of the target slave controller to the overloaded slave controller, and sends the IP address and channel ID of the overloaded slave controller to the target slave controller, so that the overloaded slave controller transparently transmits part of the video processing tasks that need to be migrated to the target slave controller, and the target slave controller synchronizes the processing results to the overloaded slave controller and the main controller.
Citation Information
Patent Citations
Dynamic load balancing method of trunking system based on task immigration
CN104615498A
Cross-device unsupervised self-scheduling edge computing system
CN117112221A
Resource scheduling method, data processing system, computing device, medium and product
CN119847773A
Load balancing for distributed key-value store
US20130332608A1
Cited By
Cooperative operation method of multiple substrate management controllers and electronic equipment
CN120723489A