Reserved instance triggering method and system based on function association
By establishing a reservation linkage mechanism between functions in the Serverless architecture, dynamically triggering the reservation of downstream functions, the problems of resource demand prediction and management in complex function call chains are solved, and efficient resource allocation and performance optimization are achieved.
Patent Information
- Application Number
- CN202411906664.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-04-11
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the Serverless architecture, the existing reserved instance mechanism cannot effectively predict and manage resource requirements of complex function call chains, resulting in frequent cold starts and performance delays.
By establishing a reservation linkage mechanism between functions, the instance reservation of downstream functions is triggered dynamically according to the operating status of the upstream function, achieving more accurate and efficient resource management.
It significantly reduces the probability of cold start in the function call chain, improves the overall response speed of the application, achieves more accurate resource allocation, reduces operational costs, and provides better performance guarantees for complex Serverless applications.
Smart Images

Figure BDA0005204522100000081 
Figure BDA0005204522100000082 
Figure BDA0005204522100000083
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cloud computing technology, and in particular to function instance management technology in a Serverless architecture. More specifically, the present invention relates to a reserved instance triggering method and system based on function call association, which is used to optimize the function cold start problem in a Serverless environment. Background Art
[0002] As an emerging paradigm of cloud computing, Serverless architecture has been widely used and developed rapidly in recent years. This architectural model decomposes applications into independent functional units, allowing developers to focus on business logic without worrying about the management of underlying infrastructure. Serverless has important applications in microservices, event-driven processing, data analysis and other fields. Its on-demand allocation and elastic scaling features provide enterprises with higher resource utilization efficiency and lower operating costs.
[0003] Currently, the Serverless platform mainly uses the dynamic creation and destruction of function instances to achieve on-demand resource allocation. When a function is called, the platform creates a new function instance to handle the request; after the request is processed, the instance is destroyed or put into hibernation. Another common optimization solution is preheating technology, which is to create a certain number of function instances in advance during expected high load periods to reduce the delay caused by cold starts. The working principle of these technologies is to manage resources based on the call status of a single function.
[0004] However, these solutions have obvious shortcomings when dealing with complex function call chains. Especially in scenarios where there is a cascade call relationship between functions, focusing only on the call status of a single function cannot effectively predict and manage the resource requirements of the entire call chain. This leads to frequent cold start problems in the function call chain, causing significant performance delays. At the same time, existing warm-up strategies are often static or based on simple thresholds, which cannot adapt to dynamically changing workloads and easily cause resource waste or insufficient supply problems.
[0005] To solve the above problems, some studies have proposed prediction models based on machine learning to optimize the reservation strategy of function instances. These methods predict future resource requirements by analyzing historical call patterns, thereby allocating an appropriate amount of function instances in advance. Although this method improves the accuracy of resource allocation to a certain extent, it is still mainly limited to the dimension of a single function and cannot effectively handle the complex calling relationships and dependencies between functions. In addition, the training and maintenance of machine learning models also increase the complexity and operation and maintenance costs of the system.
[0006] Therefore, there is an urgent need for an intelligent reservation mechanism that can perceive and utilize the calling relationship between functions to improve resource utilization efficiency while ensuring performance. Developing a reserved instance triggering method based on function call association has become an important research direction in the Serverless field. This method should be able to dynamically predict the resource requirements of downstream functions based on the running status of upstream functions, thereby achieving more accurate and efficient resource management. Summary of the invention
[0007] The main purpose of the present invention is to solve the problem that the existing reserved instance mechanism cannot effectively predict and manage resource requirements in the Serverless architecture, especially in the complex function call chain scenario, resulting in frequent cold starts and performance delays. In addition, the present invention also aims to improve resource utilization efficiency, reduce operating costs, and provide a better performance optimization solution for Serverless applications.
[0008] To achieve the above purpose, the present invention provides a reserved instance triggering method and system based on function call association, characterized in that: by establishing a reservation linkage mechanism between functions, the instance reservation of the downstream function is dynamically triggered according to the running status of the upstream function. In some embodiments, the method can be applied to various Serverless platforms and is suitable for various application scenarios such as e-commerce, data processing, and video processing.
[0009] Specifically, the method of the present invention includes receiving a reservation trigger configuration, which defines a target function, a trigger source function, a trigger condition, and a reservation behavior.
[0010] Furthermore, the method monitors the running indicators of the trigger source function in real time, and these indicators may include the number of concurrency, number of requests per second (QPS), CPU usage, memory usage, etc.
[0011] Preferably, the present invention evaluates whether it is necessary to trigger reservation for the target function according to a preset trigger condition. This evaluation mechanism ensures the accuracy and timeliness of the reservation operation.
[0012] Optionally, when the trigger condition is met, the system creates a reserved instance for the target function according to the reservation behavior, which may include parameters such as the reservation quantity and survival time.
[0013] In one embodiment, the present invention also includes managing the lifecycle of the reserved instance, including controlling the lifetime of the reserved instance, and automatically reclaiming the instance when conditions are no longer met.
[0014] In certain embodiments, the present invention introduces a cooling time mechanism to prevent frequent triggering of reservation operations, thereby improving system stability and resource utilization efficiency.
[0015] In addition, the present invention can also support multi-dimensional triggering conditions, making the reservation strategy more flexible and accurate.
[0016] In other embodiments, the system architecture of the present invention includes a configuration module, a monitoring module, an evaluation module and a reservation management module. This modular design improves the scalability and maintainability of the system.
[0017] In a preferred embodiment, the method of the present invention can be implemented through the following steps: first, the system receives and parses the reservation trigger configuration; then, the operating indicators of the trigger source function are continuously monitored; then, the evaluation module determines whether reservation is required based on the trigger conditions; if reservation is required, the reservation management module will create a corresponding number of reserved instances; finally, the system will continue to manage the life cycle of these reserved instances, including recycling them at the appropriate time.
[0018] In another preferred embodiment, the present invention can be combined with existing load balancing and automatic expansion and contraction mechanisms to form a comprehensive Serverless resource management solution.
[0019] By adopting the above scheme, the present invention has the following beneficial effects: 1. Significantly reduces the probability of cold starts in the function call chain and improves the overall response speed of the application; 2. Through the association reservation between functions, more accurate resource allocation is achieved and resource utilization efficiency is improved; 3. Dynamic triggering mechanism and lifecycle management ensure timely creation and recycling of reserved instances, reducing operating costs; 4. Flexible configuration model enables the system to adapt to different application scenarios and requirements; 5. By predicting the resource requirements of downstream functions, it provides better performance guarantees for complex Serverless applications.
[0020] In summary, the present invention effectively solves the cold start problem in the Serverless architecture through an innovative function association reservation mechanism, while improving resource utilization efficiency, providing important support for the further application and development of Serverless technology. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solution of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work.
[0022] Figure 1 It is a key element diagram of the reservation trigger configuration.
[0023] Figure 2 It is the structural diagram of the real-time monitoring module.
[0024] Figure 3 It is a data flow processing architecture diagram.
[0025] Figure 4 It is a flowchart of the trigger condition evaluation module.
[0026] Figure 5 is an example diagram of an expression tree.
[0027] Figure 6 It is the hysteresis trigger state machine diagram.
[0028] Figure 7 This is a structural diagram of the reserved instance creation module.
[0029] Figure 8 It is an instance management diagram based on resource pools.
[0030] Fig. 9 This is a structural diagram of the reserved instance lifecycle management module.
[0031] Fig.10 is a reserved instance state machine diagram.
[0032] Fig.11 This is the structural diagram of the cooldown time mechanism.
[0033] Fig.12 It is a schematic diagram of the token bucket algorithm.
[0034] Fig.13 It is the overall system architecture diagram.
[0035] Fig.14 It is a flowchart of the configuration management module.
[0036] Fig.15 It is the structural diagram of the monitoring module.
[0037] Fig.16 is a flow chart of the evaluation module.
[0038] Fig.17 It is a structural diagram of the reservation management module.
[0039] Fig.18 It is the structural diagram of the life cycle management module.
[0040] Fig.19 It is a structural diagram of the cooling control module.
[0041] Fig. 20 It is the workflow diagram of the adaptive coordinator.
[0042] Fig.21 It is a function call chain diagram of the e-commerce platform.
[0043] Fig. 22 The following is an example diagram of the reservation trigger rule configuration.
[0044] Fig.23 It is a timing diagram of the system operation process.
[0045] Fig.24 It is a flow chart of the system performance during the peak order period.
[0046] Fig.25 It is a flowchart of dynamic cooling time adjustment. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions 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 of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0048] In the description of the present invention, it should be noted that the terms "center", "up", "down", "left", "right", "vertical", "horizontal", "inside", "outside" and the like indicate directions or positional relationships based on the directions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore cannot be understood as a limitation on the present invention.
[0049] Embodiment 1: Setting and analyzing of reservation trigger configuration.
[0050] The core innovation of the present invention is to propose a reserved instance triggering mechanism based on function call association. The key component of this mechanism is the reservation trigger configuration, which defines the association relationship between functions and the conditions and behaviors for triggering reservation. This embodiment will describe in detail the structure and content of the reservation trigger configuration and how to set and parse these configuration information.
[0051] like Figure 1 As shown in the figure, the reservation trigger configuration mainly includes the following key elements: target function, trigger source function, trigger condition and reservation behavior. These elements together constitute a complete reservation trigger strategy.
[0052] The target function is the function that needs to be reserved, usually a function that is downstream in the function call chain. In the configuration, the target function is specified by its unique identifier (such as function name or ARN). For example, in an order processing system, the "payment-process" function might be specified as the target function.
[0053] A trigger source function is an upstream function whose running state affects the target function's reservation decision. Again, a trigger source function is specified in the configuration via a unique identifier. Continuing with the example above, the "order-create" function might be specified as a trigger source function.
[0054] The trigger condition defines when the reservation of the target function should be triggered. This usually includes one or more monitoring indicators, comparison operators and thresholds. The present invention supports multiple monitoring indicators, such as concurrency, number of requests per second (QPS), CPU utilization and memory utilization. The comparison operator can be greater than, less than, equal to or a combination of them. The threshold is a specific value. For example, a valid trigger condition may be: "When the concurrency of the 'order-create' function is greater than or equal to 100".
[0055] The reservation behavior defines how the reserved instances should be created when the trigger conditions are met. This includes the reservation quantity, time to live (TTL), and cooldown period. The reservation quantity specifies how many reserved instances should be created, the time to live defines how long these instances should remain active, and the cooldown period is used to prevent frequent triggering and avoid wasting resources.
[0056] The following is a complete reservation trigger configuration example (expressed in YAML format): functionName:payment-process reserveType:associated triggers: -sourceFunction:order-create conditions: metric:concurrency operator:">=" threshold:100 action: reserveCount:10 ttl:300 Cooldown:60
[0057] In this configuration, when the concurrency of the "order-create" function reaches or exceeds 100, the system will create 10 reserved instances for the "payment-process" function. These instances will remain active for 300 seconds and will not be re-triggered during the 60-second cooldown period.
[0058] The configuration setting process is usually completed through the API or management console provided by the platform. Developers can flexibly set these parameters according to the characteristics and performance requirements of the application. After the configuration is completed, the platform will save it in the configuration database.
[0059] Parsing the configuration is the first step to implement the reservation trigger mechanism. When the system starts or the configuration is updated, the configuration parsing module reads the stored configuration information and converts it into an in-memory data structure for quick access and use. The parsing process mainly includes the following steps: 1. Read the configuration information in the configuration file or database. 2. Verify the completeness and validity of the configuration, ensuring that all required fields are present and in the correct format. 3. Convert the configuration information into a data structure used internally by the system, usually an object that contains all the necessary information. 4. Establish a mapping relationship between the trigger source function and the target function so that the system can quickly locate the relevant reservation strategy.
[0060] The core functionality of the configuration parsing module can be expressed in the following pseudo code: function parseReserveConfig(configData){ validateConfig(configData); let parsedConfig={ targetFunction:configData.functionName, reserveType:configData.reserveType, triggers:[] }; for(let trigger of configData.triggers){ parsedConfig.triggers.push({ sourceFunction:trigger.sourceFunction, condition:parseCondition(trigger.conditions), action:parseAction(trigger.action) }); } return parsedConfig; }
[0061] In this way, the system can efficiently manage and use the reserved trigger configuration, laying the foundation for subsequent monitoring and trigger evaluation processes.
[0062] The reservation trigger configuration mechanism described in this embodiment is highly flexible and scalable. Developers can customize complex reservation strategies according to the needs of specific application scenarios. For example, multiple trigger source functions can be configured for a target function, or multiple trigger conditions can be combined. In addition, this mechanism also facilitates the expansion of new monitoring indicators or reservation behaviors in the future.
[0063] It should be noted that although this embodiment mainly discusses the configuration based on the YAML format, the core idea of the present invention is not limited to a specific configuration format. In practical applications, other formats such as JSON or XML can be selected according to the characteristics of the system, as long as the core elements of the reservation trigger policy can be accurately expressed.
[0064] Through this innovative configuration mechanism, the present invention implements the core logic of inter-function association reservation, providing strong support for solving the cold start problem in the Serverless architecture. In the subsequent embodiments, we will discuss in detail how to implement functions such as real-time monitoring, trigger evaluation, and reservation management based on these configuration information.
[0065] Embodiment 2: Real-time monitoring embodiment.
[0066] In Example 1, the setting and analysis of the reservation trigger configuration are described in detail. This example will focus on how to monitor the running indicators of the trigger source function in real time, which is the key link to realize the reserved instance trigger mechanism based on function call association.
[0067] like Figure 2 As shown, the real-time monitoring module is one of the core components of the entire system, which is responsible for continuously collecting and processing the runtime data of the trigger source function. The present invention supports multiple monitoring indicators, mainly including concurrency, number of requests per second (QPS), CPU usage and memory usage. These indicators can fully reflect the running status and load of the function, and provide an accurate basis for reservation trigger decision.
[0068] The workflow of the real-time monitoring module mainly includes the following steps: 1. Data collection: By integrating with the underlying monitoring system of the Serverless platform, the raw data of the function runtime is collected in real time. This usually involves lightweight instrumentation or log analysis of the function execution environment. 2. Data preprocessing: Clean, normalize and aggregate the collected raw data to generate meaningful monitoring indicators. 3. Indicator calculation: Calculate the current value of each monitoring indicator according to the predefined algorithm. 4. Data storage: Store the calculated indicator values in a high-performance time series database to support fast query and analysis. 5. Real-time push: Push the latest indicator data to the trigger evaluation module for real-time reservation trigger decision-making.
[0069] In order to achieve efficient real-time monitoring, the present invention adopts an innovative data stream processing architecture. Figure 3 As shown, the architecture consists of three main components: data collector, stream processing engine, and metrics storage.
[0070] The data collector is responsible for collecting raw runtime data from each node of the Serverless platform. In order to minimize the impact on function execution, an asynchronous log transmission mechanism is adopted to ensure that the data collection process does not significantly increase the execution time of the function. The core logic of the data collector can be expressed in the following pseudo code:
[0071] The stream processing engine is the core of the real-time monitoring module. It uses a window-based stream computing model. This model can efficiently process continuous data streams and calculate various indicators within a specified time window. For example, for the QPS indicator, a 5-second sliding window is used to calculate:
[0072] The main processing logic of the stream processing engine can be expressed as:
[0073] The indicator storage component uses a specially optimized time series database to support high-throughput writing and low-latency querying. It uses an LSM tree-based storage engine, combined with memory cache and compression algorithms, to achieve efficient data management.
[0074] In order to illustrate the effect of this embodiment, a set of experiments was conducted. In a typical e-commerce application scenario, the concurrency index of the "order-create" function was monitored.
[0075] The innovations of this embodiment are mainly reflected in the following aspects: 1. Multi-dimensional indicator support: Different from traditional single indicator monitoring, it supports multiple dimensions such as concurrency, QPS, CPU and memory usage, providing a more comprehensive basis for reservation triggering decisions. 2. Efficient stream processing architecture: By adopting asynchronous log transmission and window-based streaming computing, low-latency, high-throughput real-time monitoring is achieved while minimizing the impact on function execution. 3. Adaptive sampling rate: An adaptive sampling algorithm is introduced, which can dynamically adjust the frequency of data collection according to the function call frequency, optimizing the use of system resources while ensuring monitoring accuracy. 4. Scalable indicator definition: A flexible indicator definition framework is designed so that the system can easily add new monitoring indicators to meet different application requirements.
[0076] It should be noted that although this embodiment focuses on discussing several common monitoring indicators, the real-time monitoring mechanism of the present invention is not limited to these indicators. According to the specific application scenario and requirements, other relevant performance indicators or business indicators can be flexibly added. For example, for IO-intensive functions, it may be necessary to monitor the disk IO rate; for network-intensive functions, it may be necessary to pay attention to network throughput.
[0077] In addition, the real-time monitoring mechanism described in this embodiment can be seamlessly integrated with the existing Serverless platform. By providing standardized interfaces and plug-in mechanisms, the monitoring system can adapt to different Serverless environments and provide efficient function association reservation support for various platforms.
[0078] In summary, the real-time monitoring mechanism in this embodiment provides a solid data foundation for the reserved instance triggering system based on function call association. Through efficient and accurate indicator collection and processing, it is possible to capture changes in the function running state in a timely manner, providing reliable input for subsequent trigger evaluation and reservation management. In the next embodiment, how to evaluate the trigger conditions based on these monitoring data will be discussed in detail.
[0079] Embodiment 3: Trigger condition evaluation embodiment.
[0080] In the first two embodiments, the setting and analysis of the reservation trigger configuration and the real-time monitoring mechanism are described in detail. This embodiment will focus on how to evaluate whether to trigger a reservation for the target function based on the trigger condition, which is the core decision-making link for implementing the reserved instance trigger mechanism based on function call association.
[0081] like Figure 4As shown, the trigger condition evaluation module is the key bridge connecting real-time monitoring and reservation management. It receives the indicator data from the real-time monitoring module, evaluates according to the preset trigger conditions, and makes a decision on whether to trigger the reservation. This embodiment will explain in detail the logic and algorithm in the evaluation process, as well as how to handle complex trigger conditions.
[0082] The workflow of the trigger condition evaluation module mainly includes receiving indicator data, loading trigger conditions, condition analysis, evaluation execution and decision output. In order to support flexible and diverse trigger conditions, a condition evaluation mechanism based on expression tree is designed. Figure 5 As shown in FIG. 1 , a complex trigger condition is parsed into an expression tree, the leaf nodes of the tree are basic indicator comparisons, and the internal nodes are logical operators (such as AND, OR).
[0083] During the evaluation process, the depth-first search (DFS) is used to traverse the expression tree and evaluate the conditions of each node one by one. In order to handle critical situations and avoid frequent triggering, a hysteresis trigger mechanism is introduced. Specifically, two thresholds are used: the trigger threshold and the recovery threshold. When the indicator exceeds the trigger threshold, the reservation is triggered; only when the indicator drops below the recovery threshold, the reservation state is released. This mechanism can be represented by a state machine, such as Figure 6 shown.
[0084] A key innovation of this embodiment is the introduction of a dynamic threshold adjustment mechanism based on machine learning. A time series prediction model (such as ARIMA or Prophet) is used to predict future indicator trends, and the trigger threshold is dynamically adjusted based on the prediction results. This method can better adapt to changes in function call patterns and improve the accuracy of reservation triggering. The core algorithm of dynamic threshold adjustment can be expressed as:
[0085] Among them, threshold t is the dynamic threshold at time t, baseline is the basic threshold, is the predicted index value, σ t is the standard deviation of the prediction, and α and β are tuning parameters.
[0086] The main innovations of this embodiment include flexible condition evaluation based on expression trees, hysteresis trigger mechanism, dynamic threshold adjustment driven by machine learning, and comprehensive evaluation of multi-dimensional indicators. These innovations enable the trigger condition evaluation mechanism to adapt to various complex trigger scenarios, effectively reduce the frequent triggering problem caused by jitter, and improve the accuracy of trigger decisions through adaptive adjustment.
[0087] It should be noted that although this embodiment mainly discusses trigger conditions based on numerical indicators, the evaluation mechanism of the present invention can also be extended to other types of conditions. For example, time-based conditions (such as triggering a reservation in a specific time period) or event-based conditions (such as triggering when a specific system event occurs) can be introduced. In addition, the trigger condition evaluation mechanism described in this embodiment can work in conjunction with the existing automatic scaling system, by providing a standardized decision output interface as a supplementary input for automatic scaling decisions, to further optimize the resource management strategy.
[0088] In summary, the trigger condition evaluation mechanism in this embodiment provides intelligent and flexible decision support for the reserved instance triggering system based on function call association. Through precise condition evaluation and innovative dynamic adjustment strategies, timely and accurate reservation triggering decisions can be made in a complex and changing Serverless environment. In the next embodiment, we will discuss in detail how to create and manage reserved instances based on these evaluation results.
[0089] Embodiment 4: Reserved instance creation embodiment.
[0090] In the first three embodiments, the setting and analysis of the reservation trigger configuration, the real-time monitoring mechanism, and the trigger condition evaluation are described in detail. This embodiment will focus on how to create a reserved instance for the target function when the trigger condition is met, which is the execution link of the reserved instance trigger mechanism based on function call association.
[0091] like Figure 7 As shown, the reserved instance creation module is the execution unit of the entire system, which receives the decision result from the trigger condition evaluation module and executes the instance creation operation according to the preset reservation behavior parameters. This embodiment will describe in detail the creation process of the reserved instance, the resource allocation strategy and how to handle concurrent creation requests.
[0092] The workflow of the reserved instance creation module mainly includes receiving trigger decisions, parsing reservation behavior parameters, resource evaluation, instance creation, and status reporting. In order to achieve efficient and reliable reserved instance creation, a resource pool-based instance management mechanism is designed. Figure 8 As shown, the system maintains a preheating resource pool, which contains a certain number of pre-initialized instances. These instances have completed the basic runtime environment settings, but have not yet loaded the code and dependencies of specific functions.
[0093] When a request to create a reserved instance is received, the system first obtains a pre-initialized instance from the resource pool, and then quickly loads the target function's code and dependencies. This approach significantly reduces the time to create an instance, and a reserved instance can usually be created within 100 milliseconds. The resource pool is managed using a dynamic balancing strategy, which adjusts the number of instances in the pool in real time based on the frequency and number of historical creation requests to balance creation speed and resource usage.
[0094] During the creation of reserved instances, an innovative "gradual preheating" mechanism is introduced. Unlike the traditional one-time full preheating, the gradual preheating completes the initialization of the instance in multiple stages, and each stage completes part of the initialization work. This method can better utilize idle time and reduce the instantaneous pressure on system resources. The gradual preheating process can be represented by the following state transitions:
[0095] In order to handle concurrent creation requests and burst loads, a priority request queue is implemented. Requests in the queue are sorted by priority and arrival time. The priority calculation takes into account the importance of the function, expected load, and historical call patterns. The queue is processed using an adaptive concurrency control algorithm, which dynamically adjusts the number of concurrently processed requests based on the current system load to maximize throughput while ensuring system stability.
[0096] An important innovation of this embodiment is the introduction of the "reserved instance reuse" mechanism. When the original target function of a reserved instance no longer needs it, the system will evaluate whether there are other similar functions that can reuse this instance. The similarity is determined based on factors such as the function's runtime environment, memory requirements, and dependencies.
[0097] The creation of reserved instances also involves resource allocation strategies. A resource allocation algorithm based on multi-objective optimization is adopted, taking into account performance requirements, cost control, and system load balancing. The objective function of the algorithm can be expressed as: minf(x)=w 1 ·f performance (x)+w 2 ·f cost (x)+w 3 ·f balance (x) (4) Among them, x represents the resource allocation scheme, f performance 、f cost and f balance denote the evaluation functions of performance, cost and load balancing respectively, w 1 、w 2 and w 3 is the corresponding weight coefficient.
[0098] The main innovations of this embodiment include instance management based on resource pool, progressive warm-up mechanism, reserved instance reuse and multi-objective optimization resource allocation strategy. These innovations make the reserved instance creation process more efficient and flexible, while improving resource utilization and overall system performance.
[0099] It should be noted that although this embodiment mainly discusses the creation of reserved instances, the mechanism of the present invention is also applicable to the dynamic expansion and contraction of instances. For example, the number of reserved instances can be dynamically adjusted according to load forecasts, or redundant instances can be intelligently recycled when the load decreases. In addition, the reserved instance creation mechanism described in this embodiment can be combined with container technology and micro-virtualization technology to further optimize the instance creation speed and resource occupancy.
[0100] In summary, the reserved instance creation mechanism in this embodiment provides efficient and flexible execution support for the reserved instance triggering system based on function call association. Through innovative instance management and optimization strategies, reserved instances can be created and managed quickly and accurately in a complex Serverless environment, significantly improving the performance and resource utilization efficiency of the system. In the next embodiment, we will discuss in detail how to manage the life cycle of these reserved instances to further optimize the overall operation of the system.
[0101] Embodiment 5: Reserved instance lifecycle management embodiment.
[0102] In the first four embodiments, the setting and analysis of reservation trigger configuration, real-time monitoring mechanism, trigger condition evaluation and creation of reserved instances are described in detail. This embodiment will focus on how to manage the life cycle of reserved instances, which is the key link to implement the reserved instance trigger mechanism based on function call association, ensuring efficient use of system resources and continuous optimization of performance.
[0103] like Fig. 9 As shown, the reserved instance lifecycle management module is one of the core components of the entire system, which is responsible for monitoring and controlling the entire process from creation to destruction of the reserved instance. This embodiment will explain in detail the lifecycle management strategy, survival time control mechanism and how to achieve intelligent recycling and reuse.
[0104] The workflow of the reserved instance lifecycle management module mainly includes instance status monitoring, survival time control, load evaluation, instance recycling and reuse decision. In order to achieve efficient and flexible lifecycle management, a state machine-based instance management mechanism is designed. Fig.10 As shown, a reserved instance may go through multiple states during its lifecycle, including initialized, ready, running, idle, pending reclaim, and reclaimed.
[0105] The core logic of state transition can be expressed by the following state transition equation: S t+1 =f(S t ,A t ,E t ) (5) Among them, S t represents the instance state at time t, A t Indicates the operation of the system (such as creation, recycling), E t represents environmental factors (such as load changes), and f is the state transition function.
[0106] A key innovation of this embodiment is the introduction of a "dynamic survival time adjustment" mechanism. Different from the traditional fixed TTL (Time-To-Live) strategy, the system will dynamically adjust the instance survival time based on instance usage, system load, and predicted future demand. This method can better balance resource utilization and performance requirements. The calculation formula for dynamic TTL is as follows: TTL dynamic =TTL base ·(1+α·U+β·L+γ·F) (6) Among them, TTL base is the basic survival time, U is the historical usage rate of the instance, L is the current system load, F is the future demand prediction factor, and α, β, and γ are adjustment parameters.
[0107] In order to optimize resource utilization, an intelligent recycling mechanism is implemented. When the system detects that a reserved instance has been idle for a long time or the load of its objective function has dropped significantly, a recycling evaluation is triggered. The recycling decision not only considers the current state, but also evaluates the probability that the instance will be needed again in the short term. This probability is predicted using a machine learning model, and the model input includes historical load patterns, time characteristics, and the overall state of the system. If the predicted probability is lower than the set threshold, the system will perform a recycling operation.
[0108] Another important innovation is the "instance reuse optimizer". When a reserved instance is reclaimed, the system evaluates whether there are other functions that can reuse the instance. The reuse decision is based on multiple factors, including the similarity of the function's runtime environment, resource requirement matching, and expected load. A reuse score function is defined: Score reuse =w 1 ·Sim env +w 2 Match resource +w 3 Comp load (7) Among them, Sim env Indicates the environmental similarity, Match resourceIndicates resource matching degree, Comp load Indicates load compatibility, w 1 、w 2 and w 3 is the weight coefficient.
[0109] In order to handle sudden loads and rapidly changing demands, the concept of "elastic buffer pool" is introduced. The system maintains a small pool of reserved instances that are in a low-power standby state. When a sharp increase in load is detected, these instances can be quickly activated, significantly reducing cold start delays. The size of the buffer pool is dynamically adjusted through an adaptive algorithm, taking into account historical load fluctuations and predicted demand changes.
[0110] The main innovations of this embodiment include state machine-based lifecycle management, dynamic survival time adjustment, intelligent recycling mechanism, instance reuse optimization, and elastic buffer pool. These innovations make the lifecycle management of reserved instances more intelligent and efficient, and have the potential to significantly improve the resource utilization and performance of the system.
[0111] It should be noted that although this embodiment mainly discusses the lifecycle management of a single reserved instance, these concepts and methods can also be extended to the management of instance clusters. For example, global optimization decisions can be made based on the state of the entire cluster, or instance load balancing can be achieved across regions. In addition, the lifecycle management mechanism described in this embodiment can be integrated with container orchestration technology (such as Kubernetes) to further improve management efficiency in large-scale deployment scenarios.
[0112] In summary, the reserved instance lifecycle management mechanism in this embodiment provides intelligent and efficient resource management support for the reserved instance triggering system based on function call association. Through innovative management strategies and optimization algorithms, it is possible to achieve optimal resource configuration in a dynamically changing Serverless environment, which is expected to significantly improve the overall performance and efficiency of the system. These technologies are not only applicable to the specific scenarios of the present invention, but also provide new solutions to a wide range of cloud computing resource management problems.
[0113] Embodiment 7: System architecture embodiment.
[0114] In the first six embodiments, the setting and analysis of reservation trigger configuration, real-time monitoring mechanism, trigger condition evaluation, creation of reserved instances, lifecycle management, and cooling time mechanism are described in detail. This embodiment will focus on the architectural design of the entire reserved instance trigger system based on function call association, and show how various modules work together to achieve efficient and flexible reserved instance management.
[0115] like Fig.13As shown in Figure 1, the overall architecture of this system consists of multiple closely cooperating modules, including configuration management module, monitoring module, evaluation module, reservation management module, life cycle management module and cooling control module. These modules are interconnected through carefully designed interfaces and data flows to form a complete closed-loop system.
[0116] The configuration management module is the entrance to the system and is responsible for receiving and parsing the reservation trigger configuration defined by the user. Fig.14 As shown in the figure, the module contains three subcomponents: configuration parser, validator and storage manager. The configuration parser is responsible for converting the YAML or JSON format configuration entered by the user into an internal data structure; the validator ensures the integrity and validity of the configuration; the storage manager saves the verified configuration to persistent storage and manages the version control of the configuration.
[0117] The monitoring module is the perception center of the system, continuously collecting and processing various indicators during function execution. Fig.15 As shown in Figure 1, the module consists of three parts: data collector, stream processing engine, and indicator storage. The data collector collects raw data from the function running environment through a lightweight agent; the stream processing engine processes this data in real time and calculates various monitoring indicators; the indicator storage uses a time series database to save the processed indicators and supports fast query and analysis.
[0118] The evaluation module is the decision-making center of the system, responsible for determining whether reservation needs to be triggered based on monitoring data and preset conditions. Fig.16 As shown in Figure 1, the module includes a condition parser, an evaluation engine, and a decision outputter. The condition parser converts the trigger conditions in the configuration into executable logical expressions; the evaluation engine uses these expressions to evaluate the latest monitoring data; and the decision outputter generates trigger instructions based on the evaluation results.
[0119] The reservation management module is the execution unit of the system and is responsible for creating and managing reserved instances. Fig.17 As shown in Figure 1, the module consists of an instance creator, a resource allocator, and a state manager. The instance creator is responsible for quickly launching new function instances based on trigger instructions; the resource allocator ensures that appropriate computing resources are allocated to these instances; and the state manager tracks the current state of each reserved instance.
[0120] The lifecycle management module is responsible for controlling the entire lifecycle of a reserved instance. Fig.18 As shown in Figure 1, the module includes a TTL controller, a recycling evaluator, and a reuse optimizer. The TTL controller dynamically adjusts the survival time of the instance; the recycling evaluator determines when to recycle instances that are no longer needed; and the reuse optimizer tries to assign the instances to be recycled to other appropriate functions.
[0121] The cooling control module is the regulator of the system, preventing the reserve triggering too frequently. Fig.19 As shown in Figure 1, the module consists of a cooling time calculator, a trigger frequency controller, and a global regulator. The cooling time calculator dynamically adjusts the cooling time according to the system status; the trigger frequency controller implements the trigger limit based on the token bucket; and the global regulator adjusts the cooling strategy according to the overall system load.
[0122] These modules communicate and collaborate with each other through carefully designed interfaces. For example, the monitoring module pushes real-time indicators to the evaluation module, the evaluation module passes the decision results to the reservation management module, and the cooling control module interacts with the evaluation module and the reservation management module in a two-way manner. This close collaboration ensures that the entire system can quickly respond to changes in function call patterns and achieve efficient reserved instance management.
[0123] A key innovation of this embodiment is the introduction of an "adaptive coordinator", such as Fig. 20 This component spans multiple modules, collects the operating data of each module, and uses machine learning algorithms to dynamically adjust the parameters and strategies of each module. The core algorithm of the adaptive coordinator can be expressed as: P t+1 =f(P t ,S t ,A t ,R t ) (8) Among them, P t is the current parameter set, S t is the system status, A t is the system behavior, R t is the observed result, and f is the learning function.
[0124] Another important innovation is the "multi-level cache mechanism". In order to improve the response speed of the system, multi-level caches are introduced in different modules. For example, the configuration management module uses memory cache to store common configurations; the monitoring module uses local cache to store recent indicators; and the evaluation module caches recent evaluation results. This multi-level cache strategy significantly reduces the communication overhead and data retrieval time between modules.
[0125] In order to ensure the scalability and fault tolerance of the system, microservice architecture and event-driven design are adopted. Each module is designed as an independent microservice that can be deployed and expanded independently. Communication between modules is mainly achieved through message queues, which not only improves the decoupling of the system, but also enhances the fault tolerance of the system.
[0126] The system architecture design of this embodiment fully considers the actual deployment and operation and maintenance requirements. All modules support containerized deployment and can be easily integrated into container orchestration platforms such as Kubernetes. The system also provides comprehensive monitoring and logging functions and supports distributed tracing, which facilitates problem diagnosis and performance optimization.
[0127] It should be noted that although this embodiment describes a complete system architecture, this architecture is highly modular and customizable. Depending on the specific application scenario and requirements, certain modules can be flexibly added, removed, or replaced. For example, for simple application scenarios, the logic of the evaluation module can be simplified; for particularly complex environments, more specialized modules can be added.
[0128] In summary, the system architecture described in this embodiment provides a comprehensive, flexible and efficient implementation solution for the reserved instance triggering mechanism based on function call association. Through innovations such as modular design, adaptive coordination and multi-level caching, the architecture can adapt to various complex Serverless environments and provide high-performance, low-latency function reservation management. This architecture is not only suitable for the specific scenarios of the present invention, but also provides a valuable reference for other types of distributed system resource management.
[0129] Embodiment 8: Application scenario embodiment.
[0130] In the first seven embodiments, the various technical components and system architecture of the present invention are described in detail. This embodiment will use a specific application scenario to show how the reserved instance triggering system based on function call association works in an actual environment and how it solves the challenges faced by the traditional Serverless architecture.
[0131] Take a typical e-commerce platform as an example. This platform uses the Serverless architecture to implement its core business logic. Fig.21 As shown in the figure, the platform contains multiple interrelated functions, forming a complex call chain. The main functions include: order creation (OrderCreate), inventory check (InventoryCheck), payment processing (PaymentProcess), order confirmation (OrderConfirm) and logistics trigger (LogisticsInitiate).
[0132] In traditional Serverless deployments, these functions are usually managed independently, and each function instance is created and destroyed based on its own call situation. However, this approach often leads to performance issues when processing burst orders, especially cold start delays in functions downstream in the call chain.
[0133] After applying the system of the present invention, firstly, a reserved trigger rule is configured for this scenario. Fig. 22 As shown in the figure, the configuration file defines the association relationship and trigger conditions between functions. For example:
[0134] This configuration means that when the number of concurrent calls to the OrderCreate function reaches or exceeds 50, the system will reserve 10 instances for the PaymentProcess function. These instances will remain active for 300 seconds and will not be repeatedly reserved during the 60-second cool-down period.
[0135] The system operation process is as follows Fig.23 As shown in the figure, the monitoring module continuously collects the concurrency data of the OrderCreate function. When the concurrency number is detected to increase, the evaluation module determines whether to trigger the reservation based on the preset conditions. Once the triggering condition is met, the reservation management module immediately creates a reserved instance for the PaymentProcess function.
[0136] A key innovation of this embodiment is the "predictive reservation" mechanism. The system not only predicts the load trend in the short term based on the current concurrent data, but also combines historical data and time characteristics. The prediction algorithm uses time series analysis methods, such as the ARIMA model, and its core can be expressed as: in, is the predicted value h steps ahead, y t is the current observation value, ∈ t is the error term, p and q are the orders of autoregression and moving average, respectively.
[0137] Another innovation is the "adaptive trigger threshold". The system dynamically adjusts the trigger threshold based on the historical performance data of the function. For example, if the PaymentProcess function is observed to begin to experience performance degradation when the number of concurrent calls reaches 40, the system will automatically lower the trigger threshold. The threshold adjustment uses the following formula: Among them, T new and T old are the new and old thresholds, P target is the target performance indicator, P observed is the observed performance measure and α is the adjustment factor.
[0138] During the peak period of order processing, this system showed significant advantages. Fig.24As shown in the figure, when the order creation volume suddenly increases, the system can reserve instances for the payment processing function in advance, effectively reducing the response time of the payment link. At the same time, the lifecycle management module ensures that redundant instances are recycled in time after the load decreases, optimizing resource usage.
[0139] The cooling control module also plays an important role in this scenario. It prevents the system from over-creating reserved instances during short-term load fluctuations. Fig.25 As shown, the cooling time is dynamically adjusted according to load changes to ensure responsiveness while avoiding resource waste.
[0140] This embodiment also demonstrates the scalability of the system. When an e-commerce platform introduces a new function, such as Fraud Detection, the system can seamlessly incorporate it into the reservation management scope by simply updating the configuration file. This flexibility enables the system to adapt to the rapid changes and growth of the business.
[0141] It should be noted that although this embodiment takes the e-commerce platform as an example, the application scope of the present invention is far from limited to this. It is also applicable to other scenarios with complex function call relationships, such as IoT data processing, real-time data analysis, multimedia processing pipelines, etc. The modular design of the system allows customization and optimization according to the needs of different scenarios.
[0142] In addition, this system can also work with other Serverless optimization technologies. For example, it can be combined with function code precompilation technology to further reduce cold start time; it can be combined with container reuse strategies to improve resource utilization; it can also be integrated into Serverless orchestration tools to provide developers with end-to-end performance optimization solutions.
[0143] In summary, this embodiment uses a specific application scenario to demonstrate how the reserved instance triggering system based on function call association can effectively solve the performance challenges in the Serverless architecture. Through innovative mechanisms such as predictive reservation and adaptive threshold adjustment, the system can intelligently manage function instances, significantly reduce cold start problems, and optimize resource usage, thereby providing a more efficient and reliable operating environment for Serverless applications. This method is not only applicable to e-commerce platforms, but also provides new optimization ideas for a wide range of Serverless application scenarios.
Claims
1. A reserved instance triggering method based on function call association, characterized in that: The following steps are involved: (a) receiving a reservation trigger configuration, wherein the reservation trigger configuration includes a target function, a trigger source function, a trigger condition, and a reservation behavior; (b) monitoring the operating indicators of the trigger source function in real time; (c) evaluating whether it is necessary to trigger reservation for the objective function according to the trigger condition; (d) when the trigger condition is met, creating a reserved instance for the target function according to the reservation behavior; (e) managing the life cycle of the reserved instance.
2. The method according to claim 1, characterized in that The trigger conditions include monitoring indicators, comparison operators and thresholds.
3. The method according to claim 1, characterized in that The reservation behavior includes a reservation quantity, a survival time, and a cooling time.
4. The method according to claim 1, characterized in that The life cycle of managing a reserved instance includes: (a) controlling the survival period of the reserved instance according to the preset survival period; (b) When the survival time expires or the triggering conditions are no longer met, the reserved instance is automatically reclaimed.
5. The method according to claim 1, characterized in that Also includes: (a) Before triggering the reservation, check whether it is within the cooling time; (b) If it is within the cooling time, the reservation operation will not be performed.
6. The method according to claim 1, characterized in that The operation indicators include but are not limited to at least one of the number of concurrency, number of requests per second (QPS), CPU utilization, and memory utilization.
7. A reserved instance triggering system based on function call association, characterized in that: include: (a) a configuration module, configured to receive and parse a reservation trigger configuration; (b) a monitoring module, used to monitor the operating indicators of the trigger source function in real time; (c) an evaluation module, used to evaluate whether reservation needs to be triggered according to the triggering condition; (d) A reservation management module, used to create and manage the life cycle of reserved instances.
8. The system according to claim 7, characterized in that Also includes: (a) A cooling control module is used to manage the cooling time of the trigger operation to prevent frequent triggering.
9. The system according to claim 7, characterized in that The reservation management module is also used for: (a) controlling the survival period of the reserved instance according to the preset survival period; (b) When the survival time expires or the triggering conditions are no longer met, the reserved instance is automatically reclaimed.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the reserved instance triggering method based on function call association is implemented as described in any one of claims 1 to 6.