FaaS platform function preheating method, system, electronic device and storage medium

The method and system address FaaS platform cold starts by statistically predicting container needs and pre-starting them, reducing latency and optimizing resource usage.

CN114942824BActive Publication Date: 2024-12-27CHINA UNITED NETWORK COMM GRP CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210391421.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-14
Publication Date
2024-12-27
Estimated Expiration
2042-04-14

AI Technical Summary

Technical Problem

FaaS platform containers experience a cold start process from scratch when an event triggers function execution after a period of inactivity, leading to increased latency.

Method used

A method and system for pre-starting containers based on statistical analysis of event triggers, predicting the number of containers needed in future time periods, and initiating them accordingly to eliminate cold start delays.

Benefits of technology

Reduces cold start latency by accurately predicting and pre-starting containers before event triggers, optimizing resource usage and minimizing idle time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114942824B_ABST
    Figure CN114942824B_ABST
Patent Text Reader

Abstract

The present disclosure provides a FaaS platform function preheating method, system, electronic device and computer-readable storage medium to solve the problem in the prior art that the container in the FaaS platform must go through a cold start process from scratch, which increases the delay of function operation. The method includes: counting the trigger data of the container start event in each time period divided within a preset cycle; predicting the predicted value that the container needs to be started in each same time period in several subsequent cycles based on the trigger data; starting the container based on the time period where the current time is located and the predicted value corresponding to the time period. The technical solution disclosed in the present disclosure can realize the pre-start of the container when the function is running before the event occurs, thereby eliminating the delay caused by the cold start.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of cloud computing, and in particular to a FaaS platform function preheating method, a FaaS platform function preheating system, an electronic device, and a computer-readable storage medium. Background Art

[0002] FaaS (Function as a service) function computing platform is a new serverless cloud computing model. Automatic expansion and contraction is its biggest advantage. When there is no event trigger, the instance size of the container can be reduced to 0, thus saving cloud resources to the greatest extent. However, it also inevitably brings a problem, that is, cold start. When an event triggers the function to run again after a period of time, the container must go through a cold start process from scratch, which increases the latency of function operation.

[0003] Existing methods for solving FaaS cold start problems mainly improve on the existing situation, such as increasing memory, using scripting languages, reducing code package size, etc. However, these methods impose certain restrictions and requirements on function development, and only make limited improvements on the existing situation, and cannot completely solve the cold start problem. Summary of the invention

[0004] In order to at least solve the technical problem in the prior art that the container in the FaaS platform has to go through a cold start process from scratch, which increases the delay in function operation, the present disclosure provides a FaaS platform function preheating method, a FaaS platform function preheating system, an electronic device and a computer-readable storage medium, which can pre-start the container when the function is running before an event occurs, thereby eliminating the delay caused by the cold start.

[0005] In a first aspect, the present disclosure provides a FaaS platform function preheating method, the method comprising:

[0006] Collect statistics on the triggering data of container startup events in each time period divided within a preset period;

[0007] According to the trigger data, predict the predicted value that the container needs to be started in each same time period in several subsequent cycles;

[0008] The container is started according to the time period of the current time and the predicted value corresponding to the time period.

[0009] Furthermore, the statistically analyzing the triggering data of the container startup events in each time period divided within the preset period includes:

[0010] According to the running and waiting time of the container in the FaaS platform, the preset period is divided into a plurality of time periods according to a first preset duration, and each time period in the preset period is divided into a plurality of sub-time periods according to a second preset duration; and,

[0011] Record the actual number of times the container startup event is triggered in each sub-time period in each time period within the preset cycle.

[0012] Furthermore, predicting the predicted value of each container that needs to be started in the same time period in a subsequent number of cycles according to the trigger data includes:

[0013] Calculate the average of the actual trigger times of container start events of all sub-time periods in each time period within the preset period as the period factor of the time period;

[0014] The actual number of times the container startup event is triggered in each sub-time period in each time period within the preset period is divided by the period factor of the corresponding time period to obtain the corresponding ratio of the actual number of times the container startup event is triggered in each sub-time period in each time period within the preset period;

[0015] Calculating the median of the corresponding ratio of the actual number of times the container startup event is triggered in each sub-time period within all time periods of the preset cycle; and,

[0016] According to the product of the median and the period factor of each time period in the preset period, the predicted value that the containers in each same sub-time period in the same time period need to be started in the subsequent several periods is predicted.

[0017] Furthermore, starting the container according to the time period in which the current time is located and the predicted value corresponding to the time period includes:

[0018] According to the time period of the current time, the predicted value of the container that needs to be started in the corresponding time period is obtained;

[0019] A corresponding number of containers are started according to the predicted value that needs to be started.

[0020] Furthermore, the preset period is 3 days to 3 months.

[0021] Further, dividing the preset period into a plurality of time periods according to a first preset duration, and dividing each time period in the preset period into a plurality of sub-time periods according to a second preset duration includes:

[0022] Divide the preset cycle into multiple time periods on a daily basis;

[0023] Each day within the preset period is then divided into multiple sub-time periods of 10-30 minutes.

[0024] In a second aspect, the present disclosure provides a FaaS platform function preheating system, including:

[0025] A statistics module, which is configured to count the triggering data of container startup events in each time period divided within a preset period;

[0026] A prediction module, which is configured to predict the predicted value of the containers that need to be started in the same time period in a number of subsequent cycles according to the trigger data;

[0027] The startup module is configured to start the container according to the time period of the current time and the predicted value corresponding to the time period.

[0028] Furthermore, the statistical module includes:

[0029] a dividing unit configured to divide the preset period into a plurality of time periods according to a first preset duration according to the running and waiting time of the container in the FaaS platform, and to divide each time period in the preset period into a plurality of sub-time periods according to a second preset duration;

[0030] A recording unit, which is configured to record the number of times the container start event is actually triggered in each sub-time period in each time period within a preset period;

[0031] The prediction module comprises:

[0032] A first calculation unit, which is configured to calculate an average value of actual triggering times of container startup events of all sub-time periods in each time period within a preset period as a period factor of the time period;

[0033] A second calculation unit is configured to divide the actual number of times the container startup event is triggered in each sub-time period in each time period within the preset period by the period factor of the corresponding time period to obtain a corresponding ratio of the actual number of times the container startup event is triggered in each sub-time period in each time period within the preset period;

[0034] A third calculation unit, which is configured to respectively calculate the median of the corresponding ratios of the actual number of times the container startup event is triggered in each sub-time period within all time periods of the preset cycle;

[0035] The prediction unit is configured to predict the predicted values ​​that need to be started for each same sub-time period container in the same time period in the subsequent several cycles according to the product of the median and the period factor of each time period in the preset cycle.

[0036] Furthermore, the division unit is specifically configured as:

[0037] Divide the preset period into multiple time periods for each day; and,

[0038] Each day within the preset period is then divided into multiple sub-time periods of 10-30 minutes.

[0039] In a third aspect, the present disclosure provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and when the processor runs the computer program stored in the memory, the processor executes the FaaS platform function preheating method as described in any one of the first aspects.

[0040] In a fourth aspect, the present disclosure provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the FaaS platform function preheating method described in any one of the first aspects above is implemented.

[0041] Beneficial effects:

[0042] The FaaS platform function preheating method, FaaS platform function preheating system, electronic device and computer-readable storage medium provided by the present disclosure, by counting the trigger data of the container startup event in each time period divided within a preset cycle; predicting the predicted value that the container needs to be started in each same time period in several subsequent cycles according to the trigger data; and starting the container according to the time period where the current time is located and the predicted value corresponding to the time period. The technical solution disclosed in the present disclosure predicts the running cycle of the function based on the analysis method of the periodic factor, and then realizes the pre-starting of the container when the function is running before the event occurs, thereby eliminating the delay caused by the cold start. The higher the accuracy of the time prediction, the more the cold start delay can be eliminated. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 A flowchart of a FaaS platform function preheating method provided in Embodiment 1 of the present disclosure;

[0044] Figure 2 An architecture diagram of a FaaS platform function preheating system provided in Embodiment 2 of the present disclosure;

[0045] Figure 3 This is an architecture diagram of an electronic device provided in Embodiment 3 of the present disclosure. DETAILED DESCRIPTION

[0046] In order to enable those skilled in the art to better understand the technical solution of the present disclosure, the present disclosure is further described in detail below in conjunction with the drawings and embodiments. It should be understood that the specific embodiments and drawings described herein are only used to explain the present invention, rather than to limit the present invention.

[0047] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence; and, in the absence of conflict, the embodiments in the present disclosure and the features in the embodiments can be arbitrarily combined with each other.

[0048] The terms used in the embodiments of the present disclosure are only for the purpose of describing specific embodiments and are not intended to limit the present disclosure. The singular forms of "a", "said" and "the" used in the embodiments of the present disclosure and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings.

[0049] In the subsequent description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present disclosure, and have no specific meanings. Therefore, "module", "component" or "unit" can be used in a mixed manner.

[0050] The following specific embodiments describe in detail the technical solution of the present disclosure and how the technical solution of the present disclosure solves the problem that containers in the FaaS platform have to go through a cold start process from scratch, which increases the latency of function execution. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.

[0051] Figure 1 A flowchart of a FaaS platform function preheating method provided in Embodiment 1 of the present disclosure is shown in FIG. Figure 1 As shown, the method includes:

[0052] Step S101: collecting statistics on triggering data of container startup events in each time period divided within a preset period;

[0053] Step S102: predicting the predicted value of the containers that need to be started in the same time period in several subsequent cycles according to the trigger data;

[0054] Step S103: starting the container according to the time period of the current time and the predicted value corresponding to the time period.

[0055] At present, FaaS is mainly aimed at the Internet of Things scenario. The Internet of Things is related to consumption and has a strong periodicity. The running time of the container in the FaaS platform is generally a few minutes. That is, after the function is completed, the running container will not be destroyed immediately, but will wait for a period of time to prevent new requests from arriving immediately. The waiting time varies depending on the platform, ranging from a few minutes to dozens of minutes. When the container starts from the "cold state", the function needs to: obtain the code package from the external persistent storage, gradually start (Spin up) the container, load the package code in the memory, and run the function's handler method / function. Keeping the container active will save startup resources and speed up subsequent requests, but it will increase the idle time cost. Therefore, if there is no new request within a certain period of time, the container will be destroyed, but when a request arrives again, it will go through a cold start process from scratch, which increases the delay of the function operation. Therefore, this embodiment adopts a time series analysis method based on periodic factors to predict the time of the next event trigger, and then cooperates with the FaaS platform to pull up the container in advance to eliminate the cold start. By counting the trigger data of container startup events in each time period divided within a preset cycle, the preset cycle is related to the scenarios that FaaS mainly targets, and the divided time periods can be planned according to the platform usage scenarios. Then, based on the trigger usage of the container in each time period within the preset cycle, the predicted value of the container that needs to be started in each same time period in the subsequent cycle is predicted. Subsequently, the container is started according to the time period at the time of execution and its corresponding predicted value, that is, whether the event will be triggered and the number of triggers in the same time period, that is, in which time period FaaS needs to pre-pull the container when the function is running. The container when the function is running can be pre-started before the event occurs, thereby eliminating the delay caused by cold start. The higher the accuracy of time prediction, the more cold start delay can be eliminated.

[0056] Furthermore, the statistically analyzing the triggering data of the container startup events in each time period divided within the preset period includes:

[0057] According to the running and waiting time of the container in the FaaS platform, the preset period is divided into a plurality of time periods according to a first preset duration, and each time period in the preset period is divided into a plurality of sub-time periods according to a second preset duration; and,

[0058] Record the actual number of times the container startup event is triggered in each sub-time period in each time period within the preset cycle.

[0059] According to the running and waiting time of the container in the FaaS platform, the preset cycle is divided into multiple time periods according to the first preset duration, such as dividing the cycle into multiple days according to each day, and then each time period is divided into multiple sub-time periods according to the second preset duration, such as dividing a day into multiple sub-time periods according to the preset duration, such as the first day, the second day..., and the respective sub-time periods T1, T2...Tn in the cycle; firstly, the number of times the event is actually triggered in each time interval (i.e., sub-time period) in each day of the cycle is recorded according to the sub-time period; the recorded data can be shown in Table 1 below:

[0060] Table 1: The actual number of times the container start event is triggered in each sub-time period of each day

[0061] Time period T1 T2 T3 T4 T5 …… Tn Day 1 a1 a2 a3 a4 a5 an the next day b1 b2 b3 b4 b5 bn Day 3 c1 c2 c3 c4 c5 cn Day 4 d1 d2 d3 d4 d5 dn Day 5 e1 e2 e3 e4 e5 en …… …… …… …… …… …… ……

[0062] Through experience, we can determine the preset period, such as a week or a month, and then record in detail the actual number of times the startup event is triggered in each sub-time period of each time period within the period, laying a good foundation for subsequent data analysis, making the subsequent predicted values ​​more consistent with the actual values, and eliminating the cold start delay as much as possible without wasting resources.

[0063] Furthermore, predicting the predicted value of each container that needs to be started in the same time period in a subsequent number of cycles according to the trigger data includes:

[0064] Calculate the average of the actual trigger times of container start events of all sub-time periods in each time period within the preset period as the period factor of the time period;

[0065] The actual number of times the container startup event is triggered in each sub-time period in each time period within the preset period is divided by the period factor of the corresponding time period to obtain the corresponding ratio of the actual number of times the container startup event is triggered in each sub-time period in each time period within the preset period;

[0066] Calculating the median of the corresponding ratio of the actual number of times the container startup event is triggered in each sub-time period within all time periods of the preset cycle; and,

[0067] According to the product of the median and the period factor of each time period in the preset period, the predicted value that the containers in each same sub-time period in the same time period need to be started in the subsequent several periods is predicted.

[0068] After obtaining the actual statistical data, perform data analysis. For example, when the preset period is one day, calculate the average number of times the container startup event is triggered in each sub-period of each period (each day) as the period factor of the data for this day; i ranges from 1 to n, where n is the number of sub-time periods each day is divided into, and xi corresponds to the number of container startup events in the ith sub-time period of each day. For example, the mean xi in the first day is ai, the mean xi in the second day is bi, and so on;

[0069] Then, the number of container startup events in each sub-time period of each day is divided by the cycle factor of the day to obtain the corresponding ratio of the number of container startup events in each sub-time period of each day, and then the median of the corresponding ratio of the number of startup events in each sub-time period of all days in the preset cycle is calculated; if the median of the T1 sub-time period in all days is b1 / mean, the mean is the cycle factor of the next day, and the corresponding calculation results are as shown in Table 2 below:

[0070] Table 2: Corresponding ratios of the number of container startup events in each sub-time period of each day

[0071] Time period T1 T2 T3 T4 T5 …… Tn Day 1 a1 / mean a2 / mean a3 / mean a4 / mean a5 / mean an / mean the next day b1 / mean b2 / mean b3 / mean b4 / mean b5 / mean bn / mean Day 3 c1 / mean c2 / mean c3 / mean c4 / mean c5 / mean cn / mean Day 4 d1 / mean d2 / mean d3 / mean d4 / mean d5 / mean dn / mean Day 5 e1 / mean e2 / mean e3 / mean e4 / mean e5 / mean en / mean …… …… …… …… …… …… …… median b1 / mean c2 / mean a3 / mean a4 / mean d5 / mean …… en / mean

[0072] In the above table, the cycle factor mean of each day corresponds to that day. After obtaining the median of each sub-time period, the median of the corresponding ratio of the number of start events in each sub-time period of each time period in the preset cycle is multiplied by the cycle factor corresponding to the time period to obtain the predicted value of the container that needs to be started in each sub-time period of the time period in the subsequent cycle.

[0073] By statistically calculating the periodic factor corresponding to each day, we can know the startup status of the container corresponding to that day, and the median of each time period can eliminate additional data jitter, such as the impact of abnormally large or small data on a certain day. The data of each day is predicted at the same scale. By multiplying the median of the corresponding ratio of the number of startup events by the periodic factor corresponding to the day, the predicted value can be related to both the date of the day and the sub-time period, making the predicted value more accurate and closer to the actual situation, which can eliminate the cold start delay as much as possible without causing waste by pulling up too many containers.

[0074] Furthermore, starting the container according to the time period in which the current time is located and the predicted value corresponding to the time period includes:

[0075] According to the time period of the current time, the predicted value of the container that needs to be started in the corresponding time period is obtained;

[0076] A corresponding number of containers are started according to the predicted value that needs to be started.

[0077] According to the time period of the current time, the predicted value of the container that needs to be started in the corresponding time period is obtained. The predicted value corresponding to each time period is a series of values ​​related to its sub-time period, that is, the predicted value of the container that needs to be started in each sub-time period in the corresponding time period is obtained. For example, when the cycle is a week, the time period is a day. Select the cycle factor with the same number of days in the statistical cycle as the date to be predicted in a week. For example, if the next day we want to predict is Wednesday, we choose the daily average value of Wednesday in the statistical cycle as the cycle factor, recorded as P, and multiply P by the median of each sub-time period on Wednesday in the statistical cycle to get the predicted value. Then pull up the container according to the predicted result (predicted value). For example, if the result is 0, there is no need to pull up the container in advance in this sub-time period; if the result is 1, pull up 1 container in advance, if it is 2, pull up 2 containers in advance, and so on, so as to achieve the purpose of improving cold start.

[0078] Furthermore, the preset period is 3 days to 3 months.

[0079] The preset period can be set independently, such as any value between 3-7 days, 7 days-1 month, or 1 month-3 months, depending on the scenario in which the FaaS platform is used. Since many periodic events have strong periodicity in a week or a month, it is preferred to use a weekly or monthly period factor. When the period is a week, select the period factor of the previous date that is in the same position as the date to be predicted in the week. For example, if the next day we want to predict is Wednesday, we choose the daily average of the previous Wednesday as the period factor, recorded as P, and use P multiplied by the median of each time period to get the predicted value. Setting the preset period to one week or one month can better perform data statistics, and is more relevant to the actual periodic characteristics, making the predicted data more accurate. Of course, the preset period can also be other periods, which can be set according to actual conditions.

[0080] Further, dividing the preset period into a plurality of time periods according to a first preset duration, and dividing each time period in the preset period into a plurality of sub-time periods according to a second preset duration includes:

[0081] Divide the preset cycle into multiple time periods on a daily basis;

[0082] Each day within the preset period is then divided into multiple sub-time periods of 10-30 minutes.

[0083] Since people's daily routines are based on daily activities, data statistics and analysis can be better performed by dividing each day into multiple time periods. The sub-time periods can be divided according to the startup and running time of the container. In this embodiment, any value within 10-30 minutes can be selected, preferably 15 minutes, and 15 minutes is used as a time unit for analysis. 00:00-00:15 is recorded as t1, 00:15-00:30 is recorded as t2, ..., 01:00-01:15 is recorded as t5, ..., 23:45-24:00 is recorded as t96, so that the time period division is related to the startup to destruction of the container, that is, the average time from the startup to the destruction of a container is used as the division period. In actual operation, the division can be performed according to the usage characteristics of the platform containers, and then the time series analysis of the period factor is performed on the 96 time intervals of each day, so as to predict in which sub-time period the event will be triggered in the next day, that is, in which sub-time period FaaS needs to pre-pull the container when the function is running.

[0084] This embodiment predicts the running cycle of the function based on the analysis method of the periodic factor, and then realizes pre-starting the container when the function is running before the event occurs, and makes the predicted value related to the actual situation to obtain a more accurate prediction, thereby eliminating the delay caused by the cold start as much as possible, and avoiding additional waste caused by pulling up too many containers.

[0085] Figure 2 This is an architecture diagram of a FaaS platform function preheating system provided in Embodiment 2 of the present disclosure, such as Figure 2 As shown, including:

[0086] A statistics module 11, which is configured to count the triggering data of the container startup event in each time period divided within a preset period;

[0087] A prediction module 12, which is configured to predict the predicted value of the containers that need to be started in the same time period in a number of subsequent cycles according to the trigger data;

[0088] The starting module 13 is configured to start the container according to the time period in which the current time is located and the predicted value corresponding to the time period.

[0089] Furthermore, the statistical module 11 includes:

[0090] a dividing unit configured to divide the preset period into a plurality of time periods according to a first preset duration according to the running and waiting time of the container in the FaaS platform, and to divide each time period in the preset period into a plurality of sub-time periods according to a second preset duration;

[0091] A recording unit, which is configured to record the number of times the container start event is actually triggered in each sub-time period in each time period within a preset period;

[0092] Furthermore, the prediction module 12 includes:

[0093] A first calculation unit, which is configured to calculate an average value of actual triggering times of container startup events of all sub-time periods in each time period within a preset period as a period factor of the time period;

[0094] A second calculation unit is configured to divide the actual number of times the container startup event is triggered in each sub-time period in each time period within the preset period by the period factor of the corresponding time period to obtain a corresponding ratio of the actual number of times the container startup event is triggered in each sub-time period in each time period within the preset period;

[0095] A third calculation unit, which is configured to respectively calculate the median of the corresponding ratios of the actual number of times the container startup event is triggered in each sub-time period within all time periods of the preset cycle;

[0096] The prediction unit is configured to predict the predicted values ​​that need to be started for each same sub-time period container in the same time period in the subsequent several cycles according to the product of the median and the period factor of each time period in the preset cycle.

[0097] Furthermore, the startup module 13 is specifically configured as follows:

[0098] According to the time period of the current time, the predicted value of the container that needs to be started in the corresponding time period is obtained;

[0099] A corresponding number of containers are started according to the predicted value that needs to be started.

[0100] Furthermore, the preset period is 3 days to 3 months;

[0101] Furthermore, the division unit is specifically configured as:

[0102] Divide the preset period into multiple time periods for each day; and,

[0103] Each day within the preset period is then divided into multiple sub-time periods of 10-30 minutes.

[0104] The FaaS platform function preheating system of the disclosed embodiment is used to implement the FaaS platform function preheating method of method embodiment 1, so the description is relatively simple. For details, please refer to the relevant description in the previous method embodiment 1, which will not be repeated here.

[0105] In addition, if Figure 3 As shown, the third embodiment of the present disclosure further provides an electronic device, including a memory 10 and a processor 20, wherein the memory 10 stores a computer program, and when the processor 20 runs the computer program stored in the memory 10, the processor 20 executes the above-mentioned various possible methods.

[0106] The memory 10 is connected to the processor 20. The memory 10 may be a flash memory, a read-only memory or other memory. The processor 20 may be a central processing unit or a single-chip microcomputer.

[0107] In addition, an embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored, and the computer program is executed by a processor to perform the above-mentioned various possible methods.

[0108] The computer-readable storage medium includes volatile or non-volatile, removable or non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, computer program modules or other data). Computer-readable storage media include, but are not limited to, RAM (Random Access Memory), ROM (Read-Only Memory), EEPROM (Electrically Erasable Programmable read only memory), flash memory or other memory technology, CD-ROM (Compact Disc Read-Only Memory), digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer.

[0109] It is to be understood that the above embodiments are merely exemplary embodiments used to illustrate the principles of the present disclosure, but the present disclosure is not limited thereto. For those of ordinary skill in the art, various modifications and improvements can be made without departing from the spirit and substance of the present disclosure, and these modifications and improvements are also considered to be within the scope of protection of the present disclosure.

Claims

1. A method for preheating a function on a function-as-a-service (FaaS) platform, characterized in that: The method comprises: According to the running and waiting time of the container in the FaaS platform, the preset period is divided into a plurality of time periods according to a first preset duration, and each time period in the preset period is divided into a plurality of sub-time periods according to a second preset duration; and, Record the actual number of times the container start event is triggered in each sub-time period in each time period within the preset cycle; Calculate the average of the actual trigger times of container start events of all sub-time periods in each time period within the preset period as the period factor of the time period; The actual number of times the container startup event is triggered in each sub-time period in each time period within the preset period is divided by the period factor of the corresponding time period to obtain the corresponding ratio of the actual number of times the container startup event is triggered in each sub-time period in each time period within the preset period; Calculating the median of the corresponding ratio of the actual number of times the container startup event is triggered in each sub-time period within all time periods of the preset cycle; and, According to the product of the median and the period factor of each time period in the preset period, predict the predicted value that the container needs to be started in each same sub-time period in the same time period in the subsequent several periods; According to the sub-time period within the time period where the current time is located, a predicted value of the containers that need to be started in the corresponding sub-time period is obtained, and a corresponding number of containers are started according to the predicted value that needs to be started.

2. The method according to claim 1, characterized in that The preset period is 3 days to 3 months.

3. The method according to claim 1, characterized in that The step of dividing the preset period into a plurality of time periods according to a first preset duration, and dividing each time period in the preset period into a plurality of sub-time periods according to a second preset duration includes: Divide the preset cycle into multiple time periods on a daily basis; Each day within the preset period is then divided into multiple sub-time periods of 10-30 minutes.

4. A function preheating system for a function as a service FaaS platform, characterized in that: The system includes a statistical module, a prediction module and a startup module; The statistics module includes: a dividing unit configured to divide the preset period into a plurality of time periods according to a first preset duration according to the running and waiting time of the container in the FaaS platform, and to divide each time period in the preset period into a plurality of sub-time periods according to a second preset duration; A recording unit, which is configured to record the number of times the container start event is actually triggered in each sub-time period in each time period within a preset period; The prediction module comprises: A first calculation unit, which is configured to calculate an average value of actual triggering times of container startup events of all sub-time periods in each time period within a preset period as a period factor of the time period; A second calculation unit is configured to divide the actual number of times the container startup event is triggered in each sub-time period in each time period within the preset period by the period factor of the corresponding time period to obtain a corresponding ratio of the actual number of times the container startup event is triggered in each sub-time period in each time period within the preset period; A third calculation unit, which is configured to respectively calculate the median of the corresponding ratios of the actual number of times the container startup event is triggered in each sub-time period within all time periods of the preset cycle; A prediction unit, configured to predict the predicted values ​​that need to be started for each sub-time period container in the same time period in a subsequent number of cycles according to the product of the median and the period factor of each time period in a preset cycle; The startup module is configured to obtain a prediction value of containers that need to be started in a corresponding sub-time period according to a sub-time period within the time period where the current time is located, and start a corresponding number of containers according to the prediction value that needs to be started.

5. An electronic device, characterized in that: It includes a memory and a processor, wherein a computer program is stored in the memory, and when the processor runs the computer program stored in the memory, the processor executes the function preheating method of the Function as a Service FaaS platform as described in any one of claims 1-3.

6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the method for preheating a function on a Function as a Service (FaaS) platform as described in any one of claims 1 to 3 is implemented.

Citation Information

Patent Citations

  • Function starting method and device

    CN110083405A

  • Modular I / O configurations for edge computing using disaggregated chiplets

    CN111865647A

  • Serverless call distribution to implement spillover while avoiding cold starts

    US20210157645A1