Online container scheduling method, system and terminal based on edge computing
Optimizing container caching and scheduling through the online container scheduling algorithm solves the high startup delay and memory consumption problems caused by resource limitations in edge computing, and achieves more efficient resource utilization.
Patent Information
- Application Number
- CN202410926682.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2044-07-11
AI Technical Summary
Due to resource limitations in edge computing, existing technologies cannot make reasonable container scheduling decisions, resulting in large memory consumption, high startup delays, and low resource utilization efficiency.
By obtaining the execution results of serverless functions, obtaining container status information, calculating the startup delay and memory cost of the target container, using online container scheduling algorithms to make decisions, optimizing container caching and scheduling, and reducing overall system costs.
It minimizes the overall system cost, improves the resource utilization efficiency of edge servers, and is suitable for heterogeneous edge computing environments.
Smart Images

Figure CN118467184B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of container scheduling, and in particular to an online container scheduling method, system, terminal and storage medium based on edge computing. Background Art
[0002] Extending serverless computing to edge computing is one way to support edge services. Serverless computing achieves scalability by breaking down complex monolithic applications into smaller functions, all of which are implemented by container technology. In this model, each function call triggers the launch of the corresponding container to host and execute the function; after execution, the container becomes idle and is recycled to save hardware resources. However, the launch of containerized functions requires a lot of initialization operations, resulting in cold start delays. Therefore, reducing cold start delays in edge computing is of great significance.
[0003] At present, the existing method is to use container caching to reduce cold start delay, by caching the entire idle container to provide services for subsequent function calls, but the cached container consumes a lot of memory resources, which is not conducive to resource-constrained edge devices; then the container is replaced with a zygote container (child container) to improve memory efficiency. Compared with the container, the zygote container cannot directly run the function. Since different functions often share public packages, the zygote container can be used as the "parent container" of multiple functions; when calling, the function can import the required private package into the zygote container, and there is no need to create a corresponding container to host the function, but it will consume memory resources; after the introduction of the zygote container, the container scheduling decision needs to be reconsidered, and the container caching decision is as follows: first, the entire container is cached, but a lot of memory will be consumed; second, the cache is a zygote container, which will bring a relatively small startup delay to subsequent functions and consume memory resources; third, if it is not cached, the container will be recycled and will not consume memory, but the cold start delay of subsequent functions will be large. However, given the resource limitations of edge servers, it is currently impossible to make reasonable container scheduling decisions, which consumes a lot of memory and has a high startup delay, resulting in low resource utilization efficiency of edge servers.
[0004] Therefore, the prior art still needs to be improved and developed. Summary of the invention
[0005] The main purpose of the present invention is to provide an online container scheduling method, system and terminal based on edge computing, aiming to solve the problem of resource limitations on edge servers in the prior art, inability to make reasonable container scheduling decisions, thereby consuming a large amount of memory, and having a high startup delay, resulting in low resource utilization efficiency of edge servers.
[0006] To achieve the above object, the present invention provides an online container scheduling method based on edge computing, and the online container scheduling method based on edge computing comprises the following steps:
[0007] When edge computing is performed on the edge cluster, multiple serverless functions for edge computing are obtained, all the serverless functions are distributed to each server of the edge cluster, and function execution results are obtained;
[0008] Acquire container status information according to the function execution result, perform cache decision processing on the target container of the edge cluster according to the container status information to obtain a decision processing result, and calculate a target startup delay and a target memory cost of the target container according to the decision processing result;
[0009] A target overall cost is calculated according to the target startup delay and the target memory cost, a decision is made on the target overall cost according to an online container scheduling algorithm to obtain a target container cache decision, and container scheduling is performed according to the target container cache decision to obtain a target scheduling result.
[0010] Optionally, the online container scheduling method based on edge computing, wherein when edge computing is performed on an edge cluster, multiple serverless functions for edge computing are obtained, all the serverless functions are distributed to each server of the edge cluster, and function execution results are obtained, specifically including:
[0011] When edge computing is performed on the edge cluster, multiple serverless functions for edge computing are obtained, and all the serverless functions are matched with the servers of the edge cluster to obtain a matching result;
[0012] Distribute each of the serverless functions to a corresponding server according to the matching result, each server starts a corresponding container according to the serverless function, and executes all of the serverless functions in the corresponding container according to the first condition and the second condition to obtain a function execution result.
[0013] Optionally, in the online container scheduling method based on edge computing, the first condition is:
[0014] ;
[0015] ;
[0016] ;
[0017] The second condition is:
[0018] ;
[0019] in, For the server, For the moment, and All are of type, for New containers are created on the server all the time and recycled The number of containers of type, for Always cached on the server The number of containers of type, For Distributed to the server at all times The number of type functions, for Created on the server at the moment The number of zygote containers of type container, for Always cached on the server The number of type zygote containers, are disjoint subsets of containers, is the set of containers in the edge cluster. for Memory consumption when caching type containers, For the zygote container set, for Memory consumption when caching type zygote container, The memory capacity of the server.
[0020] Optionally, the online container scheduling method based on edge computing, wherein the container status information is obtained according to the function execution result, a cache decision process is performed on the target container of the edge cluster according to the container status information to obtain a decision process result, and a target startup delay and a target memory cost of the target container are calculated according to the decision process result, specifically including:
[0021] If the function execution result is completion, the obtained container status information is that the target container is in an idle state, and a cache decision process is performed on the target container according to the container status information to obtain a decision process result, wherein the decision process result includes any one of caching the entire container, caching child containers, and not caching;
[0022] Calculate a first number of cache containers according to the decision processing result and the first formula, and calculate a second number of cache child containers according to the decision processing result and the second formula;
[0023] A target startup delay of the target container is calculated according to a third formula, and a target memory cost of the target container is calculated according to a fourth formula, wherein the target startup delay includes a startup delay corresponding to the first number of containers and a startup delay corresponding to the second number of child containers, and the target memory cost includes a memory consumption of the first number of containers and a memory consumption of the second number of child containers.
[0024] Optionally, in the online container scheduling method based on edge computing, the first formula is:
[0025] ;
[0026] The second formula is:
[0027] ;
[0028] The third formula is:
[0029] ;
[0030] The fourth formula is:
[0031] ;
[0032] in, is the first quantity, which is equal to Always cached on the server The number of containers of type, is the second quantity, which is equal to Always cached on the server The number of type zygote containers, for Distributed to the server at all times The number of type functions, for Always cached on the server The number of containers of type, for Always cached on the server as a zygote container The number of containers of type, for Recycled on the server at all times The number of containers of type, for New containers are created on the server all the time and recycled The number of containers of type, for Always cached on the server The number of type zygote containers, for Recycled on the server at all times The number of type zygote containers, for Created on the server at the moment The number of zygote containers of type container, For the server set, Start delay for target, For the follow-up Type function call, zygote container imports private package to create corresponding container startup delay, To start from scratch The cold start delay of the container type, is the target memory cost.
[0033] Optionally, the online container scheduling method based on edge computing, wherein the target overall cost is calculated according to the target startup delay and the target memory cost, a decision is made on the target overall cost according to an online container scheduling algorithm to obtain a target container cache decision, and container scheduling is performed according to the target container cache decision to obtain a target scheduling result, specifically including:
[0034] Calculate the target startup delay and the target memory cost to obtain a target overall cost, and decompose the target overall cost according to an online container scheduling algorithm to obtain a first sub-cost and a second sub-cost;
[0035] Performing configuration calculation on the edge cluster according to the first sub-cost to obtain a target configuration, performing constant acquisition on a uniform distribution of the edge cluster to obtain a target constant, and performing policy sampling on the target configuration according to the target constant to obtain a target container cache decision;
[0036] The target container cache decision is allocated according to the second sub-cost to obtain an allocation result, and container scheduling is performed according to the allocation result to obtain a target scheduling result.
[0037] Optionally, the online container scheduling method based on edge computing, wherein the container scheduling is performed according to the allocation result to obtain a target scheduling result, and then further includes:
[0038] Monitoring the execution time of the container according to the target scheduling result to obtain a monitoring result, and determining whether the execution time of the container exceeds a preset time according to the monitoring result;
[0039] If the execution time of the container exceeds the preset time, a target time point is obtained, and the execution state of the container is converted at the target time point according to the target container cache decision.
[0040] Optionally, in the online container scheduling method based on edge computing, the online container scheduling system based on edge computing includes:
[0041] A function distribution module is used to obtain multiple serverless functions for edge computing when edge computing is performed on an edge cluster, distribute all of the serverless functions to each server of the edge cluster, and obtain function execution results;
[0042] A cost calculation module, used to obtain container status information according to the function execution result, perform cache decision processing on the target container of the edge cluster according to the container status information, obtain a decision processing result, and calculate a target startup delay and a target memory cost of the target container according to the decision processing result;
[0043] The container scheduling module is used to calculate the target overall cost according to the target startup delay and the target memory cost, make a decision on the target overall cost according to the online container scheduling algorithm, obtain a target container cache decision, and schedule the container according to the target container cache decision to obtain a target scheduling result.
[0044] In addition, to achieve the above-mentioned purpose, the present invention also provides a terminal, wherein the terminal includes: a memory, a processor, and a program stored in the memory and executable on the processor, and when the program is executed by the processor, the steps of the online container scheduling method based on edge computing as described above are implemented.
[0045] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores an online container scheduling program based on edge computing, and when the online container scheduling program based on edge computing is executed by a processor, the steps of the online container scheduling method based on edge computing as described above are implemented.
[0046] In the present invention, when edge computing is performed on an edge cluster, multiple serverless functions for edge computing are obtained, and all the serverless functions are distributed to each server of the edge cluster to obtain the function execution result; container status information is obtained according to the function execution result, and cache decision processing is performed on the target container of the edge cluster according to the container status information to obtain the decision processing result, and the target startup delay and target memory cost of the target container are calculated according to the decision processing result; the target overall cost is calculated according to the target startup delay and the target memory cost, and the target overall cost is determined according to the online container scheduling algorithm to obtain the target container cache decision, and the container is scheduled according to the target container cache decision to obtain the target scheduling result. The present invention proposes a joint optimization problem including function distribution, container startup and container caching, taking into account the container startup delay, memory cost and resource limitations of the edge server, decomposing the overall system cost, and then analyzing the random strategy from the perspective of a single container, and adjusting the random strategy of the container according to the global information, thereby minimizing the overall system cost; it is also tested based on real data sets, has strong generalization ability, and can be applied to various heterogeneous edge computing environments. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 It is a flow chart of a preferred embodiment of the online container scheduling method based on edge computing in the present invention;
[0048] Figure 2 It is a flow chart of the OCS algorithm of the preferred embodiment of the present invention;
[0049] Figure 3 It is a flow chart of the FDCS algorithm of a preferred embodiment of the present invention;
[0050] Figure 4 It is a flow chart of the ARS algorithm of the preferred embodiment of the present invention;
[0051] Figure 5 It is a flow chart of the TS algorithm of the preferred embodiment of the present invention;
[0052] Figure 6 is a schematic diagram of the overall cost of each algorithm in a preferred embodiment of the present invention at different time sequences;
[0053] Figure 7 is a schematic diagram of the overall cost of each algorithm under different weights in a preferred embodiment of the present invention;
[0054] Figure 8 is a schematic diagram of the memory cost of each algorithm under different weights in a preferred embodiment of the present invention;
[0055] Fig. 9 is a schematic diagram of average delay of each algorithm under different weights in a preferred embodiment of the present invention;
[0056] Fig.10 It is a schematic diagram of the principle of a preferred embodiment of an online container scheduling system based on edge computing in the present invention;
[0057] Fig.11 It is a schematic diagram of the operating environment of a preferred embodiment of the terminal of the present invention. DETAILED DESCRIPTION
[0058] In order to make the purpose, technical solution and advantages of the present invention clearer and more specific, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0059] It should be noted that if the embodiments of the present invention involve directional indications (such as up, down, left, right, front, back...), the directional indications are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.
[0060] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present invention, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or suggesting their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0061] The online container scheduling method based on edge computing described in the preferred embodiment of the present invention is as follows: Figure 1 As shown, the online container scheduling method based on edge computing includes the following steps:
[0062] Step S10: When edge computing is performed on the edge cluster, multiple serverless functions for edge computing are obtained, and all of the serverless functions are distributed to each server of the edge cluster to obtain function execution results.
[0063] The step S10 comprises:
[0064] Step S11: when edge computing is performed on the edge cluster, multiple serverless functions for edge computing are obtained, and all the serverless functions are matched with the servers of the edge cluster to obtain a matching result;
[0065] Step S12: Distribute each of the serverless functions to a corresponding server according to the matching result; each server starts a corresponding container according to the serverless function; and executes all the serverless functions in the corresponding container according to the first condition and the second condition to obtain a function execution result.
[0066] Specifically, when edge computing is performed on an edge cluster, the configuration of the edge cluster is considered, including a server set, using For example, 10 servers, each with limited memory capacity, are represented by For example, the memory capacity of each server is set to [32, 64] GB; the edge cluster works in a discrete time mode, where the time span is expressed as Indicates that each The duration of the moment is determined by the function call pattern, ensuring that each function (i.e., serverless function) can be served within a time slot; the edge cluster also includes a container set, which is used It is worth noting that each container uniquely corresponds to a specific serverless function, so that It can also represent a serverless function set; wherein the edge cluster also includes a zygote container set, using Indicates that the zygote container is the "parent container" of some containers, including a base container and pre-imported common packages shared between zygote containers; then divide the container set into disjoint subsets, using Represents that these containers are in each subset Therefore, Type zygote container can be used as The "parent container" of the container in the edge cluster is created by importing the private package of the container; in an embodiment of the present invention, 200 software packages are used to build 100 serverless functions, and these serverless functions share 30 zygote containers. Because the most basic container requires 15MB of memory, the container size in this edge cluster is [25, 50] MB, and the corresponding zygote container size is [20, 35] MB. The cold start delay of the container is set to [1.2, 3.7] seconds, and the startup delay of the container's imported private package is set to [0.1, 0.8] seconds. Afterwards, according to the demand for edge computing of the edge cluster, multiple serverless functions for edge computing are obtained, and all the serverless functions are matched with the servers of the edge cluster to obtain matching results. The purpose of matching is to distribute the serverless functions to the appropriate servers; each serverless function is distributed to the corresponding server according to the matching results. During the distribution process, it must be ensured that each serverless function call is distributed to a server, that is:
[0067] ;
[0068] in, for Distributed to the server at all times The number of type functions, for Generated at all times The number of type function calls, For type, is an arbitrary symbol; after that, each server starts the corresponding container to host and execute the distributed serverless function; during the execution process, two conditions need to be met, namely the first condition and the second condition, and the first condition is:
[0069] ;
[0070] ;
[0071] ;
[0072] in, for New containers are created on the server all the time and recycled The number of containers of type, for Always cached on the server The number of containers of type, for Distributed to the server at all times The number of type functions, for Created on the server at the moment The number of zygote containers of type container, for Always cached on the server The number of type zygote containers, is of type; that is, ensure The number of unused cache containers should not exceed 100%, and ensure No more than Assigned to the server The number of type functions must not exceed Always cached on the server The number of type zygote containers; the second condition is:
[0073] ;
[0074] in, for Memory consumption when caching type containers, for Memory consumption generated when zygote container type is cached; that is, due to the limited memory capacity of the server, the memory usage of the container and zygote container on the server should not exceed the memory capacity to ensure the stability of subsequent edge computing.
[0075] Step S20: Obtain container status information according to the function execution result, perform cache decision processing on the target container of the edge cluster according to the container status information to obtain a decision processing result, and calculate the target startup delay and target memory cost of the target container according to the decision processing result.
[0076] The step S20 comprises:
[0077] Step S21: If the function execution result is completed, the obtained container status information is that the target container is in an idle state, and a cache decision process is performed on the target container according to the container status information to obtain a decision process result, wherein the decision process result includes any one of caching the entire container, caching child containers, and not caching;
[0078] Step S22: Calculate a first number of cache containers according to the decision processing result and the first formula, and calculate a second number of cache child containers according to the decision processing result and the second formula;
[0079] Step S23: Calculate the target startup delay of the target container according to the third formula, and calculate the target memory cost of the target container according to the fourth formula.
[0080] Specifically, in an embodiment of the present invention, after each server starts a corresponding container to execute the distributed serverless function, a corresponding execution result is obtained. If the function execution result is an incomplete execution, the execution continues; if the function execution result is a completed execution, the obtained container status information is an idle state of the target container processing, wherein the target container refers to a container that has completed the execution of the serverless function; thereafter, for the idle container, a corresponding cache decision processing needs to be made, that is, a cache decision processing is performed on the target container according to the container status information to obtain a decision processing result, wherein the decision processing result includes caching the entire container, caching child containers, and not caching any one of them; a first number of cache containers is calculated according to the decision processing result and a first formula, and a second number of cache child containers is calculated according to the decision processing result and a second formula, wherein the first formula is:
[0081] ;
[0082] The second formula is:
[0083] ;
[0084] in, is the first quantity, which is equal to Always cached on the server The number of containers of type, is the second quantity, which is equal to Always cached on the server The number of type zygote containers, for Distributed to the server at all times The number of type functions, for Always cached on the server The number of containers of type, for Always cached on the server as a zygote container The number of containers of type, for Recycled on the server at all times The number of containers of type, for New containers are created on the server all the time and recycled The number of containers of type, for Always cached on the server The number of type zygote containers, For Recycled on the server at all times The number of type zygote containers, for Created on the server at the moment The number of zygote containers of type container.
[0085] Caching the entire container or zygote container on the server will incur a corresponding memory cost, but the benefit of doing so is to reduce the container startup delay for subsequent function calls; When caching type containers, a large amount of memory consumption is generated. The memory consumption generated is used Indicates that, if the cached The type container carries the subsequent type function call, the warm start delay is negligible; in contrast, as The zygote container cache type generates relatively low memory consumption. The memory consumption generated is This is because the zygote container only retains public packages; Type function call, the zygote container can import private packages to create a corresponding container to host the function, which will cause a corresponding startup delay. Indicates that starting from scratch The cold start delay of the container type, using Indicates; where the relationship between the above parameters is, and ; Then, the target start delay of the target container is calculated according to the third formula, and Represented by, and the target memory cost of the target container is calculated according to the fourth formula, using In other words, the target startup delay includes the startup delay corresponding to the first number of containers and the startup delay corresponding to the second number of child containers, and the target memory cost includes the memory consumption of the first number of containers and the memory consumption of the second number of child containers; the third formula is:
[0086] ;
[0087] The fourth formula is:
[0088] .
[0089] Step S30, calculating a target overall cost according to the target startup delay and the target memory cost, making a decision on the target overall cost according to an online container scheduling algorithm, obtaining a target container cache decision, and performing container scheduling according to the target container cache decision to obtain a target scheduling result.
[0090] The step S30 comprises:
[0091] Step S31: Calculate according to the target startup delay and the target memory cost to obtain a target overall cost, and decompose the target overall cost according to an online container scheduling algorithm to obtain a first sub-cost and a second sub-cost;
[0092] Step S32: performing configuration calculation on the edge cluster according to the target overall cost to obtain a target configuration, performing constant acquisition on the uniform distribution of the edge cluster to obtain a target constant, and performing strategy sampling on the target configuration according to the target constant to obtain a target container cache decision;
[0093] Step S33: allocating the target container cache decision according to the target overall cost to obtain an allocation result, and scheduling the container according to the allocation result to obtain a target scheduling result.
[0094] Specifically, after obtaining the target startup delay and the target memory cost, it is necessary to calculate according to the target startup delay and the target memory cost to obtain the target overall cost (i.e., the online joint optimization problem), which is expressed as follows using the corresponding integer programming:
[0095] ;
[0096] in, is a weight to measure the importance of startup delay; for the online joint optimization problem, in an embodiment of the present invention, it is processed by the OCS algorithm (Oline Container Scheduling, online container scheduling algorithm), the characteristics of the OCS algorithm are low computational complexity and provable competition ratio. The specific processing process is that the main idea of the OCS algorithm is to decompose the online joint optimization problem into two sub-problems, that is, to decompose the target overall cost according to the online container scheduling algorithm, wherein the first sub-problem is to determine the function distribution and container startup according to the available containers, and the second sub-problem is to determine the container cache decision; the algorithm flow corresponding to the OCS algorithm is as follows Figure 2 As shown, Figure 2The first line in the figure refers to initializing all decision variables; the second line refers to updating the corresponding parameters; the third line refers to calling FDCS (Function Distribution and Container Startup) to solve the first sub-problem; the fifth to seventh lines refer to assigning a random strategy to each container after the execution of the serverless function is completed by calling ARS (Assign the Randomized Strategy) to solve the second sub-problem, that is, allocating the target container cache decision according to the cost to obtain the allocation result, and scheduling the container according to the allocation result to obtain the target scheduling result; the eighth to ninth lines refer to calling TS (State Transform) to update the container cache decision.
[0097] Among them, the FDCS algorithm is a greedy subroutine. The process of the FDCS algorithm is as follows: Figure 3 As shown, Figure 3 In the example, lines 2 to 6 refer to distributing serverless functions, calling and using cached containers to execute these serverless functions; lines 7 to 16 refer to using zygote containers to import private packages to start corresponding containers; lines 17 to 27 refer to starting the execution of these serverless functions by cold-starting containers for the remaining undistributed serverless function calls, where lines 22 to 27 involve recycling unused cached containers to free up space for servers with insufficient memory to start containers.
[0098] The main idea of the ARS algorithm is to calculate a configuration and sample a random strategy from the configuration. The process of the ARS algorithm is as follows: Figure 4 As shown, Figure 4 In the figure, lines 1 to 17 refer to the calculation of the configuration, which is used to indicate the probability of the container being in different states, that is, the edge cluster is configured and calculated according to the first sub-cost to obtain the target configuration; line 18 refers to obtaining the corresponding constant (i.e., the target constant) from the uniform distribution of the edge cluster, and sampling a random strategy (i.e., the target container cache decision) from the target configuration according to the target constant. The target container cache decision can be used to decide when to cache a container, when to cache it as a zygote container, and when to recycle it.
[0099] The main idea of the TS algorithm is to perform state transitions according to the random strategy of the container. The process of the TS algorithm is as follows: Figure 5 As shown, Figure 5In the example, lines 1 to 8 refer to monitoring the execution time of the container according to the target scheduling result to obtain a monitoring result, wherein the execution time is the start time and the recycle time; and judging whether the execution time of the container exceeds the preset time according to the monitoring result; if the execution time of the container does not exceed the preset time, the container will remain in the original state; if the execution time of the container exceeds the preset time, the target time point is obtained, and the execution state of the container is converted at the target time point according to the target container cache decision, for example, converted to cache as a zygote container or a recycle container.
[0100] Furthermore, in order to verify the effectiveness of applying the OCS algorithm to container scheduling in edge computing, the IIC (Identifying Idle Container) algorithm, the FCI (Fixed Caching Interval) algorithm, the DG (Delay Greedy) algorithm and the CSR (Classic Ski Rental) algorithm are used as baseline algorithms, wherein the IIC algorithm uses 95% of the idle containers of the function call interval as the threshold, and caches these idle containers as zygote containers; the FCI algorithm caches idle containers within a fixed time, and here, the OCS algorithm caches each idle container for a time slot, and then caches it as a zygote container, and reserves the zygote container for a time slot; the DG algorithm is a greedy strategy based on a histogram, which records the function call interval by using a histogram, and sets the maximum interval as the threshold for caching containers; the CSR algorithm is a solution to the classic ski rental problem; and the OCS algorithm, the IIC algorithm, the FCI algorithm, the DG algorithm and the CSR algorithm are all applied to the edge cluster consisting of 10 servers in the embodiment of the present invention, and the results obtained are as follows: Figure 6 , Figure 7 , Figure 8 and Fig. 9 As shown, Figure 6 A schematic diagram of the overall cost of each algorithm at different timings, Figure 7 A schematic diagram of the overall cost of each algorithm under different weights, Figure 8 A diagram showing the memory cost of each algorithm at different weights. Fig. 9 A schematic diagram of the average delay of each algorithm under different weights, according to Figure 6-Figure 9 It can be shown that the present invention can minimize the overall system cost while taking into account the container startup delay, memory cost, and resource limitations of the edge server.
[0101] Furthermore, if Fig.10As shown, based on the above-mentioned online container scheduling method based on edge computing, the present invention also provides an online container scheduling system based on edge computing, and the online container scheduling system based on edge computing includes:
[0102] A function distribution module 51 is used to obtain multiple serverless functions for edge computing when edge computing is performed on an edge cluster, distribute all of the serverless functions to each server of the edge cluster, and obtain function execution results;
[0103] A cost calculation module 52 is used to obtain container status information according to the function execution result, perform cache decision processing on the target container of the edge cluster according to the container status information, obtain a decision processing result, and calculate a target startup delay and a target memory cost of the target container according to the decision processing result;
[0104] The container scheduling module 53 is used to calculate the target overall cost according to the target startup delay and the target memory cost, make a decision on the target overall cost according to the online container scheduling algorithm, obtain a target container cache decision, and perform container scheduling according to the target container cache decision to obtain a target scheduling result.
[0105] Furthermore, if Fig.11 As shown, based on the above-mentioned online container scheduling method based on edge computing, the present invention also provides a terminal accordingly, and the terminal includes a processor 10, a memory 20 and a display 30. Fig.11 Only some components of the terminal are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0106] In some embodiments, the memory 20 may be an internal storage unit of the terminal, such as a hard disk or memory of the terminal. In other embodiments, the memory 20 may also be an external storage device of the terminal, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), etc. equipped on the terminal. Further, the memory 20 may also include both an internal storage unit of the terminal and an external storage device. The memory 20 is used to store application software and various types of data installed on the terminal, such as the program code of the installation terminal. The memory 20 may also be used to temporarily store data that has been output or is to be output. In one embodiment, an online container scheduling program 40 based on edge computing is stored on the memory 20, and the online container scheduling program 40 based on edge computing can be executed by the processor 10, thereby realizing the online container scheduling method based on edge computing in the present application.
[0107] In some embodiments, the processor 10 may be a central processing unit (CPU), a microprocessor or other data processing chip, used to run the program code or process data stored in the memory 20, such as executing the edge computing-based online container scheduling method.
[0108] In some embodiments, the display 30 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, etc. The display 30 is used to display information on the terminal and to display a visual user interface. The components 10-30 of the terminal communicate with each other via a system bus.
[0109] In one embodiment, when the processor 10 executes the program 40 for online container scheduling of edge computing in the memory 20, the following steps are implemented:
[0110] When edge computing is performed on the edge cluster, multiple serverless functions for edge computing are obtained, all the serverless functions are distributed to each server of the edge cluster, and function execution results are obtained;
[0111] Obtaining container status information according to the function execution result, performing cache decision processing on the target container of the edge cluster according to the container status information to obtain a decision processing result, and calculating a target startup delay and a target memory cost of the target container according to the decision processing result;
[0112] A target overall cost is calculated according to the target startup delay and the target memory cost, a decision is made on the target overall cost according to an online container scheduling algorithm to obtain a target container cache decision, and container scheduling is performed according to the target container cache decision to obtain a target scheduling result.
[0113] When edge computing is performed on the edge cluster, multiple serverless functions for edge computing are obtained, all the serverless functions are distributed to each server of the edge cluster, and function execution results are obtained, specifically including:
[0114] When edge computing is performed on the edge cluster, multiple serverless functions for edge computing are obtained, and all the serverless functions are matched with the servers of the edge cluster to obtain a matching result;
[0115] Distribute each of the serverless functions to a corresponding server according to the matching result, each server starts a corresponding container according to the serverless function, and executes all of the serverless functions in the corresponding container according to the first condition and the second condition to obtain a function execution result.
[0116] Among them, the first condition is:
[0117] ;
[0118] ;
[0119] ;
[0120] The second condition is:
[0121] ;
[0122] in, For the server, For the moment, and All are of type, for New containers are created on the server all the time and recycled The number of containers of type, for Always cached on the server The number of containers of type, For Distributed to the server at all times The number of type functions, for Created on the server at the moment The number of zygote containers of type container, for Always cached on the server The number of type zygote containers, are disjoint subsets of containers, is the set of containers in the edge cluster. for Memory consumption when caching type containers, For the zygote container set, for Memory consumption when caching type zygote container, The memory capacity of the server.
[0123] The acquiring of container status information according to the function execution result, performing cache decision processing on the target container of the edge cluster according to the container status information to obtain a decision processing result, and calculating a target startup delay and a target memory cost of the target container according to the decision processing result specifically includes:
[0124] If the function execution result is completion, the obtained container status information is that the target container is in an idle state, and a cache decision process is performed on the target container according to the container status information to obtain a decision process result, wherein the decision process result includes any one of caching the entire container, caching child containers, and not caching;
[0125] Calculate a first number of cache containers according to the decision processing result and the first formula, and calculate a second number of cache child containers according to the decision processing result and the second formula;
[0126] A target startup delay of the target container is calculated according to a third formula, and a target memory cost of the target container is calculated according to a fourth formula, wherein the target startup delay includes a startup delay corresponding to the first number of containers and a startup delay corresponding to the second number of child containers, and the target memory cost includes a memory consumption of the first number of containers and a memory consumption of the second number of child containers.
[0127] Among them, the first formula is:
[0128] ;
[0129] The second formula is:
[0130] ;
[0131] The third formula is:
[0132] ;
[0133] The fourth formula is:
[0134] ;
[0135] in, is the first quantity, which is equal to Always cached on the server The number of containers of type, is the second quantity, which is equal to Always cached on the server The number of type zygote containers, for Distributed to the server at all times The number of type functions, for Always cached on the server The number of containers of type, for Always cached on the server as a zygote container The number of containers of type, for Recycled on the server at all times The number of containers of type, for New containers are created on the server all the time and recycled The number of containers of type, for Always cached on the server The number of type zygote containers, for Recycled on the server at all times The number of type zygote containers, for Created on the server at the moment The number of zygote containers of type container, For the server set, Start delay for target, For the follow-up Type function call, zygote container imports private package to create corresponding container startup delay, To start from scratch The cold start delay of the container type, is the target memory cost.
[0136] The step of calculating the target overall cost according to the target startup delay and the target memory cost, making a decision on the target overall cost according to an online container scheduling algorithm, obtaining a target container cache decision, and performing container scheduling according to the target container cache decision to obtain a target scheduling result specifically includes:
[0137] Calculate the target startup delay and the target memory cost to obtain a target overall cost, and decompose the target overall cost according to an online container scheduling algorithm to obtain a first sub-cost and a second sub-cost;
[0138] Performing configuration calculation on the edge cluster according to the cost to obtain a target configuration, performing constant acquisition on a uniform distribution of the edge cluster to obtain a target constant, and performing strategy sampling on the target configuration according to the target constant to obtain a target container cache decision;
[0139] The target container cache decision is allocated according to the cost to obtain an allocation result, and the container is scheduled according to the allocation result to obtain a target scheduling result.
[0140] The step of performing container scheduling according to the allocation result to obtain a target scheduling result further includes:
[0141] Monitoring the execution time of the container according to the target scheduling result to obtain a monitoring result, and determining whether the execution time of the container exceeds a preset time according to the monitoring result;
[0142] If the execution time of the container exceeds the preset time, a target time point is obtained, and the execution state of the container is converted at the target time point according to the target container cache decision.
[0143] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores an online container scheduling program based on edge computing, and when the online container scheduling program based on edge computing is executed by a processor, the steps of the online container scheduling method based on edge computing as described above are implemented.
[0144] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0145] Of course, those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware (such as a processor, a controller, etc.) through a computer program, and the program can be stored in a computer-readable storage medium that can be read by a computer, and the program can include the processes of the above-mentioned method embodiments when executed. The computer-readable storage medium can be a memory, a disk, an optical disk, etc.
[0146] It should be understood that the application of the present invention is not limited to the above examples. For ordinary technicians in this field, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.
Claims
1. An online container scheduling method based on edge computing, characterized in that: The online container scheduling method based on edge computing includes: When edge computing is performed on the edge cluster, multiple serverless functions for edge computing are obtained, all the serverless functions are distributed to each server of the edge cluster, and function execution results are obtained; Obtaining container status information according to the function execution result, performing cache decision processing on the target container of the edge cluster according to the container status information to obtain a decision processing result, and calculating a target startup delay and a target memory cost of the target container according to the decision processing result; The acquiring container status information according to the function execution result, performing cache decision processing on the target container of the edge cluster according to the container status information to obtain a decision processing result, and calculating the target startup delay and target memory cost of the target container according to the decision processing result, specifically includes: If the function execution result is completion, the obtained container status information is that the target container is in an idle state, and a cache decision process is performed on the target container according to the container status information to obtain a decision process result, wherein the decision process result includes any one of caching the entire container, caching child containers, and not caching; Calculate a first number of cache containers according to the decision processing result and the first formula, and calculate a second number of cache child containers according to the decision processing result and the second formula; Calculating a target startup delay of the target container according to a third formula, and calculating a target memory cost of the target container according to a fourth formula, wherein the target startup delay includes startup delays corresponding to the first number of containers and startup delays corresponding to the second number of child containers, and the target memory cost includes memory consumption of the first number of containers and memory consumption of the second number of child containers; The first formula is: ; The second formula is: ; The third formula is: ; The fourth formula is: ; in, is the first quantity, which is equal to Always cached on the server The number of containers of type, is the second quantity, which is equal to Always cached on the server The number of type zygote containers, for Distributed to the server at all times The number of type functions, for Always cached on the server The number of containers of type, for Always cached on the server as a zygote container The number of containers of type, for Recycled on the server at all times The number of containers of type, for New containers are created on the server all the time and recycled The number of containers of type, for Always cached on the server The number of type zygote containers, for Recycled on the server at all times The number of type zygote containers, for Created on the server at all times The number of zygote containers of type container, For the server set, Start delay for target, For the follow-up Type function call, zygote container imports private package to create corresponding container startup delay, To start from scratch The cold start delay of the container type, is the target memory cost; Calculating a target overall cost according to the target startup delay and the target memory cost, making a decision on the target overall cost according to an online container scheduling algorithm to obtain a target container cache decision, and performing container scheduling according to the target container cache decision to obtain a target scheduling result; The target overall cost is calculated according to the target startup delay and the target memory cost, a decision is made on the target overall cost according to an online container scheduling algorithm to obtain a target container cache decision, and a container is scheduled according to the target container cache decision to obtain a target scheduling result, specifically including: Calculate the target startup delay and the target memory cost to obtain a target overall cost, and decompose the target overall cost according to an online container scheduling algorithm to obtain a first sub-cost and a second sub-cost; Performing configuration calculation on the edge cluster according to the first sub-cost to obtain a target configuration, performing constant acquisition on a uniform distribution of the edge cluster to obtain a target constant, and performing policy sampling on the target configuration according to the target constant to obtain a target container cache decision; The target container cache decision is allocated according to the second sub-cost to obtain an allocation result, and container scheduling is performed according to the allocation result to obtain a target scheduling result.
2. The online container scheduling method based on edge computing according to claim 1 is characterized in that: When edge computing is performed on the edge cluster, multiple serverless functions for edge computing are obtained, all the serverless functions are distributed to each server of the edge cluster, and function execution results are obtained, which specifically includes: When edge computing is performed on the edge cluster, multiple serverless functions for edge computing are obtained, and all the serverless functions are matched with the servers of the edge cluster to obtain a matching result; Distribute each of the serverless functions to a corresponding server according to the matching result, each server starts a corresponding container according to the serverless function, and executes all of the serverless functions in the corresponding container according to the first condition and the second condition to obtain a function execution result.
3. The online container scheduling method based on edge computing according to claim 2 is characterized in that: The first condition is: ; ; ; The second condition is: ; in, For the server, For the moment, and All are of type, for New containers are created on the server all the time and recycled The number of containers of type, for Always cached on the server The number of containers of type, For Distributed to the server at all times The number of type functions, for Created on the server at all times The number of zygote containers of type container, for Always cached on the server The number of type zygote containers, are disjoint subsets of containers, is the set of containers in the edge cluster. for Memory consumption when caching type containers, For the zygote container set, for Memory consumption when caching type zygote container, The memory capacity of the server.
4. The online container scheduling method based on edge computing according to claim 1 is characterized in that: The container scheduling is performed according to the allocation result to obtain a target scheduling result, and then the following steps are further included: Monitoring the execution time of the container according to the target scheduling result to obtain a monitoring result, and determining whether the execution time of the container exceeds a preset time according to the monitoring result; If the execution time of the container exceeds the preset time, a target time point is obtained, and the execution state of the container is converted at the target time point according to the target container cache decision.
5. An online container scheduling system based on edge computing, characterized in that: The online container scheduling system based on edge computing includes: A function distribution module is used to obtain multiple serverless functions for edge computing when edge computing is performed on an edge cluster, distribute all of the serverless functions to each server of the edge cluster, and obtain function execution results; A cost calculation module, used to obtain container status information according to the function execution result, perform cache decision processing on the target container of the edge cluster according to the container status information, obtain a decision processing result, and calculate a target startup delay and a target memory cost of the target container according to the decision processing result; The acquiring container status information according to the function execution result, performing cache decision processing on the target container of the edge cluster according to the container status information to obtain a decision processing result, and calculating the target startup delay and target memory cost of the target container according to the decision processing result, specifically includes: If the function execution result is completion, the obtained container status information is that the target container is in an idle state, and a cache decision process is performed on the target container according to the container status information to obtain a decision process result, wherein the decision process result includes any one of caching the entire container, caching child containers, and not caching; Calculate a first number of cache containers according to the decision processing result and the first formula, and calculate a second number of cache child containers according to the decision processing result and the second formula; Calculating a target startup delay of the target container according to a third formula, and calculating a target memory cost of the target container according to a fourth formula, wherein the target startup delay includes startup delays corresponding to the first number of containers and startup delays corresponding to the second number of child containers, and the target memory cost includes memory consumption of the first number of containers and memory consumption of the second number of child containers; The first formula is: ; The second formula is: ; The third formula is: ; The fourth formula is: ; in, is the first quantity, which is equal to Always cached on the server The number of containers of type, is the second quantity, which is equal to Always cached on the server The number of type zygote containers, for Distributed to the server at all times The number of type functions, for Always cached on the server The number of containers of type, for Always cached on the server as a zygote container The number of containers of type, for Recycled on the server at all times The number of containers of type, for New containers are created on the server all the time and recycled The number of containers of type, for Always cached on the server The number of type zygote containers, for Recycled on the server at all times The number of type zygote containers, for Created on the server at all times The number of zygote containers of type container, For the server set, Start delay for target, For the follow-up Type function call, zygote container imports private package to create corresponding container startup delay, To start from scratch The cold start delay of the container type, is the target memory cost; A container scheduling module, used to calculate a target overall cost according to the target startup delay and the target memory cost, make a decision on the target overall cost according to an online container scheduling algorithm, obtain a target container cache decision, and perform container scheduling according to the target container cache decision to obtain a target scheduling result; The target overall cost is calculated according to the target startup delay and the target memory cost, a decision is made on the target overall cost according to an online container scheduling algorithm to obtain a target container cache decision, and a container is scheduled according to the target container cache decision to obtain a target scheduling result, specifically including: Calculate the target startup delay and the target memory cost to obtain a target overall cost, and decompose the target overall cost according to an online container scheduling algorithm to obtain a first sub-cost and a second sub-cost; Performing configuration calculation on the edge cluster according to the first sub-cost to obtain a target configuration, performing constant acquisition on a uniform distribution of the edge cluster to obtain a target constant, and performing policy sampling on the target configuration according to the target constant to obtain a target container cache decision; The target container cache decision is allocated according to the second sub-cost to obtain an allocation result, and container scheduling is performed according to the allocation result to obtain a target scheduling result.
6. A terminal, characterized in that: The terminal includes a memory, a processor, and a program stored in the memory and executable on the processor. When the program is executed by the processor, the steps of the online container scheduling method based on edge computing as described in any one of claims 1 to 4 are implemented.
7. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and the computer-readable storage medium stores an online container scheduling program based on edge computing. When the online container scheduling program based on edge computing is executed by a processor, the steps of the online container scheduling method based on edge computing as described in any one of claims 1 to 4 are implemented.
