Preloading method, device, equipment, medium and product
Through the preloading method, the time and resource prediction model is used to predict the startup time and resource requirements of the function, which solves the cold start problem in the serverless cloud computing environment and improves the efficiency of function calling and business execution.
Patent Information
- Application Number
- CN202510789024.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-13
- Publication Date
- 2025-09-26
AI Technical Summary
The cold start problem of functions in serverless cloud computing environments leads to inefficient function calls and waste of computing resources, affecting user experience.
Through the preloading method, the time prediction model is used to predict the startup time of the function and when the preset conditions are met, the resource prediction model is used to predict the computing resource allocation information to preload the function.
It solves the cold start problem in serverless cloud computing environments and improves function call efficiency and business execution efficiency.
Smart Images

Figure CN120704759A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a preloading method, apparatus, device, medium, and product. Background Art
[0002] With the rapid development of computer and internet technologies, cloud computing has emerged, and more and more users are choosing cloud computing to support their daily lives. Serverless cloud computing is becoming a popular choice for deploying cloud applications and services, gaining popularity because it effectively addresses the high hosting costs and resource constraints of traditional cloud solutions, which often lead to poor application performance.
[0003] Despite the numerous advantages of serverless cloud computing, some pressing challenges remain. For example, in a serverless cloud computing environment, each service corresponds to a stateless function, running in a resource-limited container. Functions in a serverless cloud computing environment only start when they are called and immediately go dormant. If a function is not called for a period of time, it is deleted. The next time it is called, a cold start problem occurs, significantly impacting function usage, resulting in poor function call efficiency and responsiveness, as well as wasted computing resources and a negative user experience. Summary of the Invention
[0004] The present application provides a preloading method, apparatus, device, medium and product to solve the cold start problem during function execution.
[0005] According to one aspect of the present application, a preloading method is provided, comprising:
[0006] Get at least one target function from the preloaded function list;
[0007] For any objective function, input the objective function type of the objective function into the pre-trained time prediction model so that the time prediction model outputs the predicted start time of the objective function;
[0008] In response to the predicted startup time meeting the preset preloading judgment condition, inputting the target function type into a pre-trained resource prediction model so that the resource prediction model outputs predicted resource allocation information of the target function;
[0009] Preload the target function according to the predicted resource allocation information.
[0010] According to another aspect of the present application, a preloading device is provided, comprising:
[0011] A function acquisition module, used to acquire at least one target function from a preloaded function list;
[0012] A time prediction module is used to input the target function type of any target function into a pre-trained time prediction model so that the time prediction model outputs the predicted start time of the target function;
[0013] a resource prediction module, configured to input the target function type into a pre-trained resource prediction model in response to the predicted startup time meeting a preset preload judgment condition, so that the resource prediction model outputs predicted resource allocation information of the target function;
[0014] The function preloading module is used to preload the target function according to the predicted resource allocation information.
[0015] According to another aspect of the present application, an electronic device is provided, comprising:
[0016] at least one processor; and
[0017] a memory communicatively connected to the at least one processor; wherein,
[0018] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the preloading method described in any embodiment of the present application.
[0019] According to another aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the preloading method described in any embodiment of the present application when executed.
[0020] According to another aspect of the present application, a computer program product is provided, comprising a computer program, which implements the preloading method according to any embodiment of the present application when executed by a processor.
[0021] The technical solution of the embodiment of the present application predicts the target function that may need to be preloaded, first predicts the startup time of the target function, and provides a time basis for the preloading of the target function; when the predicted startup time meets the preloading judgment conditions, further predicts the computing resources that the target function may need to occupy during the preloading process, and obtains predicted resource allocation information to provide basic conditions for the actual preloading process. This not only solves the cold start problem encountered by various task functions in a serverless cloud computing environment, but also further improves the calling efficiency of various task functions in the computing environment, thereby improving the efficiency of business execution.
[0022] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0024] Figure 1 This is a flowchart of a preloading method provided according to the first embodiment of the present application;
[0025] Figure 2 Schematic diagram of a function preloading process applicable to the second embodiment of the present application;
[0026] Figure 3 This is a structural diagram of a preloading device provided according to the third embodiment of the present application;
[0027] Figure 4 It is a structural diagram of an electronic device that implements the preloading method of an embodiment of the present application. DETAILED DESCRIPTION
[0028] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.
[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0030] Example 1
[0031] Figure 1 A flowchart of a preloading method is provided for the first embodiment of the present application. This embodiment is applicable to the case of preloading functions that need to be called in a computing environment. The method can be executed by a preloading device, which can be implemented in the form of hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method includes:
[0032] S110: Obtain at least one target function in the preloaded function list.
[0033] The preloaded function list can be a statistical collection of functions that may need to be preloaded in a serverless cloud computing environment, stored in a table format for easy indexing and searching. The target function can be the function that needs to be preloaded, that is, the business function that may have cold start problems. The specific business function is not limited to the business type and specific function of the function in this embodiment of the application.
[0034] Specifically, before implementing a corresponding business function, the names of functions that need to be called by the business function can be pre-stored in a preloaded function list. A business function or different business functions can call the same or different functions, so there may be multiple target functions in the preloaded function list. These target functions are directly determined from the list, providing a basis for preloading subsequent functions before they are called.
[0035] S120 . For any objective function, input the objective function type of the objective function into a pre-trained time prediction model, so that the time prediction model outputs a predicted start time of the objective function.
[0036] Among them, the objective function type can be the name of the objective function, and the objective function type is used for querying, calling and other operations. The time prediction model can be a machine learning model for predicting when the objective function will start. It can be trained using any machine learning model in the relevant technology, for example, a recurrent neural network model can be used, and the embodiments of the present application do not limit this. Of course, statistics on the calls of each function in the historical period can be collected and used as training data to train the neural network model, so that the neural network model acquires the ability to predict the startup time of a function, thereby becoming a time prediction model. As for the model training process, reference can be made to the training method for the machine learning model in the relevant technology, and the embodiments of the present application do not limit this.
[0037] It's important to note that depending on the functionality required in a business system, different business functions may need to be called to assist in their implementation. In a serverless cloud computing environment, functions only start when they are called and immediately go dormant. However, the computing resources occupied by the function have not yet terminated their processes. Restarting during dormancy allows for immediate utilization of previously occupied computing resources. If a function is not called for a period of time, it is deleted, and the associated computing resources are terminated. When the function is called again, the associated computing resources for the terminated process cannot be immediately started, resulting in a cold start problem.
[0038] The solution of the embodiment of the present application predicts the startup time of the business function to provide a judgment basis in the time dimension for subsequent preloading, effectively helping the serverless cloud computing environment to provide preloading support.
[0039] S130 : In response to the predicted startup time meeting a preset preloading judgment condition, inputting the target function type into a pre-trained resource prediction model, so that the resource prediction model outputs predicted resource allocation information of the target function.
[0040] The preloading judgment condition may be a judgment condition for whether to preload the target function. For example, it may be triggered from a time dimension. When the predicted startup time meets the preloading time period standard, preloading may be performed. Of course, the time period standard can be set by relevant technicians based on actual conditions or manual experience, and the embodiments of the present application are not limited to this.
[0041] Similar to the time prediction model, the resource prediction model can be a machine learning model used to predict the computing resources that the target function needs to occupy when preloading. Of course, the computing resources described here can be resources that may need to be called in a serverless cloud computing environment, such as but not limited to CPU (Central Processing Unit, central processing unit) resources, GPU (Graphics Processing Unit, graphics processing unit) resources, network bandwidth and memory, etc. Similarly, the resource prediction model can also adopt any machine learning model in the relevant technology, such as a recurrent neural network model, etc., and the method for training the resource prediction model is not limited in the embodiment of this application.
[0042] The predicted resource allocation information of the objective function may be information about the computing resources that the objective function predicted by the model may occupy when preloading, for example, how much CPU resources or memory the objective function predicted by the model will occupy when preloading.
[0043] That is to say, when the predicted startup time of the target function predicted by the time prediction model in the aforementioned step meets the preset preloading judgment condition, further prediction is performed through the resource prediction model according to the target function type to obtain the final prediction result of occupied resources.
[0044] S140: Preload the target function according to the predicted resource allocation information.
[0045] According to the predicted resource allocation information obtained in the previous steps, these computing resources in the serverless cloud computing environment are called, and these resources are started before the target function needs to be called, thereby achieving the purpose of preloading the target function.
[0046] The technical solution of the embodiment of the present application predicts the target function that may need to be preloaded, first predicts the startup time of the target function, and provides a time basis for the preloading of the target function; when the predicted startup time meets the preloading judgment conditions, further predicts the computing resources that the target function may need to occupy during the preloading process, and obtains predicted resource allocation information to provide basic conditions for the actual preloading process. This not only solves the cold start problem encountered by various task functions in a serverless cloud computing environment, but also further improves the calling efficiency of various task functions in the computing environment, thereby improving the efficiency of business execution.
[0047] In an optional embodiment, the resource prediction model described in S130 can be determined in the following manner: obtaining the resource category, resource usage, resource usage duration, total resource amount, actual response time and expected response time of all functions in the current computing environment each time they are scheduled and called in a preset historical period as training data for the resource prediction model; based on the training data, training a preset machine learning model to obtain a resource prediction model.
[0048] The preset historical period may be a certain historical time period in the past, and data related to function calls within this historical time period are collected for model training.
[0049] Resource categories can be the types of computing resources required by the target function during its application in the historical period, including but not limited to CPU resources, GPU resources, network resources, and memory. The total resource amount can be the total amount of resources available in these different categories, such as 32GB of total memory or 1000MB of total network bandwidth. Resource usage can be the actual amount of resources used by the target function during its application. Continuing with the previous example, memory usage could be 10GB, network bandwidth occupies 200MB, and so on. Resource usage duration can be the length of time the target function used these computing resources, such as 2 hours of memory usage or 1 hour of network bandwidth usage.
[0050] The actual response time and the expected response time are introduced separately as a pair of corresponding data. The expected response time is the time that is pre-set for a certain function and is expected to be used between the time the function is called and the time it is started. The expected response time can be set by relevant technical personnel based on actual conditions or manual experience, and in particular, it can adopt the broad opinions of users. For example, a user hopes that a certain application can respond as quickly as possible, and the corresponding business function called by the application is expected to be within a certain response time range. Correspondingly, the actual response time is the time consumed from the start of the call to the response of the function call during the actual function call process. The expected response time represents the expected performance of the function call process by the user or relevant technical personnel. The actual response time reflects the actual performance of the function being called.
[0051] The data related to these computing resources are used as training data, and the function type is used as a label to train the pre-set machine learning model so that the model can obtain the predicted resource allocation information of the computing resources that the target function needs to call according to the function type of the target function, that is, which computing resources need to be called and how many computing resources need to be used during the preloading process. The trained machine learning model can be used as a resource prediction model. Of course, the induced learning model can adopt any basic model, such as a recurrent neural network, and the training method of the model can refer to any method in the relevant technology, and the embodiment of the present application does not limit this.
[0052] Of course, it is understandable that a function generally occupies a variety of different computing resources during the process of being called, so the data used for training also corresponds to a variety of different computing resources.
[0053] In the above implementation, the resource category, resource usage, resource usage time, total resource amount, actual response time and expected response time corresponding to the computing resources called by the function in the historical period are used as training data, which provides data of multiple dimensions related to computing resources for model training, improves the comprehensiveness of model training, helps to improve the prediction performance of the model, makes the predicted resource allocation strategy more reasonable, and thus improves the accuracy of the model's prediction of resource requirements.
[0054] In a further optional embodiment, the acquisition of resource categories, resource usage, resource usage duration, total resource amount, actual response time, and expected response time for each scheduled call of all functions in the current computing environment during a preset historical period as training data for the resource prediction model may include:
[0055] A1. For any resource category, the difference between the expected response time and the actual response time corresponding to the resource category is used as the response satisfaction parameter.
[0056] The response satisfaction parameter is used to represent the user's satisfaction with the business function response requirements. It can be understood that the difference between the expected response time and the actual response time is used as the response satisfaction parameter. The larger the response satisfaction parameter, the higher the user satisfaction.
[0057] A2. The ratio of the difference between the total amount of resources corresponding to the resource category and the resource usage amount to the resource usage duration is used as the resource utilization rate parameter.
[0058] The resource utilization parameter characterizes the degree of computing resources occupied by the target function when it is called. The resource utilization parameter is calculated by taking the difference between the total amount of resources corresponding to a resource category and the amount of resource usage, and then dividing it by the duration of resource usage. A smaller resource utilization parameter indicates higher developer satisfaction (because it occupies fewer resources).
[0059] A3. Use the response satisfaction parameter and resource utilization rate parameter as training data for the resource prediction model.
[0060] It should be emphasized that the response satisfaction parameter is also used as training data. Similarly, the resource utilization parameter is also used as training data.
[0061] In the above implementation, during the training phase of the model, two important data that affect user satisfaction and developer satisfaction are used as training data for model training. This can help the model learn the optimal balance point that affects users and developers under different allocations of different computing resources, so that the model has predictive resource allocation information that can meet the needs of users and developers at the same time, and thus provide an intelligent resource allocation strategy for function preloading, ensuring the implementation of preloading while improving the resource utilization efficiency of the function.
[0062] In another optional embodiment, the step of inputting the target function type into a pre-trained resource prediction model in response to the predicted startup time meeting a preset preloading judgment condition in S130 may include: inputting the target function type into a pre-trained resource prediction model in response to the predicted startup time being within a preset time period in the future of the current time.
[0063] Among them, the future preset duration of the current time can be a time period with the current time point as the starting point and the preset duration in the future. That is to say, if the predicted startup time is within the preset duration in the future of the current time point, it can be determined that the target function needs to be preloaded to prepare for the call situation that may occur in the future preset duration. Therefore, the target function type is input into the resource prediction model to output the predicted resource allocation information, and then the computing resources in the computing environment are pre-allocated to achieve the purpose of preloading. For example, it is determined whether the predicted startup time obtained by the prediction is within 30 minutes in the future of the current time point. If so, resource prediction is performed and preloading is further enabled; if not, there is no need to perform resource prediction immediately.
[0064] In the above implementation, a practical optional solution is provided for the preloading judgment condition. From the perspective of time, when the predicted startup time of the target function is approaching, the computing resources that the function needs to call are allocated in advance to achieve the purpose of preloading. This not only solves the problem of function cold start, but also improves the efficiency of function preloading, thereby improving the user experience.
[0065] In another optional embodiment, the time prediction model in S120 can be determined by: obtaining the call time data of all functions in the current computing environment that are activated in a preset historical period; using the function type and call time data of each function to train a preset machine learning model to obtain a time prediction model.
[0066] The preset historical period may be a certain historical time period in the past, and data related to function calls within this historical time period are collected for model training.
[0067] The call time data may be all the time information when a certain target function is called in a preset historical period, that is, the time points when the target function is called multiple times in the historical period.
[0068] Multiple call time data corresponding to different functions are used as training data, and the function types are used as labels to train a preset machine learning model, such as a recurrent neural network. This enables the machine learning model to predict call time based on function types, that is, to obtain the time prediction model.
[0069] In yet another optional implementation, obtaining at least one target function in the preloaded function list in S110 may include:
[0070] S111. Traverse the preloaded function list and determine whether the preloaded function list is empty.
[0071] After traversing the preloaded function list, the system checks whether there are any records of the function type in the list. If the preloaded function list is empty, it means that there are currently no target functions that need to be preloaded. On the contrary, if the preloaded function list is not empty, it means that there are records of the function type in the list, and these functions are the task functions that need to be preloaded.
[0072] S112: In response to the preload function list being not empty, determine whether there is an active instance of each to-be-preloaded function in the preload function list in the current computing environment.
[0073] The functions to be preloaded can be the various task functions in the preload function list. The current computing environment can be the computing environment that calls these functions, such as a serverless cloud computing environment. The existence of a live instance of a function in the computing environment means that the function is calling the relevant computing resources to execute the relevant tasks.
[0074] If there are functions to be preloaded in the preload function list, the system will further determine whether there are active instances of these functions in the current computing environment. It is understood that if there are active instances of these functions in the current computing environment, it means that the functions are actually being called and their related resources are in the running process. In other words, these functions do not currently have a cold start problem and do not need to be preloaded. On the contrary, if there are no active instances of these functions in the current computing environment, that is, these functions are not being called and their related resources are in a stopped state, then these functions need to be preloaded.
[0075] S113: In response to the fact that there is no active instance of the function to be preloaded in the current computing environment, the function to be preloaded is used as the target function.
[0076] According to the content explained in the above steps, when there is no live instance of the function to be preloaded in the current computing environment, all of these functions to be preloaded are used as target functions for further preloading operations.
[0077] In the above implementation, by determining whether the preloaded function list is empty, it is confirmed whether there are functions that may need to be preloaded, and then further determining whether these functions have live instances in the current computing environment. Functions that do not have live instances are used as target functions and prepared for preloading. This can provide an accurate judgment basis for the preloading of functions, prevent repeated calls to preloaded computing resources, solve the problem of function cold start, and further improve the accuracy of preloading.
[0078] Example 2
[0079] Figure 2This is a schematic diagram of the function preloading process provided in Example 2 of this application. This example is a specific example provided on the basis of the above examples and various implementation methods. Figure 2 As shown, specifically including:
[0080] In the current period, the preloaded function list is traversed to determine whether the list is empty. If the list is empty after the traversal, there is no function that needs to be preloaded in the current serverless cloud computing environment during the period, or all preloaded functions have been preloaded.
[0081] If the list is not empty after the traversal, it is determined whether the function exists in the serverless cloud computing environment. If it exists, it means that the function has been started and does not need to be preloaded, and the preloading process of the next function is entered; if it does not exist, the function category is input into the pre-trained time prediction model so that the model outputs the predicted startup time of the function.
[0082] Further determine whether the predicted start time is within 30 minutes of the current time point. If not, enter the preloading process of the next function; if so, input the function type of the function into the pre-trained resource prediction model so that the model calculates the recommended resource configuration of the function and generates the predicted resource allocation information output.
[0083] Resources are allocated according to the predicted resource allocation information to complete the preloading of the function; after the preloading of the function is completed, the preloading process of the next function is entered.
[0084] Of course, before executing the above process, the time prediction model and resource prediction model need to be trained in advance, as follows:
[0085] First, for each type of function F (there may be multiple functions) in the serverless cloud computing environment, set an expected response time P for all functions and calculate the actual response time S of the function. The computing resources in the serverless cloud computing environment are classified into resource categories A, A1, A2, ..., An (i.e., including multiple computing resources).
[0086] Then, the response satisfaction parameter and resource utilization parameter are determined respectively: the difference between the expected response time P and the actual response time S is taken as the response satisfaction parameter Uy, that is, Uy=PS. The larger the Uy value, the shorter the response time.
[0087] The resource utilization parameter Uz is: Uz = (ZH) / L, where Z is the total amount of a resource available, H is the resource usage of the resource, and L is the resource usage duration of the resource. In the time period L, the smaller Uz is, the higher the resource utilization rate is.
[0088] In short, the larger the value of Uy and the smaller the value of Uz, the higher the satisfaction of users and developers.
[0089] In a serverless cloud computing environment, statistics are collected over a period of history to show the time T of each type of function call, the usage time L of different resources A, the resource usage H, and the function impact time S, and the corresponding Uy and Uz are calculated.
[0090] Based on the statistical call time T of each type of function, a recurrent neural network machine learning model is trained to obtain a time prediction model, which is used to predict and analyze the future call time T and execution time K of this type of function. Of course, before training, the training data can be pre-denoised and cleaned to improve training quality.
[0091] Based on the statistical data of resources A used in each scheduling of each type of function, its corresponding resource usage H, resource usage time L, as well as Uy and Uz, the machine learning model of the recurrent neural network is trained to obtain a resource prediction model, which is used to predict the optimal usage and usage time of various resources required for each scheduling of this type of function, so as to form predicted resource allocation information for preloading the function.
[0092] Example 3
[0093] Figure 3 This is a structural diagram of a preloading device provided in Example 3 of this application. Figure 3 As shown, the device 300 includes:
[0094] A function acquisition module 310 is configured to acquire at least one target function from a preloaded function list;
[0095] A time prediction module 320 is configured to input the target function type of any target function into a pre-trained time prediction model so that the time prediction model outputs a predicted start time of the target function;
[0096] The resource prediction module 330 is configured to input the target function type into a pre-trained resource prediction model in response to the predicted startup time meeting the preset preload judgment condition, so that the resource prediction model outputs predicted resource allocation information of the target function;
[0097] The function preloading module 340 is used to preload the target function according to the predicted resource allocation information.
[0098] The technical solution of the embodiment of the present application predicts the target function that may need to be preloaded, first predicts the startup time of the target function, and provides a time basis for the preloading of the target function; when the predicted startup time meets the preloading judgment conditions, further predicts the computing resources that the target function may need to occupy during the preloading process, and obtains predicted resource allocation information to provide basic conditions for the actual preloading process. This not only solves the cold start problem encountered by various task functions in a serverless cloud computing environment, but also further improves the calling efficiency of various task functions in the computing environment, thereby improving the efficiency of business execution.
[0099] In an optional implementation, the apparatus 300 includes a resource prediction model determination module, which may include:
[0100] A resource training data acquisition unit is used to obtain the resource category, resource usage, resource usage duration, total resource amount, actual response time, and expected response time of each scheduled call of all functions in the current computing environment in a preset historical period as training data for the resource prediction model;
[0101] The resource prediction model training unit is used to train a preset machine learning model based on training data to obtain a resource prediction model.
[0102] In an optional implementation, the resource training data acquisition unit may include:
[0103] The response satisfaction determination subunit is used to use the difference between the expected response time and the actual response time corresponding to any resource category as a response satisfaction parameter;
[0104] The resource utilization rate determination subunit is used to use the ratio of the difference between the total amount of resources corresponding to the resource category and the resource utilization amount to the resource utilization time as a resource utilization rate parameter;
[0105] The training data determination subunit is used to use the response satisfaction parameter and the resource utilization rate parameter as training data for the resource prediction model.
[0106] In an optional implementation, the resource prediction module 330 may include:
[0107] The prediction judgment unit is configured to input the target function type into a pre-trained resource prediction model in response to the predicted startup time being within a preset time period in the future of the current time.
[0108] In an optional implementation, the apparatus 300 includes a time prediction model determination module, which may include:
[0109] A time training data acquisition unit is used to obtain the call time data of all functions in the current computing environment that are started in a preset historical period;
[0110] The time prediction model training unit is used to use the function type and call time data of each function to train a preset machine learning model to obtain a time prediction model.
[0111] In an optional implementation, the function acquisition module 310 may include:
[0112] A list judgment unit is used to traverse the preloaded function list and judge whether the preloaded function list is empty;
[0113] an instance survival judgment unit, configured to judge whether there is a live instance of each to-be-preloaded function in the preloaded function list in the current computing environment in response to the preloaded function list being not empty;
[0114] The target function determining unit is configured to use the function to be preloaded as the target function in response to the fact that there is no active instance of the function to be preloaded in the current computing environment.
[0115] The preloading device provided in the embodiment of the present application can execute the preloading method provided in any embodiment of the present application, and has the corresponding functional modules and beneficial effects for executing each preloading method.
[0116] Example 4
[0117] Figure 4 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.
[0118] like Figure 4As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., which is communicatively connected to the at least one processor 11. The memory stores a computer program that can be executed by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. Various programs and data required for the operation of the electronic device 10 can also be stored in the RAM 13. The processor 11, ROM 12, and RAM 13 are connected to each other via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0119] Multiple components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0120] The processor 11 may be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the preloading method.
[0121] In some embodiments, the preloading method may be implemented as a computer program that is tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the preloading method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the preloading method in any other suitable manner (e.g., by means of firmware).
[0122] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0123] Computer programs for implementing the methods of the present application may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0124] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. A computer-readable storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0125] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0126] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0127] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.
[0128] The present application also discloses a computer program product, comprising a computer program that, when executed by a processor, implements the preloading method provided in any of the embodiments of the present application. This program product and the preloading method disclosed in each embodiment of the present application share the same inventive concept and are therefore not described in detail here.
[0129] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this application can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of this application can be achieved. This is not limited herein.
[0130] The above specific embodiments do not constitute a limitation on the scope of protection of this application. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application shall be included within the scope of protection of this application.
Claims
1. A preloading method, characterized in that: include: Get at least one target function from the preloaded function list; For any one of the objective functions, inputting the objective function type of the objective function into a pre-trained time prediction model so that the time prediction model outputs a predicted start time of the objective function; In response to the predicted start time meeting a preset preloading judgment condition, inputting the target function type into a pre-trained resource prediction model so that the resource prediction model outputs predicted resource allocation information of the target function; The objective function is preloaded according to the predicted resource allocation information.
2. The method according to claim 1, characterized in that The resource prediction model is determined by: Obtaining the resource category, resource usage, resource usage duration, total resource amount, actual response time, and expected response time of each scheduled call of all functions in the current computing environment in a preset historical period as training data for the resource prediction model; Based on the training data, a preset machine learning model is trained to obtain the resource prediction model.
3. The method according to claim 2, characterized in that The step of obtaining resource categories, resource usage, resource usage duration, total resource amount, actual response time, and expected response time of each scheduled call of all functions in the current computing environment during a preset historical period as training data for the resource prediction model includes: For any resource category, the difference between the expected response time and the actual response time corresponding to the resource category is used as a response satisfaction parameter; The ratio of the difference between the total amount of resources corresponding to the resource category and the resource usage amount to the resource usage duration is used as a resource usage rate parameter; The response satisfaction parameter and the resource utilization rate parameter are used as training data for the resource prediction model.
4. The method according to claim 1, wherein In response to the predicted startup time meeting a preset preloading judgment condition, inputting the objective function type into a pre-trained resource prediction model includes: In response to the predicted start time being within a preset time period in the future of the current time, the objective function type is input into a pre-trained resource prediction model.
5. The method according to claim 1, wherein The time prediction model is determined by: Get the call time data of all functions in the current computing environment that were started during the preset historical period; The function type of each function and the call time data are used to train a preset machine learning model to obtain the time prediction model.
6. The method according to claim 1, wherein The obtaining of at least one target function in the preloaded function list includes: Traversing the preloaded function list to determine whether the preloaded function list is empty; In response to the preload function list being not empty, determining whether each to-be-preloaded function in the preload function list has an active instance in the current computing environment; Corresponding to the fact that the function to be preloaded does not have the live instance in the current computing environment, the function to be preloaded is used as the target function.
7. A preloading device, characterized in that: include: A function acquisition module, used to acquire at least one target function from a preloaded function list; a time prediction module, configured to input, for any one of the objective functions, an objective function type of the objective function into a pre-trained time prediction model, so that the time prediction model outputs a predicted start time of the objective function; a resource prediction module, configured to input the objective function type into a pre-trained resource prediction model in response to the predicted startup time meeting a preset preload judgment condition, so that the resource prediction model outputs predicted resource allocation information of the objective function; A function preloading module is used to preload the target function according to the predicted resource allocation information.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor. The computer program is executed by the at least one processor to enable the at least one processor to perform the preloading method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the preloading method according to any one of claims 1 to 6 when executed.
10. A computer program product, characterized in that The computer program product comprises a computer program, which, when executed by a processor, implements the preloading method according to any one of claims 1 to 6.