Link optimization method, device, storage medium and computer device

CN116390130BActive Publication Date: 2026-09-11RAJAX NETWORK &TECHNOLOGY (SHANGHAI) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310403851.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-14
Publication Date
2026-09-11
Estimated Expiration
2043-04-14

AI Technical Summary

Technical Problem

[0005]有鉴于此,本申请提供了一种链路优化方法、装置、存储介质及计算机设备,主要目的在于解决链路优化后接口性能没有得到实质提升,反而因为占用了较多的计算资源,导致链路的整体执行效率较低的技术问题

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116390130B_ABST
    Figure CN116390130B_ABST
Patent Text Reader

Abstract

The application discloses a link optimization method and device, a storage medium and computer equipment. The method comprises the following steps: acquiring the average execution time and execution failure probability of each sub-operation in a target link, and the average waiting time from the completion of the execution of each sub-operation to the start of the execution of a key operation in the target link; for each sub-operation, determining the current global execution time corresponding to the sub-operation according to the average execution time, the execution failure probability and the average waiting time of the sub-operation; acquiring the resource calling time of the sub-operation, and determining the estimated global execution time corresponding to the sub-operation according to the resource calling time, the average execution time and the average waiting time of the sub-operation; in response to the difference between the current global execution time and the estimated global execution time corresponding to the sub-operation being greater than a preset value, performing asynchronous parallel processing on the sub-operation to obtain an optimized target link. The above method can effectively improve the pertinence and accuracy of link optimization, thereby improving the link execution efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of Internet technology, and in particular to a link optimization method, apparatus, storage medium, and computer equipment. Background Technology

[0002] With the continuous development of internet technology, the internet user base is growing larger and larger, and users are making more and more business requests. In the process of executing user business requests, servers typically call multiple interfaces, forming a chain. Generally speaking, following the operation flow of this chain, it can be broken down into multiple steps, where each sub-operation corresponds to at least one interface.

[0003] In existing technologies, in order to improve the execution efficiency of the link and shorten the execution time of the link, the interfaces corresponding to each operation step in the link are executed in parallel. That is, the interfaces corresponding to multiple operation steps are called simultaneously in parallel, thereby shortening the execution time of the entire link.

[0004] However, this approach typically requires waiting for all parallel steps to complete before querying the execution results. For steps with a high failure rate, sequential execution can actually terminate the process chain prematurely, thus speeding up the chain execution. Therefore, parallel processing of each step in the chain sometimes does not substantially improve interface performance; instead, it can reduce the overall execution efficiency of the chain due to the significant amount of computational resources consumed during execution. Summary of the Invention

[0005] In view of this, this application provides a link optimization method, apparatus, storage medium and computer device, the main purpose of which is to solve the technical problem that the interface performance is not substantially improved after link optimization, but the overall execution efficiency of the link is low because it occupies more computing resources.

[0006] According to a first aspect of the present invention, a link optimization method is provided, the method comprising:

[0007] Obtain the average execution time and failure probability of each sub-operation in the target link, as well as the average waiting time from the completion of each sub-operation to the start of the execution of the key operation in the target link;

[0008] For each sub-operation, the current global execution time corresponding to the sub-operation is determined based on the average execution time, execution failure probability, and average waiting time of the sub-operation.

[0009] Obtain the resource call time of the sub-operation, and determine the estimated global execution time of the sub-operation based on the resource call time, average execution time, and average waiting time of the sub-operation;

[0010] In response to the difference between the current global execution time and the estimated global execution time corresponding to the sub-operation being greater than a preset value, the sub-operation is processed asynchronously in parallel to obtain the optimized target link.

[0011] Optionally, before obtaining the average execution time and execution failure probability of each sub-operation in the target link, the method further includes: dividing the target link into multiple sub-operations according to the operation flow of the target link, and identifying at least one key operation among the multiple sub-operations, wherein each sub-operation corresponds to at least one interface, and the key operation is an operation to update data in the database.

[0012] Optionally, determining the current global execution time corresponding to the sub-operation based on the average execution time, execution failure probability, and average waiting time of the sub-operation includes: obtaining the current global execution time when the sub-operation fails by multiplying the average execution time and execution failure probability of the sub-operation; calculating the success probability of the sub-operation based on the execution failure probability of the sub-operation; obtaining the current global execution time when the sub-operation succeeds by multiplying the sum of the average execution time and the average waiting time of the sub-operation and the success probability of the sub-operation; and obtaining the current global execution time corresponding to the sub-operation by summing the current global execution time when the sub-operation fails and the current global execution time when the sub-operation succeeds.

[0013] Optionally, determining the estimated global execution time of the sub-operation based on its resource call time, average execution time, and average waiting time includes: when the average execution time of the sub-operation is less than or equal to the average waiting time, obtaining the estimated global execution time of the sub-operation by multiplying the sum of the resource call time and the average waiting time of the sub-operation by a preset probability coefficient; when the average execution time of the sub-operation is greater than the average waiting time, obtaining the estimated global execution time of the sub-operation by multiplying the sum of the resource call time and the average execution time of the sub-operation by a preset probability coefficient.

[0014] Optionally, the asynchronous parallel processing of the sub-operation includes: setting the interface corresponding to the sub-operation to a parallel execution mode; storing the query results of the interface corresponding to the sub-operation in a cache space, and querying the query results in the cache space before the execution of the key operation.

[0015] Optionally, the method further includes: determining whether the response time of the optimized target link is greater than a preset target response time; if so, correcting the average execution time and execution failure probability of each sub-operation in the target link, and the average waiting time from the completion of each sub-operation to the start of the execution of the critical operation in the target link; based on the corrected average execution time and execution failure probability of each sub-operation, and the average waiting time from the completion of each sub-operation to the start of the execution of the critical operation in the target link, recalculating the current global execution time and estimated global execution time corresponding to each sub-operation; in response to the difference between the recalculated current global execution time and the estimated global execution time being greater than the preset value, asynchronous parallel processing is performed on the interface corresponding to the sub-operation to obtain the re-optimized target link.

[0016] Optionally, the target link is an order creation link, and the sub-operations in the target link include at least one of the following operations: sensitive image verification operation, sensitive word verification operation, user risk control verification operation, order placement operation, and order creation success message broadcast operation. The key step in the target link is the order placement operation.

[0017] According to a second aspect of the present invention, a link optimization apparatus is provided, the apparatus comprising:

[0018] The parameter acquisition module is used to acquire the average execution time and execution failure probability of each sub-operation in the target link, as well as the average waiting time from the completion of each sub-operation to the start of the execution of the key operation in the target link.

[0019] The data calculation module is used to determine the current global execution time of each sub-operation based on its average execution time, execution failure probability, and average waiting time; obtain the resource call time of the sub-operation; and determine the estimated global execution time of the sub-operation based on its resource call time, average execution time, and average waiting time.

[0020] The link optimization module is used to perform asynchronous parallel processing on the sub-operation in response to the difference between the current global execution time and the estimated global execution time being greater than a preset value, so as to obtain the optimized target link.

[0021] Optionally, the device further includes a step splitting module, wherein the step splitting module is used to split the target link into multiple sub-operations according to the operation flow of the target link, and to identify at least one key operation among the multiple sub-operations, wherein each sub-operation corresponds to at least one interface, and the key operation is an operation to update data in the database.

[0022] Optionally, the data calculation module is specifically used to obtain the current global execution time when the sub-operation fails, based on the product of the average execution time and the failure probability of the sub-operation; to calculate the success probability of the sub-operation based on the failure probability of the sub-operation; to obtain the current global execution time when the sub-operation succeeds, based on the product of the sum of the average execution time and the average waiting time of the sub-operation and the success probability of the sub-operation; and to obtain the current global execution time corresponding to the sub-operation, based on the sum of the current global execution time when the sub-operation fails and the current global execution time when the sub-operation succeeds.

[0023] Optionally, the data calculation module is further configured to: when the average execution time of the sub-operation is less than or equal to the average waiting time, obtain the estimated global execution time corresponding to the sub-operation by multiplying the sum of the resource call time and the average waiting time of the sub-operation by a preset probability coefficient; and when the average execution time of the sub-operation is greater than the average waiting time, obtain the estimated global execution time corresponding to the sub-operation by multiplying the sum of the resource call time and the average execution time of the sub-operation by a preset probability coefficient.

[0024] Optionally, the link optimization module is specifically used to set the interface corresponding to the sub-operation to a parallel execution mode; store the query results of the interface corresponding to the sub-operation in a cache space, and query the query results in the cache space before the execution of the key operation.

[0025] Optionally, the device further includes a parameter correction module, wherein the parameter correction module is used to determine whether the response time of the optimized target link is greater than a preset target response time; if so, the average execution time and execution failure probability of each sub-operation in the target link, and the average waiting time from the completion of each sub-operation to the start of the execution of the critical operation in the target link are corrected; based on the corrected average execution time and execution failure probability of each sub-operation, and the average waiting time from the completion of each sub-operation to the start of the execution of the critical operation in the target link, the current global execution time and the estimated global execution time corresponding to each sub-operation are recalculated; in response to the difference between the recalculated current global execution time and the estimated global execution time being greater than the preset value, the interface corresponding to the sub-operation is processed asynchronously in parallel to obtain the re-optimized target link.

[0026] Optionally, the target link is an order creation link, and the sub-operations in the target link include at least one of the following operations: sensitive image verification operation, sensitive word verification operation, user risk control verification operation, order placement operation, and order creation success message broadcast operation. The key step in the target link is the order placement operation.

[0027] According to a third aspect of the present invention, a storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the above-described link optimization method.

[0028] According to a fourth aspect of the present invention, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the above-described link optimization method.

[0029] This invention provides a link optimization method, apparatus, storage medium, and computer device. First, it obtains parameters such as the average execution time, failure probability, and average waiting time from the completion of each sub-operation to the start of critical operations in the target link. Then, based on these parameters, it calculates the current global execution time and estimated global execution time for each sub-operation. When the current global execution time of a sub-operation is greater than the estimated global execution time, the sub-operation is processed asynchronously in parallel to obtain the optimized target link. This method calculates the current global execution time of each sub-operation before asynchronous optimization and the estimated global execution time after asynchronous optimization, and uses the difference between the two global execution times to filter sub-operations to be optimized. This effectively assesses the necessity of asynchronous optimization for each sub-operation, thereby improving the targeting and accuracy of link optimization and increasing the efficiency of link execution. Simultaneously, this method avoids consuming excessive computing resources during link execution, further improving the overall execution efficiency of the link.

[0030] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description

[0031] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:

[0032] Figure 1 A flowchart illustrating a link optimization method provided by an embodiment of the present invention is shown;

[0033] Figure 2 A flowchart illustrating another link optimization method provided by an embodiment of the present invention is shown;

[0034] Figure 3 A schematic diagram of a link optimization device provided in an embodiment of the present invention is shown;

[0035] Figure 4 A schematic diagram of another link optimization device provided in an embodiment of the present invention is shown. Detailed Implementation

[0036] The present invention will be described in detail below with reference to the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in the present application can be combined with each other.

[0037] In one embodiment, such as Figure 1 As shown, a link optimization method is provided. Taking the application of this method to computer devices such as servers as an example, the method includes the following steps:

[0038] 101. Obtain the average execution time and failure probability of each sub-operation in the target link, as well as the average waiting time from the completion of each sub-operation to the start of the execution of the critical operation in the target link.

[0039] Specifically, when a user initiates a service request to the server via a terminal device, the server responds by calling the corresponding interface. These interfaces form an execution chain during execution. Typically, at the beginning of the chain's construction, the interfaces are executed sequentially, meaning the server responds to the service request by calling each corresponding interface in turn to implement the relevant function. Furthermore, if an interface call fails, the chain interrupts execution and returns a failure result to the terminal device; if all interfaces in the chain are successfully called, the chain returns a success result to the terminal device. In this embodiment, the target chain primarily refers to a chain where all interfaces are executed sequentially.

[0040] In this embodiment, the target chain can be broken down into multiple sub-operations according to the operation flow. For example, in the order creation chain, each information verification step can be considered a sub-operation, and each sub-operation corresponds to one or more interfaces. By calling one or more interfaces corresponding to the sub-operation, the corresponding function of the sub-operation can be implemented. Accordingly, each sub-operation requires a certain execution time and has a certain probability of failure. The execution time of a sub-operation is typically between tens and thousands of milliseconds. There are many reasons why a sub-operation might fail, such as when the information uploaded by the user does not meet the verification requirements, when the server experiences a network failure, or when the resources that the interface depends on become invalid. Furthermore, among these sub-operations, when a sub-operation involves updating data in the database, it can be designated as a critical step. For example, in the order creation chain, the order placement operation can be designated as a critical step. After this step is successfully executed, an order record will be added to the database, indicating that the order creation chain has been successfully executed.

[0041] In this embodiment, by collecting execution data for the same link within a preset time period in the application, the average execution time and failure probability of each sub-operation in the target link can be calculated, as well as the average waiting time from the completion of each sub-operation to the start of the critical operation in the target link. It is understood that to improve the accuracy of the calculation of average execution time, average waiting time, and failure probability, the duration and scope of data collection can be appropriately extended; that is, the collected data can cover a large amount of link execution data for different types of users over a relatively long period. Furthermore, the average execution time can be obtained by averaging the total execution time of each sub-operation in the target link, by taking the median execution time of each sub-operation in the target link, or by calculating it statistically. The calculation method for the average waiting time is similar. This embodiment does not specifically limit the calculation method for the time parameters; it can be selected according to the actual situation.

[0042] 102. For each sub-operation, determine the current global execution time corresponding to the sub-operation based on the sub-operation's average execution time, execution failure probability, and average waiting time.

[0043] The current global execution time for a sub-operation refers to the estimated time required from the start of the sub-operation's execution to the execution of the critical operation, under serial execution conditions. Specifically, for each sub-operation in the target chain, the estimated time required from the sub-operation's execution to the critical operation under the condition of execution failure can be calculated by multiplying the sub-operation's average execution time by its failure probability. In the event of a sub-operation failure, the chain terminates execution. In this case, the time required from the sub-operation's execution to the critical operation can be considered the sub-operation's average execution time; that is, the chain completes execution after the sub-operation fails. Therefore, by multiplying the sub-operation's average execution time by its failure probability, the estimated time required from the sub-operation's execution to the critical operation under the condition of execution failure can be obtained.

[0044] Furthermore, if the sub-operation executes successfully, the link will not terminate. In this case, the time required from the sub-operation execution to the critical operation can be considered as the sum of the average execution time and average waiting time of the sub-operation. Therefore, by multiplying the sum of the average execution time and average waiting time of the sub-operation by the probability of the sub-operation's success, we can obtain the estimated time required from the sub-operation execution to the critical operation if the sub-operation executes successfully. The probability of the sub-operation's success can be calculated from the probability of its failure. Further, after obtaining the estimated time required from the sub-operation execution to the critical operation in both successful and failed scenarios, the two estimated values ​​can be added together to obtain the current global execution time corresponding to the sub-operation. This embodiment, by calculating the current global execution time corresponding to each sub-operation, can estimate the overall execution time of the interface corresponding to each sub-operation in the case of serial execution.

[0045] 103. Obtain the resource call time of the sub-operation, and determine the estimated global execution time of the sub-operation based on the resource call time, average execution time, and average waiting time of the sub-operation.

[0046] The estimated global execution time for a sub-operation refers to the estimated time required from the start of the sub-operation's execution to the execution of the critical operation, under parallel execution conditions. Specifically, when a sub-operation is executed in parallel with other sub-operations, the execution time of the sub-operation does not consume the execution time of the main chain. Furthermore, regardless of whether the sub-operation succeeds or fails, the execution result of the sub-operation must be queried before the execution of the critical step. Therefore, in both the successful and failed sub-operation scenarios, the overall estimated time required from the sub-operation's execution to the critical operation is the longer of the sub-operation's average waiting time or average execution time.

[0047] In this embodiment, when sub-operations are executed in parallel, a certain amount of resource call time is required. This time is usually short, around a few milliseconds. Therefore, when the average execution time of a sub-operation is less than or equal to the average waiting time, the estimated global execution time of the sub-operation can be obtained by summing the resource call time and the average waiting time of the sub-operation. When the average execution time of a sub-operation is greater than the average waiting time, the estimated global execution time of the sub-operation can also be obtained by summing the resource call time and the average execution time of the sub-operation. This embodiment estimates the overall execution time of the interface corresponding to each sub-operation under parallel execution by calculating the estimated global execution time of each sub-operation.

[0048] 104. In response to the difference between the current global execution time and the estimated global execution time of the sub-operation being greater than a preset value, the sub-operation is processed asynchronously in parallel to obtain the optimized target path.

[0049] Specifically, when the current global execution time of a sub-operation is greater than the estimated global execution time, it means that the interface corresponding to the sub-operation requires a longer execution time in serial execution compared to parallel execution. In this case, the sub-operation can be processed asynchronously in parallel, that is, the interface corresponding to the sub-operation is set to a parallel execution mode (it should be noted that multiple interfaces corresponding to the same sub-operation are executed serially, and the multiple interfaces corresponding to the asynchronously parallelized sub-operation are executed in parallel with the interfaces of other sub-operations in the target link). The execution result of the sub-operation is read before the execution of the critical steps, thereby optimizing the target link and reducing the overall execution time of the target link. In this embodiment, during the optimization of the target link, asynchronous parallel processing can be performed on only one sub-operation at a time, or multiple sub-operations can be processed asynchronously in parallel simultaneously. This embodiment does not make specific limitations here. In addition, the preset value in this step can be a natural number greater than or equal to zero. The specific value can be set according to the intensity of interface performance optimization. This embodiment does not make specific limitations.

[0050] The link optimization method provided in this embodiment first obtains parameters such as the average execution time, failure probability, and average waiting time from the completion of each sub-operation to the start of the critical operation in the target link. Then, based on the above parameters, it calculates the current global execution time and the estimated global execution time for each sub-operation. When the current global execution time of a sub-operation is greater than the estimated global execution time, the sub-operation is processed asynchronously in parallel to obtain the optimized target link. This method, by calculating the current global execution time of each sub-operation before asynchronous optimization and the estimated global execution time after asynchronous optimization, and then subtracting the two global execution times to filter sub-operations to be optimized, can effectively assess the necessity of asynchronous optimization for each sub-operation. This improves the targeting and accuracy of link optimization and enhances the efficiency of link execution. Furthermore, this method avoids consuming a large amount of computing resources during link execution, further improving the overall execution efficiency of the link.

[0051] Furthermore, as a refinement and extension of the specific implementation of the above embodiments, and to fully illustrate the implementation process of this embodiment, a link optimization method is provided, such as... Figure 2 As shown, the method includes the following steps:

[0052] 201. According to the operation process of the target link, the target link is divided into multiple sub-operations, and at least one key operation is identified among the multiple sub-operations.

[0053] In this context, the target link refers to a link in which all interfaces are executed serially. A sub-operation is a code block within the target link that implements a specific function. Each sub-operation corresponds to one or more interfaces, which are called sequentially. After the call, if the corresponding result is returned, the sub-operation is considered successful; otherwise, it is considered to have failed. Furthermore, a critical operation refers to a sub-operation within the target link that updates data in the database. Generally, there is one critical operation, although there can be multiple critical operations.

[0054] For example, in an order creation scenario, the target process can be the order creation process itself. Sub-operations within this process can include at least one of the following: sensitive image verification, sensitive word verification, user risk control verification, order placement, and order success message broadcast. The key step in this process is the order placement operation. In this scenario, when a user initiates an order creation request, the server sequentially calls the corresponding interface to perform various information verification operations related to order creation, including sensitive image verification, sensitive word verification, user risk control verification, etc. When all verification operations succeed, the order placement and notification operations are executed to achieve the order creation function. If one or more verification operations fail, the order placement operation is not executed, and the order creation fails, returning a notification message to the user.

[0055] In this embodiment, the target link can also be other types of links, such as order modification links and order cancellation links. In addition, the number, type and splitting method of sub-operations in the target link can also be set according to the actual situation. This embodiment does not make specific limitations here.

[0056] 202. Obtain the average execution time and failure probability of each sub-operation in the target link, as well as the average waiting time from the completion of each sub-operation to the start of the execution of the critical operation in the target link.

[0057] Specifically, by collecting execution data for the same link within a preset time period in the application, the average execution time and failure probability of each sub-operation in the target link can be calculated, as well as the average waiting time from the completion of each sub-operation to the start of the critical operation in the target link. It is understandable that to improve the accuracy of the calculation of average execution time, average waiting time, and failure probability, the data collection period and scope can be appropriately extended; that is, the collected data can cover a large amount of link execution data for different types of users over a relatively long period. Furthermore, the average execution time can be obtained by averaging the total execution time of each sub-operation in the target link, by taking the median execution time of each sub-operation in the target link, or by calculating it statistically. The average waiting time is calculated similarly. This embodiment does not impose specific limitations on the specific calculation method for the time parameters; it can be selected according to the actual situation.

[0058] 203. For each sub-operation, determine the current global execution time corresponding to the sub-operation based on the sub-operation's average execution time, execution failure probability, and average waiting time.

[0059] Here, the current global execution time corresponding to a sub-operation refers to the estimated time required from the start of the sub-operation's execution to the execution of the critical operation, under the condition of serial execution. Specifically, for each sub-operation in the target chain, the current global execution time when the sub-operation fails can be obtained first by multiplying the average execution time and the probability of execution failure of the sub-operation. Then, based on the probability of execution failure of the sub-operation, the probability of execution success of the sub-operation is calculated. Subsequently, the current global execution time when the sub-operation succeeds is obtained by multiplying the sum of the average execution time and the average waiting time of the sub-operation with the probability of execution success of the sub-operation. Finally, the current global execution time corresponding to the sub-operation is obtained by summing the current global execution time when the sub-operation fails and the current global execution time when the sub-operation succeeds. In this embodiment, the calculation method for the current global execution time corresponding to the sub-operation can be as shown in Formula 1:

[0060] T1 = CFP*CT + (100-CFP)*(CT+BT) (Formula 1)

[0061] Where T1 is the current global execution time corresponding to the sub-operation, CFP (child step failprobability) is the probability of the sub-operation failing. For example, when the probability of a sub-operation failing is 10%, the value of the failure probability corresponding to the sub-operation is 10, and the value of the success probability corresponding to the sub-operation is 100-10=90. CT (child step time use) is the average execution time of the sub-operation, and BT (to back ks time use) is the average waiting time from the completion of the sub-operation to the start of the critical operation in the target link.

[0062] 204. Obtain the resource call time of the sub-operation, and determine the estimated global execution time of the sub-operation based on the resource call time, average execution time, and average waiting time of the sub-operation.

[0063] The estimated global execution time for a sub-operation refers to the estimated time required from the start of the sub-operation's execution to the execution of the critical operation, under parallel execution conditions. Specifically, for each sub-operation in the target chain, when the average execution time of a sub-operation is less than or equal to the average waiting time, the estimated global execution time can be obtained by multiplying the sum of the sub-operation's resource call time and average waiting time by a preset probability coefficient; when the average execution time of a sub-operation is greater than the average waiting time, the estimated global execution time can be obtained by multiplying the sum of the sub-operation's resource call time and average execution time by a preset probability coefficient. In this embodiment, the calculation method for the estimated global execution time of a sub-operation can be as shown in Formula 2:

[0064] T2={100*(CAT+BT)(CT≤BT);

[0065] 100*(CAT+CT)(CT>BT)}(Formula 2)

[0066] Where T2 is the estimated global execution time corresponding to the sub-operation.

[0067] CAT (child step asynchronous time use) is the resource call time of the child operation, BT (to backks time use) is the average waiting time from the completion of the child operation to the start of the critical operation in the target link, CT (child step time use) is the average execution time of the child operation, and 100 is the preset probability coefficient. This probability coefficient can also be changed to other values ​​according to the actual situation. The purpose of setting the probability coefficient is to make the estimated global execution time corresponding to the child operation the same as the current global execution time corresponding to the child operation, so as to facilitate the calculation.

[0068] 205. In response to the difference between the current global execution time and the estimated global execution time of the sub-operation being greater than a preset value, the sub-operation is processed asynchronously in parallel to obtain the optimized target path.

[0069] Specifically, when the current global execution time of a sub-operation is greater than the estimated global execution time (i.e., when the probability gain of the sub-operation is positive), it means that the interface corresponding to the sub-operation requires a longer execution time in serial execution compared to parallel execution. In this case, the sub-operation can be processed asynchronously in parallel, that is, the interface corresponding to the sub-operation is set to a parallel execution mode (it should be noted that multiple interfaces corresponding to the same sub-operation are executed serially, and at the same time, multiple interfaces corresponding to the asynchronously parallelized sub-operation are executed in parallel with the interfaces of other sub-operations in the target link). The query results of the interface corresponding to the sub-operation are stored in a cache space, and then the query results in the cache space are queried before the execution of critical operations, thereby optimizing the target link and reducing the overall execution time of the target link. In this embodiment, during the optimization of the target link, asynchronous parallel processing can be performed on only one sub-operation at a time, or multiple sub-operations can be processed asynchronously in parallel simultaneously. This embodiment does not make specific limitations here. In addition, the preset value in this step can be a natural number greater than or equal to zero. The specific value can be set according to the intensity of interface performance optimization. This embodiment does not make specific limitations.

[0070] In other embodiments, besides asynchronously parallelizing sub-operations with positive probability gains, other methods can be used to optimize the performance of sub-operations. For example, I / O and remote calls within the loop body of the code block corresponding to the sub-operation can be changed to deduplicated execution outside the loop to avoid repeated calls. Alternatively, slow database queries in the code block can be optimized by improving SQL query statements and indexes. Sending message notifications and adding / deleting member points can be changed to sending messages to a queue and then consuming them asynchronously, i.e., using Q-message decoupling to ensure data consistency in a shorter time. This embodiment will not list all the performance optimization methods for sub-operations. During interface performance optimization, one or more of the above optimization methods can be selected according to the actual situation. It is important to note that during the performance optimization of the sub-operation interface, changes to the logic and semantics of the original code should be avoided as much as possible. This needs to be repeatedly tested during code self-testing and formal testing to ensure that performance optimization does not introduce explicit or implicit online problems.

[0071] 206. Determine whether the response time of the optimized target link is greater than the preset target response time.

[0072] 207. If so, then the average execution time and failure probability of each sub-operation in the target link, as well as the average waiting time from the completion of each sub-operation to the start of the execution of the critical operation in the target link, are corrected.

[0073] 208. Based on the corrected average execution time and failure probability of each sub-operation, and the average waiting time from the completion of each sub-operation to the start of the execution of the critical operation in the target link, recalculate the current global execution time and the estimated global execution time for each sub-operation.

[0074] 209. In response to the difference between the current global execution time and the estimated global execution time of the sub-operation after recalculation being greater than a preset value, the interface corresponding to the sub-operation is processed asynchronously in parallel to obtain the re-optimized target link.

[0075] Specifically, for each sub-operation in the target chain, according to the calculation methods in steps 203 to 205, the difference between the current global execution time and the estimated global execution time for each sub-operation can be calculated to see if it is greater than a preset value. If it is greater than the preset value, the sub-operation is considered to have a certain positive benefit, meaning it is necessary to perform asynchronous and cache-based performance optimization on the sub-operation. After evaluating the probabilistic benefits of all sub-operations in the target chain in this way, the optimized target chain can be verified in the actual business system. If the optimized target chain does not meet expectations, it is likely that there are problems with the initial probability estimation and time statistics, requiring parameter correction. Then, based on the corrected parameters, it is possible to recalculate whether a certain sub-operation needs asynchronous / caching optimization. By continuously repeating this step, the performance optimization benefits of the target chain interface can be maximized.

[0076] The core of the technical solution provided in this embodiment lies in making various time and probability estimates for each step in the target link based on the current online context environment, and then making an overall link optimization plan based on this. In this embodiment, when the online context environment changes, such as when the time consumption of a certain resource that a certain sub-operation depends on increases, it may affect the previous judgment on whether optimization is needed for this sub-operation, thereby affecting the overall performance optimization plan. In practical application scenarios, after the target link is broken down into multiple sub-operations, an optimization plan can be developed for each sub-operation. Then, through process orchestration, the optimized sub-operations and the unoptimized sub-operations are assembled together. In this way, when the external context environment changes, only the process orchestration part needs to be modified to adapt well to the changes.

[0077] Understandably, existing interface performance optimization solutions typically involve specific problem-based analysis, meaning targeted optimization of code blocks affecting performance within the target pipeline. However, such optimization solutions are usually not replicable. In contrast, this embodiment breaks down the target pipeline into multiple sub-operations and, based on a probability-benefit formula, sequentially determines whether each sub-operation requires asynchronous parallel processing and other performance optimizations. This makes the interface performance optimization of the target pipeline highly targeted, effectively improving pipeline execution performance and shortening pipeline execution time.

[0078] The link optimization method provided in this embodiment breaks down the target link into multiple sub-operations, calculates the current global execution time of each sub-operation before asynchronous optimization and the estimated global execution time after asynchronous optimization, and filters out the sub-operations to be optimized by subtracting the two global execution times. This effectively assesses the necessity of asynchronous optimization for each sub-operation, thereby improving the targeting and accuracy of link optimization and increasing the efficiency of link execution. Furthermore, the method evaluates the interface performance of the optimized target link, and if the interface performance evaluation results are unsatisfactory, readjusts the time parameters and execution failure probability parameters of the sub-operations. Based on the corrected parameters, it calculates the current global execution time and estimated global execution time of the corresponding sub-operation, and then re-filters out the sub-operations to be optimized based on the calculation results. This allows for continuous optimization of the link, resulting in a better execution mode for the target link and substantial optimization of its execution time.

[0079] Furthermore, as Figure 1 , Figure 2 The specific implementation of the method shown in this embodiment provides a link optimization device, such as... Figure 3 As shown, the device includes: a parameter acquisition module 31, a data calculation module 32, and a link optimization module 33, wherein:

[0080] The parameter acquisition module 31 can be used to acquire the average execution time and execution failure probability of each sub-operation in the target link, as well as the average waiting time from the completion of each sub-operation to the start of the execution of the key operation in the target link;

[0081] The data calculation module 32 can be used to determine the current global execution time of each sub-operation based on its average execution time, execution failure probability, and average waiting time; obtain the resource call time of the sub-operation; and determine the estimated global execution time of the sub-operation based on its resource call time, average execution time, and average waiting time.

[0082] The link optimization module 33 can be used to asynchronously and parallelly process the sub-operation in response to the difference between the current global execution time and the estimated global execution time being greater than a preset value, so as to obtain the optimized target link.

[0083] In specific application scenarios, such as Figure 4 As shown, the device also includes a step splitting module 34, which can be used to split the target link into multiple sub-operations according to the operation flow of the target link, and determine at least one key operation in the multiple sub-operations, wherein each sub-operation corresponds to at least one interface, and the key operation is an operation to update data in the database.

[0084] In specific application scenarios, the data calculation module 32 can be used to obtain the current global execution time when the sub-operation fails, based on the product of the average execution time and the failure probability of the sub-operation; calculate the success probability of the sub-operation based on the failure probability of the sub-operation; obtain the current global execution time when the sub-operation succeeds, based on the product of the sum of the average execution time and the average waiting time of the sub-operation and the success probability of the sub-operation; and obtain the current global execution time corresponding to the sub-operation, based on the sum of the current global execution time when the sub-operation fails and the current global execution time when the sub-operation succeeds.

[0085] In specific application scenarios, the data calculation module 32 can also be used to obtain the estimated global execution time of the sub-operation when the average execution time of the sub-operation is less than or equal to the average waiting time, based on the product of the sum of the resource call time and the average waiting time of the sub-operation and a preset probability coefficient; and to obtain the estimated global execution time of the sub-operation when the average execution time of the sub-operation is greater than the average waiting time, based on the product of the sum of the resource call time and the average execution time of the sub-operation and a preset probability coefficient.

[0086] In specific application scenarios, the link optimization module 33 can be used to set the interface corresponding to the sub-operation to a parallel execution mode; store the query results of the interface corresponding to the sub-operation in a cache space; and query the query results in the cache space before the execution of the key operation.

[0087] In specific application scenarios, such as Figure 4As shown, the device further includes a parameter correction module 35, which can be used to determine whether the response time of the optimized target link is greater than a preset target response time; if so, it corrects the average execution time and execution failure probability of each sub-operation in the target link, as well as the average waiting time from the completion of each sub-operation to the start of the execution of the critical operation in the target link; the data calculation module 32 can also be used to recalculate the current global execution time and estimated global execution time corresponding to each sub-operation based on the corrected average execution time and execution failure probability of each sub-operation, as well as the average waiting time from the completion of each sub-operation to the start of the execution of the critical operation in the target link; the link optimization module 33 can also be used to perform asynchronous parallel processing on the interface corresponding to the sub-operation in response to the difference between the current global execution time and the estimated global execution time of the recalculated sub-operation being greater than the preset value, to obtain the re-optimized target link.

[0088] In a specific application scenario, the target link is the order creation link. The sub-operations in the target link include at least one of the following operations: sensitive image verification operation, sensitive word verification operation, user risk control verification operation, order placement operation, and order creation success message broadcast operation. The key step in the target link is the order placement operation.

[0089] It should be noted that other corresponding descriptions of the functional units involved in the link optimization device provided in this embodiment can be found in [reference needed]. Figure 1 , Figure 2 The corresponding description in [the document] will not be repeated here.

[0090] Based on the above, Figure 1 , Figure 2 Accordingly, this embodiment also provides a storage medium storing a computer program that, when executed by a processor, implements the above-described method. Figure 1 , Figure 2 The link optimization method shown.

[0091] Based on this understanding, the technical solution of this application can be embodied in the form of a software product. The software product to be identified can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, or portable hard drive), including several instructions to cause a computer device (such as a personal computer, server, or network device) to execute the methods described in the various implementation scenarios of this application.

[0092] Based on the above, Figure 1 , Figure 2 The method shown, and Figure 3 and Figure 4To achieve the above objectives, the illustrated link optimization device embodiment also provides a link optimization computer device, specifically a personal computer, server, smartphone, tablet computer, smartwatch, or other network device. This computer device includes a storage medium and a processor; the storage medium stores computer programs and an operating system; the processor executes the computer programs to implement the above-described... Figure 1 , Figure 2 The method shown.

[0093] Optionally, the computer device may also include internal memory, a communication interface, a network interface, a camera, radio frequency (RF) circuitry, sensors, audio circuitry, a Wi-Fi module, a display screen, and input devices such as a keyboard. The communication interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).

[0094] Those skilled in the art will understand that the computer device structure for recognizing operational actions provided in this embodiment does not constitute a limitation on the computer device, and may include more or fewer components, or combine certain components, or have different component arrangements.

[0095] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the aforementioned computer hardware and the software resources to be identified, supporting the operation of information processing programs and other software and / or programs to be identified. The network communication module is used to enable communication between the various components within the storage medium, as well as communication with other hardware and software in the information processing computer device.

[0096] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware platforms, or it can be implemented by hardware. By applying the technical solution of this application, firstly, the average execution time and execution failure probability of each sub-operation in the target link are obtained, as well as the average waiting time from the completion of each sub-operation to the start of the execution of the key operation in the target link. Then, for each sub-operation, the current global execution time corresponding to the sub-operation is determined according to the average execution time, execution failure probability, and average waiting time of the sub-operation. Furthermore, the resource call time of the sub-operation is obtained, and the estimated global execution time corresponding to the sub-operation is determined according to the resource call time, average execution time, and average waiting time of the sub-operation. Finally, in response to the difference between the current global execution time and the estimated global execution time of the sub-operation being greater than a preset value, the sub-operation is asynchronously parallelized to obtain the optimized target link. Compared with the prior art, the above method can effectively judge the necessity of asynchronous optimization of each sub-operation, thereby improving the pertinence and accuracy of link optimization, and thus improving the efficiency of link execution. At the same time, the above method avoids consuming a large amount of computing resources during link execution, further improving the overall execution efficiency of the link.

[0097] Those skilled in the art will understand that the accompanying drawings are merely schematic diagrams of a preferred embodiment, and the modules or processes shown in the drawings are not necessarily essential for implementing this application. Those skilled in the art will understand that the modules in the apparatus of the embodiment can be distributed within the apparatus of the embodiment as described, or can be modified to be located in one or more apparatuses different from this embodiment. The modules of the above-described embodiment can be combined into one module, or further divided into multiple sub-modules.

[0098] The serial numbers in this application are for descriptive purposes only and do not represent the superiority or inferiority of any particular implementation scenario. The above disclosures are merely a few specific implementation scenarios of this application; however, this application is not limited thereto, and any variations conceived by those skilled in the art should fall within the protection scope of this application.

Claims

1. A method of link optimization, characterized by, The method includes: Obtain the average execution time and failure probability of each sub-operation in the target link, as well as the average waiting time from the completion of each sub-operation to the start of the execution of the key operation in the target link; For each sub-operation, the current global execution time corresponding to the sub-operation is determined based on the average execution time, execution failure probability and average waiting time of the sub-operation. The current global execution time is an estimated value of the time required from the start of the execution of the sub-operation to the execution of the critical operation when the interface corresponding to the sub-operation is executed serially. Obtain the resource call time of the sub-operation, and determine the estimated global execution time corresponding to the sub-operation based on the resource call time, average execution time, and average waiting time of the sub-operation. The estimated global execution time is the estimated value of the time required from the start of the execution of the sub-operation to the execution of the critical operation when the interface corresponding to the sub-operation is executed in parallel. In response to the difference between the current global execution time and the estimated global execution time corresponding to the sub-operation being greater than a preset value, the sub-operation is processed asynchronously in parallel to obtain the optimized target link.

2. The method of claim 1, wherein, Before obtaining the average execution time and execution failure probability of each sub-operation in the target link, the method further includes: According to the operation flow of the target link, the target link is divided into multiple sub-operations, and at least one key operation is identified in the multiple sub-operations. Each sub-operation corresponds to at least one interface, and the key operation is the operation of updating data in the database.

3. The method according to claim 1, characterized in that, The step of determining the current global execution time corresponding to the sub-operation based on the average execution time, execution failure probability, and average waiting time of the sub-operation includes: The current global execution time when the sub-operation fails is obtained by multiplying the average execution time and the failure probability of the sub-operation. Calculate the success probability of the sub-operation based on its failure probability; The current global execution time when the sub-operation is successfully executed is obtained by multiplying the sum of the average execution time and the average waiting time of the sub-operation with the probability of success of the sub-operation. The current global execution time of the sub-operation is obtained by summing the current global execution time when the sub-operation fails and the current global execution time when the sub-operation succeeds.

4. The method according to claim 1, characterized in that, The step of determining the estimated global execution time of a sub-operation based on its resource call time, average execution time, and average waiting time includes: When the average execution time of the sub-operation is less than or equal to the average waiting time, the estimated global execution time of the sub-operation is obtained by multiplying the sum of the resource call time and the average waiting time of the sub-operation with a preset probability coefficient. When the average execution time of the sub-operation is greater than the average waiting time, the estimated global execution time of the sub-operation is obtained by multiplying the sum of the resource call time and the average execution time of the sub-operation by a preset probability coefficient.

5. The method according to claim 1, characterized in that, The asynchronous parallel processing of the sub-operations includes: Configure the interface corresponding to the sub-operation to execute in parallel mode; The query results of the interface corresponding to the sub-operation are stored in the cache space, and the query results in the cache space are queried before the key operation is executed.

6. The method according to claim 1, characterized in that, The method further includes: Determine whether the response time of the optimized target link is greater than the preset target response time; If so, then the average execution time and failure probability of each sub-operation in the target link, as well as the average waiting time from the completion of each sub-operation to the start of the execution of the critical operation in the target link, are corrected. Based on the corrected average execution time and execution failure probability of each sub-operation, and the average waiting time from the completion of each sub-operation to the start of the execution of the critical operation in the target link, the current global execution time and the estimated global execution time corresponding to each sub-operation are recalculated. In response to the difference between the current global execution time and the estimated global execution time corresponding to the recalculated sub-operation being greater than the preset value, the interface corresponding to the sub-operation is processed asynchronously in parallel to obtain the re-optimized target link.

7. The method according to any one of claims 1-6, characterized in that, The target link is the order creation link. The sub-operations in the target link include at least one of the following operations: sensitive image verification operation, sensitive word verification operation, user risk control verification operation, order placement operation, and order creation success message broadcast operation. The key step in the target link is the order placement operation.

8. A link optimization device, characterized in that, The device includes: The parameter acquisition module is used to acquire the average execution time and execution failure probability of each sub-operation in the target link, as well as the average waiting time from the completion of each sub-operation to the start of the execution of the key operation in the target link. The data calculation module is used to determine the current global execution time of each sub-operation based on its average execution time, execution failure probability, and average waiting time. The current global execution time is an estimated value representing the time required from the start of the sub-operation's execution to the execution of the critical operation when the interface corresponding to the sub-operation is executed serially. The module also acquires the resource call time of the sub-operation and determines the estimated global execution time based on its resource call time, average execution time, and average waiting time. The estimated global execution time is an estimated value representing the time required from the start of the sub-operation's execution to the execution of the critical operation when the interface corresponding to the sub-operation is executed in parallel. The link optimization module is used to perform asynchronous parallel processing on the sub-operation in response to the difference between the current global execution time and the estimated global execution time being greater than a preset value, so as to obtain the optimized target link.

9. The apparatus according to claim 8, characterized in that, The device further includes a step-breaking module, wherein... The step-splitting module is used to split the target link into multiple sub-operations according to the operation flow of the target link, and to identify at least one key operation among the multiple sub-operations. Each sub-operation corresponds to at least one interface, and the key operation is an operation to update data in the database.

10. The apparatus according to claim 8, characterized in that, The data calculation module is specifically used to obtain the current global execution time when the sub-operation fails, based on the product of the average execution time and the probability of execution failure of the sub-operation. Calculate the success probability of the sub-operation based on its failure probability; The current global execution time when the sub-operation is successfully executed is obtained by multiplying the sum of the average execution time and the average waiting time of the sub-operation with the probability of success of the sub-operation. The current global execution time of the sub-operation is obtained by summing the current global execution time when the sub-operation fails and the current global execution time when the sub-operation succeeds.

11. The apparatus according to claim 8, characterized in that, The data calculation module is further configured to, when the average execution time of the sub-operation is less than or equal to the average waiting time, obtain the estimated global execution time corresponding to the sub-operation based on the product of the sum of the resource call time and the average waiting time of the sub-operation and a preset probability coefficient. When the average execution time of the sub-operation is greater than the average waiting time, the estimated global execution time of the sub-operation is obtained by multiplying the sum of the resource call time and the average execution time of the sub-operation by a preset probability coefficient.

12. The apparatus according to claim 8, characterized in that, The link optimization module is specifically used to set the interface corresponding to the sub-operation to a parallel execution mode; store the query results of the interface corresponding to the sub-operation in a cache space; and query the query results in the cache space before the execution of the key operation.

13. The apparatus according to claim 8, characterized in that, The device further includes a parameter correction module, wherein... The parameter correction module is used to determine whether the response time of the optimized target link is greater than the preset target response time. If so, then the average execution time and failure probability of each sub-operation in the target link, as well as the average waiting time from the completion of each sub-operation to the start of the execution of the critical operation in the target link, are corrected. Based on the corrected average execution time and execution failure probability of each sub-operation, and the average waiting time from the completion of each sub-operation to the start of the execution of the critical operation in the target link, the current global execution time and the estimated global execution time corresponding to each sub-operation are recalculated. In response to the difference between the current global execution time and the estimated global execution time corresponding to the recalculated sub-operation being greater than the preset value, the interface corresponding to the sub-operation is processed asynchronously in parallel to obtain the re-optimized target link.

14. The apparatus according to any one of claims 8-13, characterized in that, The target link is the order creation link. The sub-operations in the target link include at least one of the following operations: sensitive image verification operation, sensitive word verification operation, user risk control verification operation, order placement operation, and order creation success message broadcast operation. The key step in the target link is the order placement operation.

15. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.

16. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Data processing method and device, equipment and storage medium

    CN114880120A