Method and apparatus for determining graceful shutdown timeout duration

CN115718645BActive Publication Date: 2026-09-25INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211506459.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-28
Publication Date
2026-09-25
Estimated Expiration
2042-11-28

AI Technical Summary

Technical Problem

[0003]相关技术中,配置的超时时长通常是个经验值,设置过短造成在途请求未处理完毕被迫中断从而影响业务的连续性,设置过长也会导致停机时长延长带来不必要的等待

Benefits of technology

[0048]通过本公开的实施例提供的一种优雅停机超时时长的确定方法,响应于服务停机指令,使用超时时长预测模型预测目标停机超时时长,其中,所述超时时长预测模型为根据历史服务调用信息预先训练得到的;根据所述目标停机超时时长动态配置超时时长,以执行服务停机流程。相比于相关技术,本公开实施例提供的方法通过使用预先训练的超时时长预测模型预测目标停机超时时长,得到的停机超时时长更加精确,从而降低优雅停机过程中对服务的影响,提高用户的体验。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115718645B_ABST
    Figure CN115718645B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method for determining graceful shutdown timeout duration, relates to the field of cloud computing, and can be applied to the field of financial technology. The method comprises: in response to a service shutdown instruction, predicting a target shutdown timeout duration using a timeout duration prediction model, wherein the timeout duration prediction model is obtained by pre-training according to historical service call information; and dynamically configuring a timeout duration according to the target shutdown timeout duration to execute a service shutdown process. The present disclosure also provides a device, equipment, storage medium and program product for determining graceful shutdown timeout duration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of cloud computing technology, specifically to the field of microservices technology, and more specifically to a method, apparatus, device, storage medium, and program product for determining graceful downtime duration. Background Technology

[0002] As monolithic applications transition to microservices, internet technologies centered on microservices and containers have become a major trend, with numerous enterprises implementing microservice architectures. Graceful shutdown of service provider nodes can effectively reduce the impact of sudden interruptions to business operations on servers. Currently, the graceful shutdown mechanism of the Dubbo microservice framework mainly includes registry deregistration logic and protocol deregistration logic. First, the service provider address corresponding to this node is deleted from the registry, and the registry notifies the service consumer to unsubscribe from that node address. Then, the service provider sends a readonly event message to notify the service consumer and waits for any pending requests to be processed within the configured timeout period.

[0003] In related technologies, the configured timeout duration is usually an empirical value. Setting it too short can cause in-transit requests to be interrupted before they are fully processed, thus affecting business continuity. Setting it too long can also lead to prolonged downtime and unnecessary waiting. Therefore, how to accurately determine the timeout duration has become an urgent technical problem to be solved.

[0004] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0005] In view of the above problems, this disclosure provides a method, apparatus, device, medium and program product for determining the graceful shutdown timeout duration.

[0006] According to a first aspect of this disclosure, a method for determining the duration of graceful shutdown timeout is provided, the method comprising:

[0007] In response to a service shutdown command, a timeout duration prediction model is used to predict the target shutdown timeout duration, wherein the timeout duration prediction model is pre-trained based on historical service call information;

[0008] The timeout duration is dynamically configured based on the target downtime duration to execute the service downtime process.

[0009] According to embodiments of this disclosure, pre-training the timeout duration prediction model based on historical service call information includes:

[0010] Service call information is collected periodically according to a preset frequency.

[0011] The target timeout duration is calculated based on the service call information, wherein the target timeout duration is the timeout duration required to trigger graceful shutdown at any time within the collection period;

[0012] The data sample set is constructed by using the timestamp of the midpoint of each collection cycle as the explanatory variable and the target timeout duration corresponding to each collection cycle as the explained variable.

[0013] The data sample set is input into the timeout duration prediction model for training and testing.

[0014] According to embodiments of this disclosure, the service call information includes the number of successful service calls, the number of failed calls, the total response time, the average number of transactions per second, the maximum response time, and the maximum number of transactions per second.

[0015] According to embodiments of this disclosure, calculating the target timeout duration based on the service call information includes:

[0016] Based on the service call information, calculate the number of calls to a single service, the total response time of a single service, and the average transaction volume per second of a single service within each collection period;

[0017] The weighted average response time of a single service is determined based on the number of calls to the single service, the total response time of the single service, and the average number of transactions per second of the single service.

[0018] The target timeout duration is determined based on the weighted average response time and the total number of service calls.

[0019] According to embodiments of this disclosure, predicting the target downtime duration using a timeout duration prediction model includes:

[0020] Obtain the time information of the service shutdown command initiation;

[0021] Input the time information into the timeout duration prediction model; and

[0022] Output the target downtime duration.

[0023] According to embodiments of this disclosure, it further includes:

[0024] The data sample set is updated periodically;

[0025] The updated data sample set is input into the training timeout prediction model to update the model.

[0026] A second aspect of this disclosure provides an apparatus for determining the duration of a graceful shutdown timeout, the apparatus comprising:

[0027] The prediction module is used to predict the target downtime duration in response to a service downtime command using a timeout duration prediction model, wherein the timeout duration prediction model is pre-trained based on historical service call information.

[0028] The timeout duration configuration module is used to dynamically configure the timeout duration according to the target downtime duration to execute the service downtime process; and

[0029] The timeout duration prediction model training module is used to pre-train the timeout duration prediction model based on historical service call information.

[0030] According to embodiments of this disclosure, it further includes:

[0031] The timeout duration prediction model update module is used to update the data sample set periodically and input the updated data sample set into the training timeout duration prediction model to update the model.

[0032] According to embodiments of this disclosure, the timeout duration prediction model training module includes: a data collection submodule, a determination submodule, a data sample set construction submodule, and a training submodule.

[0033] The data collection submodule is used to collect service call information at preset frequencies.

[0034] The determination submodule is used to calculate the target timeout duration based on the service call information, wherein the target timeout duration is the timeout duration required to trigger graceful shutdown at any time within the collection period;

[0035] The data sample set construction submodule is used to construct a data sample set by using the timestamp of the middle moment of each collection cycle as the explanatory variable and the target timeout duration corresponding to each collection cycle as the explained variable.

[0036] The training submodule is used to input the data sample set into the timeout duration prediction model for training and testing.

[0037] According to embodiments of this disclosure, the determining submodule includes a first determining unit, a second determining unit, and a third determining unit.

[0038] The first determining unit is used to calculate the number of calls to a single service, the total response time of a single service, and the average transaction processing volume per second of a single service in each collection period based on the service call information.

[0039] The second determining unit is used to determine the weighted average response time of a single service based on the number of single service calls, the total response time of the single service, and the average number of transactions per second of the single service.

[0040] The third determining unit is used to determine the target timeout duration based on the weighted average response time and the total number of service calls.

[0041] According to embodiments of this disclosure, the prediction module includes an acquisition submodule, an input submodule, and an output submodule.

[0042] The `get` submodule is used to obtain the time information of initiating the service shutdown command;

[0043] The input submodule is used to input the time information into the timeout duration prediction model for prediction; and

[0044] The output submodule is used to output the target downtime duration.

[0045] A third aspect of this disclosure provides an electronic device comprising: one or more processors; and a memory for storing one or more programs, wherein, when the one or more programs are executed by the one or more processors, the one or more processors perform the method for determining the graceful shutdown timeout duration described above.

[0046] A fourth aspect of this disclosure also provides a computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, cause the processor to perform the method for determining the graceful halt timeout duration described above.

[0047] The fifth aspect of this disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the method for determining the graceful shutdown timeout duration described above.

[0048] The present disclosure provides a method for determining the graceful shutdown timeout duration. In response to a service shutdown command, it uses a timeout duration prediction model to predict a target shutdown timeout duration. This timeout duration prediction model is pre-trained based on historical service call information. The timeout duration is dynamically configured according to the target shutdown timeout duration to execute the service shutdown process. Compared to related technologies, the method provided in this disclosure, by using a pre-trained timeout duration prediction model to predict the target shutdown timeout duration, yields a more accurate shutdown timeout duration, thereby reducing the impact on services during graceful shutdown and improving user experience. Attached Figure Description

[0049] The foregoing contents, as well as other objects, features, and advantages of this disclosure, will become clearer from the following description of embodiments with reference to the accompanying drawings, in which:

[0050] Figure 1 The illustration schematically depicts an application scenario of a method, apparatus, device, medium, and program product for determining graceful shutdown timeout duration according to embodiments of the present disclosure;

[0051] Figure 2 A flowchart illustrating a method for determining the duration of graceful shutdown timeout according to an embodiment of the present disclosure is shown schematically.

[0052] Figure 3 A flowchart illustrating a timeout duration prediction model training method provided according to an embodiment of the present disclosure is shown in the schematic diagram.

[0053] Figure 4 A flowchart illustrating a method for calculating a target timeout duration based on service call information according to an embodiment of this disclosure is shown schematically.

[0054] Figure 5 A flowchart illustrating the prediction of target downtime duration using a timeout duration prediction model according to an embodiment of the present disclosure is shown.

[0055] Figure 6 A flowchart illustrating an update method for a timeout duration prediction model provided according to an embodiment of this disclosure is shown schematically.

[0056] Figure 7 A schematic block diagram illustrating a device for determining the duration of graceful shutdown timeout according to an embodiment of the present disclosure is shown; and

[0057] Figure 8 A block diagram of an electronic device suitable for implementing a method for determining the duration of graceful shutdown timeout according to an embodiment of the present disclosure is shown schematically. Detailed Implementation

[0058] The embodiments of the present disclosure will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the disclosure. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the present disclosure for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concepts of the present disclosure.

[0059] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0060] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.

[0061] When using expressions such as "at least one of A, B, and C", they should generally be interpreted in accordance with the meaning that is commonly understood by a person skilled in the art (e.g., "a system having at least one of A, B, and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B, and C, etc.).

[0062] First, the terms appearing in the embodiments of this disclosure will be explained:

[0063] Graceful shutdown: This refers to the process where, after a shutdown command is issued to a business application, the application stops accepting new requests but continues to process already accepted requests. However, after a timeout period, the application will terminate immediately.

[0064] Timeout duration: When a service provider node needs to be shut down, in order to reduce the impact of sudden interruption of business execution on the server, a delay is often made to allow the running business or service to complete. This delay is called the timeout duration.

[0065] Based on the above-mentioned technical problems, embodiments of this disclosure provide a method for determining graceful shutdown timeout duration. The method includes: in response to a service shutdown command, using a timeout duration prediction model to predict a target shutdown timeout duration, wherein the timeout duration prediction model is pre-trained based on historical service call information; and dynamically configuring the timeout duration according to the target shutdown timeout duration to execute the service shutdown process.

[0066] Figure 1 The illustration schematically depicts an application scenario of a method, apparatus, device, medium, and program product for determining graceful shutdown timeout duration according to embodiments of the present disclosure.

[0067] like Figure 1 As shown, application scenario 100 according to this embodiment may include a graceful shutdown scenario. Network 104 serves as a medium for providing a communication link between terminal devices 101, 102, 103 and server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.

[0068] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).

[0069] Terminal devices 101, 102, and 103 can be various electronic devices with displays and web browsing capabilities, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0070] Server 105 can be a server for dynamically configuring graceful shutdown timeout duration. This server has a timeout duration prediction model deployed in it. When a shutdown command is received, the current time information is input into the timeout duration prediction model to predict the duration required for the current shutdown and then configure it.

[0071] It should be noted that the method for determining the graceful shutdown timeout duration provided in this embodiment can generally be executed by server 105. Correspondingly, the device for determining the graceful shutdown timeout duration provided in this embodiment can generally be located in server 105. The method for determining the graceful shutdown timeout duration provided in this embodiment can also be executed by a server or server cluster that is different from server 105 and capable of communicating with terminal devices 101, 102, 103 and / or server 105. Correspondingly, the device for determining the graceful shutdown timeout duration provided in this embodiment can also be located in a server or server cluster that is different from server 105 and capable of communicating with terminal devices 101, 102, 103 and / or server 105.

[0072] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0073] It should be noted that the method and apparatus for determining the graceful shutdown timeout duration determined in the embodiments of this disclosure can be used in the field of cloud computing technology, the field of financial technology, and any field other than the financial field. The application field of the method and apparatus for determining the graceful shutdown timeout duration determined in the embodiments of this disclosure is not limited.

[0074] The following will be based on Figure 1 The described scene, through Figures 2-6 The method for determining the graceful shutdown timeout duration according to embodiments of this disclosure is described in detail.

[0075] Figure 2 A flowchart illustrating a method for determining the graceful shutdown timeout duration according to an embodiment of this disclosure is shown schematically. Figure 2 As shown, the method for determining the graceful shutdown timeout duration in this embodiment includes operations S210 and S220, which can be executed by a server or other computing device.

[0076] In operation S210, in response to a service shutdown command, the target shutdown timeout duration is predicted using a timeout duration prediction model.

[0077] In operation S220, the timeout duration is dynamically configured according to the target downtime duration in order to execute the service downtime procedure.

[0078] According to embodiments of this disclosure, the timeout duration prediction model is pre-trained based on historical service call information.

[0079] In one example, the timeout duration is related to the number of currently running services, and the number of services running over a period of time exhibits a certain periodic pattern. For example, it could be measured on a daily basis, with a pattern in the number of services running per hour, where fewer services are called in the early morning and more are called during the day; or it could be measured on a weekly basis, with fewer services called during the week than on the weekend, and so on. This embodiment of the disclosure uses a machine learning model algorithm to fit the timeout duration and time from historical service call information, establishing a relationship between the timeout duration and the current moment, thereby building a timeout duration prediction model to achieve accurate prediction of timeout duration.

[0080] To better understand this solution, the graceful shutdown mechanism is briefly described below. ShutdownHook is a mechanism provided by the Java language. When the JVM receives a system shutdown notification, it calls methods within the ShutdownHook to complete cleanup operations, thus smoothly exiting the application. When Spring executes the shutdown process, it publishes a ContextClosedEvent. The ShutdownHookListener in Dubbo listens for this ContextClosedEvent, triggering Dubbo's graceful shutdown, and then shutting down the Spring application. In this embodiment, the prediction of timeout duration is delegated to Spring for management. The system listens for Spring's ContextClosedEvent and prioritizes the timeout duration prediction and dynamic configuration processing logic to ensure it completes before Dubbo's graceful shutdown.

[0081] In one example, upon receiving a shutdown command, the pre-trained timeout prediction model determines the shutdown timeout duration and dynamically configures it. Compared to existing technologies that fix the timeout duration based on empirical values, the timeout duration in this embodiment is dynamically changing. When the number of running services is small, the required timeout duration is small; when the number of running services is large, the required timeout duration is large. Therefore, the predicted timeout duration is more accurate and has less impact on business operations. For a detailed explanation of the process of using the timeout prediction model to predict the target shutdown timeout duration, please refer to [link to relevant documentation]. Figure 5 Operations S211 to S213 are shown.

[0082] The present disclosure provides a method for determining the graceful shutdown timeout duration. In response to a service shutdown command, it uses a timeout duration prediction model to predict a target shutdown timeout duration. This timeout duration prediction model is pre-trained based on historical service call information. The timeout duration is dynamically configured according to the target shutdown timeout duration to execute the service shutdown process. Compared to related technologies, the method provided in this disclosure, by using a pre-trained timeout duration prediction model to predict the target shutdown timeout duration, yields a more accurate shutdown timeout duration, thereby reducing the impact on services during graceful shutdown and improving user experience.

[0083] The following will combine Figure 3 and Figure 4 The training process of the timeout duration prediction model in the embodiments of this disclosure is described. Figure 3 A flowchart illustrating a timeout duration prediction model training method provided according to an embodiment of the present disclosure is shown. Figure 4 A flowchart illustrating a method for calculating a target timeout duration based on service call information according to an embodiment of this disclosure is shown. Figure 3 As shown, this includes operations S310 to S340.

[0084] When operating S310, service call information is collected periodically at a preset frequency.

[0085] According to embodiments of this disclosure, the service call information includes the number of successful service calls, the number of failed calls, the total response time, the average number of transactions per second, the maximum response time, and the maximum number of transactions per second.

[0086] In operation S320, the target timeout duration is calculated based on the service call information.

[0087] According to embodiments of this disclosure, the target timeout duration is the timeout duration required to trigger graceful shutdown at any time during the collection period.

[0088] In one example, this embodiment of the disclosure analyzes and processes data from the Dubbo monitoring center to obtain training samples for the prediction model, namely the target timeout duration. This target timeout duration is the timeout duration required to trigger graceful shutdown at any time within the collection period. Dubbo monitoring is implemented by collecting service call TPS (Transactions Per Second) and service response time data during Dubbo service calls, and reporting statistical data to the monitoring center at a certain frequency. Furthermore, a monitoring center outage will not affect transactions between the service provider and the service consumer; only the sampled data for the corresponding abnormal time period will be lost. For example, the frequency at which the service provider reports service call information to the monitoring center can be configured to be 30 seconds. The service call information includes the number of successful calls, the number of failed calls, the total response time, the average TPS per collection period, the maximum response time, and the maximum TPS.

[0089] like Figure 4 As shown, operation S320 specifically includes operations S321 to S323.

[0090] In operation S321, the number of calls to a single service, the total response time of a single service, and the average transaction volume per second of a single service are calculated based on the service call information within each collection period.

[0091] In operation S322, the weighted average response time of a single service is determined based on the number of single service calls, the total response time of the single service, and the average number of transactions per second of the single service.

[0092] In one example, data from the past month is collected, and the cumulative data submitted by each service is broken down into a single collection period. Based on formula (1), the number of calls to a single service, the total response time, and the average TPS within each collection period are calculated. This leads to the total number of service calls and the weighted average response time within each collection period. The weighted average response time is weighted by the reciprocal of the average TPS of a single service (assuming that a higher average TPS for a single service results in a shorter response time).

[0093]

[0094] in t i n i TPS i These represent the weighted average response time, the total response time of a single service, the number of calls to a single service, and the average TPS of a single service, respectively.

[0095] In operation S323, the target timeout duration is determined based on the weighted average response time and the total number of service calls.

[0096] In one example, the total number is averaged over the collection period to obtain the service calls per second, which is then multiplied by the weighted average response time to obtain the timeout required to trigger graceful shutdown at any time within that collection period. As shown in formula (2),

[0097]

[0098] Where T represents a single collection period, which can be minutes, hours, days, weeks, months, etc.

[0099] In operation S330, the timestamp of the middle moment of each collection cycle is used as the explanatory variable, and the target timeout duration corresponding to each collection cycle is used as the explained variable to construct a data sample set.

[0100] In operation S340, the data sample set is input into the timeout duration prediction model for training and testing.

[0101] In one example, the timestamp of the midpoint of each collection cycle is used as the explanatory variable, and the calculated graceful downtime is used as the dependent variable. A dataset is constructed using data from the past 30 days, and the training and test sets are divided in a 7:3 ratio for model training and testing, respectively. Taking the XGBoost algorithm in machine learning as an example, data preprocessing is first performed, including deduplication, missing data checking, and cleaning of the dataset. The training set data is then input into the XGBoost model for training. This process can improve the model's accuracy on the test set and reduce overfitting by adjusting the model's parameters and cross-validation, resulting in the final model.

[0102] Figure 5 A flowchart illustrating the prediction of a target downtime duration using a timeout duration prediction model according to an embodiment of this disclosure is shown. Figure 5 As shown, this includes operations S211 to S213.

[0103] In operation S211, obtain the time information of initiating the service shutdown command.

[0104] In operation S212, the time information is input into the timeout duration prediction model.

[0105] When operating S213, output the target shutdown timeout duration.

[0106] In one example, upon receiving a service shutdown command, the current time and date are retrieved; this could be a date or a specific timestamp. This time information is then input into a trained timeout prediction model to output the target downtime.

[0107] Figure 6A flowchart illustrating an update method for a timeout duration prediction model provided according to an embodiment of this disclosure is shown. It includes operations S410 and S420.

[0108] When operating S410, update the data sample set periodically.

[0109] In operation S420, the updated data sample set is input into the training timeout duration prediction model to update the model.

[0110] In one example, a Dubbo listener is configured to report service call information to the monitoring center every 30 seconds. The data sample set is updated periodically, for example at 2:00 AM, to minimize the impact on business operations. The latest 24-hour service call information is analyzed and processed, the latest 30-day data is retained, the data sample set is updated, and the model is updated by combining the old and new data.

[0111] Based on the above method for determining the graceful shutdown timeout duration, this disclosure also provides a device for determining the graceful shutdown timeout duration. The following will be combined with... Figure 7 The device is described in detail.

[0112] Figure 7 The diagram schematically illustrates a structural block diagram of an apparatus for determining the duration of graceful shutdown timeout according to an embodiment of the present disclosure.

[0113] like Figure 7 As shown, the graceful shutdown timeout determination device 700 of this embodiment includes a prediction module 710, a timeout duration configuration module 720, and a timeout duration prediction model training module 730.

[0114] The prediction module 710 is used to predict the target downtime duration in response to a service shutdown command using a timeout duration prediction model, wherein the timeout duration prediction model is pre-trained based on historical service call information. In one embodiment, the prediction module 710 can be used to perform the operation S210 described above, which will not be repeated here.

[0115] The timeout duration configuration module 720 is used to dynamically configure the timeout duration according to the target downtime duration to execute the service downtime procedure. In one embodiment, the timeout duration configuration module 720 can be used to execute the operation S220 described above, which will not be repeated here.

[0116] The timeout duration prediction model training module 730 is used to pre-train the timeout duration prediction model based on historical service call information. In one embodiment, the timeout duration prediction model training module can be used to perform the operation S340 described above, which will not be repeated here.

[0117] According to embodiments of this disclosure, it further includes: a timeout duration prediction model update module.

[0118] The timeout duration prediction model update module is used to periodically update the data sample set and input the updated data sample set into the trained timeout duration prediction model to update the model. In one embodiment, the timeout duration prediction model update module can be used to execute the operations S410 and S420 described above, which will not be repeated here.

[0119] According to embodiments of this disclosure, the timeout duration prediction model training module includes: a data collection submodule, a determination submodule, a data sample set construction submodule, and a training submodule.

[0120] The data collection submodule is used to collect service call information periodically at a preset frequency. In one embodiment, the data collection submodule can be used to perform the operation S310 described above, which will not be repeated here.

[0121] The determination submodule is used to calculate the target timeout duration based on the service call information, wherein the target timeout duration is the timeout duration required to trigger graceful shutdown at any time within the collection period. In one embodiment, the determination submodule can be used to perform the operation S320 described above, which will not be repeated here.

[0122] The data sample set construction submodule is used to construct a data sample set by using the timestamp of the midpoint of each collection cycle as an explanatory variable and the target timeout duration corresponding to each collection cycle as the explained variable. In one embodiment, the data sample set construction submodule can be used to perform the operation S330 described above, which will not be repeated here.

[0123] The training submodule is used to input the data sample set into the timeout duration prediction model for training and testing. In one embodiment, the training submodule can be used to perform the operation S340 described above, which will not be repeated here.

[0124] According to embodiments of this disclosure, the determining submodule includes a first determining unit, a second determining unit, and a third determining unit.

[0125] The first determining unit is used to calculate the number of calls to a single service, the total response time of a single service, and the average transaction volume per second of a single service within each collection period based on the service call information. In one embodiment, the first determining unit may be used to perform the operation S321 described above, which will not be repeated here.

[0126] The second determining unit is used to determine the weighted average response time of a single service based on the number of single service calls, the total response time of the single service, and the average number of transactions per second of the single service. In one embodiment, the second determining unit may be used to perform the operation S322 described above, which will not be repeated here.

[0127] The third determining unit is used to determine the target timeout duration based on the weighted average response time and the total number of service calls. In one embodiment, the third determining unit can be used to perform the operation S323 described above, which will not be repeated here.

[0128] According to embodiments of this disclosure, the prediction module 710 includes an acquisition submodule, an input submodule, and an output submodule.

[0129] The acquisition submodule is used to obtain the time information of the service shutdown command. In one embodiment, the acquisition submodule can be used to perform the operation S211 described above, which will not be repeated here.

[0130] The input submodule is used to input the time information into the timeout duration prediction model for prediction. In one embodiment, the input submodule can be used to perform the operation S212 described above, which will not be repeated here.

[0131] The output submodule is used to output the target downtime duration. In one embodiment, the third determining unit can be used to perform the operation S213 described above, which will not be repeated here.

[0132] According to embodiments of this disclosure, any plurality of modules among the prediction module 710, timeout duration configuration module 720, and timeout duration prediction model training module 730 can be combined into one module, or any one of these modules can be split into multiple modules. Alternatively, at least part of the functionality of one or more of these modules can be combined with at least part of the functionality of other modules and implemented in one module. According to embodiments of this disclosure, at least one of the prediction module 710, timeout duration configuration module 720, and timeout duration prediction model training module 730 can be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or implemented in hardware or firmware by any other reasonable means of integrating or packaging the circuitry, or implemented in software, hardware, or firmware, or in any suitable combination of any of these three implementation methods. Alternatively, at least one of the prediction module 710, the timeout duration configuration module 720, and the timeout duration prediction model training module 730 can be at least partially implemented as a computer program module, which can perform corresponding functions when the computer program module is run.

[0133] Figure 8 A block diagram of an electronic device suitable for implementing a method for determining the duration of graceful shutdown timeout according to an embodiment of the present disclosure is shown schematically.

[0134] like Figure 8 As shown, an electronic device 900 according to an embodiment of the present disclosure includes a processor 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage portion 908 into a random access memory (RAM) 903. The processor 901 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 901 may also include onboard memory for caching purposes. The processor 901 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.

[0135] RAM 903 stores various programs and data required for the operation of electronic device 900. Processor 901, ROM 902, and RAM 903 are interconnected via bus 904. Processor 901 performs various operations of the method flow according to embodiments of the present disclosure by executing programs in ROM 902 and / or RAM 903. It should be noted that the programs may also be stored in one or more memories other than ROM 902 and RAM 903. Processor 901 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in said one or more memories.

[0136] According to embodiments of this disclosure, the electronic device 900 may further include an input / output (I / O) interface 905, which is also connected to a bus 904. The electronic device 900 may also include one or more of the following components connected to the I / O interface 905: an input section 906 including a keyboard, mouse, etc.; an output section 907 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 908 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN card, modem, etc. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as needed. A removable medium 911, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 910 as needed so that computer programs read from it can be installed into the storage section 908 as needed.

[0137] This disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs that, when executed, implement the method for determining the graceful shutdown timeout duration according to embodiments of this disclosure.

[0138] According to embodiments of this disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, such as including, but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to embodiments of this disclosure, the computer-readable storage medium may include ROM 902 and / or RAM 903 and / or one or more memories other than ROM 902 and RAM 903 described above.

[0139] Embodiments of this disclosure also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowchart. When the computer program product is run on a computer system, the program code enables the computer system to implement the method for determining the graceful shutdown timeout duration provided in embodiments of this disclosure.

[0140] When the computer program is executed by the processor 901, it performs the functions defined in the system / apparatus of this disclosure embodiments. According to embodiments of this disclosure, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0141] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and downloaded and installed via the communication section 909, and / or installed from a removable medium 911. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.

[0142] In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 909, and / or installed from the removable medium 911. When the computer program is executed by the processor 901, it performs the functions defined in the system of this disclosure embodiment. According to embodiments of this disclosure, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0143] According to embodiments of this disclosure, program code for executing the computer programs provided in embodiments of this disclosure can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, languages ​​such as Java, C++, Python, "C", or similar programming languages. The program code can execute entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0144] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0145] Those skilled in the art will understand that the features described in the various embodiments and / or claims of this disclosure can be combined or combined in various ways, even if such combinations or combinations are not explicitly described in this disclosure. In particular, the features described in the various embodiments and / or claims of this disclosure can be combined or combined in various ways without departing from the spirit and teachings of this disclosure. All such combinations and / or combinations fall within the scope of this disclosure.

[0146] The embodiments of this disclosure have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of this disclosure. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. The scope of this disclosure is defined by the appended claims and their equivalents. Various substitutions and modifications can be made by those skilled in the art without departing from the scope of this disclosure, and all such substitutions and modifications should fall within the scope of this disclosure.

Claims

1. A method for determining the graceful shutdown timeout duration, characterized in that, The method includes: In response to a service shutdown command, a timeout duration prediction model is used to predict the target shutdown timeout duration, wherein the timeout duration prediction model is pre-trained based on historical service call information; The timeout duration is dynamically configured based on the target downtime duration to execute the service downtime process; Among them, the timeout prediction model pre-trained based on historical service call information includes: Calculate the number of calls to a single service, the total response time of a single service, and the average number of transactions per second for a single service within each collection period based on historical service call information. The weighted average response time of a single service is determined based on the number of calls to the single service, the total response time of the single service, the average number of transactions per second of the single service, and a preset formula, wherein the preset formula is: ,in , , , These represent the weighted average response time, the total response time of a single service, the number of calls to a single service, and the average number of transactions per second for a single service, respectively. The target timeout duration is determined based on the weighted average response time and the total number of service calls, and the target timeout duration is used to train the timeout duration prediction model.

2. The method according to claim 1, characterized in that, Pre-training the timeout prediction model based on historical service call information includes: Service call information is collected periodically according to a preset frequency. The target timeout duration is calculated based on the service call information, wherein the target timeout duration is the timeout duration required to trigger graceful shutdown at any time within the collection period; The data sample set is constructed by using the timestamp of the middle moment of each collection cycle as the explanatory variable and the target timeout duration corresponding to each collection cycle as the explained variable. The data sample set is input into the timeout duration prediction model for training and testing.

3. The method according to claim 2, characterized in that, The service call information includes the number of successful service calls, the number of failed calls, the total response time, the average number of transactions per second, the maximum response time, and the maximum number of transactions per second.

4. The method according to claim 2, characterized in that, The prediction of the target downtime duration using the timeout duration prediction model includes: Obtain the time information of the service shutdown command initiation; Input the time information into the timeout duration prediction model; and Output the target downtime duration.

5. The method according to claim 2, characterized in that, Also includes: The data sample set is updated periodically; The updated data sample set is input into the timeout duration prediction model to update the model.

6. A device for determining the duration of graceful shutdown timeout, characterized in that, The device includes: The prediction module is used to predict the target downtime duration in response to a service downtime command using a timeout duration prediction model, wherein the timeout duration prediction model is pre-trained based on historical service call information. The timeout duration configuration module is used to dynamically configure the timeout duration according to the target downtime duration to execute the service downtime process; and The timeout duration prediction model training module is used to pre-train the timeout duration prediction model based on historical service call information; The training module is used to calculate the number of calls to a single service, the total response time of a single service, and the average transaction volume per second of a single service within each collection period based on historical service call information; and to determine the weighted average response time of a single service based on the number of calls to a single service, the total response time of a single service, the average transaction volume per second of a single service, and a preset formula, wherein the preset formula is: ,in , , , These represent the weighted average response time, the total response time of a single service, the number of calls to a single service, and the average number of transactions per second for a single service, respectively. A target timeout is determined based on the weighted average response time and the total number of service calls, and the target timeout is used to train the timeout prediction model.

7. An electronic device, comprising: One or more processors; Storage device 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 execute the method for determining the graceful shutdown timeout duration according to any one of claims 1 to 5.

8. A computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the method for determining the graceful shutdown timeout duration according to any one of claims 1 to 5.

9. A computer program product comprising a computer program that, when executed by a processor, implements the method for determining the graceful shutdown timeout duration according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Server control method and device, computing equipment and medium

    CN112860328A

  • Method, system and equipment for setting calling timeout duration between micro-services

    CN114356612A