Resource scheduling method and device, equipment and medium
By obtaining business requests from message queues in the function computing platform, determining the target instance and executing the objective function, and adopting a delay processing strategy when the function execution fails, the problems of insufficient resources and scheduling failure are solved, and the success rate and resource utilization rate of function calls are improved.
Patent Information
- Application Number
- CN202411859435.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-04-11
AI Technical Summary
In the function computing platform under the serverless architecture, there are often situations where resources are insufficient or scheduling fails, resulting in low function call success rate and resource utilization rate.
By obtaining the service requests of the pending application from the message queue, determining the resource configuration information of the objective function, and determining the corresponding target instance from the function calculation platform based on the objective function identification and resource configuration information in the service request. If the function execution fails, the target processing strategy is determined based on the current retention time of the exception call data and/or business request, and the resource scheduling delay processing is performed.
The full use of resources is achieved, the resource utilization rate is improved, and the function call success rate is improved through a delay processing strategy when the function execution fails.
Smart Images

Figure CN119806820A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of cloud computing technology, and in particular to a resource scheduling method, device, equipment and medium. Background Art
[0002] In the traditional architecture, if a business wants to be developed and launched, it needs to evaluate resource usage and configure cloud hosts and other resources based on the resource evaluation results. However, serverless (Serverless Computing) function computing does not require such a complicated process. As a fully managed computing service under the serverless architecture, all backend services are handled by the function computing platform provider. When an event is triggered on the platform, function computing will perform asynchronous resource scheduling. However, the platform will always encounter insufficient resources or scheduling failures. Therefore, how to improve the success rate of function calls and resource utilization is crucial. Summary of the invention
[0003] The present invention provides a resource scheduling method, device, equipment and medium to improve the function call success rate and resource utilization rate.
[0004] According to one aspect of the present invention, a resource scheduling method is provided, which is applied to a scheduling gateway, and the method includes:
[0005] Obtaining a service request of an application to be processed from a message queue, and determining resource configuration information of a target function according to the service request; wherein the service request includes a target function identifier;
[0006] According to the target function identifier in the business request and the resource configuration information, a corresponding target instance is determined from the function computing platform, and the target function is executed according to the target instance to obtain a function execution result; wherein the target instance is a target hot instance or a target cold instance;
[0007] If the function execution result is a function execution failure, then determining the abnormal call data corresponding to the function execution failure, and determining the target processing strategy of the business request according to the abnormal call data and / or the current retention time of the business request; wherein the target processing strategy is a custom processing strategy or a delayed processing strategy;
[0008] If the target processing strategy is a delayed processing strategy, resource scheduling delayed processing is performed on the service request according to the delayed processing strategy.
[0009] According to another aspect of the present invention, a resource scheduling device is provided, which is configured in a scheduling gateway, and the device includes:
[0010] A business request acquisition module, used to acquire the business request of the application to be processed from the message queue, and determine the resource configuration information of the target function according to the business request; wherein the business request includes the target function identifier;
[0011] An execution result determination module, used to determine a corresponding target instance from a function computing platform according to the target function identifier in the business request and the resource configuration information, and execute the target function according to the target instance to obtain a function execution result; wherein the target instance is a target hot instance or a target cold instance;
[0012] A target processing strategy determination module, for determining the abnormal call data corresponding to the function execution failure if the function execution result is a function execution failure, and determining the target processing strategy of the business request according to the abnormal call data and / or the current retention time of the business request; wherein the target processing strategy is a custom processing strategy or a delayed processing strategy;
[0013] The delay processing module is used to perform resource scheduling delay processing on the service request according to the delay processing strategy if the target processing strategy is the delay processing strategy.
[0014] According to another aspect of the present invention, there is provided an electronic device, comprising:
[0015] one or more processors;
[0016] A memory for storing one or more programs;
[0017] When one or more programs are executed by one or more processors, the one or more processors can execute any resource scheduling method provided by the embodiments of the present invention.
[0018] According to another aspect of the present invention, 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 any resource scheduling method provided by an embodiment of the present invention when executed.
[0019] An embodiment of the present invention provides a resource scheduling solution, which obtains the business request of the application to be processed from the message queue, and determines the resource configuration information of the target function according to the business request; wherein the business request includes the target function identifier; according to the target function and resource configuration information in the business request, determines the corresponding target instance from the function computing platform, and executes the target function according to the target instance to obtain the function execution result; wherein the target instance is a target hot instance or a target cold instance; if the function execution result is a function execution failure, determines the abnormal call data corresponding to the function execution failure, and determines the target processing strategy of the business request according to the abnormal call data and / or the current retention time of the business request; wherein the target processing strategy is a custom processing strategy or a delayed processing strategy; if the target processing strategy is a delayed processing strategy, performs resource scheduling delay processing on the business request according to the delayed processing strategy. The above scheme determines the target cold instance or target hot instance of the target function, and executes the target function based on the target cold instance or target hot instance, thereby achieving full use of resources and improving resource utilization. At the same time, when the function execution result is a function execution failure, the target processing strategy of the business request is determined according to the abnormal call data and / or the current retention time of the business request. If the target processing strategy is a delayed processing strategy, resource scheduling and delayed processing are performed on the business request, thereby achieving repeated processing of business requests that failed to execute, and improving the success rate of function calls.
[0020] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, 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 invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0022] Figure 1 is a flow chart of a resource scheduling method provided by Embodiment 1 of the present invention;
[0023] Figure 2 is a flow chart of a resource scheduling method provided by Embodiment 2 of the present invention;
[0024] Figure 3 is a flow chart of a resource scheduling method provided by Embodiment 3 of the present invention;
[0025] Figure 4 is a structural diagram of a resource scheduling device provided by Embodiment 4 of the present invention;
[0026] Figure 5 It is a structural diagram of an electronic device for implementing a resource scheduling method provided in Embodiment 5 of the present invention. DETAILED DESCRIPTION
[0027] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0028] Function Compute: Function Compute is a form of serverless architecture, which is a fully managed computing service based on event-driven and function programming. With Function Compute, users do not need to manage infrastructure such as servers. They only need to write and upload code. The Function Compute platform will prepare computing resources for users and run their code in an elastic and reliable manner.
[0029] Function cold start: Cold start refers to the startup process in the function call link that includes code download, runtime initialization, code initialization, and other links.
[0030] Function hot start: When the function instance is ready, the function request can be executed directly. This process is called function hot start.
[0031] Cold instance: Idle instance resources that are not occupied by functions.
[0032] Hot instance: An instance that has been loaded with the code and runtime required by a function and can handle function traffic.
[0033] Embodiment 1
[0034] Figure 1 This is a flowchart of a resource scheduling method provided in Example 1 of the present invention. This embodiment is applicable to the situation of performing resource scheduling on a function computing platform. The method can be executed by a resource scheduling device, which can be implemented in software and / or hardware and can be configured in an electronic device that carries the resource scheduling function.
[0035] See also Figure 1 The resource scheduling method shown is applied to a scheduling gateway, and includes:
[0036] S110 . Obtain a service request of an application to be processed from a message queue, and determine resource configuration information of a target function according to the service request.
[0037] Among them, the message queue can be used to store business requests that have not been processed by resource scheduling. The pending application refers to the application that needs to be processed. The business request can be understood as a function call request, which is used to call the target function. Exemplarily, the business request may include a target function identifier and input parameters. The target function identifier can be used to uniquely represent the identity of the target function. Exemplarily, the target function identifier may include a target function name and a target function version. The target function name refers to the name of the target function. The target function version can be used to characterize the difference between target functions with the same target function name. Input parameters refer to the parameters required to execute the target function.
[0038] The target function refers to the function to be executed. Exemplarily, the target function may be a program function. Resource configuration information refers to information about the required resource pool corresponding to the target function. Exemplarily, the resource configuration information may include resource pool identification information. The resource pool identification information may be used to characterize the identity of the resource pool in the function computing platform.
[0039] Among them, the scheduling gateway can be used to process business requests and realize resource scheduling of the target function.
[0040] Exemplarily, the message queue obtains and stores the business request of the application to be processed; the scheduling gateway obtains the business request of the application to be processed from the message queue; the scheduling gateway determines the target function according to the target function identifier in the business request, and determines the resource configuration information of the target function.
[0041] S120. According to the target function identifier and resource configuration information in the business request, determine the corresponding target instance from the function computing platform, and execute the target function according to the target instance to obtain the function execution result.
[0042] The target instance can be understood as a resource instance required for executing the target function. Exemplarily, the target instance can be a target hot instance or a target cold instance. A target hot instance refers to a resource instance that has been started and can directly execute the target function. A target cold instance refers to an idle resource instance that can execute the target function.
[0043] The function execution result refers to the execution result of the target function. Exemplarily, the function execution result includes function execution success and function execution failure. Function execution success can indicate that the target function is successfully executed. Function execution failure can indicate that the target function fails to execute or resource call fails.
[0044] Specifically, the scheduling gateway determines the target instance corresponding to the target function according to the target function identifier and resource configuration information in the business request; the scheduling gateway starts the target function through the target instance and obtains the function execution result.
[0045] S130. If the function execution result is a function execution failure, determine the abnormal call data corresponding to the function execution failure, and determine the target processing strategy of the business request according to the abnormal call data and / or the current retention time of the business request.
[0046] Among them, abnormal call data refers to the factor data of the failure of the target function execution. The current retention time refers to the length of time that the business request has existed on the function computing platform. The target processing strategy refers to the solution for processing the business request that failed to execute.
[0047] Exemplarily, the target processing strategy is a custom processing strategy or a delayed processing strategy. The custom processing strategy refers to a pre-set strategy for custom processing of failed business requests. The embodiment of the present invention does not impose any limitation on the custom processing strategy, which can be set by a technician based on experience or needs. The delayed processing strategy can be characterized by sending a business request to a delay queue, the scheduling gateway obtaining the business request from the delay queue, and reprocessing the business request.
[0048] The delay queue may be used to store service requests that have failed in resource scheduling and that can be processed by the next resource scheduling.
[0049] In an optional embodiment, a target processing strategy for a business request is determined based on the exception call data and / or the current retention time of the business request, including: determining the exception type of the function execution failure based on the exception call data; if the exception type is a retryable type, determining the current retention time of the business request; comparing the current retention time with a preset request retention time threshold, and determining the target processing strategy for the business request based on the comparison result.
[0050] Among them, the exception type refers to the type of factor that causes the failure of the target function to execute. Exemplarily, the exception type may include a retryable type and a non-retryable type. The retryable type is used to indicate that the target function can be executed again. For example, the retryable type can be understood as the type of execution failure caused by an error other than the target function itself, such as insufficient resources corresponding to the target function. The non-retryable type can indicate that the target function is prohibited from being executed again. For example, the non-retryable type can be understood as the type of execution failure caused by an error in the target function itself, such as a code exception in the target function.
[0051] The embodiment of the present invention does not impose any limitation on the size of the preset request retention time threshold, which can be set by a technician based on experience or repeatedly determined through a large number of experiments.
[0052] Exemplarily, if the current retention time is greater than the preset request retention time threshold, the target processing strategy is determined to be a custom processing strategy; if the current retention time is less than or equal to the preset request retention time threshold, the target processing strategy is determined to be a delayed processing strategy.
[0053] It can be understood that by determining the exception type based on the exception call data, when the exception type is a retryable type, the target processing strategy is determined based on the current retention time and the preset request retention time threshold, thereby improving the accuracy of the determined target processing strategy.
[0054] In another optional embodiment, the target processing strategy for the business request is determined based on the exception call data and / or the current retention time of the business request, including: determining the exception type of the function execution failure based on the exception call data; if the exception type is a non-retryable type, determining the target processing strategy as a custom processing strategy.
[0055] Exemplarily, if the function execution result is that the function execution is successful, the target function is subsequently processed based on the preset configuration information. The preset configuration information refers to information of the target function that is preset by the user and is used to process the target function that is successfully executed.
[0056] S140: If the target processing strategy is a delayed processing strategy, perform resource scheduling delayed processing on the service request according to the delayed processing strategy.
[0057] Optionally, if the target processing strategy is a delayed processing strategy, when the current waiting time of the service request outside the delay queue reaches the preset delay storage time threshold, the scheduling gateway stores the service request in the delay queue, and directly obtains the aforementioned service request from the delay queue, and performs resource scheduling processing on the aforementioned service request again, that is, performs resource scheduling delay processing on the aforementioned service request.
[0058] The current waiting time refers to the waiting time of the service request outside the delay queue at the current moment. The preset delay storage time threshold can be understood as the waiting time threshold before being stored in the delay queue. The embodiment of the present invention does not impose any limitation on the size of the preset delay storage time threshold, which can be set by technicians based on experience or needs, or repeatedly determined through a large number of experiments.
[0059] Or optionally, if the target processing strategy is a delayed processing strategy, the scheduling gateway can directly store the business request in the delay queue; when the current storage time of the aforementioned business request in the delay queue reaches the preset request waiting threshold, the scheduling gateway obtains the aforementioned business request from the delay queue and performs resource scheduling processing on the aforementioned business request again, that is, performs resource scheduling delay processing on the aforementioned business request.
[0060] The current storage duration refers to the storage duration of the service request in the delay queue at the current moment. The preset request waiting threshold can be understood as the threshold of the duration in which the service request is stored in the delay queue. The embodiment of the present invention does not impose any limitation on the size of the preset request waiting threshold, which can be set by technicians based on experience or needs, or repeatedly determined through a large number of experiments.
[0061] An embodiment of the present invention provides a resource scheduling solution, which obtains the business request of the application to be processed from the message queue, and determines the resource configuration information of the target function according to the business request; wherein the business request includes the target function identifier; according to the target function and resource configuration information in the business request, determines the corresponding target instance from the function computing platform, and executes the target function according to the target instance to obtain the function execution result; wherein the target instance is a target hot instance or a target cold instance; if the function execution result is a function execution failure, determines the abnormal call data corresponding to the function execution failure, and determines the target processing strategy of the business request according to the abnormal call data and / or the current retention time of the business request; wherein the target processing strategy is a custom processing strategy or a delayed processing strategy; if the target processing strategy is a delayed processing strategy, performs resource scheduling delay processing on the business request according to the delayed processing strategy. The above scheme determines the target cold instance or target hot instance of the target function, and executes the target function based on the target cold instance or target hot instance, thereby achieving full use of resources and improving resource utilization. At the same time, when the function execution result is a function execution failure, the target processing strategy of the business request is determined according to the abnormal call data and / or the current retention time of the business request. If the target processing strategy is a delayed processing strategy, resource scheduling and delayed processing are performed on the business request, thereby achieving repeated processing of business requests that failed to execute, and improving the success rate of function calls.
[0062] Embodiment 2
[0063] Figure 2 It is a flow chart of a resource scheduling method provided in the second embodiment of the present invention. Based on the above embodiments, this embodiment further refines the operation of "determining the corresponding target instance from the function computing platform according to the target function identifier and resource configuration information in the business request" into "determining whether there is a corresponding target hot instance in the function computing platform according to the target function identifier and resource configuration information; if not, cold start the target function and determine the current cold start data and the current number of cold starts of the target function; determine the target cold instance corresponding to the target function according to the current cold start data and the current number of cold starts" to improve the target instance determination mechanism. It should be noted that for the parts not described in detail in the embodiments of the present invention, please refer to the descriptions of other embodiments.
[0064] See also Figure 2The resource scheduling method shown includes:
[0065] S210: Obtain a service request of an application to be processed from a message queue, and determine resource configuration information of a target function according to the service request.
[0066] The business request includes a target function identifier.
[0067] S220: Determine whether there is a corresponding target hot instance in the function computing platform according to the target function identifier and resource configuration information.
[0068] Exemplarily, according to the target function identifier and resource configuration information, determine the target resource pool corresponding to the target function; determine whether there is a hot instance in the target resource pool, if so, determine whether the aforementioned hot instance is occupied, if not, use the aforementioned hot instance as the target hot instance of the target function. The target resource pool refers to a resource pool that can provide resources for the target function.
[0069] S230: If it does not exist, cold start the target function and determine the current cold start data and the current cold start times of the target function.
[0070] Among them, the current cold start data refers to data associated with the cold start of the target function. Exemplarily, the current cold start data includes the current cold start duration and the current cold start state. The current cold start duration refers to the duration of the cold start of the target function this time. The current cold start state refers to the state of the cold start of the target function this time. Exemplarily, the current cold start state may include the current cold start failure and the current cold start success. The current cold start failure refers to the failure of the target function of this cold start. The current cold start success refers to the success of the target function of this cold start.
[0071] S240: Determine a target cold instance corresponding to the target function according to current cold start data and the current number of cold starts.
[0072] In an optional embodiment, if the current cold start data includes the current cold start duration and the current cold start status, the target cold instance corresponding to the objective function is determined based on the current cold start data and the current number of cold starts, including: if the current cold start duration is greater than a preset cold start duration threshold, and the current cold start status is a current cold start failure, the current number of cold starts is updated; based on the updated current number of cold starts and the preset number of cold starts threshold, the target cold instance corresponding to the objective function is determined.
[0073] The embodiment of the present invention does not impose any limitation on the size of the preset cold start duration threshold, which can be set by a technician based on experience or needs, or determined repeatedly through a large number of experiments. The embodiment of the present invention does not impose any limitation on the size of the preset cold start number threshold, which can be set by a technician based on experience or needs, or determined repeatedly through a large number of experiments.
[0074] It can be understood that when the current cold start duration is greater than the preset cold start duration threshold and the current cold start state is the current cold start failure, the current number of cold starts is updated, and the target cold instance corresponding to the objective function is determined based on the updated current number of cold starts and the preset cold start number threshold. By introducing the preset cold start duration threshold, the current number of cold starts is updated, and the target cold instance is determined based on the preset cold start number threshold, thereby improving the accuracy of the determined target cold instance.
[0075] Exemplarily, if the current cold start duration is less than or equal to the preset cold start duration threshold, and the current cold start status is that the current cold start is successful, it is determined that there is a resource instance in the function computing platform that corresponds to the target function and is in an idle state (that is, the target cold instance corresponding to the target function is determined), which indicates that there are sufficient resources that can be called to execute the target function.
[0076] In an optional embodiment, the target cold instance corresponding to the target function is determined based on the updated current number of cold starts and the preset cold start number threshold, including: if the updated current number of cold starts is greater than the preset cold start number threshold, it is determined that there is no corresponding target cold instance for the target function; if the updated current number of cold starts is less than or equal to the preset cold start number threshold, the target function is cold started again.
[0077] Exemplarily, if the updated current number of cold starts is greater than a preset cold start number threshold, it is determined that the resources corresponding to the target function are insufficient, that is, it is determined that there is no corresponding target cold instance for the target function.
[0078] It can be understood that by comparing the updated current number of cold starts with the preset cold start number threshold, the target cold instance is determined according to the comparison result, thereby improving the accuracy of the determined target cold instance.
[0079] In an optional embodiment, when the current number of cold starts reaches a preset cold start number threshold, or when a target cold instance is obtained within the preset cold start number threshold, the target function cold start is stopped.
[0080] Exemplarily, if the current number of cold starts reaches a preset cold start number threshold, the cold start of the target function is stopped; if the target function obtains a corresponding target cold instance within the preset cold start number threshold, the cold start of the target function can be stopped.
[0081] It can be understood that by stopping the cold start of the target function when the current number of cold starts reaches the preset cold start number threshold, or when the target cold instance is obtained within the preset cold start number threshold, infinite cold starts of the target function are avoided, resource waste is reduced, and timeliness of stopping the cold start of the target function is achieved.
[0082] S250: If the function execution result is a function execution failure, determine the abnormal call data corresponding to the function execution failure, and determine the target processing strategy of the business request according to the abnormal call data and / or the current retention time of the business request.
[0083] The target processing strategy is a custom processing strategy or a delayed processing strategy.
[0084] S260: If the target processing strategy is a delayed processing strategy, perform resource scheduling delayed processing on the service request according to the delayed processing strategy.
[0085] The resource scheduling scheme provided by the embodiment of the present invention refines the target instance determination operation from the function computing platform according to the target function identifier and resource configuration information in the business request to determine whether there is a corresponding target hot instance in the function computing platform according to the target function identifier and resource configuration information; if not, the target function is cold started, and the current cold start data and the current number of cold starts of the target function are determined; the target cold instance corresponding to the target function is determined according to the current cold start data and the current number of cold starts, thereby improving the target instance determination mechanism. The above scheme achieves full utilization of resources and improves resource utilization by cold starting the target function when there is no target hot instance, and determining the target cold instance corresponding to the target function according to the current cold start data and the current number of cold starts.
[0086] Embodiment 3
[0087] The embodiment of the present invention provides an optional example of resource scheduling based on the above embodiment. It should be noted that for the parts not described in detail in the embodiment of the present invention, reference may be made to the descriptions of other embodiments.
[0088] The embodiment of the present invention optimizes the existing serverless function computing resource shortage and scheduling failure situations, and improves the call success rate and resource utilization rate of the function computing platform. The embodiment of the present invention proposes an event-triggered scheduling method suitable for serverless function computing. The scheme supports limited attempts to obtain resources and perform scheduling within the user-defined message retention time, and can perform limited retries through user-configured retryable exceptions, ensuring the successful scheduling of the function and guaranteeing the high availability of the function computing platform.
[0089] Exemplarily, the submission step of the function trigger event in an embodiment of the present invention may include: the application to be processed submits an asynchronous event request (i.e., a business request) to the function computing platform; the function computing platform performs necessary verification on the asynchronous event request, and writes the asynchronous call request to the message queue after the verification passes; the function computing platform returns the request ID (Identity document) of this event.
[0090] For example, see Figure 3 The resource scheduling method shown in the figure shows the asynchronous processing method of the serverless function computing platform, including:
[0091] S311. The scheduling gateway obtains the service request of the application to be processed from the message queue and verifies the service request.
[0092] Exemplarily, the format of the service request, the target function identifier in the service request, etc. may be checked to determine whether the scheduling gateway can process the service request and whether the format of the service request is standardized.
[0093] S312: After the verification is passed, determine whether there is a target hot instance of the target function; if so, execute S313; if not, execute S314.
[0094] S313: If it exists, directly send the service request to the corresponding target hot instance.
[0095] S314: If not, determine whether the current number of cold starts reaches a preset cold start number threshold; if so, execute S316; if not, execute S315.
[0096] S315: The platform waits for the function instance to be cold started and determines again whether a hot instance has been successfully started or released, that is, S312-S315 are executed in a loop.
[0097] S316: Determine the function execution result.
[0098] S317, determine whether the function execution result is successful; if so, execute S320; if not, execute S318.
[0099] S318. Determine whether the exception type of the function execution failure is a retryable type; if so, execute S319; if not, execute S320.
[0100] S319, determine whether the current retention time exceeds the preset retention time threshold; if so, execute S320; if not, execute S321.
[0101] S320: Perform subsequent processing according to user configuration.
[0102] S321, sending the service request to the delay queue, and then executing S311-S321 in a loop.
[0103] The embodiment of the present invention proposes a resource scheduling method based on delay and retry based on the serverless function computing event trigger mode, which improves the scheduling success rate and resource utilization of function computing.
[0104] It should be noted that the information collected in the embodiments of the present invention is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data comply with the relevant laws, regulations and standards of relevant countries and regions, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse; if the user chooses to refuse, the expert decision-making process will be entered.
[0105] Embodiment 4
[0106] Figure 4 This is a schematic diagram of the structure of a resource scheduling device provided in Embodiment 4 of the present invention. This embodiment is applicable to the case of performing resource scheduling on a function computing platform. The method can be executed by a resource scheduling device, which can be implemented in software and / or hardware and can be configured in an electronic device that carries the resource scheduling function.
[0107] like Figure 4 As shown, the device is configured in the scheduling gateway, and the device includes: a service request acquisition module 410, an execution result determination module 420, a target processing strategy determination module 430 and a delay processing module 440. Among them,
[0108] The service request acquisition module 410 is used to acquire the service request of the application to be processed from the message queue, and determine the resource configuration information of the target function according to the service request; wherein the service request includes the target function identifier;
[0109] An execution result determination module 420 is used to determine a corresponding target instance from a function computing platform according to the target function identifier in the business request and the resource configuration information, and execute the target function according to the target instance to obtain a function execution result; wherein the target instance is a target hot instance or a target cold instance;
[0110] The target processing strategy determination module 430 is used to determine the abnormal call data corresponding to the function execution failure if the function execution result is a function execution failure, and determine the target processing strategy of the business request according to the abnormal call data and / or the current retention time of the business request; wherein the target processing strategy is a custom processing strategy or a delayed processing strategy;
[0111] The delay processing module 440 is used to perform resource scheduling delay processing on the service request according to the delay processing strategy if the target processing strategy is the delay processing strategy.
[0112] An embodiment of the present invention provides a resource scheduling solution, which obtains the business request of the application to be processed from the message queue, and determines the resource configuration information of the target function according to the business request; wherein the business request includes the target function identifier; according to the target function and resource configuration information in the business request, determines the corresponding target instance from the function computing platform, and executes the target function according to the target instance to obtain the function execution result; wherein the target instance is a target hot instance or a target cold instance; if the function execution result is a function execution failure, determines the abnormal call data corresponding to the function execution failure, and determines the target processing strategy of the business request according to the abnormal call data and / or the current retention time of the business request; wherein the target processing strategy is a custom processing strategy or a delayed processing strategy; if the target processing strategy is a delayed processing strategy, performs resource scheduling delay processing on the business request according to the delayed processing strategy. The above scheme determines the target cold instance or target hot instance of the target function, and executes the target function based on the target cold instance or target hot instance, thereby achieving full use of resources and improving resource utilization. At the same time, when the function execution result is a function execution failure, the target processing strategy of the business request is determined according to the abnormal call data and / or the current retention time of the business request. If the target processing strategy is a delayed processing strategy, resource scheduling and delayed processing are performed on the business request, thereby achieving repeated processing of business requests that failed to execute, and improving the success rate of function calls.
[0113] Optionally, the execution result determination module 420 includes:
[0114] a target hot instance determining unit, configured to determine whether a corresponding target hot instance exists in the function computing platform according to the target function identifier and the resource configuration information;
[0115] a function cold start unit, configured to cold start the target function if it does not exist, and determine current cold start data and current cold start times of the target function;
[0116] The target cold instance determining unit is used to determine the target cold instance corresponding to the objective function according to the current cold start data and the current number of cold starts.
[0117] Optionally, if the current cold start data includes a current cold start duration and a current cold start state, the target cold instance determination unit includes:
[0118] A current cold start number updating subunit, configured to update the current cold start number if the current cold start duration is greater than a preset cold start duration threshold and the current cold start state is a current cold start failure;
[0119] The target cold instance determination subunit is used to determine the target cold instance corresponding to the objective function according to the updated current cold start number and a preset cold start number threshold.
[0120] Optionally, the target cold instance determination subunit is specifically used to:
[0121] If the updated current cold start number is greater than the preset cold start number threshold, it is determined that there is no corresponding target cold instance for the target function;
[0122] If the updated current number of cold starts is less than or equal to the preset cold start number threshold, the objective function is cold started again.
[0123] Optionally, when the current number of cold starts reaches the preset cold start number threshold, or when the target cold instance is obtained within the preset cold start number threshold, the target function cold start is stopped.
[0124] Optionally, the target processing strategy determination module 430 includes:
[0125] An exception type determination unit, used to determine the exception type of the function execution failure according to the exception call data;
[0126] a current retention time determination unit, configured to determine a current retention time of the service request if the exception type is a retryable type;
[0127] The target processing strategy determining unit is used to compare the current retention time with a preset request retention time threshold, and determine the target processing strategy of the service request according to the comparison result.
[0128] The resource scheduling device provided in the embodiment of the present invention can execute the resource scheduling method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing each resource scheduling method.
[0129] In the technical solution of the present invention, the collection, storage, use, processing, transmission, provision and disclosure of the business requests, preset cold start duration thresholds and preset cold start number thresholds, etc., all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0130] According to an embodiment of the present invention, the present invention also provides an electronic device, a readable storage medium and a computer program product.
[0131] Embodiment 5
[0132] Figure 5 It is a structural diagram of an electronic device for implementing a resource scheduling method provided by Embodiment 5 of the present invention. Electronic device 510 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may 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 invention described and / or required herein.
[0133] like Figure 5 As shown, the electronic device 510 includes at least one processor 511, and a memory connected to the at least one processor 511 in communication, such as a read-only memory (ROM) 512, a random access memory (RAM) 513, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 511 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 512 or the computer program loaded from the storage unit 518 to the random access memory (RAM) 513. In the RAM 513, various programs and data required for the operation of the electronic device 510 can also be stored. The processor 511, the ROM 512, and the RAM 513 are connected to each other via a bus 514. An input / output (I / O) interface 515 is also connected to the bus 514.
[0134] A number of components in the electronic device 510 are connected to the I / O interface 515, including: an input unit 516, such as a keyboard, a mouse, etc.; an output unit 517, such as various types of displays, speakers, etc.; a storage unit 518, such as a disk, an optical disk, etc.; and a communication unit 519, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 519 allows the electronic device 510 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0135] The processor 511 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 511 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated 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 511 executes the various methods and processes described above, such as a resource scheduling method.
[0136] In some embodiments, the resource scheduling method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 518. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 510 via the ROM 512 and / or the communication unit 519. When the computer program is loaded into the RAM 513 and executed by the processor 511, one or more steps of the resource scheduling method described above may be performed. Alternatively, in other embodiments, the processor 511 may be configured to perform the resource scheduling method in any other appropriate manner (e.g., by means of firmware).
[0137] Various implementations of the systems and techniques described above 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), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including 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.
[0138] Computer programs for implementing the methods of the present invention 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, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0139] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may 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 may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may 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.
[0140] To provide interaction with a user, the systems and techniques described herein may 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 a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0141] The systems and techniques described herein may be implemented in a computing system that includes backend 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 frontend components (e.g., a user computer with a graphical user interface or a 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 backend components, middleware components, or frontend components. The components of the system may 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.
[0142] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0143] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0144] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A resource scheduling method, characterized in that: Applied to a scheduling gateway, the method comprises: Obtaining a service request of an application to be processed from a message queue, and determining resource configuration information of a target function according to the service request; wherein the service request includes a target function identifier; According to the target function identifier in the business request and the resource configuration information, a corresponding target instance is determined from the function computing platform, and the target function is executed according to the target instance to obtain a function execution result; wherein the target instance is a target hot instance or a target cold instance; If the function execution result is a function execution failure, then determining the abnormal call data corresponding to the function execution failure, and determining the target processing strategy of the business request according to the abnormal call data and / or the current retention time of the business request; wherein the target processing strategy is a custom processing strategy or a delayed processing strategy; If the target processing strategy is a delayed processing strategy, resource scheduling delayed processing is performed on the service request according to the delayed processing strategy.
2. The method according to claim 1, characterized in that The determining a corresponding target instance from the function computing platform according to the target function identifier in the business request and the resource configuration information includes: Determining whether a corresponding target hot instance exists in the function computing platform according to the target function identifier and the resource configuration information; If not, cold start the target function and determine the current cold start data and the current cold start times of the target function; A target cold instance corresponding to the objective function is determined according to the current cold start data and the current number of cold starts.
3. The method according to claim 2, characterized in that If the current cold start data includes a current cold start duration and a current cold start state, determining a target cold instance corresponding to the objective function according to the current cold start data and the current number of cold starts includes: If the current cold start duration is greater than the preset cold start duration threshold, and the current cold start state is a current cold start failure, then the current number of cold starts is updated; The target cold instance corresponding to the objective function is determined according to the updated current number of cold starts and a preset cold start number threshold.
4. The method according to claim 3, characterized in that The determining, according to the updated current cold start number and the preset cold start number threshold, a target cold instance corresponding to the objective function includes: If the updated current cold start number is greater than the preset cold start number threshold, it is determined that there is no corresponding target cold instance for the target function; If the updated current number of cold starts is less than or equal to the preset cold start number threshold, the objective function is cold started again.
5. The method according to claim 4, characterized in that When the current number of cold starts reaches the preset cold start number threshold, or when the target cold instance is obtained within the preset cold start number threshold, the target function cold start is stopped.
6. The method according to any one of claims 1 to 5, characterized in that: The determining, according to the abnormal call data and / or the current retention time of the service request, a target processing strategy for the service request includes: Determine the exception type of the function execution failure according to the exception call data; If the exception type is a retryable type, determining the current retention time of the service request; The current retention time is compared with a preset request retention time threshold, and a target processing strategy for the service request is determined based on the comparison result.
7. A resource scheduling device, characterized in that: Configured in a scheduling gateway, the device includes: A business request acquisition module, used to acquire the business request of the application to be processed from the message queue, and determine the resource configuration information of the target function according to the business request; wherein the business request includes the target function identifier; An execution result determination module, used to determine a corresponding target instance from a function computing platform according to the target function identifier in the business request and the resource configuration information, and execute the target function according to the target instance to obtain a function execution result; wherein the target instance is a target hot instance or a target cold instance; A target processing strategy determination module, for determining the abnormal call data corresponding to the function execution failure if the function execution result is a function execution failure, and determining the target processing strategy of the business request according to the abnormal call data and / or the current retention time of the business request; wherein the target processing strategy is a custom processing strategy or a delayed processing strategy; The delay processing module is used to perform resource scheduling delay processing on the service request according to the delay processing strategy if the target processing strategy is the delay processing strategy.
8. An electronic device, characterized in that: include: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement a resource scheduling method as described in any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, a resource scheduling method as described in any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program / instruction, wherein the computer program / instruction, when executed by a processor, implements the steps of the resource scheduling method according to any one of claims 1 to 6.