Method and device for monitoring API in energy internet marketing service system, and storage medium
By building a two-dimensional dependency matrix and API call heatmap, monitoring and processing the API of the energy Internet marketing service system, the system performance bottleneck problem is solved, and the fast and accurate API bottleneck identification and processing is achieved, which improves system performance and reduces maintenance costs.
Patent Information
- Application Number
- CN202510316855.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-18
- Publication Date
- 2025-07-04
- Estimated Expiration
- 2045-03-18
AI Technical Summary
In the prior art, energy Internet marketing service systems are prone to scheduling node downtime under high transaction data volume, resulting in system performance degradation, and multiple scheduling nodes lead to complex scheduling algorithms and high maintenance costs, making it difficult to accurately find bottleneck APIs.
By building a two-dimensional dependency matrix and API call heatmap of the energy Internet marketing service system, monitoring API call records, determining bottleneck APIs, and processing different bottleneck APIs, such as buffering, switching backup APIs or prioritizing dependencies, and restarting the service.
Quickly and accurately identify and handle bottleneck APIs, improve system performance, reduce computing resource requirements, and reduce maintenance costs.
Smart Images

Figure CN120256241A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer system program control, and particularly relates to a method, device, and storage medium for monitoring APIs in an energy Internet marketing service system. Background Art
[0002] In an energy Internet marketing service system, such as an electricity grid marketing system, there are multiple sales channels, and each sales channel has multiple sales terminals. The transaction data volume per unit time (such as one day or one hour, etc.) is extremely large. Therefore, a distributed database is generally used to store transaction data. Since there are many database nodes, a load balancing algorithm needs to be used for load balancing when storing data, and a data migration algorithm needs to be used to migrate data when the data volume on a certain database node is large. These operations all require the use of a scheduling node. Due to the large volume of power grid transaction data, the data processing volume of the scheduling node increases. In extreme cases, the scheduling node crashes, affecting the system performance.
[0003] In the prior art, there is also a method of using multiple scheduling nodes. However, using multiple scheduling nodes makes the scheduling algorithm more complex, difficult to find bugs when they occur, and has a high maintenance cost. Summary of the Invention
[0004] In view of one or more of the above technical defects in the prior art, the present invention proposes the following technical solutions.
[0005] The present invention proposes a method for monitoring APIs in an energy Internet marketing service system, the method comprising:
[0006] An obtaining step of obtaining all callable APIs in the energy Internet marketing service system and constructing a two-dimensional dependency matrix based on the dependency relationships of the APIs;
[0007] A monitoring step of monitoring the calls of all APIs and generating a call record for each call, the call record at least including: the calling application, the ID of the called API, the call time, and the call response time;
[0008] A generating step of generating an API call heat map based on the call records of all APIs and marking the average value of the call response time of each API in the API call heat map;
[0009] A processing step of determining bottleneck APIs affecting the performance of the energy Internet marketing service system based on the two-dimensional dependency matrix and the API call heat map, and processing the bottleneck APIs.
[0010] Furthermore, at least all APIs that can be called in the energy Internet marketing service system include: financial payment channel APIs, non-financial payment channel APIs, government affairs channel APIs, database APIs, network service APIs, and system APIs.
[0011] Furthermore, the operation of determining the bottleneck APIs affecting the performance of the energy Internet marketing service system based on the two-dimensional dependency matrix and the API call heat map is as follows: Determine at least one hot API that is called in the API call heat map, determine the ID of the first API whose average call response time is greater than the first threshold among the at least one hot API, and based on the ID of the API, look up the ID of the second API that depends on the first API and the ID of the third API that the first API depends on in the two-dimensional dependency matrix, and determine whether the second API is a hot API in the API call heat map. If so, determine the number of times the second API is called based on the API call heat map, determine the average value of the call response time of the third API based on the ID of the third API. If the number of times the second API is called is greater than or equal to the second threshold, the second API is a bottleneck API. If the average value of the call response time of the third API is greater than or equal to the third threshold, the third API is a bottleneck API. If the number of times the second API is called is less than the second threshold and the average value of the call response time of the third API is less than the third threshold, the first API is a bottleneck API.
[0012] Furthermore, highlight the bottleneck APIs in the API call heat map and send out an alarm message.
[0013] Furthermore, the alarm message at least includes: alarm sound, alarm indicator light, alarm text message, alarm WeChat, and alarm email.
[0014] Furthermore, the operations for processing the bottleneck APIs include:
[0015] If the first API is a bottleneck API, determine whether the throughput rate of the first API is greater than the fourth threshold. If so, construct a first call queue to buffer the services that call the first API. If not, determine whether the error rate of the first API is greater than the fifth threshold. If so, suspend the use of the first API and switch to the backup API of the first API;
[0016] If the second API is a bottleneck API, determine whether the number of times the second API is called is greater than the maximum concurrent number allowed for the second API. If so, when the I / O utilization rate of the current system is less than the sixth threshold, increase the maximum concurrent number allowed for the second API. If not, construct a second call queue to buffer the services that call the second API, and place the ID of the first API at the front of the second call queue;
[0017] If the third API is a bottleneck API, based on the two-dimensional dependency matrix, determine whether the third API depends on the second API. If so, make the second API give priority to processing the call of the third API. If not, restart the service that provides the third API.
[0018] The present invention also proposes a monitoring device for APIs in an energy Internet marketing service system. The device includes:
[0019] An acquisition unit, which acquires all callable APIs in the energy Internet marketing service system and constructs a two-dimensional dependency matrix based on the dependency relationships of the APIs;
[0020] A monitoring unit, which monitors the calls of all APIs and generates a call record for each call. The call record at least includes: the calling application, the ID of the called API, the call time, and the call response time;
[0021] A generating unit, which generates an API call heat map based on the call records of all APIs and marks the average value of the call response time of each API in the API call heat map;
[0022] A processing unit, which determines the bottleneck APIs that affect the performance of the energy Internet marketing service system based on the two-dimensional dependency matrix and the API call heat map, and processes the bottleneck APIs.
[0023] Furthermore, all callable APIs in the energy Internet marketing service system at least include: financial payment channel APIs, non-financial payment channel APIs, government affairs channel APIs, database APIs, network service APIs, and system APIs.
[0024] Furthermore, the operation of determining the bottleneck APIs that affect the performance of the energy Internet marketing service system based on the two-dimensional dependency matrix and the API call heat map is as follows: determine at least one hot API that is called in the API call heat map, determine the IDs of the first APIs in the at least one hot API whose average call response time is greater than the first threshold, based on the IDs of the APIs, look up the IDs of the second APIs that depend on the first API and the IDs of the third APIs that the first API depends on in the two-dimensional dependency matrix, and determine whether the second API is a hot API in the API call heat map. If so, determine the number of times the second API is called based on the API call heat map, determine the average call response time of the third API based on the ID of the third API. If the number of times the second API is called is greater than or equal to the second threshold, the second API is a bottleneck API. If the average call response time of the third API is greater than or equal to the third threshold, the third API is a bottleneck API. If the number of times the second API is called is less than the second threshold and the average call response time of the third API is less than the third threshold, the first API is a bottleneck API.
[0025] Furthermore, highlight the bottleneck APIs in the API call heat map and send out warning messages.
[0026] Furthermore, the warning messages at least include: warning sounds, warning indicator lights, warning text messages, warning WeChat messages, and warning emails.
[0027] Furthermore, the operations for processing the bottleneck APIs include:
[0028] If the first API is a bottleneck API, determine whether the throughput rate of the first API is greater than the fourth threshold. If so, construct a first call queue to buffer the services that call the first API. If not, determine whether the error rate of the first API is greater than the fifth threshold. If so, suspend the use of the first API and switch to the alternative API of the first API;
[0029] If the second API is a bottleneck API, determine whether the number of times the second API is called is greater than the maximum concurrent number allowed for the second API. If so, when the I / O utilization rate of the current system is less than the sixth threshold, increase the maximum concurrent number allowed for the second API. If not, construct a second call queue to buffer the services that call the second API, and place the ID of the first API in front of the second call queue;
[0030] If the third API is a bottleneck API, determine whether the third API depends on the second API based on the two-dimensional dependency matrix. If so, cause the second API to preferentially process calls to the third API. If not, restart the service providing the third API.
[0031] The present invention also proposes a computer-readable storage medium having computer program code stored thereon, and when the computer program code is executed by a computer, the method according to any one of the above is executed.
[0032] The technical effects of the present invention are as follows: In a monitoring method, device and storage medium of APIs in an energy Internet marketing service system of the present invention, in the acquisition step S101, all callable APIs in the energy Internet marketing service system are acquired, and a two-dimensional dependency matrix is constructed based on the dependency relationships of the APIs; in the monitoring step S102, the calls of all APIs are monitored, and a call record is generated for each call, and the call record at least includes: the calling application, the ID of the called API, the call time and the call response time; in the generation step S103, an API call heat map is generated based on the call records of all APIs, and the average value of the call response time of each API is marked in the API call heat map; in the processing step S104, the bottleneck APIs affecting the performance of the energy Internet marketing service system are determined based on the two-dimensional dependency matrix and the API call heat map, and the bottleneck APIs are processed.The important inventive concept of the present invention is to solve the problem of determining bottleneck APIs in the system in the background technology. First, all callable APIs in the energy Internet marketing service system are obtained, and a two-dimensional dependency matrix is constructed based on the dependency relationships of the APIs. Then, the calls of all APIs are monitored, and each call generates a call record, and an API call heat map is generated. The average value of the call response time of each API is marked in the API call heat map. Based on the two-dimensional dependency matrix and the API call heat map, the bottleneck APIs affecting the performance of the energy Internet marketing service system are determined, and the bottleneck APIs are processed. That is, the inventive concept of the present invention is to determine the bottleneck APIs affecting the performance of the energy Internet marketing service system based on the two-dimensional dependency matrix and the API call heat map, which solves the technical defects in the prior art that determining bottleneck APIs by means of dependency trees, artificial intelligence, etc. requires a large amount of computing resources and has low accuracy. Since the present invention first constructs a two-dimensional dependency matrix of APIs and then constructs an API call heat map, the hot APIs can be obtained based on the heat map, and then the bottleneck APIs are determined according to the two-dimensional dependency matrix. This determination method has a lower computational amount, and the determined bottleneck APIs are relatively accurate, and the use of the heat map is extended. The present invention proposes different methods for determining bottleneck APIs for dependent and dependent APIs, which are determined according to the characteristics of the dependent and dependent APIs, so that the bottleneck APIs can be determined quickly and accurately, providing a basis for improving system performance. In the present invention, different processing methods for different bottleneck APIs are also proposed. That is, when the API itself is the API causing the bottleneck, the call is buffered based on the throughput and error rate or switched to a standby API. When the second API is the bottleneck API, if the system permits, its concurrency number is increased as much as possible to speed up the processing. When the third API is the bottleneck API, it is also necessary to determine whether the third API depends on the second API. If it depends on the second API, it means that the dependency relationships of the first, second, and third APIs form a closed loop. At this time, only by giving priority to the second API to process the calls of the third API can the bottleneck problem be solved as soon as possible. In addition, restart the service providing the third API. The present invention proposes different processing methods for different bottleneck APIs, so as to restore the system performance as soon as possible. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Other features, objects, and advantages of the present application will become more apparent by reading the detailed description of the non-limiting embodiments with reference to the following drawings.
[0034] Figure 1 It is a flowchart of a method for monitoring APIs in an energy Internet marketing service system according to an embodiment of the present invention.
[0035] Figure 2It is a structural diagram of a monitoring device for APIs in an energy Internet marketing service system according to an embodiment of the present invention. Detailed implementation manners
[0036] The present application will be further described in detail below with reference to the accompanying drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the related invention and are not intended to limit the invention. Additionally, it should be noted that for the sake of description, only parts related to the relevant invention are shown in the drawings.
[0037] It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments can be combined with each other. The present application will be described in detail below with reference to the drawings and embodiments.
[0038] Figure 1 A method for monitoring APIs in an energy Internet marketing service system according to the present invention is shown. The method includes:
[0039] An obtaining step S101, obtaining all the callable APIs in the energy Internet marketing service system, and constructing a two-dimensional dependency matrix based on the dependency relationships of the APIs;
[0040] A monitoring step S102, monitoring the calls of all the APIs, and generating a call record for each call. The call record at least includes: the calling application, the ID of the called API, the call time, and the call response time;
[0041] A generating step S103, generating an API call heat map based on the call records of all the APIs, and marking the average value of the call response time of each API in the API call heat map;
[0042] A processing step S104, determining the bottleneck APIs that affect the performance of the energy Internet marketing service system based on the two-dimensional dependency matrix and the API call heat map, and processing the bottleneck APIs.
[0043] The important inventive concept of the present invention is to solve the problem of determining the bottleneck APIs in the system in the background art. First, all the APIs that can be called in the energy Internet marketing service system are obtained, and a two-dimensional dependency matrix is constructed based on the dependency relationships of the APIs. Then, the calls of all the APIs are monitored, and each call generates a call record, and an API call heat map is generated. The average value of the call response time of each API is marked in the API call heat map. Based on the two-dimensional dependency matrix and the API call heat map, the bottleneck APIs that affect the performance of the energy Internet marketing service system are determined, and the bottleneck APIs are processed. That is, the inventive concept of the present invention is to determine the bottleneck APIs that affect the performance of the energy Internet marketing service system based on the two-dimensional dependency matrix and the API call heat map, which solves the technical defects in the prior art that determining bottleneck APIs by means of dependency trees, artificial intelligence, etc. requires a large amount of computing resources and has low accuracy. Since the present invention first constructs a two-dimensional dependency matrix of the APIs and then constructs an API call heat map, the hot APIs can be obtained based on the heat map, and then the bottleneck APIs are determined according to the two-dimensional dependency matrix. This determination method has a lower calculation amount, and the determined bottleneck APIs are more accurate, and the use of the heat map is extended. This is one of the important inventive points of the present invention.
[0044] In one embodiment, all the APIs that can be called in the energy Internet marketing service system at least include: financial payment channel APIs, non-financial payment channel APIs, government affairs channel APIs, database APIs, network service APIs, and system APIs.
[0045] For example, the financial payment channel APIs include APIs such as online banking payments and bill inquiries of each bank, the non-financial payment channel APIs include APIs such as WeChat Pay and Alipay Pay, the government affairs channel APIs mainly include APIs such as electricity application, electricity service change, and warranty, the database APIs mainly include the relevant APIs for database operations, such as retrieval, insertion, deletion, etc., the network service APIs are mainly network-related APIs, and the system APIs are system-level APIs.
[0046] In one embodiment, the operation of determining the bottleneck API that affects the performance of the energy Internet marketing service system based on the two-dimensional dependency matrix and the API call heat map is as follows: determine at least one hot API that is called in the API call heat map, determine the ID of the first API whose average call response time is greater than the first threshold among the at least one hot API, look up the ID of the second API that depends on the first API and the ID of the third API that the first API depends on in the two-dimensional dependency matrix based on the ID of the API, and determine whether the second API is a hot API in the API call heat map. If so, determine the number of times the second API is called based on the API call heat map, determine the average value of the call response time of the third API based on the ID of the third API. If the number of times the second API is called is greater than or equal to the second threshold, the second API is the bottleneck API. If the average value of the call response time of the third API is greater than or equal to the third threshold, the third API is the bottleneck API. If the number of times the second API is called is less than the second threshold and the average value of the call response time of the third API is less than the third threshold, the first API is the bottleneck API.
[0047] In the present invention, in order to accurately determine the bottleneck API, first determine the called hot API in the API call heat map, find the ID of the first API whose average call response time is greater than the first threshold among the hot APIs, and then look up the ID of the second API that depends on the first API and the ID of the third API that the first API depends on in the two-dimensional dependency matrix based on this ID, and determine whether the second API is a hot API in the API call heat map. If so, determine the number of times the second API is called based on the API call heat map. If the number of times the second API is called is greater than or equal to the second threshold, the second API is the bottleneck API. The basis for such an operation is that if the call count of the first API is too high, it may be that a certain API depends on the first API. Thus, based on the dependency relationship diagram, the second API that calls the first API is determined, and further determine whether the second API is a hot API, and further determine that its call count is greater than the second threshold. At this time, the second API is the reason for the excessive call of the first API, that is, the reason for the frequent call of the first API is actually the second API, that is, the second API is the bottleneck API. This is another inventive concept of the present invention.
[0048] Then, based on the ID of the third API, determine the average value of the third API call response time. If the average value of the third API call response time is greater than or equal to the third threshold, then the third API is a bottleneck API. If the number of calls to the second API is less than the second threshold and the average value of the third API call response time is less than the third threshold, then the first API is a bottleneck API. The first API depends on the third API. If the response time of the third API is slow, that is, the performance of the third API is low, then the third API is a bottleneck API. That is, it is possible to determine whether it is a bottleneck API based on the response time of the third API. If neither the second nor the third API is the API causing the bottleneck, then the first API itself is the bottleneck API. That is, the present invention proposes different ways to determine the bottleneck API for dependent and dependent APIs, which are determined according to the characteristics of the dependent and dependent APIs, so that the bottleneck API can be determined quickly and accurately, providing a basis for improving system performance. This is another important inventive concept of the present invention.
[0049] It should be noted that the first, second, and third APIs refer to APIs of corresponding types, and there can be multiple APIs. For example, there can be multiple second APIs that depend on the first API. Similarly, there can be multiple third APIs, and for those skilled in the art, the dependent and dependent relationships vary for different monitored APIs.
[0050] In one embodiment, highlight the bottleneck API in the API call heat map and send an alarm message. In one embodiment, the alarm message at least includes: alarm sound, alarm indicator light, alarm text message, alarm WeChat, and alarm email. The alarm can be sent in a hierarchical manner. For example, an emergency alarm will emit an alarm sound and an alarm indicator light, a general alarm will be notified by an alarm text message and alarm WeChat, and a low-level alarm will be notified by email. And so on.
[0051] In one embodiment, the operations for processing the bottleneck API include: if the first API is the bottleneck API, determine whether the throughput rate of the first API is greater than the fourth threshold. If so, construct a first call queue to buffer the services that call the first API. If not, determine whether the error rate of the first API is greater than the fifth threshold. If so, suspend the use of the first API and switch to the backup API of the first API;
[0052] If the second API is a bottleneck API, determine whether the number of times the second API is called is greater than the maximum concurrent number allowed for the second API. If so, when the I / O utilization rate of the current system is less than the sixth threshold, increase the maximum concurrent number allowed for the second API. If not, construct a second call queue to buffer the services that call the second API, and rank the ID of the first API in front of the second call queue;
[0053] If the third API is a bottleneck API, based on the two-dimensional dependency matrix, determine whether the third API depends on the second API. If so, make the second API give priority to processing the call of the third API. If not, restart the service that provides the third API.
[0054] In the present invention, different processing methods for different bottleneck APIs are also proposed. That is, when the API itself is the API that causes the bottleneck, buffer the call based on the throughput rate and error rate or switch to the standby API. When the second API is a bottleneck API, if the system permits, increase its concurrent number as much as possible to speed up the processing. When the third API is a bottleneck API, it is also necessary to determine whether the third API depends on the second API. If it depends on the second API, it means that the dependency relationships of the first, second, and third APIs form a closed loop. At this time, only by making the second API give priority to processing the call of the third API can the bottleneck problem be solved as soon as possible. In addition, restart the service that provides the third API. The present invention proposes different processing methods for different bottleneck APIs, thereby restoring the system performance as soon as possible, which is one of the important inventions of the present invention.
[0055] Figure 2 Fig. shows a monitoring device for APIs in an energy Internet marketing service system of the present invention. The device includes:
[0056] An acquisition unit 201, which acquires all the APIs that can be called in the energy Internet marketing service system and constructs a two-dimensional dependency matrix based on the dependency relationships of the APIs;
[0057] A monitoring unit 202, which monitors the calls of all the APIs and generates a call record for each call. The call record at least includes: the calling application, the ID of the called API, the call time, and the call response time;
[0058] A generating unit 203, which generates an API call heat map based on the call records of all the APIs and marks the average value of the call response time of each API in the API call heat map;
[0059] The processing unit 204 determines the bottleneck APIs that affect the performance of the energy Internet marketing service system based on the two-dimensional dependency matrix and the API call heat map, and processes the bottleneck APIs.
[0060] An important inventive concept of the present invention is to solve the problem of determining bottleneck APIs in the system in the background technology. First, all the APIs that can be called in the energy Internet marketing service system are obtained, and a two-dimensional dependency matrix is constructed based on the dependency relationship of the APIs. Then, the calls of all the APIs are monitored, and each call generates a call record, and an API call heat map is generated. The average value of the call response time of each API is marked in the API call heat map. The bottleneck APIs that affect the performance of the energy Internet marketing service system are determined based on the two-dimensional dependency matrix and the API call heat map, and the bottleneck APIs are processed. That is, the inventive concept of the present invention is to determine the bottleneck APIs that affect the performance of the energy Internet marketing service system based on the two-dimensional dependency matrix and the API call heat map, which solves the technical defects that the existing technologies for determining bottleneck APIs according to dependency trees, artificial intelligence, etc. require large computing resources and have low accuracy. Since the present invention first constructs a two-dimensional dependency matrix of the APIs and then constructs an API call heat map, the hot APIs can be obtained based on the heat map, and then the bottleneck APIs are determined according to the two-dimensional dependency matrix. This determination method has a lower calculation amount, and the determined bottleneck APIs are more accurate, and the use of the heat map is extended, which is one of the important inventive points of the present invention.
[0061] In one embodiment, all the APIs that can be called in the energy Internet marketing service system at least include: financial payment channel APIs, non-financial payment channel APIs, government affairs channel APIs, database APIs, network service APIs, and system APIs.
[0062] For example, the financial payment channel APIs include online banking payments, bill inquiries, etc. of each bank, the non-financial payment channel APIs include WeChat payment, Alipay payment, etc., the government affairs channel APIs mainly include electricity application, electricity service change, warranty, etc., the database APIs mainly include the relevant APIs for database operations, such as retrieval, insertion, deletion, etc., the network service APIs are mainly network-related APIs, and the system APIs are system-level APIs.
[0063] In one embodiment, the operation of determining the bottleneck APIs that affect the performance of the energy Internet marketing service system based on the two-dimensional dependency matrix and the API call heat map is as follows: determine at least one hot API that is called in the API call heat map, determine the ID of the first API whose average call response time is greater than a first threshold among the at least one hot API, look up the ID of the second API that depends on the first API and the ID of the third API that the first API depends on in the two-dimensional dependency matrix based on the ID of the API, and determine whether the second API is a hot API in the API call heat map. If so, determine the number of times the second API is called based on the API call heat map, determine the average call response time of the third API based on the ID of the third API. If the number of times the second API is called is greater than or equal to a second threshold, the second API is a bottleneck API. If the average call response time of the third API is greater than or equal to a third threshold, the third API is a bottleneck API. If the number of times the second API is called is less than the second threshold and the average call response time of the third API is less than the third threshold, the first API is a bottleneck API.
[0064] In the present invention, in order to accurately determine the bottleneck APIs, first determine the called hot APIs in the API call heat map, find the ID of the first API whose average call response time is greater than the first threshold among the hot APIs, and then look up the ID of the second API that depends on the first API and the ID of the third API that the first API depends on in the two-dimensional dependency matrix based on this ID, and determine whether the second API is a hot API in the API call heat map. If so, determine the number of times the second API is called based on the API call heat map. If the number of times the second API is called is greater than or equal to the second threshold, the second API is a bottleneck API. The basis for such an operation is that if the call count of the first API is too high, it may be that a certain API depends on the first API. Thus, based on the dependency relationship graph, the second API that calls the first API is determined, and further determine whether the second API is a hot API, and further determine that its call count is greater than the second threshold. At this time, the second API is the reason for the excessive call of the first API, that is, the reason for the frequent call of the first API is actually the second API, that is, the second API is a bottleneck API. This is another inventive concept of the present invention.
[0065] Then, based on the ID of the third API, the average value of the third API call response time is determined. If the average value of the third API call response time is greater than or equal to the third threshold, then the third API is a bottleneck API. If the number of calls to the second API is less than the second threshold and the average value of the third API call response time is less than the third threshold, then the first API is a bottleneck API. The first API depends on the third API. If the response time of the third API is slow, that is, the performance of the third API is low, then the third API is a bottleneck API. That is, it is possible to determine whether it is a bottleneck API based on the response time of the third API. If neither the second nor the third API is the API causing the bottleneck, then the first API itself is the bottleneck API. That is, the present invention proposes different ways to determine the bottleneck API for dependent and depended-on APIs, which are determined according to the characteristics of the dependent and depended-on APIs, so as to quickly and accurately determine the bottleneck API and provide a basis for improving system performance. This is another important inventive concept of the present invention.
[0066] It should be noted that the first, second, and third APIs refer to APIs of corresponding types, and there can be multiple APIs. For example, there can be multiple second APIs that depend on the first API. Similarly, there can be multiple third APIs, and for those skilled in the art, the dependent and depended-on relationships vary for different monitored APIs.
[0067] In one embodiment, the bottleneck API is highlighted in the API call heat map and an alarm message is sent. In one embodiment, the alarm message at least includes: alarm sound, alarm indicator light, alarm text message, alarm WeChat, and alarm email. The alarm can be sent in a hierarchical manner. For example, an emergency alarm will emit an alarm sound and an alarm indicator light, a general alarm is notified by an alarm text message and alarm WeChat, and a low-level alarm is notified by email. And so on.
[0068] In one embodiment, the operations for processing the bottleneck API include: if the first API is the bottleneck API, then determine whether the throughput rate of the first API is greater than the fourth threshold. If so, construct a first call queue to buffer the services that call the first API. If not, determine whether the error rate of the first API is greater than the fifth threshold. If so, suspend the use of the first API and switch to the standby API of the first API;
[0069] If the second API is a bottleneck API, determine whether the number of times the second API is called is greater than the maximum concurrent number allowed for the second API. If so, when the I / O utilization rate of the current system is less than the sixth threshold, increase the maximum concurrent number allowed for the second API. If not, construct a second call queue to buffer the services that call the second API, and rank the ID of the first API in front of the second call queue;
[0070] If the third API is a bottleneck API, based on the two-dimensional dependency matrix, determine whether the third API depends on the second API. If so, give priority to the second API to process the call of the third API. If not, restart the service that provides the third API.
[0071] In the present invention, different processing methods for different bottleneck APIs are also proposed. That is, when the API itself is the API that causes the bottleneck, buffer the call based on the throughput rate and error rate or switch to the standby API. When the second API is a bottleneck API, if the system permits, increase its concurrent number as much as possible to speed up the processing. When the third API is a bottleneck API, it is also necessary to determine whether the third API depends on the second API. If it depends on the second API, it means that the dependency relationships of the first, second, and third APIs form a closed loop. At this time, only by giving priority to the second API to process the call of the third API can the bottleneck problem be solved as soon as possible. In addition, restart the service that provides the third API. The present invention proposes different processing methods for different bottleneck APIs, thereby restoring the system performance as soon as possible, which is one of the important inventions of the present invention.
[0072] In an embodiment of the present invention, a computer storage medium is proposed. A computer program is stored on the computer storage medium. When the computer program on the computer storage medium is executed by a processor, the above method is implemented. The computer storage medium can be a hard disk, DVD, CD, flash memory, etc. memory.
[0073] For the convenience of description, the above device is described by dividing it into various units according to functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0074] As can be seen from the description of the above embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the device described in each embodiment or some parts of the embodiments of this application.
[0075] Finally, it should be noted that the above embodiments are only used to illustrate rather than limit the technical solutions of the present invention. Although the present invention has been described in detail with reference to the above embodiments, those of ordinary skill in the art should understand that: the present invention can still be modified or equivalently replaced, and any modification or partial replacement without departing from the spirit and scope of the present invention shall be covered by the scope of the claims of the present invention.
Claims
1. A monitoring method for APIs in an energy Internet marketing service system, characterized in that, The method includes: An obtaining step of obtaining all APIs that can be called in the energy Internet marketing service system, and constructing a two-dimensional dependency matrix based on the dependency relationships of the APIs; A monitoring step of monitoring the calls of all APIs, and generating a call record for each call, where the call record at least includes: the calling application, the ID of the called API, the call time, and the call response time; A generating step of generating an API call heat map based on the call records of all APIs, and marking the average value of the call response time of each API in the API call heat map; A processing step of determining the bottleneck APIs that affect the performance of the energy Internet marketing service system based on the two-dimensional dependency matrix and the API call heat map, and processing the bottleneck APIs.
2. The method according to claim 1, characterized in that, All APIs that can be called in the energy Internet marketing service system at least include: financial payment channel APIs, non-financial payment channel APIs, government affairs channel APIs, database APIs, network service APIs, and system APIs.
3. The method according to claim 2, characterized in that, The operation of determining the bottleneck APIs that affect the performance of the energy Internet marketing service system based on the two-dimensional dependency matrix and the API call heat map is: determining at least one hot API that is called in the API call heat map, determining the ID of the first API whose average call response time is greater than a first threshold among the at least one hot API, searching in the two-dimensional dependency matrix based on the ID of the API for the ID of the second API that depends on the first API and the ID of the third API that the first API depends on, determining whether the second API is a hot API in the API call heat map, if so, determining the number of times the second API is called based on the API call heat map, determining the average value of the call response time of the third API based on the ID of the third API, if the number of times the second API is called is greater than or equal to a second threshold, then the second API is a bottleneck API, if the average value of the call response time of the third API is greater than or equal to a third threshold, then the third API is a bottleneck API, if the number of times the second API is called is less than the second threshold and the average value of the call response time of the third API is less than the third threshold, then the first API is a bottleneck API.
4. The method according to claim 3, wherein Highlight the bottleneck APIs in the API call heat map and issue an alarm message.
5. The method according to claim 4, wherein The alarm message at least includes: alarm sound, alarm indicator light, alarm text message, alarm WeChat, and alarm email.
6. A monitoring device for an API in an energy Internet marketing service system, characterized in that, The device includes: An obtaining unit that obtains all APIs that can be called in the energy Internet marketing service system, and constructs a two-dimensional dependency matrix based on the dependency relationships of the APIs; A monitoring unit that monitors the calls of all APIs, and generates a call record for each call, where the call record at least includes: the calling application, the ID of the called API, the call time, and the call response time; A generating unit generates a heat map of API calls based on the call records of all APIs, and marks the average value of the call response time of each API in the heat map of API calls; A processing unit determines the bottleneck APIs that affect the performance of the energy Internet marketing service system based on the two-dimensional dependency matrix and the heat map of API calls, and processes the bottleneck APIs.
7. The device according to claim 6, characterized in that, All APIs that can be called in the energy Internet marketing service system at least include: financial payment channel APIs, non-financial payment channel APIs, government affairs channel APIs, database APIs, network service APIs, and system APIs.
8. The device according to claim 7, wherein, The operation of determining the bottleneck APIs that affect the performance of the energy Internet marketing service system based on the two-dimensional dependency matrix and the heat map of API calls is as follows: determine at least one hot API that is called in the heat map of API calls, determine the ID of the first API whose average call response time is greater than the first threshold among the at least one hot API, look up the ID of the second API that depends on the first API and the ID of the third API that the first API depends on in the two-dimensional dependency matrix based on the ID of the API, determine whether the second API is a hot API in the heat map of API calls, if so, determine the number of times the second API is called based on the heat map of API calls, determine the average value of the call response time of the third API based on the ID of the third API, if the number of times the second API is called is greater than or equal to the second threshold, then the second API is a bottleneck API, if the average value of the call response time of the third API is greater than or equal to the third threshold, then the third API is a bottleneck API, if the number of times the second API is called is less than the second threshold and the average value of the call response time of the third API is less than the third threshold, then the first API is a bottleneck API.
9. The device according to claim 8, characterized in that, Highlight the bottleneck APIs in the heat map of API calls and send out an alarm message.
10. A computer storage medium, characterized in that, A computer program is stored on the computer storage medium, and when the computer program on the computer storage medium is executed by a processor, the method according to any one of claims 1-5 is implemented.
Citation Information
Patent Citations
Method and device for identifying performance bottleneck of transaction in transaction processing system
CN105335142A
Hot function determination method based on thermodynamic diagram
CN113886251A
Visual monitoring early warning method and system, storage medium and equipment
CN114116398A
API interface performance studying and judging method and system based on link tracking and medium
CN114528196A
Micro-service performance diagnosis method and system based on dependency graph
CN115118621A