CN116390130A - Link optimization method, device, storage medium and computer equipment - Google Patents

Link optimization method, device, storage medium and computer equipment Download PDF

Info

Publication number
CN116390130A
CN116390130A CN202310403851.XA CN202310403851A CN116390130A CN 116390130 A CN116390130 A CN 116390130A CN 202310403851 A CN202310403851 A CN 202310403851A CN 116390130 A CN116390130 A CN 116390130A
Authority
CN
China
Prior art keywords
sub
execution
time
execution time
average
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310403851.XA
Other languages
Chinese (zh)
Inventor
冉桂生
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Lazas Network Technology Shanghai Co Ltd
Original Assignee
Lazas Network Technology Shanghai Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Lazas Network Technology Shanghai Co Ltd filed Critical Lazas Network Technology Shanghai Co Ltd
Priority to CN202310403851.XA priority Critical patent/CN116390130A/en
Publication of CN116390130A publication Critical patent/CN116390130A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W24/00Supervisory, monitoring or testing arrangements
    • H04W24/02Arrangements for optimising operational condition
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Multi Processors (AREA)
  • Elevator Control (AREA)
  • Exchange Systems With Centralized Control (AREA)

Abstract

The invention discloses a link optimization method, a device, a storage medium and computer equipment. The method comprises the following steps: acquiring average execution time and execution failure probability of each sub-operation in a target link and average waiting time from completion of execution of each sub-operation to start of 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; and responding to the difference between the current global execution time and the estimated global execution time corresponding to the sub-operation is larger than a preset value, and carrying out asynchronous parallel processing on the sub-operation to obtain an optimized target link. The method can effectively improve the pertinence and the accuracy of link optimization, thereby improving the link execution efficiency.

Description

Link optimization method, device, storage medium and computer equipment
Technical Field
The present invention relates to the field of internet technologies, and in particular, to a link optimization method, a device, a storage medium, and a computer apparatus.
Background
With the continuous development of internet technology, the user population of the internet is getting larger and larger, the service requests of users are getting more and more, and the server usually calls a plurality of interfaces and forms a link in the process of executing the service requests of users. Generally, according to the operation flow of the link, the link may be split into a plurality of steps, where each sub-operation corresponds to at least one interface.
In the prior art, in order to improve the execution efficiency of a link and shorten the execution time of the link, interfaces corresponding to each operation step in the link are executed in a parallel manner, that is, interfaces corresponding to a plurality of operation steps are called simultaneously in a parallel execution manner, so that the execution time of the whole link is shortened.
However, this operation mode generally needs to wait for all the parallel steps to be executed and then can query the execution results of the steps, and for some steps with a high execution failure rate, the serial execution mode is adopted to end the execution of the link in advance, so as to increase the speed of executing the link. Therefore, after parallel processing is performed on each step in the link, the performance of the interface is sometimes not substantially improved, but a large amount of computing resources are occupied in the link execution process, so that the overall execution efficiency of the link is reduced.
Disclosure of Invention
In view of this, the present application provides a link optimization method, apparatus, storage medium, and computer device, which mainly aims to solve the technical problem that the overall execution efficiency of a link is low because more computing resources are occupied because the interface performance is not substantially improved after the link optimization.
According to a first aspect of the present invention, there is provided a link optimization method comprising:
acquiring average execution time and execution failure probability of each sub-operation in a target link and average waiting time from completion of execution of each sub-operation to start of 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;
and responding to the difference between the current global execution time corresponding to the sub-operation and the estimated global execution time is larger than a preset value, and carrying out asynchronous parallel processing on the sub-operation to obtain an optimized target link.
Optionally, before the obtaining the average execution time and the execution failure probability of each sub-operation in the target link, the method further includes: according to the operation flow of the target link, splitting the target link into a plurality of sub-operations, and determining at least one key operation in the plurality of sub-operations, wherein each sub-operation corresponds to at least one interface, and the key operation is an operation for updating data in a database.
Optionally, the 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 includes: obtaining the current global execution time when the sub-operation fails to be executed according to the product of the average execution time of the sub-operation and the execution failure probability; calculating the execution success probability of the sub-operation according to the execution failure probability of the sub-operation; obtaining the current global execution time when the sub-operation is successfully executed according to the product of the average execution time of the sub-operation and the average waiting time and the execution success probability of the sub-operation; and obtaining the current global execution time corresponding to the sub-operation according to the sum of the current global execution time when the sub-operation fails to be executed and the current global execution time when the sub-operation is successfully executed.
Optionally, the 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 includes: when the average execution time of the sub-operation is smaller than or equal to the average waiting time, obtaining the estimated global execution time corresponding to the sub-operation according to the product of the sum of the resource calling 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 longer than the average waiting time, obtaining the estimated global execution time corresponding to the sub-operation according to the product of the sum of the resource calling time and the average execution time of the sub-operation and a preset probability coefficient.
Optionally, the asynchronous parallel processing of the sub-operations includes: setting the interfaces corresponding to the sub-operations as parallel execution modes; and storing the query results of the interfaces corresponding to the sub-operations in a cache space, and querying the query results in the cache space before the key operation is executed.
Optionally, the method further comprises: judging whether the response time of the optimized target link is longer than the preset target response time; if yes, 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 the execution of each sub-operation to the start of the execution of a key operation in the target link; recalculating the current global execution time and the estimated global execution time corresponding to each sub-operation based on the corrected average execution time and execution failure probability of each sub-operation and the average waiting time from the completion of the execution of each sub-operation to the start of the execution of the key operation in the target link; and responding to the difference between the current global execution time corresponding to the sub-operation after recalculation and the estimated global execution time is larger than the preset value, and carrying out asynchronous parallel processing on the interface corresponding to the sub-operation to obtain a target link after re-optimization.
Optionally, the target link creates a link for the order, the sub-operations in the target link include at least one operation of a sensitive picture checking operation, a sensitive word checking operation, a user wind control checking operation, a ticket dropping operation and a ticket success message broadcasting operation, and the key step in the target link is the ticket dropping operation.
According to a second aspect of the present invention, there is provided a link optimizing apparatus comprising:
the parameter acquisition module is used for 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;
the data calculation module is used for determining the current global execution time corresponding to each 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;
and the link optimization module is used for carrying out asynchronous parallel processing on the sub-operation to obtain an optimized target link in response to the difference between the current global execution time corresponding to the sub-operation and the estimated global execution time being larger than a preset value.
Optionally, the device further includes a step splitting module, where the step splitting module is configured to split the target link into a plurality of sub-operations according to an operation flow of the target link, and determine at least one key operation in the plurality of sub-operations, where each sub-operation corresponds to at least one interface, and the key operation is an operation for updating data in a database.
Optionally, the data calculation module is specifically configured to obtain, according to a product of the average execution time of the sub-operation and the execution failure probability, a current global execution time when the sub-operation fails to execute; calculating the execution success probability of the sub-operation according to the execution failure probability of the sub-operation; obtaining the current global execution time when the sub-operation is successfully executed according to the product of the average execution time of the sub-operation and the average waiting time and the execution success probability of the sub-operation; and obtaining the current global execution time corresponding to the sub-operation according to the sum of the current global execution time when the sub-operation fails to be executed and the current global execution time when the sub-operation is successfully executed.
Optionally, the data calculation module is specifically further configured to obtain, when the average execution time of the sub-operation is less than or equal to the average waiting time, an estimated global execution time corresponding to the sub-operation according to a product of a sum of a resource calling 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 longer than the average waiting time, obtaining the estimated global execution time corresponding to the sub-operation according to the product of the sum of the resource calling time and the average execution time of the sub-operation and a preset probability coefficient.
Optionally, the link optimization module is specifically configured to set an interface corresponding to the sub-operation as a parallel execution mode; and storing the query results of the interfaces corresponding to the sub-operations in a cache space, and querying the query results in the cache space before the key operation is executed.
Optionally, the device further includes a parameter correction module, where the parameter correction module is configured to determine whether the response time of the optimized target link is greater than a preset target response time; if yes, 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 the execution of each sub-operation to the start of the execution of a key operation in the target link; recalculating the current global execution time and the estimated global execution time corresponding to each sub-operation based on the corrected average execution time and execution failure probability of each sub-operation and the average waiting time from the completion of the execution of each sub-operation to the start of the execution of the key operation in the target link; and responding to the difference between the current global execution time corresponding to the sub-operation after recalculation and the estimated global execution time is larger than the preset value, and carrying out asynchronous parallel processing on the interface corresponding to the sub-operation to obtain a target link after re-optimization.
Optionally, the target link creates a link for the order, the sub-operations in the target link include at least one operation of a sensitive picture checking operation, a sensitive word checking operation, a user wind control checking operation, a ticket dropping operation and a ticket success message broadcasting operation, and the key step in the target link is the ticket dropping operation.
According to a third aspect of the present invention, there is provided a storage medium having stored thereon a computer program which when executed by a processor implements the above-described link optimization method.
According to a fourth aspect of the present invention there is provided a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the above-described link optimisation method when executing the program.
According to the link optimization method, the device, the storage medium and the computer equipment, firstly, parameters such as average execution time, execution failure probability, average waiting time and the like of each sub-operation in a target link and execution completion of each sub-operation to the start of key operation in the target link are obtained, then, according to the parameters, the current global execution time and the estimated global execution time corresponding to each sub-operation are calculated respectively, and when the current global execution time corresponding to a certain sub-operation is greater than the estimated global execution time, asynchronous parallel processing is carried out on the sub-operation to obtain the optimized target link. According to the method, the current global execution time of each sub-operation before asynchronous optimization and the estimated global execution time after asynchronous optimization are calculated, and the difference is carried out on the two global execution times to screen the sub-operation to be optimized, so that the necessity of asynchronous optimization of each sub-operation can be effectively judged, the pertinence and the accuracy of link optimization are improved, the efficiency of link execution is improved, meanwhile, a large amount of calculation resources are prevented from being occupied in the link execution process, and the overall execution efficiency of the link is further improved.
The foregoing description is only an overview of the technical solutions of the present application, and may be implemented according to the content of the specification in order to make the technical means of the present application more clearly understood, and in order to make the above-mentioned and other objects, features and advantages of the present application more clearly understood, the following detailed description of the present application will be given.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiments of the invention and together with the description serve to explain the invention and do not constitute a limitation on the invention. In the drawings:
fig. 1 shows a flow diagram of a link optimization method according to an embodiment of the present invention;
fig. 2 is a schematic flow chart of another link optimization method according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a link optimization device according to an embodiment of the present invention;
fig. 4 shows a schematic structural diagram of another link optimization device according to an embodiment of the present invention.
Detailed Description
The invention will be described in detail hereinafter with reference to the drawings in conjunction with embodiments. It should be noted that, in the case of no conflict, the embodiments and features in the embodiments may be combined with each other.
In one embodiment, as shown in fig. 1, a link optimization method is provided, and the method is applied to a computer device such as a server, and the method includes the following steps:
101. 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 execution to the start of the key operation execution in the target link are obtained.
Specifically, after a user initiates a service request to a server through a terminal device, the server responds to the service request and calls interfaces corresponding to the service request, and the interfaces form an execution link in the execution process. In general, at the beginning of link construction, the interfaces in the link are all executed in a serial manner, that is, the server responds to the service request and calls each interface corresponding to the service request in turn, and realizes the corresponding function. Further, when a certain interface call fails, the link can interrupt execution and return a corresponding execution failure result to the terminal equipment; when all interfaces in the link are successfully invoked, the link returns a corresponding successful execution result to the terminal equipment. In this embodiment, the target link mainly refers to a link in which all interfaces in the link are executed in a serial manner.
In this embodiment, the target link may be split into a plurality of sub-operations according to the operation flow. For example, in the order creation link, each information verification step may be used as a sub-operation, each sub-operation corresponds to one or more interfaces, and functions corresponding to the sub-operations may be implemented by calling one or more interfaces corresponding to the sub-operations. Accordingly, a certain execution time is required for each sub-operation, and there is a certain probability of failure. The execution time of the sub-operation is usually different from tens to thousands of milliseconds, and many reasons exist for the failure of the sub-operation, for example, when the information uploaded by the user does not meet the verification requirement, the server has network failure or the interface-dependent resource fails, the sub-operation fails to execute. Further, among these sub-operations, when a certain sub-operation involves an operation of updating data in the database, it may be set as a critical step. For example, in order creation links, the drop operation may be set as a critical step, and after the step is successfully performed, an order data item may be added to the database, which represents that the order creation link is successfully performed.
In this embodiment, by collecting execution data for the same link in a preset time period in the application program, an average execution time and an execution failure probability of each sub-operation in the target link can be calculated, and an average waiting time from completion of execution of each sub-operation to start of execution of a key operation in the target link can be calculated. It will be appreciated that in order to increase the accuracy of the calculation of the average execution time, average latency and probability of execution failure, the length and breadth of data collection may be suitably extended, i.e. the collected data may cover a large amount of link execution data for different types of users over a longer period of time. In addition, the average execution time can be obtained by calculating the average of the sum of the execution time durations of each sub-operation in the target link, can also be obtained by taking the median of the execution time of each sub-operation in the target link, can also be obtained by calculating in a statistical manner, and can also be obtained by calculating in a similar manner the average waiting time. The specific calculation mode of the time parameter is not specifically limited in this embodiment, and can be selected according to actual situations.
102. 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.
The current global execution time corresponding to the sub-operation refers to an estimated value of time required from the start of execution of the sub-operation to the execution of the key operation under the condition that the interfaces corresponding to the sub-operation are executed in series. Specifically, for each sub-operation in the target link, an estimated value of the time required for the sub-operation to execute from the sub-operation to the critical operation in the case of the execution failure may be calculated from the product of the average execution time of the sub-operation and the execution failure probability. In this case, the time required from the execution of the sub-operation to the critical operation may be considered as the average execution time of the sub-operation, that is, the link is completed after the sub-operation fails to execute. Therefore, by multiplying the average execution time of the sub-operation by the execution failure probability of the sub-operation, the estimated value of the time required from the execution of the sub-operation to the critical operation in the case of the execution failure of the sub-operation can be obtained.
Further, in the case that the execution of the sub-operation is successful, the link does not terminate the execution, in which case the time required from the execution of the sub-operation to the critical operation can be considered as the sum of the average execution time and the average waiting time of the sub-operation, and therefore, by multiplying the sum of the average execution time and the average waiting time of the sub-operation by the execution success probability of the sub-operation, a predicted value of the time required from the execution of the sub-operation to the critical operation in the case that the execution of the sub-operation is successful can be obtained, wherein the execution success probability of the sub-operation can be calculated by the execution failure probability of the sub-operation. Further, after obtaining the estimated value of the time required from the execution of the sub-operation to the key operation under the two conditions of the execution success and the execution failure of the sub-operation, the two estimated values may be added to obtain the current global execution time corresponding to the sub-operation. The embodiment can estimate the total execution time of the interface corresponding to each sub-operation under the condition of serial execution by calculating the current global execution time corresponding to each sub-operation.
103. 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.
The estimated global execution time corresponding to the sub-operation refers to an estimated value of time required from the start of sub-operation execution to the execution of the key operation under the condition that the interfaces corresponding to the sub-operation are executed in parallel. Specifically, when the sub-operation is executed in parallel with other sub-operations, the execution time of the sub-operation does not occupy the execution time of the main link, and the execution result of the sub-operation needs to be queried before the execution of the critical step no matter whether the sub-operation is executed successfully or not, so that in both cases of the sub-operation is executed successfully and the sub-operation is executed failed, the overall predicted value of the time required from the sub-operation to the critical operation is the longer one of the average waiting time of the sub-operation or the average execution time of the sub-operation.
In this embodiment, when the sub-operations are executed in parallel, a certain resource calling time is required, and this time is usually shorter, in about several milliseconds, based on this, when the average execution time of the sub-operations is less than or equal to the average waiting time, the estimated global execution time corresponding to the sub-operations can be obtained by the sum of the resource calling time of the sub-operations and the average waiting time of the sub-operations; when the average execution time of the sub-operations is greater than the average waiting time, the estimated global execution time corresponding to the sub-operations can be obtained by the sum of the resource calling time of the sub-operations and the average execution time of the sub-operations. According to the embodiment, the estimated global execution time corresponding to each sub-operation is calculated, so that the overall execution time of the interface corresponding to each sub-operation under the condition of parallel execution can be estimated.
104. And responding to the difference between the current global execution time and the estimated global execution time corresponding to the sub-operation is larger than a preset value, and carrying out asynchronous parallel processing on the sub-operation to obtain an optimized target link.
Specifically, when the current global execution time corresponding to the sub-operation is longer than the estimated global execution time, it represents that the execution time of the interface corresponding to the sub-operation needs to be longer than that of parallel execution under the condition of serial execution, at this time, asynchronous parallel processing can be performed on the sub-operation, that is, the interface corresponding to the sub-operation is set to be an execution mode of parallel processing (note that multiple interfaces corresponding to the same sub-operation are serial execution modes, and meanwhile, the multiple interfaces corresponding to the sub-operation after asynchronous parallel processing are parallel execution modes with interfaces of other sub-operations in the target link), and the execution result of the sub-operation is read before the execution of the key step, so that the optimization of the target link is realized, and the overall execution time of the target link is reduced. In this embodiment, in the process of optimizing the target link, only one sub-operation may be asynchronously and parallelly processed at a time, or a plurality of sub-operations may be asynchronously and parallelly processed at the same time, which is not specifically limited herein.
According to the link optimization method provided by the embodiment, firstly, parameters such as average execution time and execution failure probability of each sub-operation in a target link, average waiting time from completion of execution of each sub-operation to start of execution of a key operation in the target link and the like are obtained, then, according to the parameters, current global execution time and estimated global execution time corresponding to each sub-operation are calculated respectively, and when the current global execution time corresponding to a certain sub-operation is greater than the estimated global execution time, asynchronous parallel processing is carried out on the sub-operation to obtain an optimized target link. According to the method, the current global execution time of each sub-operation before asynchronous optimization and the estimated global execution time after asynchronous optimization are calculated, and the difference is carried out on the two global execution times to screen the sub-operation to be optimized, so that the necessity of asynchronous optimization of each sub-operation can be effectively judged, the pertinence and the accuracy of link optimization are improved, the efficiency of link execution is improved, meanwhile, a large amount of calculation resources are prevented from being occupied in the link execution process, and the overall execution efficiency of the link is further improved.
Further, as a refinement and extension of the specific implementation manner of the foregoing embodiment, in order to fully describe the implementation process of this embodiment, a link optimization method is provided, as shown in fig. 2, and the method includes the following steps:
201. And splitting the target link into a plurality of sub-operations according to the operation flow of the target link, and determining at least one key operation in the plurality of sub-operations.
The target link refers to a link in which all interfaces in the link are executed in a serial mode, the sub-operations refer to code blocks for realizing a certain specific function in the target link, each sub-operation corresponds to one or more interfaces, the interfaces are sequentially called in a serial mode, and after the calling is finished, if a corresponding result is returned, the sub-operation is considered to be successfully executed, otherwise, the sub-operation is considered to be failed to be executed. Further, the key operation refers to a sub-operation of updating data in the database in the target link, and generally, the number of key operations is one, and of course, the number of key operations may be multiple.
For example, in an order creation scenario, the target link may create a link for the order, and the sub-operations in the target link may include at least one of a sensitive picture check operation, a sensitive word check operation, a user wind check operation, a drop-out operation, and a creation success message broadcast operation, wherein the key step in the target link is a drop-out operation. In the scene, when a user initiates an order creation request, the server sequentially calls an interface corresponding to the order creation request, so that various information verification operations related to order creation are executed, including a sensitive picture verification operation, a sensitive word verification operation, a user wind control verification operation and the like, and when all the information verification operations are executed successfully, a drop-order operation and an information notification operation are executed to realize an order creation function; when one or more information verification operations fail to be executed, no order dropping operation is executed, and the order creation fails at this time, and notification information of the failure order creation is returned to the user.
In this embodiment, the target link may be another type of link, such as an order modification link and an order cancellation link, and the number, type and splitting manner of the sub-operations in the target link may be set according to the actual situation, which is not limited herein specifically.
202. 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 execution to the start of the key operation execution in the target link are obtained.
Specifically, by collecting execution data for the same link in a preset time period in the application program, the average execution time and execution failure probability of each sub-operation in the target link can be calculated, and the average waiting time from the completion of the execution of each sub-operation to the start of the execution of the key operation in the target link can be calculated. It will be appreciated that in order to increase the accuracy of the calculation of the average execution time, average latency and probability of execution failure, the length and breadth of data collection may be suitably extended, i.e. the collected data may cover a large amount of link execution data for different types of users over a longer period of time. In addition, the average execution time can be obtained by calculating the average of the sum of the execution time durations of each sub-operation in the target link, can also be obtained by taking the median of the execution time of each sub-operation in the target link, can also be obtained by calculating in a statistical manner, and can also be obtained by calculating in a similar manner the average waiting time. The specific calculation mode of the time parameter is not specifically limited in this embodiment, and can be selected according to actual situations.
203. 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.
The current global execution time corresponding to the sub-operation refers to an estimated value of time required from the start of execution of the sub-operation to the execution of the key operation under the condition that the interfaces corresponding to the sub-operation are executed in series. Specifically, for each sub-operation in the target link, the current global execution time when the sub-operation fails to execute can be obtained according to the product of the average execution time and the execution failure probability of the sub-operation, then the execution success probability of the sub-operation is calculated according to the execution failure probability of the sub-operation, and then the current global execution time when the sub-operation succeeds in executing is obtained according to the product of the sum of the average execution time and the average waiting time of the sub-operation and the execution success probability of the sub-operation, and finally the current global execution time corresponding to the sub-operation is obtained according to the sum of the current global execution time when the sub-operation fails to execute and the current global execution time when the sub-operation succeeds in executing. In this embodiment, the calculation method of the current global execution time corresponding to the sub-operation may be as shown in formula one:
T1=cfp+ct+ (100-CFP) ×ct+bt (equation one)
Wherein T1 is the current global execution time corresponding to the sub-operation, CFP (child step failprobability) is the execution failure probability of the sub-operation, for example, when the execution failure probability of a certain sub-operation is 10%, the value of the execution failure probability corresponding to the sub-operation is 10, and correspondingly, the value of the execution 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 execution of the sub-operation to the start of the execution of the key operation in the target link.
204. 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.
The estimated global execution time corresponding to the sub-operation refers to an estimated value of time required from the start of sub-operation execution to the execution of the key operation under the condition that the interfaces corresponding to the sub-operation are executed in parallel. Specifically, for each sub-operation in the target link, when the average execution time of a certain sub-operation is less than or equal to the average waiting time, the estimated global execution time corresponding to the sub-operation can be obtained according to the product of the sum of the resource calling time and the average waiting time of the sub-operation and a preset probability coefficient; when the average execution time of a certain sub-operation is longer than the average waiting time, the estimated global execution time corresponding to the sub-operation can be obtained according to the product of the sum of the resource calling time and the average execution time of the sub-operation and the preset probability coefficient. In this embodiment, the calculation method of the estimated global execution time corresponding to the sub-operation may be as shown in formula two:
T2={100*(CAT+BT)(CT≤BT);
100 (CAT+CT) (CT > BT) } (equation II)
Wherein T2 is the estimated global execution time corresponding to the sub-operation,
CAT (child step asynchronoustimeuse) is the resource calling time of the sub-operation, BT (to back ks time use) is the average waiting time from the completion of the sub-operation execution to the start of the key operation execution in the target link, CT (child step time use) is the average execution time of the sub-operation, 100 is a preset probability coefficient, the probability coefficient can be changed into other values according to the actual situation, and the purpose of setting the probability coefficient is to make the estimated global execution time corresponding to the sub-operation and the current global execution time corresponding to the sub-operation have the same order of magnitude, so that the operation is convenient.
205. And responding to the difference between the current global execution time and the estimated global execution time corresponding to the sub-operation is larger than a preset value, and carrying out asynchronous parallel processing on the sub-operation to obtain an optimized target link.
Specifically, when the current global execution time corresponding to the sub-operation is longer than the estimated global execution time (i.e., the probability gain of the sub-operation is positive), it means that the execution time of the interface corresponding to the sub-operation needs longer than that of parallel execution under the condition of serial execution, and at this time, asynchronous parallel processing can be performed on the sub-operation, that is, the interface corresponding to the sub-operation is set to be an execution mode of parallel processing (note that multiple interfaces corresponding to the same sub-operation are serial execution modes, and meanwhile, the interfaces corresponding to the sub-operation after asynchronous parallel processing and the interfaces of other sub-operations in the target link are parallel execution modes), and the query results of the interfaces corresponding to the sub-operation are stored in the cache space, and then the query results in the cache space are queried before the execution of the key operation, so as to implement optimization on the target link, thereby reducing the overall execution time of the target link. In this embodiment, in the process of optimizing the target link, only one sub-operation may be asynchronously and parallelly processed at a time, or a plurality of sub-operations may be asynchronously and parallelly processed at the same time, which is not specifically limited herein.
In other embodiments, in addition to asynchronous parallel processing of sub-operations with positive probability yields, performance optimization of sub-operations may be performed in other ways. For example, IO and remote call in a cyclic body in a code block corresponding to the sub-operation can be changed into batch execution after duplicate removal outside the cyclic body, so that repeated call initiation is avoided, or slow query of a database in the code block can be optimized, SQL query statement and index can be optimized, or member points can be notified, added and deleted by messaging can be changed into messaging to a queue and then asynchronously consumed, namely, final data consistency in a short time is ensured through Q message decoupling. The performance optimization processing modes of the sub-operations are not listed one by one, and in the process of optimizing the interface performance, one or more performance optimization modes of the optimization modes can be selected according to actual conditions. It should be noted that in the process of optimizing performance of the sub-operation interface, the logic and the semantic changes in the original code are avoided as much as possible, and repeated testing is required in the code self-testing and formal testing stages, so that explicit or implicit online problems caused by performance optimization are avoided.
206. Judging whether the response time of the optimized target link is longer than the preset target response time.
207. If yes, correcting the average execution time and the execution failure probability of each sub-operation in the target link and the average waiting time from the completion of the execution of each sub-operation to the start of the execution of the key operation in the target link.
208. And recalculating the current global execution time and the estimated global execution time corresponding to each sub-operation based on the corrected average execution time and execution failure probability of each sub-operation and the average waiting time from the completion of the execution of each sub-operation to the start of the execution of the key operation in the target link.
209. And responding to the difference between the current global execution time and the estimated global execution time corresponding to the sub-operation after recalculation is greater than a preset value, and carrying out asynchronous parallel processing on the interfaces corresponding to the sub-operation to obtain a target link after re-optimization.
Specifically, for each sub-operation in the target link, whether the difference between the current global execution time and the estimated global execution time corresponding to each sub-operation is greater than a preset value or not may be calculated according to the calculation manners from step 203 to step 205, if so, the sub-operation is considered to have a certain forward benefit, that is, asynchronous performance optimization and performance optimization based on buffering are necessary for the sub-operation, so that after probability benefit evaluation is sequentially performed for all sub-operations in the target link, the optimized target link may be verified in the actual service system. If the optimized target link does not reach the expectation, the probability estimation and time statistics at the early stage are likely to be problematic, parameter correction is needed, whether asynchronous/cache optimization is needed for a certain sub-operation can be recalculated based on the corrected parameters, and the steps are repeated continuously, so that the optimization benefit of the interface performance of the target link can be maximized.
The core of the technical scheme provided by the embodiment is to make various time and probability estimations for each step in the target link based on the current online context, and make an overall link optimization scheme based on the estimations. In this embodiment, when the context environment on the line changes, for example, when the time consumption of a certain resource on which a certain sub-operation depends increases, it is highly likely to influence whether the judgment of optimizing for the sub-operation is required or not, which is evaluated before, so that the overall performance optimization scheme is affected. In an actual application scene, after splitting a target link into a plurality of sub-operations, a set of optimization schemes can be made for each sub-operation, and then the optimized sub-operation and the sub-operation which are not optimized are assembled together through the flow, so that when the external context environment is changed, the change can be well adapted by only modifying the flow arrangement part.
It can be appreciated that the interface performance optimization scheme in the prior art is generally a specific problem-specific analysis, i.e. a targeted optimization is performed for the code blocks affecting the performance in the target link. However, such performance optimization schemes are generally not reproducible. In contrast, in this embodiment, by splitting the target link into a plurality of sub-operations and sequentially determining whether each sub-operation needs to perform asynchronous parallel processing and performance optimization processing in other aspects according to the probability yield formula, the optimization of the interface performance of the target link can be very targeted, so that the link execution performance is effectively improved, and the link execution time is shortened.
According to the link optimization method provided by the embodiment, the target link is split into the plurality of sub-operations, then the current global execution time of each sub-operation before asynchronous optimization and the estimated global execution time after asynchronous optimization are calculated, and the difference is carried out on the two global execution times to screen out the sub-operation to be optimized, so that the necessity of asynchronous optimization of each sub-operation can be effectively judged, the pertinence and the accuracy of link optimization are improved, and the efficiency of link execution is improved. In addition, the method carries out evaluation on the interface performance of the optimized target link, corrects the time parameter and the execution failure probability parameter of the sub-operation again under the condition that the interface performance evaluation result is not ideal, calculates the corresponding current global execution time and the estimated global execution time of the sub-operation based on the corrected parameters, and further screens out the sub-operation to be optimized again according to the calculation result, so that the link can be continuously optimized, and a better execution mode of the target link is obtained, and the execution time of the link is substantially optimized.
Further, as a specific implementation of the methods shown in fig. 1 and fig. 2, the present embodiment provides a link optimization apparatus, as shown in fig. 3, including: a parameter acquisition module 31, a data calculation module 32 and a link optimization module 33, wherein:
A parameter obtaining module 31, configured to obtain an average execution time and an execution failure probability of each sub-operation in a target link, and an average waiting time from completion of execution of each sub-operation to start of execution of a key operation in the target link;
the data calculation module 32 is configured to determine, for each of the sub-operations, a current global execution time corresponding to the sub-operation according to an average execution time, an execution failure probability, and an 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;
and the link optimization module 33 is configured to perform asynchronous parallel processing on the sub-operations to obtain an optimized target link in response to a difference between the current global execution time corresponding to the sub-operations and the estimated global execution time being greater than a preset value.
In a specific application scenario, as shown in fig. 4, the apparatus further includes a step splitting module 34, where the step splitting module 34 is configured to split the target link into a plurality of sub-operations according to an operation flow of the target link, and determine at least one key operation in the plurality of sub-operations, where each sub-operation corresponds to at least one interface, and the key operation is an operation for updating data in a database.
In a specific application scenario, the data calculation module 32 may be specifically configured to obtain, according to a product of the average execution time of the sub-operation and the execution failure probability, a current global execution time when the sub-operation fails to execute; calculating the execution success probability of the sub-operation according to the execution failure probability of the sub-operation; obtaining the current global execution time when the sub-operation is successfully executed according to the product of the average execution time of the sub-operation and the average waiting time and the execution success probability of the sub-operation; and obtaining the current global execution time corresponding to the sub-operation according to the sum of the current global execution time when the sub-operation fails to be executed and the current global execution time when the sub-operation is successfully executed.
In a specific application scenario, the data calculation module 32 may be specifically further configured to obtain, when the average execution time of the sub-operation is less than or equal to the average waiting time, an estimated global execution time corresponding to the sub-operation according to a product of a sum of the resource calling 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 longer than the average waiting time, obtaining the estimated global execution time corresponding to the sub-operation according to the product of the sum of the resource calling time and the average execution time of the sub-operation and a preset probability coefficient.
In a specific application scenario, the link optimization module 33 may be specifically configured to set an interface corresponding to the sub-operation to a parallel execution mode; and storing the query results of the interfaces corresponding to the sub-operations in a cache space, and querying the query results in the cache space before the key operation is executed.
In a specific application scenario, as shown in fig. 4, the apparatus further includes a parameter correction module 35, where the parameter correction module 35 is configured to determine whether the response time of the optimized target link is greater than a preset target response time; if yes, 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 the execution of each sub-operation to the start of the execution of a key operation in the target link; the data calculating module 32 is further configured to recalculate a current global execution time and an estimated global execution time corresponding to each sub-operation based on the corrected average execution time and execution failure probability of each sub-operation and an average waiting time from completion of execution of each sub-operation to start of execution of a key operation in the target link; the link optimization module 33 is further configured to perform asynchronous parallel processing on the interface corresponding to the sub-operation to obtain a re-optimized target link in response to the difference between the current global execution time corresponding to the sub-operation and the estimated global execution time after the re-calculation being greater than the preset value.
In a specific application scenario, the target link is an order creation link, sub-operations in the target link include at least one operation of a sensitive picture checking operation, a sensitive word checking operation, a user wind control checking operation, a ticket dropping operation and a ticket creating success message broadcasting operation, and key steps in the target link are the ticket dropping operation.
It should be noted that, other corresponding descriptions of each functional unit related to the link optimization apparatus provided in this embodiment may refer to corresponding descriptions in fig. 1 and fig. 2, and are not described herein again.
Based on the above methods shown in fig. 1 and fig. 2, correspondingly, the present embodiment further provides a storage medium, on which a computer program is stored, which when executed by a processor, implements the above link optimization method shown in fig. 1 and fig. 2.
Based on such understanding, the technical solution of the present application may be embodied in the form of a software product, where the software product to be identified may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disc, a mobile hard disk, etc.), and include several instructions for causing a computer device (may be a personal computer, a server, or a network device, etc.) to execute the method described in each implementation scenario of the present application.
Based on the method shown in fig. 1 and fig. 2 and the link optimization apparatus embodiments shown in fig. 3 and fig. 4, in order to achieve the above objects, the present embodiment further provides a link-optimized computer device, which may specifically be a personal computer, a server, a smart phone, a tablet computer, a smart watch, or other network devices, where the computer device includes a storage medium and a processor; a storage medium storing a computer program and an operating system; a processor for executing a computer program to implement the method as shown in fig. 1 and 2.
Optionally, the computer device may further include an internal memory, a communication interface, a network interface, a camera, a Radio Frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, a Display screen (Display), an input device such as a Keyboard (Keyboard), and the like, and optionally, the communication interface may further include a USB interface, a card reader interface, and the like. The network interface may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface), etc.
It will be appreciated by those skilled in the art that the computer device structure provided by the present embodiment for identification of an operational action is not limiting of the computer device and may include more or fewer components, or may combine certain components, or a different arrangement of components.
The storage medium may also include an operating system, a network communication module. The operating system is a program for managing the hardware of the computer device and the software resources to be identified, and supports the operation of the information processing program and other software and/or programs to be identified. The network communication module is used for realizing communication among all components in the storage medium and communication with other hardware and software in the information processing computer equipment.
From the above description of the embodiments, it will be apparent to those skilled in the art that the present application may be implemented by means of software plus necessary general hardware platforms, or may be implemented by hardware. By applying the technical scheme, firstly, 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 are obtained, then, for each sub-operation, the current global execution time corresponding to the sub-operation is determined according to the average execution time, the execution failure probability and the average waiting time of the sub-operation, further, the resource calling time of the sub-operation is obtained, the estimated global execution time corresponding to the sub-operation is determined according to the resource calling time, the average execution time and the average waiting time of the sub-operation, finally, asynchronous parallel processing is carried out on the sub-operation in response to the difference between the current global execution time corresponding to the sub-operation and the estimated global execution time being greater than a preset value, and the optimized target link is obtained. Compared with the prior art, the method can effectively judge the necessity of asynchronous optimization of each sub-operation, thereby improving the pertinence and the accuracy of link optimization, further improving the efficiency of link execution, simultaneously avoiding occupying a large amount of computing resources in the link execution process, and further improving the overall execution efficiency of the link.
Those skilled in the art will appreciate that the drawings are merely schematic illustrations of one preferred implementation scenario, and that the modules or flows in the drawings are not necessarily required to practice the present application. Those skilled in the art will appreciate that modules in an apparatus in an implementation scenario may be distributed in an apparatus in an implementation scenario according to an implementation scenario description, or that corresponding changes may be located in one or more apparatuses different from the implementation scenario. The modules of the implementation scenario may be combined into one module, or may be further split into a plurality of sub-modules.
The foregoing application serial numbers are merely for description, and do not represent advantages or disadvantages of the implementation scenario. The foregoing disclosure is merely a few specific implementations of the present application, but the present application is not limited thereto and any variations that can be considered by a person skilled in the art shall fall within the protection scope of the present application.

Claims (10)

1. A method of link optimization, the method comprising:
acquiring average execution time and execution failure probability of each sub-operation in a target link and average waiting time from completion of execution of each sub-operation to start of 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;
and responding to the difference between the current global execution time corresponding to the sub-operation and the estimated global execution time is larger than a preset value, and carrying out asynchronous parallel processing on the sub-operation to obtain an optimized target link.
2. The method of claim 1, wherein prior to the obtaining the average execution time and execution failure probability for each sub-operation in the target link, the method further comprises:
according to the operation flow of the target link, splitting the target link into a plurality of sub-operations, and determining at least one key operation in the plurality of sub-operations, wherein each sub-operation corresponds to at least one interface, and the key operation is an operation for updating data in a database.
3. The method of claim 1, wherein 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 comprises:
Obtaining the current global execution time when the sub-operation fails to be executed according to the product of the average execution time of the sub-operation and the execution failure probability;
calculating the execution success probability of the sub-operation according to the execution failure probability of the sub-operation;
obtaining the current global execution time when the sub-operation is successfully executed according to the product of the average execution time of the sub-operation and the average waiting time and the execution success probability of the sub-operation;
and obtaining the current global execution time corresponding to the sub-operation according to the sum of the current global execution time when the sub-operation fails to be executed and the current global execution time when the sub-operation is successfully executed.
4. The method of claim 1, wherein determining the estimated global execution time corresponding to the sub-operation according to the resource call time, the average execution time, and the average wait time of the sub-operation comprises:
when the average execution time of the sub-operation is smaller than or equal to the average waiting time, obtaining the estimated global execution time corresponding to the sub-operation according to the product of the sum of the resource calling 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 longer than the average waiting time, obtaining the estimated global execution time corresponding to the sub-operation according to the product of the sum of the resource calling time and the average execution time of the sub-operation and a preset probability coefficient.
5. The method of claim 1, wherein said asynchronously parallel processing of said sub-operations comprises:
setting the interfaces corresponding to the sub-operations as parallel execution modes;
and storing the query results of the interfaces corresponding to the sub-operations in a cache space, and querying the query results in the cache space before the key operation is executed.
6. The method according to claim 1, wherein the method further comprises:
judging whether the response time of the optimized target link is longer than the preset target response time;
if yes, 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 the execution of each sub-operation to the start of the execution of a key operation in the target link;
recalculating the current global execution time and the estimated global execution time corresponding to each sub-operation based on the corrected average execution time and execution failure probability of each sub-operation and the average waiting time from the completion of the execution of each sub-operation to the start of the execution of the key operation in the target link;
And responding to the difference between the current global execution time corresponding to the sub-operation after recalculation and the estimated global execution time is larger than the preset value, and carrying out asynchronous parallel processing on the interface corresponding to the sub-operation to obtain a target link after re-optimization.
7. The method of any of claims 1-6, wherein the target link creates a link for an order, wherein sub-operations in the target link include at least one of a sensitive picture check operation, a sensitive word check operation, a user wind check operation, a drop operation, and a creation success message broadcast operation, and wherein a critical step in the target link is the drop operation.
8. A link optimization apparatus, the apparatus comprising:
the parameter acquisition module is used for 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;
the data calculation module is used for determining the current global execution time corresponding to each 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;
And the link optimization module is used for carrying out asynchronous parallel processing on the sub-operation to obtain an optimized target link in response to the difference between the current global execution time corresponding to the sub-operation and the estimated global execution time being larger than a preset value.
9. A storage medium having stored thereon a computer program, which when executed by a processor, implements the steps of the method of any of claims 1 to 7.
10. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the computer program when executed by the processor implements the steps of the method according to any one of claims 1 to 7.
CN202310403851.XA 2023-04-14 2023-04-14 Link optimization method, device, storage medium and computer equipment Pending CN116390130A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310403851.XA CN116390130A (en) 2023-04-14 2023-04-14 Link optimization method, device, storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310403851.XA CN116390130A (en) 2023-04-14 2023-04-14 Link optimization method, device, storage medium and computer equipment

Publications (1)

Publication Number Publication Date
CN116390130A true CN116390130A (en) 2023-07-04

Family

ID=86961456

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310403851.XA Pending CN116390130A (en) 2023-04-14 2023-04-14 Link optimization method, device, storage medium and computer equipment

Country Status (1)

Country Link
CN (1) CN116390130A (en)

Similar Documents

Publication Publication Date Title
WO2019120037A1 (en) Model construction method, network resource preloading method and apparatus, medium, and terminal
CN110109953B (en) Data query method, device and equipment
EP3502878B1 (en) Method for preloading application and terminal device
WO2020037105A1 (en) Identification and application of hyperparameters for machine learning
CN107872523B (en) Network data loading method and device, storage medium and mobile terminal
CN109344044B (en) Method and system for calculating rendering time of first screen of page
CN111666497A (en) Application program loading method and device, electronic equipment and readable storage medium
CN111311014B (en) Service data processing method, device, computer equipment and storage medium
CN110602207A (en) Method, device, server and storage medium for predicting push information based on off-network
CN116390130A (en) Link optimization method, device, storage medium and computer equipment
CN106294457B (en) Network information pushing method and device
CN110442616B (en) Page access path analysis method and system for large data volume
CN110704614A (en) Information processing method and device for predicting user group type in application
CN113010310B (en) Method, device and server for processing job data
CN114595146A (en) AB test method, device, system, electronic equipment and medium
CN114691703A (en) Data updating method and device, electronic equipment and storage medium
CN113886192A (en) Log data acquisition method and device, terminal equipment and readable storage medium
CN110852873A (en) Data trust method, device, equipment and computer readable storage medium
CN113327133B (en) Data recommendation method, data recommendation device, electronic equipment and readable storage medium
CN105468603A (en) Data selection method and apparatus
CN111352825A (en) Data interface test method and device and server
CN112631752B (en) List operation method and device based on operation priority
CN113626739B (en) Method and system for accelerating optimization of website rendering path
CN112416401B (en) Data updating method, device and equipment
CN115578583B (en) Image processing method, device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination