Method for adjusting load balance of embedded device
By establishing a monitoring queue and dynamic resource scheduling mechanism in embedded devices, the problem that resource management in the existing technology cannot distinguish business priorities is solved, and the stable and reliable operation of the video surveillance system is achieved.
Patent Information
- Application Number
- CN202510318179.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-18
- Publication Date
- 2025-04-22
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The internal resource management mechanism of existing embedded devices cannot effectively distinguish the importance and priority of business modules, resulting in excessive consumption of resources in the case of high load or multi-task concurrency, squeezing the resource share of the basic business modules, affecting system stability and reliability.
Through business registration and business exclusion, business modules that need to be monitored will be added to the monitoring queue, and real-time monitoring and dynamic resource allocation and adjustments will be made according to the system load situation, ensuring that resources are obtained for critical tasks are preferred.
It realizes the ability to intelligently identify and prioritize key tasks, dynamically adjust resource allocation, adapt to changing workload needs, and ensure the continuous and stable and reliable operation of the video surveillance system.
Smart Images

Figure CN119862038A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical fields of embedded devices, video monitoring, load balancing adjustment and the like, and in particular to a load balancing adjustment method applied to embedded devices. Background Art
[0002] In the video surveillance industry, the front-end IP CAMERA (i.e., network camera) and the back-end NVR (Network Video Recorder) usually run embedded operating systems. Although these devices have limited resources, the tasks they carry are complex and diverse, ranging from basic data transmission and storage to advanced face recognition and event processing. Take NVR as an example, its core responsibility is to ensure the stable operation of the two basic business modules of network access transmission and video storage. In addition, NVR also supports a variety of value-added functions, such as pre-recording, local and remote preview and playback, face recognition, and event background image processing. In actual application environments, these multi-task parallel operations may cause competition for CPU and memory resources, especially in extreme cases or when non-core businesses occupy a large amount of resources, which will threaten the performance of key tasks and may cause problems such as video recording loss or failure to write video data in time. In embedded devices, CPU and memory resources are often limited, and as business needs grow, how to ensure stable system operation and provide reliable services has become a key challenge. Previous optimization strategies have mostly focused on improving CPU and memory utilization, without considering how to adjust the relationship between various business loads. This approach is inadequate in the face of growing business loads, and the product may experience a sharp increase in load when facing different complex environments. In today's existing embedded system architecture, especially for video surveillance devices such as IP CAMERA (network camera) and NVR (network video recorder), although these devices carry complex and diverse business modules, their internal resource management mechanisms have failed to fully cope with the challenges brought about by multi-task parallel operation. Current embedded systems often lack effective processing strategies for resource competition between different business modules, resulting in frequent competition between modules for CPU and memory resources. This disordered competition not only affects the overall performance of the system, but more importantly, it seriously threatens the stability and reliability of basic business modules. For example, in NVR, non-core modules may occupy a large amount of system resources for a long time, making it impossible for key basic business modules, such as network access transmission and video storage, to obtain the necessary resource support. This directly leads to a series of unacceptable problems: network frame loss, that is, data packets are lost during the network transmission of audio and video stream data, affecting local and remote preview and playback; video storage anomalies, that is, video data cannot be written to the storage medium in time, resulting in the loss of important videos, seriously affecting the security effect; system response delay, that is, the response time of user operations (such as local or remote playback) is extended, and the user experience is degraded. The root cause of these problems is that the existing embedded system fails to effectively distinguish the importance and priority of business modules and fails to provide sufficient resource guarantee mechanisms for key tasks.When the system is under high load or multi-tasking, non-core modules may consume excessive resources due to design defects, thereby squeezing out the resource share that should be allocated to the basic business modules.
[0003] To sum up, the internal resource management mechanism of existing embedded devices cannot effectively distinguish the importance and priority of business modules, cannot provide sufficient resource guarantee mechanism for key tasks, and when the system is under high load or multi-tasking concurrently, non-core modules consume resources excessively and easily squeeze out the resource share that should be allocated to the basic business modules. Summary of the invention
[0004] In view of the deficiencies in the above-mentioned prior art, the present invention provides a method for adjusting load balancing of embedded devices, which can intelligently identify and prioritize key tasks, dynamically adjust resource allocation capabilities, adapt to changing workload requirements, and ensure the continuous stability and reliable operation of the video surveillance system.
[0005] The method for adjusting load balancing of embedded devices provided by the present invention comprises: By registering and removing services, the service modules that need to be monitored are added to the monitoring queue for unified management and resource scheduling, and the specified service modules are removed from the monitoring queue to stop resource management and monitoring of the specified service modules; During the period when monitoring is required, real-time monitoring is performed on the service modules that need to be monitored in the monitoring queue, and dynamic resource allocation and adjustment are performed according to the system load of the embedded device; After completing the monitoring task of the service modules in the monitoring queue, the monitoring and resource management of all service modules in the monitoring queue are stopped, and the monitoring queue is cleared, so that the system load of the embedded device returns to the initial state.
[0006] Compared with the prior art, the present invention has the following beneficial effects: The present invention provides an adjustment method for load balancing of embedded devices. Through service registration and service removal, a service module that needs to be monitored is added to a monitoring queue for unified management and resource scheduling. The specified service module is removed from the monitoring queue, and resource management and monitoring of the specified service module is stopped. During the period when monitoring is required, the service module that needs to be monitored in the monitoring queue is monitored in real time, and dynamic resource allocation and adjustment are performed according to the system load of the embedded device. After completing the monitoring task of the service module in the monitoring queue, the monitoring and resource management of all service modules in the monitoring queue are stopped, the monitoring queue is cleared, and the system load of the embedded device is returned to an initial state, thereby realizing intelligent identification and priority processing of key tasks, the ability to dynamically adjust resource allocation, adapting to changing workload requirements, and ensuring the continuous stability and reliable operation of a video surveillance system. BRIEF DESCRIPTION OF THE DRAWINGS
[0007] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their description are used to explain the present invention and do not constitute an improper limitation of the present invention. Some specific embodiments of the present invention will be described in detail in an exemplary and non-restrictive manner with reference to the drawings. The same reference numerals in the drawings indicate the same or similar components or parts. It should be understood by those skilled in the art that these drawings are not necessarily drawn to scale. In the drawings: Figure 1 The present invention is a flowchart of a method for adjusting load balancing of embedded devices according to an embodiment of the present invention. DETAILED DESCRIPTION
[0008] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is only an embodiment of a part of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work should fall within the scope of protection of the present invention.
[0009] Embodiment 1 See also Figure 1 This embodiment provides a method for adjusting load balancing of an embedded device, including step S101, step S102 and step S103.
[0010] S101, through service registration and service removal, add the service module that needs to be monitored to the monitoring queue for unified management and resource scheduling, remove the specified service module from the monitoring queue, and stop resource management and monitoring of the specified service module; S102, during the period when monitoring is required, real-time monitoring is performed on the service modules that need to be monitored in the monitoring queue, and dynamic resource allocation and adjustment is performed according to the system load of the embedded device; S103: After completing the monitoring task of the service modules in the monitoring queue, stop monitoring and resource management of all service modules in the monitoring queue, clear the monitoring queue, and return the system load of the embedded device to an initial state.
[0011] It should be noted that, in this embodiment, through business registration and business removal, it is clear which business modules are controlled (joined the queue) and which businesses are no longer controlled (removed from the queue). This can facilitate subsequent unified management and dynamic scheduling, ensure that the scope of controlled businesses can be flexibly adjusted during system operation, and avoid irrelevant businesses being redundantly included in management or important businesses being unable to be included in monitoring. In addition, the business modules in the monitoring queue will undergo load changes at any time during operation, and corresponding resource adjustments need to be made according to indicators such as CPU idle rate to ensure that key businesses get resources first. In this embodiment, dynamic resource allocation and adjustment are performed according to the system load of the embedded device, which can respond in time when the system load fluctuates, rather than just a one-time configuration at startup. When the monitoring task is completed or the system no longer needs to adjust the load, it needs to return to the initial state. This can avoid unnecessary monitoring and system overhead, and also ensure that the system can run in the default mode when load balancing is not turned on, preventing continuous resource occupation for irrelevant tasks or non-existent businesses. It can be understood that in this embodiment, through the centralized management of the controlled business modules, the system can accurately allocate or recycle resources for each business, avoiding blindly or unable to reduce / increase the load in a targeted manner. When the load is high or multiple tasks are running in parallel, real-time monitoring helps to detect and handle load anomalies in the first place, ensuring the stability of key tasks. By clearing the monitoring queue, the system can quickly switch back to normal operation mode when load balancing is not needed, reducing additional system consumption.
[0012] In some preferred embodiments, when adding a business module that needs to be monitored to a monitoring queue through business registration and business removal, it includes: registering the business module name of the business module that needs to be monitored, the business module name is a unique identifier of the business module, and is used to distinguish different business modules; after the business module name of the business module is registered, the business module pointed to by the business module name of the business module that needs to be monitored is added to the monitoring queue. It should be noted that in the present embodiment, each business has a unique identifier to avoid duplication or conflict. When the operation and maintenance personnel or the system is doing load adjustment, they can accurately locate based on the business name, reducing the risk of confusion in scheduling and monitoring. Registering the business module name of the business module that needs to be monitored can also provide basic information support for subsequent priority management, API calls, status printing and other functions.
[0013] In some preferred embodiments, when adding the business modules that need to be monitored to the monitoring queue through business registration and business elimination, it includes: registering the business module priority of the business module that needs to be monitored, and the business module priority defines the importance of the business module that needs to be monitored; after the business module priority registration of the business module is completed, the business module with the business module priority is added to the monitoring queue. It should be noted that the importance of different business modules to the system is inconsistent, and their priorities need to be clarified during management, so that when the load is too high, low-priority services can be closed or limited first; or when the system is restored, high-priority services can be restored first. In this embodiment, by assigning different levels of priority to the business, the principle of giving priority to key businesses is implemented to reduce interference with core functions. The priority mechanism can not only switch between extreme binary modes such as all on and all off, but also manage in layers and make gradual adjustments according to the importance of the business.
[0014] In some preferred embodiments, the priority value range of the service module is 0-100, and the higher the value, the more important it is. It should be noted that the priority value range is set to 0-100, which allows developers or systems to set more fine-grained business importance divisions as needed, which can not only maintain the consistency of the system, but also facilitate implementation. Among the same type of services, different priority values can also be used to distinguish them to ensure that load adjustment can be carried out in a more refined order. The range of 0-100 is clear and easy to understand, and it is also easy to implement in actual programs.
[0015] In some preferred embodiments, when dynamic resource allocation and adjustment are performed according to the system load of the embedded device, if the system load of the embedded device needs to be reduced, the business modules that need to be monitored with low priority will be allocated and adjusted first, and if the system load of the embedded device needs to be restored, the business modules that need to be monitored with high priority will be allocated and adjusted first. It should be noted that when the system load is too high, low-priority businesses are closed or unloaded first, which can quickly reduce resource occupancy; when the load is restored, high-priority businesses are restored first to ensure the normal operation of key functions. It can be understood that in this embodiment, in extreme cases, it can better ensure the continuous operation of high-priority (core) businesses and avoid "occupying" resources due to low-priority businesses. For core businesses, recovery as soon as possible can reduce the impact on user experience or security functions (such as video recording).
[0016] In some preferred embodiments, when dynamic resource allocation and adjustment are performed according to the system load of the embedded device, the effective time length after the load adjustment is preset to ensure a smooth transition of the load adjustment process. It should be noted that when the system decides to shut down certain services or reduce the load, it often takes a buffer time for the system to gradually release resources and stabilize the system status. If there is no effective time, the system may frequently perform adjustment operations, resulting in repeated fluctuations. It is understandable that in this embodiment, a smooth transition can prevent frequent business opening / closing from causing system jitter or excessive overhead of the resource management module; adding an effective delay in real-time monitoring makes load changes controllable and reduces the uncertainty risks brought by sudden operations.
[0017] In some preferred embodiments, when dynamic resource allocation and adjustment are performed according to the system load of the embedded device, an API is provided for dynamically reducing or increasing the business load to support flexible configuration. It should be noted that developers or managers need a callable interface to flexibly adjust the operating status and resource occupancy of the business when the load is detected to be too high / too low. The entire load balancing method not only stays in the internal mechanism, but also can interact with external management systems or third-party modules. After providing the API, the system or administrator can automatically control the business load through programming, scripts or upper-level platforms. In large systems, most functions are integrated or called through APIs, which can ensure that the solution of this embodiment is widely used in different scenarios.
[0018] In some preferred embodiments, when dynamic resource allocation and adjustment are performed according to the system load of the embedded device, it is queried whether there is still room for further load reduction for the current business, reflecting the state of business activities. It should be noted that not all businesses can be cut indefinitely; some businesses are already in the lowest operating mode (cannot be reduced any further), and this state needs to be identified in order to shift the adjustment focus to other adjustable businesses. When the load is too high, the system will give priority to reducing the load of businesses that still have room for reduction to reduce useless work; if the key business has reached the minimum guaranteed state, it will not continue to be reduced to ensure that the most core functions are not shut down by mistake.
[0019] In some preferred embodiments, when dynamic resource allocation and adjustment are performed according to the system load of the embedded device, it is queried whether the current business can be restored or the load can be increased to reflect the status of the suspended business. It should be noted that when the system idle rate increases, it is necessary to gradually restore the previously closed / suspended or cut businesses to a normal state, or add other extended businesses as needed. It is necessary to distinguish whether the business is really in a recoverable state to avoid performing erroneous operations on businesses that have been completely stopped and do not meet the conditions for recovery. In this embodiment, when the load is low, the cut business can be restored as soon as possible to ensure the user experience or function. In conjunction with the solution that can reduce space in the above-mentioned embodiment, this embodiment can realize a complete process from reduction to addition, greatly improving the flexibility of system resource scheduling.
[0020] In some further embodiments, when dynamic resource allocation and adjustment are performed according to the system load of the embedded device, the status information of all services is output in real time, and the status information of all services includes the status information of running and suspended tasks, which is convenient for administrators to monitor and troubleshoot. It should be noted that in actual use, operation and maintenance or developers need to know which services are cut or suspended and which services are running normally in order to make operation and maintenance decisions or troubleshoot. In this embodiment, the administrator can see the system load adjustment process at a glance and discover misoperation or business conflicts in time; if a fault occurs (such as loss of video data), the status information can be used to determine whether it is caused by the suspension or reduction of a key business during a certain period of time.
[0021] In some further embodiments, when removing a specified business module from the monitoring queue, it includes: according to the business module name of the business module to be removed as needed, removing the business module with the specified name from the monitoring queue to ensure accurate removal of the target business. It should be noted that when removing a business, the operation is performed through a unique business name to prevent the accidental removal of other businesses. In this embodiment, removal by name is simple and accurate, and unnecessary monitoring and resource overhead is prevented. When multiple business names are similar, the use of a unique identifier can ensure accurate deletion, thereby reducing operation and maintenance errors.
[0022] In some further embodiments, when dynamic resource allocation and adjustment are performed according to the system load of the embedded device, the frequency of the CPU idle rate of the embedded device is detected to ensure timely response to changes. It should be noted that real-time monitoring of the CPU idle rate requires an appropriate monitoring interval. If the interval is too long, the system may not be able to respond to load changes in a timely manner; if it is too short, the system overhead will increase. In this embodiment, a good balance is achieved between real-time response and reduction of monitoring overhead by reasonably setting the detection frequency. Once the CPU idle rate drops or increases rapidly, the system can quickly perform load adjustment or recovery operations in the next monitoring cycle.
[0023] In some further embodiments, when dynamic resource allocation and adjustment are performed according to the system load of the embedded device, if the load is reduced, the time required to restore normal adjustment after the load is reduced is used to avoid frequent adjustments. It should be noted that in order to prevent the system from quickly resuming business when the load has just dropped, causing frequent fluctuations in a short period of time, it is necessary to set a stabilization time required for load recovery, so that the system can continue in a low-load state for a period of time, and then gradually restore or increase business. If there is no time limit, the system may repeatedly switch between reducing and increasing the load, resulting in unstable overall performance. The time required to restore normal adjustment after reducing the load can give the system a sufficient observation period. On the one hand, it can verify whether the load has indeed been stably reduced, and on the other hand, it can avoid resource management pressure caused by excessive switching.
[0024] In some further embodiments, the monitoring queue includes a remote preview service, and the load adjustment rules of the remote preview service include: the service name is NetPreview, the priority is 1; the preset load adjustment effective time is 15 seconds; the load adjustment levels include full preview, partial preview and all closed, corresponding to all preview channels fully open, partial channels closed and completely stop remote preview. It should be noted that although remote preview is a common function, it has a lower priority (set to 1) compared with core services such as video storage and network transmission, and can be unloaded or closed in advance when the load is high. By setting the service name and priority, refined management can be achieved in unified monitoring and scheduling. 15 seconds is set as the waiting time after the adjustment action to avoid the system from repeating the loading or unloading operation immediately after detecting the load change, thereby causing excessive resource fluctuations. The three levels of full preview, partial preview and all closed correspond to different degrees of resource occupation, providing a basis for hierarchical adjustment. In this embodiment, orderly load control can be achieved through service name and priority; when system resources are tight, low-priority services are automatically started to ensure stable operation of high-priority services. When the remote preview service is partially or completely closed, more CPU and memory can be freed up for core modules such as video storage and network transmission, improving the overall system performance. After the adjustment action is executed, the 15-second effective time can gradually stabilize the system operation status and prevent jitter or business abnormalities caused by frequent switching.
[0025] In some further embodiments, when the CPU idle rate of the remote preview service is monitored to be low or the system is in a high load state, first determine whether the current remote preview service is in a state of full preview, partial preview or full shutdown, and perform dynamic load adjustment according to the following rules: if the current state is full preview, reduce it to partial preview and wait for 15 seconds, if the CPU idle rate is still too low, further reduce it to full shutdown; if all remote previews are in full shutdown and the system resources are sufficient, first restore to partial preview and continue to monitor the load situation, if there are still surplus resources, gradually restore to full preview; if the system still does not return to normal after reducing the remote preview service to full shutdown, then detect and adjust the load of other high priority tasks in turn until the system returns to a benign state. It should be noted that in this embodiment, the remote preview service is gradually reduced from full preview to partial preview and then to full shutdown, which helps to gradually release resources when high load occurs, rather than shutting down all channels at once. When it is detected that the CPU idle rate has risen to a certain level, in order not to affect the user experience, the service is allowed to be gradually restored; first partial preview, then full preview, can avoid excessive instantaneous resource consumption. When the adjustment of remote preview is still not enough to reduce the load to a safe level, it is necessary to check and adjust other services with higher priority or the same level to form a set of multi-service parallel management strategies. It can be understood that in this embodiment, by first reducing the load of low-priority remote preview services, it is possible to prioritize the continuous operation of high-priority services such as video storage and network transmission in a resource-constrained environment to prevent the loss of critical data. The adjustment process can also be integrated into the unified monitoring module of the system; it is not only applicable to remote preview, but can be extended to other business scenarios, such as face recognition, event analysis, etc. When system resources are tight, users can still retain some preview requirements, rather than shutting them down across the board; when the load improves, it can be restored in sequence, allowing users to have more available functions while ensuring the security of core services.
[0026] The above embodiments are only preferred specific implementation modes of the present invention, and the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention. The protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A method for adjusting load balancing of embedded devices, characterized in that: include: By registering and removing services, the service modules that need to be monitored are added to the monitoring queue for unified management and resource scheduling, and the specified service modules are removed from the monitoring queue to stop resource management and monitoring of the specified service modules; During the period when monitoring is required, real-time monitoring is performed on the service modules that need to be monitored in the monitoring queue, and dynamic resource allocation and adjustment is performed according to the system load of the embedded device; After completing the monitoring task of the service modules in the monitoring queue, the monitoring and resource management of all service modules in the monitoring queue are stopped, and the monitoring queue is cleared, so that the system load of the embedded device returns to the initial state.
2. The method for adjusting load balancing of embedded devices according to claim 1, characterized in that: When adding a business module that needs to be monitored to a monitoring queue through business registration and business removal, it includes: registering a business module name of the business module that needs to be monitored, wherein the business module name is a unique identifier of the business module and is used to distinguish different business modules; after the business module name of the business module is registered, adding the business module pointed to by the business module name of the business module that needs to be monitored to the monitoring queue.
3. The method for adjusting load balancing of embedded devices according to claim 2, characterized in that: When adding a business module that needs to be monitored to a monitoring queue through business registration and business elimination, it includes: registering a business module priority of the business module that needs to be monitored, wherein the business module priority defines the importance of the business module that needs to be monitored; after the business module priority registration of the business module is completed, adding the business module with the business module priority to the monitoring queue.
4. The method for adjusting load balancing of embedded devices according to claim 3, characterized in that: The priority of the service module ranges from level 0 to level 100, and the higher the value, the more important it is.
5. The method for adjusting load balancing of embedded devices according to claim 4, characterized in that: When dynamically allocating and adjusting resources according to the system load of the embedded device, if the system load of the embedded device needs to be reduced, the business modules that need to be monitored with low priority will be allocated and adjusted first; if the system load of the embedded device needs to be restored, the business modules that need to be monitored with high priority will be allocated and adjusted first.
6. The method for adjusting load balancing of embedded devices according to claim 1, characterized in that: When dynamically allocating and adjusting resources according to the system load of the embedded device, the effective time length after the load adjustment is preset to ensure a smooth transition of the load adjustment process.
7. The method for adjusting load balancing of embedded devices according to claim 1, characterized in that: When dynamically allocating and adjusting resources according to the system load of the embedded device, an API is provided for dynamically reducing or increasing the business load, supporting flexible configuration.
8. The method for adjusting load balancing of embedded devices according to claim 1, characterized in that: When dynamically allocating and adjusting resources according to the system load of the embedded device, it is queried whether there is room for further reducing the load of the current business, reflecting the business activity status.
9. The method for adjusting load balancing of embedded devices according to claim 1, characterized in that: When dynamically allocating and adjusting resources according to the system load of the embedded device, it is queried whether the current service can be resumed or the load can be increased to reflect the status of the suspended service.
Citation Information
Patent Citations
Task scheduling method and device based on equipment snapshot polling and storage medium
CN119025287A
System, apparatus and method for cloud resource allocation
US20240193010A1
Cited By
Dynamic load balancing method and system based on session granularity and bit mask mapping
CN121433862A