Interface timeout parameter configuration method and device, equipment and medium
By starting the interface configuration task in response to a preset time period in the call link, obtaining the interface's TP indicator and configuring the timeout parameters according to the call order, the problem of reasonable configuration of the interface timeout parameters is solved, and the stability of the call service is improved.
Patent Information
- Application Number
- CN202311369924.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-20
- Publication Date
- 2025-04-22
AI Technical Summary
In the call link scenario, how to reasonably configure the timeout parameters of the interface is an urgent problem to be solved, and the existing technology lacks effective solutions.
By initiating tasks in response to interface configurations at every preset time period, multiple call links are determined and the highest percentage TP metric for interfaces on each link is obtained. According to the TP indicator and the call order of the interface, configure timeout parameters for each interface to ensure the rationality and dynamicity of the timeout parameters.
It improves the rationality of the interface timeout parameters, enhances the stability of the call service, and adapts to the changes in the call service by dynamically adjusting the timeout parameters.
Smart Images

Figure CN119861977A_ABST
Abstract
Description
Background Art
[0002] With the rapid development of the Internet, more and more interfaces are used. When a client calls a server interface, the interface generally has a timeout parameter configuration. Once the execution time of the server exceeds the parameter, the client will actively disconnect and throw a timeout exception.
[0003] In the related art, there is no suitable solution for setting the timeout parameter of the interface in the link in the scenario of calling the link. Therefore, how to configure a reasonable timeout parameter for the interface is an urgent problem to be solved.
[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0005] The purpose of the present disclosure is to provide a method for configuring timeout parameters of an interface, which can at least improve the rationality of the timeout parameters of the interface to a certain extent and improve the stability of calling services.
[0006] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.
[0007] According to a first aspect of the present disclosure, a method for configuring timeout parameters of an interface is provided, wherein the method comprises:
[0008] In response to the interface configuration startup task every preset time period, determining a plurality of call links;
[0009] Get the highest percentage TP index of the interface on each call link and get the TP index of multiple interfaces;
[0010] Configure the timeout parameters for each interface based on the TP indicator of each interface and the calling order of each interface on the calling link.
[0011] In one embodiment of the present disclosure, in response to the interface configuration startup task every preset time period, determining multiple call links includes:
[0012] In response to the interface configuration startup task every preset time period, obtaining an interface list;
[0013] Based on the interface list, multiple call links are determined.
[0014] In one embodiment of the present disclosure, configuring a timeout parameter for each interface according to the TP indicator of each interface and the calling order of each interface on the calling link includes:
[0015] According to the TP indicator of each interface and a pre-established parameter configuration list; the parameter configuration list includes a mapping relationship between the TP indicator and the timeout parameter; and, according to the calling order of the interface in each calling link, the timeout parameter is configured for each interface; wherein, in a calling link, the interface is called in a sequence from the upstream interface to the downstream interface, and the corresponding timeout parameter decreases in sequence.
[0016] In one embodiment of the present disclosure, after configuring the timeout parameter for each interface according to the TP indicator of each interface and the calling order of each interface on the calling link, the method further includes:
[0017] According to the timeout parameters of each interface, determine whether the timeout parameters of each interface are reasonable;
[0018] If it is determined that the timeout parameter of the interface is unreasonable, the timeout parameter of the interface is updated within a preset range; or an alarm indication is issued.
[0019] In one embodiment of the present disclosure, judging whether the timeout parameter of each interface is reasonable according to the timeout parameter of each interface includes:
[0020] If in a call link, the timeout parameter of the downstream interface is greater than or equal to the timeout parameter of the upstream interface, it is determined that the timeout parameter is unreasonable.
[0021] In one embodiment of the present disclosure, judging whether the timeout parameter of each interface is reasonable according to the timeout parameter of each interface includes:
[0022] If the difference between the timeout parameter of the interface and the TP indicator of the interface is greater than the first preset difference, or less than the second preset difference, it is determined that the timeout parameter is unreasonable.
[0023] In one embodiment of the present disclosure, the interface in the call link is configured in a distributed environment; the method further includes:
[0024] If the upstream interface calls the downstream interface during the call link and a timeout parameter exception occurs;
[0025] A retry mechanism is triggered to instruct the upstream interface to re-call the parallel interface of the downstream interface in the distributed environment.
[0026] In one embodiment of the present disclosure, the method further includes:
[0027] Monitor whether there are pending interfaces whose timeout parameters are not configured;
[0028] If it exists, the timeout parameters are configured for the interface to be processed according to the TP index of the interface to be processed and the calling order of the interface to be processed on the calling link.
[0029] In one embodiment of the present disclosure, the method further includes:
[0030] Get the timeout parameter exceptions for each interface;
[0031] Collect statistics on timeout parameter exceptions and generate timeout parameter exception logs;
[0032] Analyze the timeout parameter exception log to obtain the timeout parameter exception analysis result of each interface;
[0033] According to the timeout parameter abnormality analysis result, the TP index of each interface and the calling order of each interface on the calling link, the timeout parameter is configured for each interface respectively.
[0034] In one embodiment of the present disclosure, after configuring the timeout parameter for each interface according to the TP indicator of each interface and the calling order of each interface on the calling link, the method further includes:
[0035] In response to the user's operation of querying the first interface parameter interface of the application, the first interface parameter interface of the application is displayed; the first interface parameter interface includes the interface name of the current interface being called, the timeout parameters of the current interface, the TP indicator of the current interface and the link parameter viewing item.
[0036] In one embodiment of the present disclosure, after displaying the first interface parameter interface of the application, the method further includes:
[0037] In response to the user touching any link parameter viewing item, displaying the link parameter interface of the target call link;
[0038] In the link parameter interface, the current interface in the target call link, the TP index of the interface associated with the current interface, the timeout parameter and the interface name are displayed.
[0039] In one embodiment of the present disclosure, after configuring the timeout parameter for each interface according to the TP indicator of each interface and the calling order of each interface on the calling link, the method further includes:
[0040] In response to the user's operation of querying the second interface parameter interface of the application, the second interface parameter interface of the application is displayed; wherein the second interface parameter interface includes the interface name of the current interface being called, the timeout parameter of the current interface, the TP index of the current interface and the problem description item;
[0041] When it is determined that the timeout parameter of the interface is unreasonable, the unreasonable reason for the interface is displayed in the problem description item corresponding to the interface.
[0042] According to another aspect of the present disclosure, a device for configuring timeout parameters of an interface is provided, comprising:
[0043] An acquisition unit, configured to determine a plurality of call links in response to an interface configuration startup task every preset time period;
[0044] The acquisition unit is further used to acquire the highest percentage TP index of the interface on each call link, and obtain the TP indexes of multiple interfaces;
[0045] The configuration unit is used to configure a timeout parameter for each interface according to a TP indicator of each interface and a calling sequence of each interface on a calling link.
[0046] According to another aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any one of the methods in the first aspect by executing the executable instructions.
[0047] According to another aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the method of any one of the first aspects is implemented.
[0048] The embodiments of the present invention provide a method, device, equipment and medium for configuring the timeout parameters of an interface, which relate to the field of Internet technology. The method includes: in response to an interface configuration startup task at every preset time period, determining multiple call links, obtaining the highest percentage TP index of the interface on each call link, obtaining the TP indexes of multiple interfaces, and configuring the timeout parameters for each interface according to the TP index of each interface and the calling order of each interface on the call link. Through the above method, the rationality of the timeout parameter configuration of the interface can be improved, and the stability of the call service can be improved.
[0049] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0051] Figure 1 A flowchart showing a method for configuring timeout parameters of an interface in an embodiment of the present disclosure is shown;
[0052] Figure 2 A flow chart of monitoring and judging timeout parameters in an embodiment of the present disclosure is shown;
[0053] Figure 3 A flow chart showing an interface parameter interface in an embodiment of the present disclosure;
[0054] Figure 4 A flow chart of interface monitoring in an embodiment of the present disclosure is shown;
[0055] Figure 5 A flowchart showing another method for configuring timeout parameters of an interface in an embodiment of the present disclosure is shown;
[0056] Figure 6 A flowchart showing an interface calling process in an embodiment of the present disclosure is shown;
[0057] Figure 7 A flow chart showing another interface parameter interface in an embodiment of the present disclosure;
[0058] Figure 8 A flow chart showing a link parameter interface in an embodiment of the present disclosure is shown;
[0059] Fig. 9 A flowchart showing a method for configuring timeout parameters of another interface in an embodiment of the present disclosure is shown;
[0060] Fig.10 A schematic diagram showing the structure of a device for configuring timeout parameters of an interface in an embodiment of the present disclosure is shown;
[0061] Fig.11 A schematic structural diagram of an electronic device in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0062] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the disclosure will be more comprehensive and complete and to fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0063] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0064] In related technologies, when a client calls a server interface, there is generally a timeout parameter configuration. Once the server execution time exceeds the parameter, the client will actively disconnect and throw a Timeout exception.
[0065] In the scenario of link calling, for example, in a call link, interface A calls B, B calls C, and C calls D. How to recommend a suitable time for each node? Generally, there are two ways to do it: set a very large parameter, such as 60 seconds, to avoid interface exceptions caused by timeouts to the maximum extent. However, the above method may result in the inability to generate call results, but because it has not timed out, the user wastes time waiting.
[0066] Reasonable parameters are set based on experience. For example, interface A generally takes 1 second to process a business, and interface B takes 3 seconds to process a business. Based on experience, the timeout parameter of interface A may be set to 2 seconds, and the timeout parameter of interface B may be set to 5 seconds. However, due to factors such as business changes, the two interfaces are located in a link, and interface A calls interface B. The downstream execution of B takes more than 2 seconds and less than 5 seconds. In this case, B gets the result, but A has timed out and is disconnected, so it cannot get the result.
[0067] Based on the consideration of the above technical problems, the inventor solves the above problems in the following way: in response to the interface configuration startup task every preset time period, multiple call links are determined, the top percentage (TP) index of the interface on each call link is obtained, and the TP index of multiple interfaces is obtained. According to the TP index of each interface and the calling order of each interface on the call link, the timeout parameter is configured for each interface. The TP index of the interface is dynamically obtained, and the timeout parameter of the interface is dynamically set, so that the timeout parameter can adapt with the change of the call service, and the timeout parameter is set for the interface in a call link according to the calling order, and the timeout parameter of the interface in the call link is dynamically and automatically determined, which not only ensures the rationality of the timeout parameter, but also ensures the dynamic nature of the timeout parameter, and also ensures automatic calculation, improves efficiency, and can also improve the stability of the call service.
[0068] The solution provided in the embodiment of the present application involves technologies such as a method for configuring timeout parameters of an interface in a business processing process, which is specifically described through the following embodiments:
[0069] Figure 1 The flowchart of a method for configuring timeout parameters of an interface in an embodiment of the present disclosure is shown. The method provided in the embodiment of the present disclosure can be executed by a server and is not specifically limited here. Figure 1 As shown, steps S102 to S106 are included:
[0070] S102: In response to the interface configuration startup task every preset time period, a plurality of call links are determined.
[0071] In a possible embodiment, the preset time period can be 1 day or 12 hours, for example, and the interface configuration startup task is started every 1 day or 12 hours, and the server determines the call link in response to the interface configuration startup task every preset time period. The method of monitoring the call link can be specifically implemented by skyworking, etc.
[0072] The call link may include an interface and may include at least two serial interfaces.
[0073] In a possible embodiment, in order to facilitate calling of the interface, the following method may be adopted: in response to the interface configuration startup task every preset time period, an interface list is obtained, and multiple call links are determined based on the interface list.
[0074] Among them, first obtain the interface list, the interface list includes the first interface that the client wants to call to the server in the calling service, and determine multiple calling links starting with the first interface.
[0075] The interface list can be obtained by using prometheus or zabbix. The interface can include service interfaces and external interfaces.
[0076] S104: Obtain the highest percentage TP index of the interface on each call link to obtain TP indexes of multiple interfaces.
[0077] In a possible embodiment, the TP indicator may be one of TP90, TP99 or TP999. According to the preset time period as the time range for obtaining the TP indicator of the interface, the value of the TP indicator will be affected by the time range. Among them, the method for obtaining the TP indicator of the interface can be to monitor the response time after the interface is called in real time, and obtain and calculate according to the preset time period. The response time after the interface is called is monitored in real time to determine the TP indicator. TP50, TP90, TP99 or TP999 can be arbitrarily selected, and the average value, maximum value, minimum value, etc. of the response time can also be calculated.
[0078] For example, the present disclosure takes TP999 as an example, and the meaning of TP999 can be understood as: the minimum time required for a certain interface to meet 99.9% of network requests. TP999 = 100 milliseconds, which means that when calling interface A, 99.9% of the response time is less than 100 milliseconds.
[0079] Each interface has a TP indicator, and the TP indicator can be set to TP999. By obtaining a dynamic timed startup task, the TP999 of the interface is obtained as a basis for setting the timeout parameters of the interface.
[0080] S106: According to the TP indicator of each interface and the calling order of each interface on the calling link, a timeout parameter is configured for each interface.
[0081] In a call link, if there are four interfaces A, B, C and D, the calling order is A->B->C->D; then A is the upstream interface of B, B is the downstream interface of A, B is the upstream interface of C, and so on.
[0082] In a possible embodiment, the timeout parameter may be set by using the TP indicator of each interface as the timeout parameter of the minimum threshold, adding a reasonable preset value on the basis of the TP indicator as the intermediate timeout parameter, and after determining the intermediate timeout parameter, according to the calling order of the interface in each calling link, in a calling link, the interfaces are called in the order from the upstream interface to the downstream interface, and the corresponding timeout parameters are reduced in sequence. For interfaces that do not meet the requirements, adjustments are made within a fluctuating range centered on the intermediate timeout parameter, and the timeout parameters are configured for each interface.
[0083] In a possible embodiment, the setting can be performed in the following manner: according to the TP indicator of each interface and a pre-established parameter configuration list; the parameter configuration list includes a mapping relationship between the TP indicator and the timeout parameter; and, according to the calling order of the interface in each calling link, the timeout parameter is configured for each interface; wherein, in a calling link, the interface is called in the order from the upstream interface to the downstream interface, and the corresponding timeout parameter decreases successively.
[0084] Among them, taking TP indicator TP999 as an example, the parameter configuration list is shown in Table 1:
[0085] TP999 Timeout parameter recommendations tp999<100ms timeout<=500ms tp999<200ms timeout<=1s tp999<500ms timeout<=1.5s tp999<1s timeout<=2s <h2 style=";text-align:left;direction:ltr">tp999<2s<h2 style=";text-align:left;direction:ltr"> timeout<=3s tp999>2s Instruct staff to optimize interface performance
[0086] Table 1
[0087] According to the recommendation in the parameter configuration list, the server sets the interface timeout parameter to be greater than or equal to TP999 and less than the recommended value of the timeout parameter. It also ensures that in a call link, the interfaces are called in the order from the upstream interface to the downstream interface, and the corresponding timeout parameters decrease in sequence. Any appropriate value can be selected as the timeout parameter.
[0088] In a possible embodiment, the timeout parameters of the interface can be set starting from the last interface of the call link. For example, after obtaining TP999 of each interface, the timeout parameters of the D interface are set first, and then the timeout parameters of the interface C are set. When setting, the timeout parameters of the interface C are made greater than the timeout parameters of the interface D.
[0089] In a possible embodiment, the timeout parameters of all interfaces are written into a database, including at least three fields: application name, calling relationship between interfaces in the link, timeout parameters, etc.
[0090] In a possible embodiment, if the newly calculated timeout parameter is inconsistent with the historical record, a notification message can be sent to the service manager, who can decide whether to adjust the timeout parameter. Prompting the staff to check can avoid the risk of full automation, improve the rationality of the timeout parameter through the staff's secondary check, eliminate risks in the configuration process of the timeout parameter, and improve the stability of the calling service.
[0091] In a possible embodiment, since the timeout parameter of the interface is adjusted along with the TP indicator of the interface, the TP999 of the interface will change dynamically with the service iteration. When the interface TP999 changes, the timeout parameter should also be adjusted accordingly. If the change is large, the entire link needs to be adjusted together. Therefore, this is a complicated process.
[0092] To make this process more efficient, you can make it possible to dynamically adjust the timeout parameter range for each interface, and then let the server dynamically adjust the timeout parameter.
[0093] After the timeout parameters for each interface are configured, the timeout parameters can be judged to see whether they are reasonable, so as to avoid unreasonable configuration of the timeout parameters.
[0094] In a possible implementation manner, the embodiment of the present disclosure further shows a flow chart of a method for monitoring an interface after step S106, such as: Figure 2 As shown, the following steps are included:
[0095] S202: According to the timeout parameter of each interface, determine whether the timeout parameter of each interface is reasonable.
[0096] In a possible embodiment, if in a call link, a timeout parameter of a downstream interface is greater than or equal to a timeout parameter of an upstream interface, it is determined that the timeout parameter is unreasonable.
[0097] In a possible embodiment, if the difference between the timeout parameter of the interface and the real-time TP indicator of the interface is greater than a first preset difference, or less than a second preset difference, it is determined that the timeout parameter is unreasonable.
[0098] In a possible embodiment, if in a call link, the difference between the timeout parameter of the upstream interface and the timeout parameter of the downstream interface is smaller than a third preset difference, it is determined that the timeout parameter is unreasonable.
[0099] This can avoid the situation where the difference between the timeout parameters of the upstream interface and the downstream interface is too small. Delays or network fluctuations may occur, resulting in the downstream interface getting the result but the upstream interface not getting it. Therefore, the difference should not be too small to improve the stability of calling the service.
[0100] In a possible embodiment, it can be determined whether the timeout parameter configured for each interface is the same as the original timeout parameter. If not, or the difference is greater than a fourth preset difference, the timeout parameter is considered unreasonable. The specific selection of the judgment condition can also be determined according to the actual situation.
[0101] S204: If it is determined that the timeout parameter of the interface is unreasonable, the timeout parameter of the interface is updated within a preset range; or an alarm indication is issued.
[0102] In a possible embodiment, after determining that the timeout parameter is unreasonable, a preset range may be reserved around the timeout parameter when configuring the timeout parameter. When the timeout parameter is unreasonable, the server automatically makes adjustments.
[0103] In a possible embodiment, an alarm indication may be directly issued to remind the staff to make adjustments.
[0104] The above method can add another layer of protection to the configuration process of the timeout parameters. Even in the configuration process, the configuration is performed according to the calling order of the interfaces in the calling link to prevent errors.
[0105] In a possible embodiment, during the configuration of the interface, in addition to judging the rationality of the timeout parameter, the interface also needs to be monitored to ensure the stability of the calling service.
[0106] Based on the above method of judging whether the timeout parameters of the interface are reasonable, a visual interface can be provided for the staff to check. When it is found that the timeout parameters of a certain interface are unreasonable, an alarm is issued in time and the modification is made in time. This can avoid the loss of calls (PV_LOST) caused by too small timeout parameters, resulting in business damage, and avoid the timeout parameters being too high, which brings hidden dangers to system stability. It can also detect unreasonable link timeout parameters, such as the downstream timeout parameters exceeding the upstream, resulting in resource waste.
[0107] like Figure 3 As shown, the second interface parameter interface includes an option to select an application, and can specifically query and search interfaces according to the interface name, as well as query controls. Among them, the second interface parameter interface includes the current interface being called, the timeout parameter of the current interface, the TP indicator of the current interface, and the problem description item. Among them, the TP indicator takes TP999 as an example.
[0108] The server determines whether it is reasonable and displays it through a visual interface. There is a "Modify" option in the problem description item, and the user can touch the option to modify it manually.
[0109] The specific query method may be: in response to the user's operation of querying the second interface parameter interface of the application, the second interface parameter interface of the application is displayed, and when it is determined that the timeout parameter of the interface is unreasonable, the unreasonable reason of the interface is displayed in the problem description item corresponding to the interface. Further, in response to the user inputting the target application and the operation of touching the query control, the interface parameter interface of the application is displayed.
[0110] In one possible implementation, Figure 4 FIG. 4 shows a flow chart of monitoring an interface during a timeout parameter configuration process of an interface; Figure 4 As shown, the following steps are included:
[0111] S402: Monitor whether there is an interface to be processed whose timeout parameters are not configured.
[0112] S404: If so, configure a timeout parameter for the interface to be processed according to the TP indicator of the interface to be processed and the calling order of the interface to be processed on the calling link.
[0113] In a possible embodiment, the above method can be used to monitor the timeout parameters of interfaces that are not configured due to execution errors and the interfaces that are missed to be processed. In this way, it can be ensured that all interfaces can be configured.
[0114] In another possible embodiment, since new interfaces may be added at any time when calling the service, by monitoring whether there are unconfigured interfaces to be processed, it can be ensured that new interfaces can be monitored at any time, and the timeout parameters can be configured through the configuration method disclosed in the present invention to improve the risk resistance of the link and improve the stability of the calling service.
[0115] In a possible implementation, logs of timeout exceptions may be collected and analyzed in a unified manner. Figure 5 FIG. 4 is a flow chart showing another method for configuring timeout parameters of an interface; Figure 5 As shown, the following steps are included:
[0116] S502: Obtain the timeout parameter exception of each interface.
[0117] S504: Count the abnormal situations of timeout parameters and generate a timeout parameter abnormality log.
[0118] S506: Analyze the timeout parameter exception log to obtain the timeout parameter exception analysis result of each interface.
[0119] In a possible embodiment, the abnormal ratio of the timeout parameters can be analyzed to determine the ratio of the abnormal timeout parameters of the interface to the response time when the interface is called. For example, if interface A is called 1000 times and the number of abnormalities is 1, it can be determined that the abnormal ratio meets the conditions, and the timeout parameter abnormality analysis result can output that the timeout parameters of interface A are reasonable.
[0120] In a possible embodiment, the distribution of timeout parameter exceptions can be analyzed from the perspective of time. For example, if interface A is called 1000 times and an exception occurs, the timeout parameter is not reasonable and can be appropriately increased. The output timeout parameter exception analysis result is that the timeout parameter is set too small.
[0121] S508: According to the timeout parameter abnormality analysis result, the TP index of each interface and the calling sequence of each interface on the calling link, respectively configure the timeout parameter for each interface.
[0122] Through the above method, the timeout exception is analyzed, the impact of call loss on the business is evaluated, and then it is fed back to the configuration of timeout parameters, eventually forming a virtuous circle, providing the most reasonable timeout parameter configuration, and improving the stability of the call service.
[0123] In one possible implementation, reasonable timeout parameters can help maintain system stability. Unreasonable timeout parameters will occupy most resources in high-concurrency scenarios, causing normal business requests to fail to execute. This is acceptable for some business scenarios, such as querying a list of data on a web page. If an exception occurs, the user can manually query again on the client side. This is unacceptable for some business scenarios, such as scheduled tasks that process data in batches, which cannot be manually retried and results in incomplete data.
[0124] After step S106, the embodiment of the present disclosure further shows a flow chart of processing in the interface calling process, and the interface in the calling link adopts a distributed environment configuration; Figure 6 As shown, the following steps are included:
[0125] S602: If in the calling link, a timeout parameter exception occurs when the upstream interface calls the downstream interface.
[0126] S604: triggering a retry mechanism to instruct the upstream interface to re-call the parallel interface of the downstream interface in the distributed environment.
[0127] For example, if in the call link, interface A calls interface B, and interface B adopts a distributed environment configuration in a distributed environment, interface B can be deployed on multiple machines, assuming they are No. 1, No. 2, and No. 3. Interface A calls interface No. 1 of interface B and a timeout exception occurs, triggering a retry mechanism, instructing interface A to retry calling interface No. 2 of interface B.
[0128] Through the above method, although timeout exceptions are unavoidable, it can be combined with the RPC framework to configure the interface in a distributed environment. When a timeout exception occurs, the retry mechanism is triggered to avoid PV_LOST to the greatest extent and improve the stability of calling services.
[0129] In a possible implementation, the embodiment of the present disclosure provides a visual display interface after step S106, specifically as follows: Figure 7 As shown, the first interface parameter interface is displayed, wherein the first interface parameter interface specifically includes the interface name of the current interface being called, the timeout parameter of the current interface, the TP index of the current interface, and the link parameter viewing item. The timeout parameter of the interface can be manually modified. The TP index takes TP999 as an example.
[0130] The display method may include: in response to a user's operation of querying a first interface parameter interface of the application, displaying an interface parameter interface of the application.
[0131] Furthermore, in response to the user inputting a target application and touching the query control, a first interface parameter interface of the application is displayed.
[0132] In a possible implementation, after displaying the first interface parameter interface of the application, the following steps may also be included: in response to the user touching any operation of viewing the link parameter items, displaying the link parameter interface of the target call link, in which the current interface in the target call link, the TP indicator of the interface associated with the current interface, the timeout parameter and the interface name are displayed. The TP indicator takes TP999 as an example.
[0133] like Figure 8 As shown, Figure 8 The current interface in is displayed as highlighted. Figure 8 DB in the table indicates a database, and redis indicates a cache. timeout indicates a timeout parameter. The timeout parameters of each interface are illustrative.
[0134] Through the above visualization method, users can see where the configuration problems occur on the page in a timely manner and modify them in time, thereby increasing the stability of calling services and the rationality of link calls.
[0135] In one possible implementation, Fig. 9 A flow chart of a method for configuring timeout parameters of an interface is shown, Fig. 9 As shown, the following steps are included:
[0136] S902: In response to the interface configuration startup task every preset time period, obtain an interface list.
[0137] S904: Monitor whether there is a pending interface with unconfigured timeout parameters; if so, execute S906; if not, end.
[0138] S906: Determine multiple call links based on the interface list.
[0139] S908: Obtain the highest percentage TP index of the interface on each call link, and obtain TP indexes of multiple interfaces.
[0140] S910: According to the TP indicator of each interface and the calling order of each interface on the calling link, configure the timeout parameter for each interface, and return to step S904.
[0141] S912: judging whether the timeout parameter of each interface is reasonable according to the timeout parameter of each interface; if it is not reasonable, executing S914; if it is reasonable, ending.
[0142] S914: Update the timeout parameter of the interface within a preset range; or issue an alarm indication.
[0143] Through the above method, during the timeout parameter configuration of the interface, not only can it be monitored whether there are unprocessed interfaces, but it can also be monitored whether the timeout parameter configuration is reasonable, thereby improving the rationality of the timeout parameter configuration of the interface and improving the stability of the calling service.
[0144] Based on the same inventive concept as the above method embodiment, the embodiment of the present application also provides a timeout parameter configuration device for an interface. Fig.10 A schematic diagram of the structure of a timeout parameter configuration device for an interface provided in an embodiment of the present application is shown.
[0145] The timeout parameter configuration device 100 of the interface includes: an acquisition unit 1001, which is used to determine multiple call links in response to the interface configuration startup task every preset time period; the acquisition unit is also used to obtain the highest percentage TP index of the interface on each call link to obtain the TP index of multiple interfaces; the configuration unit 1002 is used to configure the timeout parameters for each interface according to the TP index of each interface and the calling order of each interface on the call link.
[0146] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as a system, method or program product. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system".
[0147] Refer to the following Fig.11The electronic device 1100 according to this embodiment of the present invention is described. Fig.11 The electronic device 1100 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0148] like Fig.11 As shown, the electronic device 1100 is in the form of a general computing device. The components of the electronic device 1100 may include but are not limited to: at least one processing unit 1110, at least one storage unit 1120, and a bus 1130 connecting different system components (including the storage unit 1120 and the processing unit 1110).
[0149] The storage unit stores program codes, which can be executed by the processing unit 1110, so that the processing unit 1110 executes the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification.
[0150] The storage unit 1120 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 11201 and / or a cache storage unit 11202 , and may further include a read-only storage unit (ROM) 11203 .
[0151] The storage unit 1120 may also include a program / utility 11204 having a set (at least one) of program modules 11205, such program modules 11205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0152] Bus 1130 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0153] The electronic device 1100 may also communicate with one or more external devices 1140 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1100, and / or communicate with any device that enables the electronic device 1100 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1150. Furthermore, the electronic device 1100 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 1160. As shown, the network adapter 1160 communicates with other modules of the electronic device 1100 via a bus 1130. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1100, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0154] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0155] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of the present specification.
[0156] A program product for implementing the above method according to an embodiment of the present invention is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.
[0157] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0158] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0159] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0160] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0161] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0162] In addition, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0163] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0164] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the appended claims.
Claims
1. A method for configuring timeout parameters of an interface, characterized in that: The method comprises: In response to the interface configuration startup task every preset time period, determining a plurality of call links; Get the highest percentage TP index of the interface on each call link and get the TP index of multiple interfaces; Configure the timeout parameters for each interface based on the TP indicator of each interface and the calling order of each interface on the calling link.
2. The method according to claim 1, characterized in that: The step of determining a plurality of call links in response to the interface configuration startup task every preset time period includes: In response to the interface configuration startup task every preset time period, obtaining an interface list; Based on the interface list, multiple call links are determined.
3. The method according to claim 1, characterized in that: The timeout parameters are configured for each interface according to the TP index of each interface and the calling order of each interface on the calling link, including: According to the TP indicator of each interface and a pre-established parameter configuration list; the parameter configuration list includes a mapping relationship between the TP indicator and the timeout parameter; and, according to the calling order of the interface in each calling link, the timeout parameter is configured for each interface; wherein, in a calling link, the interface is called in a sequence from the upstream interface to the downstream interface, and the corresponding timeout parameter decreases in sequence.
4. The method according to claim 1, characterized in that: After configuring the timeout parameter for each interface according to the TP index of each interface and the calling order of each interface on the calling link, the method further includes: According to the timeout parameters of each interface, determine whether the timeout parameters of each interface are reasonable; If it is determined that the timeout parameter of the interface is unreasonable, the timeout parameter of the interface is updated within a preset range; or an alarm indication is issued.
5. The method according to claim 4, characterized in that: The step of judging whether the timeout parameter of each interface is reasonable according to the timeout parameter of each interface includes: If in a call link, the timeout parameter of the downstream interface is greater than or equal to the timeout parameter of the upstream interface, it is determined that the timeout parameter is unreasonable.
6. The method according to claim 4, characterized in that: The step of judging whether the timeout parameter of each interface is reasonable according to the timeout parameter of each interface includes: If the difference between the timeout parameter of the interface and the TP indicator of the interface is greater than the first preset difference, or less than the second preset difference, it is determined that the timeout parameter is unreasonable.
7. The method according to claim 1, characterized in that: The interface in the call link is configured in a distributed environment; the method further includes: If the upstream interface calls the downstream interface during the call link and a timeout parameter exception occurs; A retry mechanism is triggered to instruct the upstream interface to re-call the parallel interface of the downstream interface in the distributed environment.
8. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: Monitor whether there are pending interfaces whose timeout parameters are not configured; If it exists, the timeout parameters are configured for the interface to be processed according to the TP index of the interface to be processed and the calling order of the interface to be processed on the calling link.
9. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: Get the timeout parameter exceptions for each interface; Collect statistics on timeout parameter exceptions and generate timeout parameter exception logs; Analyze the timeout parameter exception log to obtain the timeout parameter exception analysis result of each interface; According to the timeout parameter abnormality analysis result, the TP index of each interface and the calling order of each interface on the calling link, the timeout parameter is configured for each interface respectively.
10. The method according to claim 1, characterized in that After configuring the timeout parameter for each interface according to the TP index of each interface and the calling order of each interface on the calling link, the method further includes: In response to the user's operation of querying the first interface parameter interface of the application, the first interface parameter interface of the application is displayed; the first parameter interface includes the interface name of the current interface being called, the timeout parameter of the current interface, the TP indicator of the current interface and the link parameter viewing item.
11. The method according to claim 10, characterized in that After displaying the first interface parameter interface of the application, the method further includes: In response to the user touching any link parameter viewing item, displaying the link parameter interface of the target call link; In the link parameter interface, the current interface in the target call link, the TP index of the interface associated with the current interface, the timeout parameter and the interface name are displayed.
12. The method according to any one of claims 5 to 6, characterized in that: After configuring the timeout parameter for each interface according to the TP index of each interface and the calling order of each interface on the calling link, the method further includes: In response to the user's operation of querying the second interface parameter interface of the application, the second interface parameter interface of the application is displayed; wherein the second interface parameter interface includes the interface name of the current interface being called, the timeout parameter of the current interface, the TP index of the current interface and the problem description item; When it is determined that the timeout parameter of the interface is unreasonable, the unreasonable reason for the interface is displayed in the problem description item corresponding to the interface.
13. A device for configuring timeout parameters of an interface, characterized in that: include: An acquisition unit, configured to determine a plurality of call links in response to the interface configuration startup task at every preset time period; The acquisition unit is further used to acquire the highest percentage TP index of the interface on each call link, and obtain the TP indexes of multiple interfaces; The configuration unit is used to configure a timeout parameter for each interface according to a TP indicator of each interface and a calling sequence of each interface on a calling link.
14. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 12 by executing the executable instructions.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 12 is implemented.