Disclosure of Invention
The application provides a memory balancing method, a system, a medium and a program product based on edge calculation, which are used for improving the efficiency of memory load balancing.
In a first aspect, the present application provides a memory balancing method based on edge computing, detecting, according to a preset period, a memory usage amount and a memory change rate of a plurality of edge computing devices, and network communication quality between the plurality of edge computing devices;
Calculating a memory release prediction time point of each edge computing device according to the memory change rate;
dividing the memory space of each edge computing device into a computing storage area and a temporary buffer area, wherein the temporary buffer area is used for temporarily storing the overload data migrated by other edge computing devices except the current edge computing device, and the computing storage area is used for data computing and storing of the current edge computing device;
When any target edge computing device is detected to exist, at least two candidate devices with optimal communication quality with the target edge computing device are selected according to the network communication quality, wherein the target edge computing device is an edge computing device with the memory usage exceeding a preset threshold;
sequencing candidate devices from the early to the late according to the corresponding memory release prediction time points to obtain a candidate device queue;
Respectively migrating the overload data of the target edge computing equipment to temporary buffer areas of all candidate equipment in the candidate equipment queue according to the memory release prediction time points of all candidate equipment in the candidate equipment queue;
Before the memory release prediction time point of any candidate device in the candidate device queue arrives, controlling the target edge computing device to read corresponding overload data from the temporary cache area of the candidate device;
And migrating the read overload data to a calculation storage area, in which the memory usage amount in the plurality of edge calculation devices is lower than a preset threshold value.
By adopting the technical scheme, the data migration strategy can be planned in advance by periodically detecting the memory use condition and network communication quality of the edge computing equipment and predicting the memory release time point by combining the memory change rate. When the memory overload of the target edge computing equipment is found, the optimal candidate equipment is selected based on the network communication quality, and the candidate equipment is ordered according to the memory release prediction time point, so that the network transmission efficiency of data migration can be improved. By storing overload data in the temporary buffer areas of a plurality of candidate devices in a scattered manner and timely reading and reassigning the overload data before the memory release prediction time point arrives, the problem of overlarge memory pressure of a single device is solved, and the risk of data loss caused by insufficient memory of the candidate devices is reduced. And finally, the overload data is migrated to a calculation storage area with sufficient memory, so that the memory load balancing among edge calculation devices is realized, and the efficiency of the memory load balancing is improved.
With reference to some embodiments of the first aspect, in some embodiments, calculating a memory release prediction time point of each edge computing device according to a memory change rate specifically includes:
calculating the memory change trend of each edge computing device in a plurality of continuous preset periods;
dividing a memory release period according to the memory change trend, and marking a peak time point and a trough time point of the memory capacity in each memory release period;
And calculating the next memory release prediction time point by combining the memory usage at the current moment based on the time interval between the peak time point and the trough time point.
By adopting the technical scheme, the periodic rule of the memory use can be accurately identified by analyzing the memory change trend of the edge computing equipment in a plurality of continuous preset periods. By dividing the memory change into a plurality of release cycles and marking the time points of the wave crest and the wave trough in each cycle, the system can grasp the dynamic change characteristics of the memory use. Based on the time interval between the wave crest and the wave trough time points, the next memory release prediction time point is calculated by combining the current memory usage amount, so that the system can more accurately predict the available time of the memory resources, the accuracy of memory release time prediction is improved, the resource waste caused by prediction errors is reduced, and the memory resource scheduling efficiency of the whole system is improved.
With reference to some embodiments of the first aspect, in some embodiments, migrating overload data of the target edge computing device to temporary buffers of candidate devices in the candidate device queue respectively specifically includes:
Obtaining the residual duration of each candidate device distance corresponding to the memory release prediction time point and the residual capacity of the temporary buffer area in the candidate device queue;
calculating the time weight of each candidate device according to the residual duration;
Calculating the data bearing coefficient of each candidate device based on the time weight and the residual capacity, wherein the data bearing coefficient is positively correlated with the time weight and the residual capacity;
Partitioning overload data of the target edge computing equipment according to a preset data block size to obtain a plurality of data blocks;
based on the data bearing coefficient of each candidate device, distributing a plurality of data blocks to each candidate device in a weighted polling mode;
Combining the data blocks with access frequency difference smaller than a preset value into a data group for the data blocks allocated to each candidate device;
Establishing a plurality of parallel data transmission channels, and setting different transmission priorities in each data transmission channel, wherein the transmission priorities are positively correlated with the access frequency of a corresponding transmitted data group;
and transmitting each data group to the temporary buffer area of the corresponding candidate equipment in parallel through the data transmission channel, and storing each data group in the temporary buffer area according to the order of the access frequency from high to low.
By adopting the technical scheme, the reasonable distribution of overload data is realized by calculating the time weight and the data bearing coefficient of the candidate equipment. The overload data are segmented according to the preset size and weighted polling distribution is carried out based on the data bearing coefficient, so that the balance of data distribution is improved. And the data blocks with similar access frequencies are combined, so that the fragmentation degree of data transmission is reduced. By establishing a plurality of parallel data transmission channels and setting transmission priority according to the data access frequency, the system realizes efficient parallel transmission of data. The data are stored in the temporary buffer area according to the access frequency, so that the access efficiency of the data is optimized, the data migration efficiency is improved, the network bandwidth consumption is reduced, and the quick response capability of the high-frequency access data is ensured.
In combination with some embodiments of the first aspect, in some embodiments, after migrating the read overload data into a computing storage area in which memory usage in the plurality of edge computing devices is below a preset threshold, the method further includes:
acquiring memory load data of each edge computing device in a plurality of continuous preset periods;
determining a load fluctuation period based on the memory load data, and dividing the load fluctuation period into a plurality of continuous time windows;
Predicting memory load transfer trend of each edge computing device in a time window;
calculating the probability that each edge computing device becomes a target edge computing device at the end of the current time window according to the memory load transfer trend;
And when the probability distance is smaller than the preset threshold probability interval, reversely distributing the overload data to ensure that the migration direction of the overload data is opposite to the current memory load migration direction.
By adopting the technical scheme, the historical load data of the edge computing equipment is analyzed, the load fluctuation period is identified, and the time window is divided. And predicting the memory load transfer trend in a time window, and calculating the probability that each device becomes a target edge computing device, so that the system can discover potential memory pressure problems in advance. When the prediction probability is close to a critical value, the reverse data distribution strategy is implemented to enable the migration direction of overload data to be opposite to the current memory load transfer direction, so that the memory loads of all devices in the system are balanced, the problem of the memory pressure of local device groups in linkage can be prevented, and the load balancing capacity and the running stability of the whole edge computing system are improved.
With reference to some embodiments of the first aspect, in some embodiments, predicting a memory load transfer trend of each edge computing device within a time window specifically includes:
calculating the memory usage rate change rate and the memory release rate of each edge computing device in the current time window;
calculating a net growth rate of the memory load based on the memory usage rate and the memory release rate;
judging a memory load transfer direction according to the positive and negative of the memory load net growth rate, and determining a memory load transfer speed based on the absolute value of the memory load net growth rate;
And taking the memory load transfer direction and the memory load transfer speed as characterization parameters to obtain a memory load transfer trend.
By adopting the technical scheme, the dynamic change condition of the memory resource of the device can be accurately mastered by calculating the memory usage rate and the memory release rate of the edge computing device in the current time window. The net increase rate of the memory load is obtained by combining and calculating the change rate of the memory usage and the memory release rate, and the actual consumption speed of the memory resources of the equipment can be comprehensively reflected. And judging the transfer direction of the memory load based on the positive and negative of the net growth rate of the memory load, and determining the transfer speed according to the absolute value of the transfer direction, so that the system can accurately grasp the flow situation among the edge computing devices of the memory load. The memory load transfer direction and the transfer speed are used as the memory load transfer trend obtained by the characterization parameters, so that the dynamic characteristics of the memory load distribution of the edge computing equipment group can be truly reflected, the prejudgment accuracy of the system on the memory load distribution change of the edge computing equipment group is improved, the system can more actively allocate memory resources, the blindness of memory resource allocation is reduced, and the overall operation efficiency of the edge computing system is improved.
With reference to some embodiments of the first aspect, in some embodiments, when the probability distance is smaller than the preset probability threshold, the reverse distribution of the overload data specifically includes:
Obtaining the residual capacity of a calculation storage area of each edge calculation device and the current service processing load;
calculating the data receiving capacity index of each edge computing device according to the residual capacity of the calculation storage area and the current service processing load;
grouping edge computing devices based on the data receiving capability index to obtain a plurality of target receiving groups;
Calculating the data receiving quota of each target receiving group, wherein the data receiving quota is positively correlated with the average value of the data receiving capacity indexes of all edge computing devices in the target receiving group;
and determining a reverse distribution scheme of the overload data according to the data receiving quota so that the migration direction of the overload data is opposite to the current memory load transfer direction.
By adopting the technical scheme, the data receiving capacity index is obtained by calculation through obtaining the residual capacity of the calculation storage area of the edge calculation equipment and the current business processing load information, and the data receiving capacity index comprehensively reflects the actual capacity of the equipment for receiving and processing data. The data receiving capacity index is used for grouping the devices and calculating the data receiving quota of each target receiving group, so that the system can reasonably distribute the data amount according to the actual processing capacity of the devices. The overload data reverse distribution scheme established on the basis can inhibit the centralized trend of the memory load in the edge computing equipment group by making the data migration direction opposite to the current memory load migration direction, and improves the stability of the system under the condition of high load.
With reference to some embodiments of the first aspect, in some embodiments, calculating a data receiving capability index of each edge computing device according to the calculated storage area remaining capacity and the current traffic processing load specifically includes:
converting the residual capacity of the calculated storage area into a normalized capacity score;
Calculating the busyness of the business according to the current business processing load, and converting the busyness of the business into a standardized load score;
Setting different weights for the normalized capacity score and the normalized load score;
and subtracting the product of the normalized load score and the corresponding weight from the product of the normalized capacity score and the corresponding weight to obtain a data receiving capacity index.
By adopting the technical scheme, the calculated storage area residual capacity and the current service processing load are respectively converted into the standardized scores, and different weights are set for calculation, so that the obtained data receiving capacity index can more objectively reflect the actual data processing capacity of the edge computing equipment. The normalization process eliminates the differences between the different dimension parameters, making the two dimension indicators of capacity and load comparable. Through weight setting, the system can adjust the influence degree of capacity factors and load factors on the data receiving capacity according to actual application scenes, and the flexibility of data receiving capacity assessment is enhanced. The storage space and the processing load of the equipment are comprehensively considered by the data receiving capacity index, so that the hardware resource condition of the equipment is reflected, the real-time processing pressure of the equipment is reflected, the data processing potential of the edge computing equipment can be accurately estimated by the system, and the accuracy and the rationality of the system resource allocation are improved.
In a second aspect, embodiments of the present application provide an edge computing based memory equalisation system comprising one or more processors and memory, the memory being coupled to the one or more processors, the memory being for storing computer program code comprising computer instructions, the one or more processors invoking the computer instructions to cause the system to perform a method as described in the first aspect and any possible implementation of the first aspect.
In a third aspect, embodiments of the present application provide a computer readable storage medium comprising instructions which, when run on a system, cause the system to perform a method as described in the first aspect and any possible implementation of the first aspect.
In a fourth aspect, embodiments of the application provide a computer program product, characterized in that the computer program product, when run on a system, causes the system to perform the method as described in any one of the possible implementations of the first aspect.
One or more technical solutions provided in the embodiments of the present application at least have the following technical effects or advantages:
1. The application provides a memory balancing method based on edge calculation, which can plan data migration strategies in advance by periodically detecting the memory use condition and network communication quality of edge calculation equipment and predicting memory release time points by combining memory change rates. When the memory overload of the target edge computing equipment is found, the optimal candidate equipment is selected based on the network communication quality, and the candidate equipment is ordered according to the memory release prediction time point, so that the network transmission efficiency of data migration can be improved. By storing overload data in the temporary buffer areas of a plurality of candidate devices in a scattered manner and timely reading and reassigning the overload data before the memory release prediction time point arrives, the problem of overlarge memory pressure of a single device is solved, and the risk of data loss caused by insufficient memory of the candidate devices is reduced. And finally, the overload data is migrated to a calculation storage area with sufficient memory, so that the memory load balancing among edge calculation devices is realized, and the efficiency of the memory load balancing is improved.
2. The application provides a memory balancing method based on edge calculation, which is used for analyzing historical load data of edge calculation equipment, identifying a load fluctuation period and dividing a time window. And predicting the memory load transfer trend in a time window, and calculating the probability that each device becomes a target edge computing device, so that the system can discover potential memory pressure problems in advance. When the prediction probability is close to a critical value, the reverse data distribution strategy is implemented to enable the migration direction of overload data to be opposite to the current memory load transfer direction, so that the memory loads of all devices in the system are balanced, the problem of the memory pressure of local device groups in linkage can be prevented, and the load balancing capacity and the running stability of the whole edge computing system are improved.
3. The application provides a memory balancing method based on edge calculation, which obtains the data receiving capacity index by obtaining the residual capacity of a calculation storage area of edge calculation equipment and the current business processing load information, wherein the data receiving capacity index comprehensively reflects the actual capacity of the equipment for receiving and processing data. The data receiving capacity index is used for grouping the devices and calculating the data receiving quota of each target receiving group, so that the system can reasonably distribute the data amount according to the actual processing capacity of the devices. The overload data reverse distribution scheme established on the basis can inhibit the centralized trend of the memory load in the edge computing equipment group by making the data migration direction opposite to the current memory load migration direction, and improves the stability of the system under the condition of high load.
Detailed Description
The terminology used in the following embodiments of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of the present application and the appended claims, the singular forms "a," "an," "the," and "the" are intended to include the plural forms as well, unless the context clearly indicates to the contrary. It should also be understood that the term "and/or" as used in this disclosure is intended to encompass any or all possible combinations of one or more of the listed items.
The terms "first," "second," and the like, are used below for descriptive purposes only and are not to be construed as implying or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature, and in the description of embodiments of the application, unless otherwise indicated, the meaning of "a plurality" is two or more.
An embodiment of a memory balancing method based on edge computation according to an embodiment of the present application is described below with reference to fig. 1:
Fig. 1 is a schematic flow chart of a memory balancing method based on edge calculation according to an embodiment of the application.
S101, detecting the memory usage amount and the memory change rate of a plurality of edge computing devices and the network communication quality among the plurality of edge computing devices according to a preset period;
in this step, the system periodically monitors the memory usage of the edge computing device at certain time intervals, including the current memory usage and the rate of change of the memory usage. Meanwhile, the system also detects the network communication quality among a plurality of edge computing devices so as to select the optimal candidate device for data migration according to the communication quality. This step provides a decision basis for subsequent memory balancing operations.
The system can collect memory usage data in real time through monitoring agents deployed on each edge computing device and calculate an average rate of change over a range of time. Network communication quality can be assessed by periodically transmitting probe packets and counting metrics such as round trip delay and packet loss rate. The system gathers the collected data to form a global view reflecting the usage of the entire edge computing network resources.
When the number of edge devices is large, the collection and processing of the monitoring data may occupy a large amount of network bandwidth and computing resources. Therefore, the system can adopt a layered monitoring architecture, and the original data is locally aggregated and then reported to the central node. Meanwhile, the timeliness and the accuracy of monitoring data can be ensured and the resource expenditure can be reduced by setting reasonable data sampling frequency and data compression algorithm.
S102, calculating a memory release prediction time point of each edge computing device according to the memory change rate;
the system calculates a memory release prediction time point of each edge computing device according to the memory change rate, and specifically includes:
calculating the memory change trend of each edge computing device in a plurality of continuous preset periods;
dividing a memory release period according to the memory change trend, and marking a peak time point and a trough time point of the memory capacity in each memory release period;
And calculating the next memory release prediction time point by combining the memory usage at the current moment based on the time interval between the peak time point and the trough time point.
And the system predicts the change trend of the memory usage of each edge computing device in a period of time in the future according to the memory change rate data acquired in the step S101, and calculates the predicted memory release time point. The memory release prediction time point represents the predicted time when the memory usage of the current device falls below a certain threshold value and other device migration data can be received. Through the step, the system can plan the data migration scheme in advance, and optimize the resource scheduling efficiency.
The system analyzes the memory change condition of each device in a plurality of continuous periods and judges whether the change trend of each device continuously increases, continuously decreases or fluctuates. For the case of periodic fluctuation, the peaks and troughs of the memory usage can be further identified, and the peak-to-trough duration can be calculated. In combination with the current memory usage, the system can calculate the predicted time point for the next release of sufficient memory space.
The actual memory trend may be affected by many uncertain factors, such as rapid increase in memory usage caused by sudden task requests. To cope with this situation, the system may consider introducing confidence intervals, i.e. the probability that the memory release time points fall within a certain confidence interval, when predicting. When the confidence level does not meet the requirements, the priority and strategy of data migration can be adjusted accordingly. In addition, the system can record the historical load change rule of each edge node, and utilize a machine learning algorithm to conduct trend prediction, so that the prediction accuracy is improved.
S103, dividing the memory space of each edge computing device into a computing storage area and a temporary cache area;
The system divides the memory space of each edge computing device into a computing storage area and a temporary buffer area, wherein the temporary buffer area is used for temporarily storing the overload data migrated by other edge computing devices except the current edge computing device, and the computing storage area is used for data computing and storing of the current edge computing device.
The system logically divides the memory space of each edge computing device, one part is used as a computing storage area for executing the computing task distributed by the current device and storing the persistent data, and the other part is used as a temporary buffer area for receiving and storing the overload data migrated by other devices. By dividing the independent temporary buffer area, the influence of migration data on the calculation task of the current equipment is avoided, and unified management and recovery are convenient.
The memory space can be divided in a dynamic allocation mode, and the proportion of the calculation storage area and the temporary cache area is flexibly adjusted according to the memory use condition of the current equipment and the requirement of the migration data cache. For example, when the task of the device is less, the space of the temporary buffer area can be correspondingly increased, and when a large amount of migration data arrives, the space of a part of the calculation storage area can be temporarily occupied to store the data. In addition, for a device with a nonvolatile memory (such as an NVDIMM), a part of the space can be specially divided into temporary buffer areas, so that a larger buffer space can be provided, and data can be quickly recovered after the device is restarted.
In heterogeneous edge computing environments, there may be large differences in memory performance and access latency for different devices. In order to fully exert the memory capacity of each device, the system can consider the memory performance level of the device when dividing the temporary buffer area, and divide a larger buffer space on the device with higher memory performance. In addition, for some delay-sensitive migration data, the system may further divide a small cache area for storing the data, ensuring fast access.
S104, when any target edge computing device is detected to exist, selecting at least two candidate devices with optimal communication quality with the target edge computing device according to the network communication quality;
When the system detects that any target edge computing device exists, at least two candidate devices with optimal communication quality with the target edge computing device are selected according to the network communication quality, wherein the target edge computing device is an edge computing device with the memory usage exceeding a preset threshold.
When the system finds that the memory usage of a certain edge computing device (i.e., the target device) exceeds a preset threshold, it means that the device is already overloaded, and it is necessary to migrate part of the data to other devices to relieve the memory pressure. The system selects at least two devices with the best communication quality with the target device as destinations of migration data, called candidate devices, based on the network communication quality information collected in step S101. By selecting the equipment with optimal communication quality for data migration, the time delay and the packet loss rate of data transmission can be reduced, and the migration efficiency is improved.
The system comprehensively considers a plurality of indexes such as network delay, bandwidth, packet loss rate and the like to evaluate the communication quality between the edge devices. For example, a score for each indicator may be calculated and then weighted and summed to yield a composite communication quality score. In order to avoid the influence of the abnormal value of the individual index on the result, reasonable upper and lower limit thresholds can be set, and the values exceeding the range can be truncated. When selecting the candidate device, the device with the highest comprehensive communication quality score is preferentially selected. To improve the reliability of data migration, the system selects at least two candidate devices, and may switch to an alternative candidate device when the preferred candidate device is unable to receive or store the migrated data.
S105, sorting the candidate devices from the morning to the evening according to the corresponding memory release prediction time points to obtain a candidate device queue;
After selecting the candidate devices meeting the communication quality requirement, the system further sorts the candidate devices according to the predicted memory release time point (i.e. the calculation result in step S102) of each candidate device, so as to form a candidate device queue. The candidates placed in front of the queue, which expects a relatively early memory release time point, may receive and store the migration data faster, while the candidates placed in back, which have a later memory release time, may alternatively continue to receive data when the memory of the previous candidate is filled. Through this ordering mechanism, data migration may more efficiently utilize memory resources of different candidate devices.
The system sorts the predicted time points of memory release of candidate devices from early to late, and basic sorting algorithms such as bubble sorting, selection sorting, etc. may be used. Considering the requirement of the edge scene on the real-time performance, a non-comparison sort sorting algorithm with lower calculation complexity, such as bucket sorting, counting sorting and the like, can be adopted. In the sorting process, if the memory release time points of the candidate devices are the same, the memory space sizes of the candidate devices can be further compared, and the devices with larger space are preferentially selected. The generated candidate device queue can be stored in a memory or can be persisted to a disk so as to quickly recover after the system is restarted.
The prediction of the memory release time of the candidate device may have a certain error, and if the data migration is completely arranged according to the sequence of the predicted time points, the situation that the data migration is to the device with the predicted earlier but actual release time later, and the device with the predicted later but actual earlier release of the memory is idle may occur. To avoid this, the system may evaluate the priority of the device in combination with the predicted point in time and the predicted confidence when generating the candidate device queue. For devices with higher confidence in the predictions, the priority is relatively high, while for devices with lower confidence, the ranking position can be reduced appropriately even if the prediction time is early. This reduces the influence of prediction errors to some extent.
S106, respectively migrating the overload data of the target edge computing device to the temporary buffer areas of each candidate device in the candidate device queue according to the memory release prediction time points of each candidate device in the candidate device queue;
The system respectively migrates the overload data of the target edge computing device to temporary buffer areas of candidate devices in the candidate device queue, and specifically comprises the following steps:
Obtaining the residual duration of each candidate device distance corresponding to the memory release prediction time point and the residual capacity of the temporary buffer area in the candidate device queue;
calculating the time weight of each candidate device according to the residual duration;
Calculating the data bearing coefficient of each candidate device based on the time weight and the residual capacity, wherein the data bearing coefficient is positively correlated with the time weight and the residual capacity;
Partitioning overload data of the target edge computing equipment according to a preset data block size to obtain a plurality of data blocks;
based on the data bearing coefficient of each candidate device, distributing a plurality of data blocks to each candidate device in a weighted polling mode;
Combining the data blocks with access frequency difference smaller than a preset value into a data group for the data blocks allocated to each candidate device;
Establishing a plurality of parallel data transmission channels, and setting different transmission priorities in each data transmission channel, wherein the transmission priorities are positively correlated with the access frequency of a corresponding transmitted data group;
and transmitting each data group to the temporary buffer area of the corresponding candidate equipment in parallel through the data transmission channel, and storing each data group in the temporary buffer area according to the order of the access frequency from high to low.
According to the candidate device queue generated in step S105, the system migrates the overload data of the target edge computing device to the temporary buffer area of the candidate device in batches. In specific migration, the system is based on the predicted time point of memory release of the candidate device, and migrates data to the candidate device arranged in front of the queue, where the candidate device can release the memory to receive the data earlier. After the memory of the previous candidate device is filled, the memory is migrated to the next candidate device. By the method, memory resources of different candidate devices can be fully utilized, data backlog is reduced, and the overall service quality of the edge computing system is improved.
When data is migrated, the system firstly acquires the memory use condition of each candidate device and determines the size of the currently available temporary buffer area. Based on the available buffer size and the memory release time point, the system may further estimate the amount of data that each candidate device may receive before the next memory release time point. When the overload data is migrated, the system takes the preset data block size as a unit, divides a large data set into a plurality of small data blocks, and then distributes the data blocks to temporary buffer areas of candidate devices in sequence according to the receiving capacity of the candidate devices. For sliced data blocks, content-based addressing may be used for identification for quick positioning during subsequent accesses. Meanwhile, in order to improve the efficiency of data migration, the system can also select a proper data transmission path and protocol according to the network topology structure and the load condition.
In an actual edge computation scenario, there may be a large difference in access frequency of different data blocks. In order to optimize the data access performance, the system can consider that when data is migrated, data blocks with similar access frequencies are migrated to a temporary buffer area of the same candidate device to form access locality, so that data access of cross devices is reduced. In addition, for the data block with very high access frequency, a multi-copy strategy can be adopted to copy the data block into a plurality of candidate devices, so that the data redundancy is improved, and meanwhile, the access pressure of a single device is reduced. For the data blocks with lower access frequency, the modes of data compression, redundancy deletion and the like can be considered to save the storage space and the transmission bandwidth.
S107, before the memory release prediction time point of any candidate device in the candidate device queue arrives, controlling the target edge computing device to read corresponding overload data from the temporary cache area of the candidate device;
when the target edge computing device needs to access the overload data which has been migrated to the candidate device, the system selects proper time to read the data from the temporary cache area of the candidate device according to the memory release prediction time point recorded in the candidate device queue. Ideally, the data read occurs before the predicted memory release time point of the candidate device, at which time the memory of the candidate device has not been released yet, and the data is still valid. In this way, the target device can continue to use the migrated overload data without affecting the continuity of the service due to the migration of the data.
The system maintains a timer for each candidate device, the triggering time of the timer being set to the predicted memory release time point of the corresponding candidate device. When the timer is about to expire, the system sends a notification to the target device prompting it to read the overload data on the candidate device as soon as possible. After receiving the notification, the target device can selectively read part or all of the overload data according to the actual data access requirement. In order to improve the efficiency of data reading, the system can arrange and package the data to be read in the temporary buffer area of the candidate device in advance, so that the cost of data searching and transmission is reduced. Meanwhile, considering the uncertainty of network transmission, the system can also set a receiving buffer area locally in the target equipment for temporarily storing the data read from the candidate equipment and processing the data after the data is completely received.
S108, the read overload data are migrated to a calculation storage area, in which the memory usage amount in the plurality of edge calculation devices is lower than a preset threshold value.
After the target edge computing device reads the overload data from the temporary cache area of the candidate device, in order to thoroughly relieve the memory pressure of the target device, the system further migrates the read data to a computing storage area with lower memory usage in other edge computing devices. Unlike temporarily storing data in a cache of a candidate device, data migration herein is a long-term, persistent store. By storing the overload data into a plurality of edge devices in a scattered way, load balancing among the devices can be realized, and the advantages of the distributed system are fully exerted.
The system monitors the memory use condition of each edge computing device in real time, and identifies the device with the memory use amount lower than the preset threshold (such as 20%) and uses the device as the migration target of the overload data. During data migration, the system comprehensively considers the factors such as the memory capacity, the current load, the communication quality with a data source and the like of target equipment, and selects an optimal migration strategy. For example, the device with large memory capacity, low load and good communication quality can be selected as the first choice, or related data blocks are migrated to the same device according to the access frequency and the association degree of the data blocks, so that the access locality is improved. In the migration process, the system adopts an incremental synchronization mode, and the repeated transmission of the existing data blocks is avoided. Meanwhile, in order to ensure data consistency, reconciliation and verification can be performed between the source device and the target device after migration is completed.
In the above embodiment, by periodically detecting the memory usage condition and the network communication quality of the edge computing device, and predicting the memory release time point in combination with the memory change rate, the data migration policy may be planned in advance. When the memory overload of the target edge computing equipment is found, the optimal candidate equipment is selected based on the network communication quality, and the candidate equipment is ordered according to the memory release prediction time point, so that the network transmission efficiency of data migration can be improved. By storing overload data in the temporary buffer areas of a plurality of candidate devices in a scattered manner and timely reading and reassigning the overload data before the memory release prediction time point arrives, the problem of overlarge memory pressure of a single device is solved, and the risk of data loss caused by insufficient memory of the candidate devices is reduced. And finally, the overload data is migrated to a calculation storage area with sufficient memory, so that the memory load balancing among edge calculation devices is realized, and the efficiency of the memory load balancing is improved.
In the above embodiment, the system realizes basic memory load balancing by monitoring and dynamically adjusting the memory usage of the edge computing device in real time. However, in an actual application scenario, the memory load of the edge computing device may exhibit a regular fluctuation trend, and if only the memory is passively adjusted when the memory is overloaded, the problem of the memory pressure of the linkage may not be effectively prevented. Therefore, there is a need for further optimization of the memory balancing mechanism of the system to provide active prediction and preventive regulation capabilities. Another memory balancing method based on edge computation in the embodiment of the present application is described below with reference to fig. 2:
Fig. 2 is a schematic flow chart of a memory balancing method based on edge calculation according to an embodiment of the application.
S201, acquiring memory load data of each edge computing device in a plurality of continuous preset periods;
In the step, the system acquires time sequence data reflecting the change of the memory load by continuously monitoring the memory use condition of each edge computing device in a period of time. The data includes indexes such as memory usage, memory occupancy, memory allocation and release frequency in each preset period. By analyzing the data of a plurality of continuous periods, the system can find the fluctuation rule and trend of the memory load and provide basis for subsequent prediction and adjustment.
The system can deploy a monitoring agent program on each edge computing device, periodically collect the memory use condition, and report the collected data to the central node. To reduce the overhead of data transfer, the monitoring agent may locally pre-process the original data, such as compression, filtering, aggregation, etc. After receiving the memory load data of each device, the central node stores the memory load data in a time sequence database and indexes the memory load data according to the device ID and the time stamp, so that the subsequent query and analysis are convenient. Considering that the memory load of the edge device may show a periodic rule, such as peak-to-valley change every day, the system may cover at least one complete period when selecting data, so as to improve the accuracy of analysis.
S202, determining a load fluctuation period based on memory load data, and dividing the load fluctuation period into a plurality of continuous time windows;
After the memory load time sequence data of each edge computing device are obtained, the system determines the fluctuation period of the memory load by analyzing the periodic characteristics of the data. The period of fluctuation reflects the regularity of the memory load changes, which may be daily, weekly, monthly, etc. After the period of the fluctuation is determined, the system divides it into several consecutive time windows, each covering a portion of the period of the fluctuation period. Through dividing the time window, the memory load change trend in a long time range can be decomposed into a plurality of short-term change fragments, so that finer analysis and prediction can be conveniently carried out later.
The system may use a variety of timing analysis methods to determine the period of memory load fluctuations, such as fourier transforms, autocorrelation analysis, and the like. These methods can help identify periodic components in the time series data, resulting in dominant period lengths. In practical applications, considering that the fluctuation of the memory load may be affected by multiple factors, complex features of superposition of multiple periods are presented, the system may select a multi-scale analysis method, such as wavelet transform, and extract periodic signals on different time scales. After determining the fluctuation period, the system equally divides the fluctuation period into continuous time slices according to the length of the time window. The length of the time window can be set according to actual requirements, and is long enough to cover the complete load change process and short enough to ensure the timeliness of prediction.
S203, predicting the memory load transfer trend of each edge computing device in a time window;
the system predicts the memory load transfer trend of each edge computing device in a time window, and specifically comprises the following steps:
calculating the memory usage rate change rate and the memory release rate of each edge computing device in the current time window;
calculating a net growth rate of the memory load based on the memory usage rate and the memory release rate;
judging a memory load transfer direction according to the positive and negative of the memory load net growth rate, and determining a memory load transfer speed based on the absolute value of the memory load net growth rate;
And taking the memory load transfer direction and the memory load transfer speed as characterization parameters to obtain a memory load transfer trend.
For each divided time window, the system analyzes the memory use condition of each edge computing device and predicts the memory load transfer trend between devices in the window period. The memory load transfer trend reflects the direction and speed of memory pressure transfer between devices. By analyzing the rate of change of the memory usage and the memory release rate, the system can determine whether the memory pressure of each device is gradually accumulated or gradually relieved, and how fast the pressure changes. Based on the above, the system can predict how the memory load between the devices will shift, and provides decision basis for the subsequent active adjustment.
In each time window, the system first calculates the memory usage rate and the memory release rate of each edge computing device. The memory usage rate reflects the rate of increase or decrease of memory occupancy, and can be calculated by comparing the memory usage at the current time with the memory usage at the previous time. The memory release rate reflects the recovery speed of the memory space and can be calculated by counting the memory release request times and the released memory amount in a period of time. After the two indexes are obtained, the system can calculate the net length increase rate of the memory load, namely the difference between the memory usage rate and the memory release rate. The positive and negative of the net growth rate can be used to determine the direction of the transfer of the memory load, and the magnitude of its absolute value can be indicative of the speed of the transfer. The system takes the memory load transfer direction and speed of each device as characterization parameters, synthesizes the performances of each device, and obtains the memory load transfer trend of the whole edge computing environment.
S204, calculating the probability that each edge computing device becomes a target edge computing device when the current time window is finished according to the memory load transfer trend;
after predicting the memory load transfer trend of each edge computing device, the system further calculates the probability that each device becomes the target edge computing device (i.e., the device whose memory load needs to be data transferred) at the end of the current time window. By analyzing the memory load change of the device in the time window, particularly the memory usage approaching the upper limit of the device's own memory, the system can estimate the likelihood that the device will have memory pressure at the end of the window period and will need to release data. The calculation result of the probability can help the system identify high-risk equipment in advance, so that preventive measures can be taken before problems occur.
The system may employ various probability calculation models to estimate the probability that the device becomes the target edge computing device, such as logistic regression, naive bayes, etc. The models perform risk assessment and probability scoring on the devices by comprehensively considering a plurality of characteristic dimensions affecting memory loads. The input characteristics may include a baseline level of memory usage for the device, an amplitude of fluctuation in memory usage, a rate of increase in memory load, an amount of free memory, etc. In addition, if there is available a priori knowledge, such as the hardware configuration of the device, the type of service being responsible, etc., it may also be used as a reference for the evaluation. Through statistical analysis of the historical data, the system can obtain the correlation of each feature and the equipment serving as target edge computing equipment, and train an optimization probability computing model according to the correlation. In the application stage, the model takes memory load data in the current time window as input, and the risk probability of each device at the end of the window period is estimated.
S205, when the probability distance preset critical probability interval is smaller than a preset probability threshold value, reversely distributing the overload data.
When the probability distance preset critical probability interval is smaller than the preset probability threshold value, the system performs reverse distribution on the overload data, and specifically comprises the following steps:
Obtaining the residual capacity of a calculation storage area of each edge calculation device and the current service processing load;
calculating the data receiving capability index of each edge computing device according to the residual capacity of the computing storage area and the current service processing load, wherein the method specifically comprises the following steps:
converting the residual capacity of the calculated storage area into a normalized capacity score;
Calculating the busyness of the business according to the current business processing load, and converting the busyness of the business into a standardized load score;
Setting different weights for the normalized capacity score and the normalized load score;
Subtracting the product of the normalized load score and the corresponding weight from the product of the normalized capacity score and the corresponding weight to obtain a data receiving capacity index;
grouping edge computing devices based on the data receiving capability index to obtain a plurality of target receiving groups;
Calculating the data receiving quota of each target receiving group, wherein the data receiving quota is positively correlated with the average value of the data receiving capacity indexes of all edge computing devices in the target receiving group;
and determining a reverse distribution scheme of the overload data according to the data receiving quota so that the migration direction of the overload data is opposite to the current memory load transfer direction.
And the system judges whether the memory load of the edge computing equipment needs to be actively regulated according to the probability result calculated in the last step. When the probability that the device becomes the target edge computing device approaches a preset critical probability interval (e.g., 70% -80%), that is, when the probability is smaller than a preset threshold from the boundary of the critical interval, the system considers that the risk of the device that the memory pressure occurs at the end of the current time window is higher, and needs to take preventive measures in advance. At this time, the system will migrate partial overload data on the device to other devices with lower loads in a reverse distribution manner, so as to relieve the memory pressure of the device and avoid performance degradation or service interruption caused by too high pressure.
Upon triggering the reverse distribution of data, the system first evaluates the data-receiving capabilities of the devices in the current edge computing environment in order to reasonably select the destination of the data migration. The system comprehensively considers the factors such as the residual capacity of a calculation storage area of the equipment, the current service processing load and the like, and scores each equipment in a weighted scoring mode to obtain an index representing the data receiving capacity. The index considers the free memory capacity of the equipment on one hand and the real-time business busyness of the equipment on the other hand so as to avoid the influence of data migration on the normal business of the equipment. Then, the system groups the devices according to the data receiving capability index to divide a plurality of target receiving groups with similar data receiving capability.
In the above embodiment, the historical load data of the edge computing device is analyzed, the load fluctuation period is identified, and the time window is divided. And predicting the memory load transfer trend in a time window, and calculating the probability that each device becomes a target edge computing device, so that the system can discover potential memory pressure problems in advance. When the prediction probability is close to a critical value, the reverse data distribution strategy is implemented to enable the migration direction of overload data to be opposite to the current memory load transfer direction, so that the memory loads of all devices in the system are balanced, the problem of the memory pressure of local device groups in linkage can be prevented, and the load balancing capacity and the running stability of the whole edge computing system are improved.
The following describes a system in the embodiment of the present application from the perspective of hardware processing, please refer to fig. 3, which is a schematic diagram of a physical device structure of a memory balancing system based on edge computation according to the embodiment of the present application.
It should be noted that the structure of the system shown in fig. 3 is only an example, and should not impose any limitation on the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 3, the system includes a central processing unit (Central Processing Unit, CPU) 301 that can perform various appropriate actions and processes, such as performing the methods in the above-described embodiments, according to a program stored in a Read-Only Memory (ROM) 302 or a program loaded from a storage section 308 into a random access Memory (Random Access Memory, RAM) 303. In the RAM303, various programs and data required for the system operation are also stored. The CPU301, ROM302, and RAM303 are connected to each other through a bus 304. An Input/Output (I/O) interface 305 is also connected to bus 304.
Connected to the I/O interface 305 are an input section 306 including a camera, an infrared sensor, and the like, an output section 307 including a Liquid crystal display (Liquid CRYSTAL DISPLAY, LCD), a speaker, and the like, a storage section 308 including a hard disk, and the like, and a communication section 309 including a network interface card such as a LAN (Local Area Network) card, a modem, and the like. The communication section 309 performs communication processing via a network such as the internet. The drive 310 is also connected to the I/O interface 305 as needed. A removable medium 311 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed on the drive 310 as needed, so that a computer program read therefrom is installed into the storage section 308 as needed.
In particular, according to embodiments of the present invention, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising a computer program for performing the method shown in the flowchart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 309, and/or installed from the removable medium 311. When the computer program is executed by a Central Processing Unit (CPU) 301, various functions defined in the present invention are performed.
It should be noted that, the computer readable medium shown in the embodiments of the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of a computer-readable storage medium may include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-Only Memory (ROM), an erasable programmable read-Only Memory (Erasable Programmable Read Only Memory, EPROM), a flash Memory, an optical fiber, a portable compact disc read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with a computer-readable computer program embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. Where each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
As another aspect, the present invention also provides a computer-readable storage medium, which may be included in the system described in the above embodiment, or may exist alone without being assembled into the system. The storage medium carries one or more computer programs which, when executed by a processor of a system, cause the system to implement the methods provided in the embodiments described above.
While the application has been described in detail with reference to the foregoing embodiments, it will be understood by those skilled in the art that the foregoing embodiments may be modified or equivalents may be substituted for some of the features thereof, and that the modifications or substitutions do not depart from the spirit of the embodiments.
As used in the above embodiments, the term "when..is" may be interpreted as "if..is" or "after..is" or "in response to determining..is" or "in response to detecting..is" depending on the context. Similarly, the phrase "when determined" or "if detected (a stated condition or event)", depending on the context, may be interpreted as "if determined" or "in response to a determination" or "when detected (a stated condition or event)" or "in response to detection (a stated condition or event)".
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present application, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by a wired (e.g., coaxial cable, fiber optic, digital subscriber line), or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk), etc.
Those of ordinary skill in the art will appreciate that implementing all or part of the above-described method embodiments may be accomplished by a computer program to instruct related hardware, the program may be stored in a computer readable storage medium, and the program may include the above-described method embodiments when executed. The storage medium includes a ROM or a random access memory RAM, a magnetic disk or an optical disk, and other various media capable of storing program codes.