Interface calling method, system and equipment

By establishing an interface metadatabase and using inverted indexing, dynamic proxying, distributed tracking and caching technologies, the problems of interface management complexity and high concurrent requests in enterprise information systems are solved, and the stability and performance of the system are improved.

CN119271732AInactive Publication Date: 2025-01-07广州三七极耀网络科技有限公司
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411461333.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-18
Publication Date
2025-01-07
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing technology has complex interface management in enterprise information systems, resulting in high maintenance costs, long development cycles, unstable system performance, and difficulty in effectively monitoring and troubleshooting. Especially when high concurrent asynchronous requests are prone to bottlenecks, affecting the user experience.

Method used

By establishing an interface metadatabase, using inverted indexing technology to obtain candidate interface lists, establishing an interface call routing model, dynamic proxy technology generates call agents, distributed tracking technology performs full-link data analysis, distributed cache technology caches high-frequency interfaces, and Message cluster deployment is used to handle high concurrent requests.

Benefits of technology

It realizes unified management and efficient call of interfaces, improves system stability and reliability, reduces maintenance costs, improves performance monitoring and troubleshooting efficiency, and ensures high concurrent request processing capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119271732A_ABST
    Figure CN119271732A_ABST
Patent Text Reader

Abstract

The invention is applicable to the technical field of computers, and provides an interface calling method which comprises the following steps: establishing an interface metadatabase; obtaining a candidate interface list of the interface calling request from the interface metadatabase by adopting an inverted index technology; based on the target interface, a calling agent of the target interface is generated by adopting a dynamic agent technology, and interface calling is executed; tracking and recording full-link data generated in an interface calling execution process by adopting a distributed tracking technology, and performing interface calling behavior analysis on the full-link data to obtain an analysis result; based on an analysis result, obtaining a high-frequency calling interface in the interface metadatabase, and caching the high-frequency calling interface by adopting a distributed caching technology; for high-concurrency asynchronous interface requests, a message cluster deployment method is adopted to carry out concurrent request processing. According to the method, calling and unified management of the interfaces can be realized, and concurrent execution of asynchronous interface requests can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of computer technology, and in particular, relates to an interface calling method, system and device. Background Art

[0002] In modern enterprise information systems, data interaction and interface management with multiple external systems are often required. As the business scale expands and the system complexity increases, the number of interfaces surges, and the processing logic and response characteristics of different interfaces vary.

[0003] The interface management method of the prior art often develops an interface for each external system separately. This practice not only increases the complexity of the system, but also leads to high maintenance costs and long development cycles. At the same time, due to the dispersion of interfaces and the lack of unified management and monitoring, the overall performance of the system is affected, and it is difficult to ensure the stability and reliability of the system. Secondly, when processing highly concurrent asynchronous requests, due to the lack of effective management and optimization methods, the system is prone to bottlenecks, resulting in response delays and affecting user experience. In addition, due to the different interface processing logics and the lack of unified processing procedures and standards, it is difficult for the system to conduct effective performance monitoring and troubleshooting.

[0004] In summary, there are many technical problems in interface management in current enterprise information systems. These problems not only affect the stability and reliability of the system, but also increase the maintenance cost and development cycle of the system. Summary of the invention

[0005] The embodiments of the present application provide an interface calling method, system and device, which can solve one of the above-mentioned prior art problems.

[0006] In a first aspect, an embodiment of the present application provides an interface calling method, comprising:

[0007] Based on the interface information of each interface, an interface metadata database is established;

[0008] Using an inverted indexing technique, a candidate interface list for an interface call request is obtained from the interface metadata database;

[0009] Establishing an interface call routing model, wherein the interface call routing model is used to select a target interface from the candidate interface list;

[0010] Based on the target interface, a calling proxy of the target interface is generated by using dynamic proxy technology to execute the interface call;

[0011] Distributed tracing technology is used to track and record the full-link data generated during the execution of the interface call, and the interface call behavior analysis is performed on the full-link data to obtain the analysis results;

[0012] Based on the analysis result, the frequently called interfaces in the interface metadata database are obtained, and the frequently called interfaces are cached by using a distributed cache technology;

[0013] For high-concurrency asynchronous interface requests, a message cluster deployment method is used to process concurrent requests.

[0014] Furthermore, the inverted index technology is used to obtain a candidate interface list of the interface call request from the interface metadata database, including:

[0015] Performing semantic analysis on the interface call request to obtain keywords of the interface call request, wherein the keywords include interface name, parameter name and return value type;

[0016] Perform fuzzy matching between the keyword and each interface in the interface metadata database to obtain a candidate interface list.

[0017] Further, the fuzzy matching of the keyword with each interface in the interface metadata database to obtain a candidate interface list includes:

[0018] Based on the keyword, construct a first semantic vector representation of the interface call request;

[0019] Based on the interface metadata database, interface information of each interface is acquired, and based on the interface information, a second semantic vector representation of each of the interface information is constructed;

[0020] Calculating the similarity between the first semantic vector representation and the second vector representation to obtain a matching score between the interface call request and each of the interfaces;

[0021] All the interfaces are sorted based on the matching scores, the first N interfaces with the highest matching scores are selected as candidate interfaces, and a candidate interface list is generated.

[0022] Further, the establishing of an interface call routing model, wherein the interface call routing model is used to select a target interface from the candidate interface list, includes:

[0023] Obtaining interface information of all candidate interfaces and context information of the interface call request;

[0024] Preprocessing the interface information of the candidate interface based on the context information to obtain key features of the candidate interface;

[0025] For the key features of the plurality of candidate interfaces, the plurality of key features are sequentially converted into standardized input data, the plurality of standardized data are sequentially input into a pre-trained interface call routing model, and the score vectors of the candidate interfaces are sequentially output;

[0026] Based on the score vector, the plurality of candidate interfaces are sorted, and a target interface is selected according to a preset priority selection strategy.

[0027] Furthermore, before the calling proxy of the target interface is generated by using the dynamic proxy technology based on the target interface and the interface call is executed, the following steps are included:

[0028] An interface adapter matching the target interface is obtained, wherein the interface adapter is used to convert the request parameters of the interface call request into a data format required by the target interface.

[0029] Furthermore, the distributed tracing technology is used to track and record the full-link data generated during the execution of the interface call, and the interface call behavior analysis is performed on the full-link data to obtain the analysis results, including:

[0030] According to the preset link tracking rules, determine the key nodes of the interface call;

[0031] Implanting tracking code at key nodes of interface calls, generating tracking identifiers, and attaching the tracking identifiers to the interface call requests;

[0032] Based on a preset tracking data structure, the call data of each node is obtained, the call data is associated with the tracking identifier, a call link of the interface call request is formed, and full link data of the call link is obtained;

[0033] The full-link data is mined and analyzed through big data analysis technology to obtain the frequency, duration and performance indicators of the interface call in the interface call request, and generate analysis results.

[0034] Furthermore, the distributed cache technology is used to cache the high-frequency call interface, including:

[0035] Based on the frequency statistics of the interface calls in the analysis results, determine the high-frequency call interface that needs to be cached, and obtain the high-frequency interface information, wherein the high-frequency interface information includes the interface address, call parameters and authentication information;

[0036] The high-frequency interface information is cached using a cache key-value pair method to generate a distributed cache table;

[0037] During the interface call process, the interface information required by the interface call request is preferentially queried from the distributed cache table;

[0038] If the distributed cache table contains high-frequency interface information corresponding to the interface information required by the interface call request, the high-frequency interface information is returned;

[0039] If the high-frequency interface information corresponding to the interface information required by the interface call request does not exist in the distributed cache table, querying the corresponding interface information from the interface metadata database, and synchronizing the interface information to the distributed cache table;

[0040] For the high-frequency calling interface in the distributed cache table, the high-frequency calling interface in the distributed cache table is dynamically updated through a preset cache strategy, and authentication information is generated according to the interface authentication requirement, and the high-frequency interface information is called based on the authentication information.

[0041] Furthermore, for high-concurrency asynchronous interface requests, a message cluster deployment method is used to process concurrent requests, including:

[0042] Based on a preset message structure, encapsulate the asynchronous interface request into a message body, wherein the message body includes interface information and a call status of the asynchronous interface request;

[0043] Determine the message middleware based on the performance requirements of high-concurrency asynchronous interface requests;

[0044] Cluster deployment of the message middleware and setting of multiple node instances;

[0045] Based on a preset partitioning strategy, the message bodies corresponding to the multiple asynchronous interface requests with high concurrency are divided into multiple partitions, and the multiple partitions are distributed to different node instances, so that the multiple asynchronous interface requests are executed concurrently;

[0046] For the message body in each partition, multiple message body replicas are set, and the message body replicas are distributed to different node instances.

[0047] In a second aspect, an embodiment of the present application provides an interface calling system, including:

[0048] The first processing module is used to establish an interface metadata database based on the interface information of each interface;

[0049] The second processing module is used to obtain a candidate interface list of the interface call request from the interface metadata database by using an inverted index technology;

[0050] The third processing module is used to establish an interface call routing model, and the interface call routing model is used to select a target interface from the candidate interface list;

[0051] The fourth processing module is used to generate a calling agent of the target interface based on the target interface by using dynamic proxy technology to execute the interface call;

[0052] The fifth processing module is used to track and record the full-link data generated during the execution of the interface call using distributed tracing technology, perform interface call behavior analysis on the full-link data, and obtain analysis results;

[0053] The sixth processing module is used for obtaining the frequently called interface in the interface metadata database based on the analysis result, and caching the frequently called interface by using the distributed cache technology;

[0054] The seventh processing module: is used to process concurrent requests for highly concurrent asynchronous interface requests using a message cluster deployment method.

[0055] In a third aspect, an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned interface calling method when executing the computer program.

[0056] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0057] The present application discloses an interface calling method. By setting a distributed cache table for high-frequency calling interfaces, during the interface calling process, the interface metadata database and the distributed cache table cooperate with each other to realize the calling and unified management of the interface. At the same time, by adopting distributed tracking technology, it is possible to comprehensively monitor and analyze the data generated by calling the interface in the enterprise information system, thereby improving the practicality of the interface calling method and the validity and security of the data. In addition, by encapsulating asynchronous interface requests as message bodies and distributing and processing them through message middleware, the decoupling between business logic and request processing is achieved, the concurrent execution of asynchronous interface requests is realized, and the interface processing efficiency is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0059] Figure 1 It is a flowchart of an interface calling method provided by an embodiment of the present invention;

[0060] Figure 2 It is a structural diagram of an interface calling system provided by an embodiment of the present invention;

[0061] Figure 3 It is a structural diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0062] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0063] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0064] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0065] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.

[0066] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0067] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0068] See also Figure 1As shown, the present invention is an interface calling method, comprising the following steps:

[0069] S100, establishing an interface metadata database based on the interface information of each interface;

[0070] In this embodiment, a unified interface metadata database is established through centralized interface configuration management, thereby realizing centralized management of interfaces. When the interface information of an interface changes, the centralized interface configuration management center will automatically synchronize the changed interface information to the nodes of each interface call request, thereby ensuring the reliability of the interface information and avoiding integration problems and errors caused by inconsistent interfaces. At the same time, the interface metadata database realizes the documentation of each interface during the interface call process, which is convenient for developers to understand and use the interface, and reduces communication costs and maintenance costs.

[0071] In this embodiment, the interface metadata library can be used to achieve interface standardization and cache interface information, thereby improving the interoperability and scalability of the system, reducing frequent access to the original data source, and improving the response speed and performance of the system. In addition, in high-concurrency scenarios, the interface metadata library can assist in load balancing, optimize resource allocation, ensure the stability and reliability of the interface calling method, and help enterprises better plan and manage interface resources.

[0072] Specifically, the above interface information includes interface name, interface address, interface parameters and return value.

[0073] S200, using an inverted index technology to obtain a candidate interface list for an interface call request from the interface metadata database;

[0074] In this embodiment, in order to improve the efficiency of obtaining the target interface when requesting an interface call, an inverted index technology is used to map the keywords of the interface call request and the interface information in the interface metadata database, thereby quickly locating the interface containing the keywords from the interface metadata database.

[0075] In some embodiments, the step S200 includes:

[0076] Performing semantic analysis on the interface call request to obtain keywords of the interface call request, wherein the keywords include interface name, parameter name and return value type;

[0077] Perform fuzzy matching between the keyword and each interface in the interface metadata database to obtain a candidate interface list.

[0078] In this embodiment, natural language processing technology is used to perform word segmentation and part-of-speech tagging on the interface call request, and keywords in the interface call request are extracted. The interface information such as the function description and interface parameters of each interface are obtained according to the interface metadata database, and the keywords are cryptographically matched with the above interface information to obtain a list of candidate interfaces, thereby improving the accuracy of interface matching and the calling efficiency, thereby ensuring the stable operation of the interface call.

[0079] In some embodiments, the fuzzy matching of the keyword with each interface in the interface metadata database to obtain a candidate interface list includes:

[0080] Based on the keyword, construct a first semantic vector representation of the interface call request;

[0081] Based on the interface metadata database, interface information of each interface is acquired, and based on the interface information, a second semantic vector representation of each of the interface information is constructed;

[0082] Calculating the similarity between the first semantic vector representation and the second vector representation to obtain a matching score between the interface call request and each of the interfaces;

[0083] All the interfaces are sorted based on the matching scores, the first N interfaces with the highest matching scores are selected as candidate interfaces, and a candidate interface list is generated.

[0084] In this embodiment, a first semantic vector representation of the interface call request is constructed based on keywords, and a second semantic vector representation of the interface information is constructed at the same time. The similarity between the first semantic vector representation and the second semantic vector representation is calculated by using cosine similarity to obtain a matching score between the interface call request and each interface. Multiple interfaces are sorted according to the matching scores, and the top N interfaces with the highest matching scores are selected as the most relevant candidate interface list.

[0085] Specifically, if an interface call request is "query user order status", the jieba word segmentation library is used to segment the above interface call request, and the four words "query", "user", "order", and "status" are obtained. HanLP is used for part-of-speech tagging, and "query" is identified as a verb, and "user", "order", and "status" are nouns. The keywords "query", "user", "order", and "status" of the above interface call request after part-of-speech tagging are extracted to construct a first semantic vector representation based on the above keywords. Specifically, the Word2Vec model is used to convert each of the above keywords into a 100-dimensional vector, and the first semantic vector representation of the interface call request is obtained by weighted average of the word vectors. According to the interface metadata database, the function description and interface parameters of each interface are obtained, wherein the interface parameters include input parameters and output parameters. For example, the function description of interface A is "obtain user order details", the input parameter is "user ID", and the output parameter is "order status, order amount", etc. The same Word2Vec model is used to convert the interface description and interface parameters into a second semantic vector representation. The cosine similarity is used to calculate the similarity between the first semantic vector representation and the second semantic vector representation to obtain a matching score, and then the candidate interfaces are sorted according to the matching score, and the top three interfaces with the highest matching scores are selected as the most relevant candidate interface list, such as interface A, interface C, and interface D.

[0086] S300, establishing an interface call routing model, wherein the interface call routing model is used to select a target interface from the candidate interface list;

[0087] In this embodiment, the interface information of the candidate interface is associated with the interface call request through the interface call routing model, and the target interface that best meets the interface call request is selected from multiple candidate interfaces. This can significantly improve the efficiency of interface retrieval and the accuracy of interface calls, thereby enhancing the stability and reliability of the enterprise information system that applies the interface call method and improving the practicality of interface calls.

[0088] In some embodiments, the step S300 includes:

[0089] Obtaining interface information of all candidate interfaces and context information of the interface call request;

[0090] Preprocessing the interface information of the candidate interface based on the context information to obtain key features of the candidate interface;

[0091] For the key features of the plurality of candidate interfaces, the plurality of key features are sequentially converted into standardized input data, the plurality of standardized data are sequentially input into a pre-trained interface call routing model, and the score vectors of the candidate interfaces are sequentially output;

[0092] Based on the score vector, the plurality of candidate interfaces are sorted, and a target interface is selected according to a preset priority selection strategy.

[0093] In this embodiment, after obtaining the interface information of the candidate interface and the context information of the interface call request, they are preprocessed, such as removing stop words, word segmentation, part-of-speech tagging, etc., and extracting key features to obtain key features such as request time, requester IP, request parameters, etc. The above key features are converted into standardized input data through a normalization method. The standardized input data is used as the input data of the pre-trained interface call routing model, which can eliminate the format differences between different data sources, making the data preprocessing process simpler and more unified. At the same time, it can reduce the impact of data noise and outliers on model training, thereby improving the accuracy of the model. The standardized input data format helps the interface call routing model to better learn the inherent laws and characteristics of the data and process more types of data inputs, thereby enhancing the generalization ability of the model.

[0094] In this embodiment, the pre-trained interface call routing model uses historical request data as a training data set during training to build and optimize the interface call routing model. Specifically, during the model training process, we set the following key parameters: feature dimension: 50, indicating that 50 key features were extracted from the historical request data during model training; learning rate: 0.5, the learning rate determines the magnitude of the model parameter update in each iteration, and has an important impact on the training speed and effect of the model. Maximum depth: 7, where the maximum depth refers to the maximum depth of the decision tree, which helps to control the complexity of the model and the risk of overfitting. Based on the above key parameters, after 100 rounds of iterative training, we obtained an optimal interface call routing model. The interface call routing model outputs a score vector of candidate interfaces, which is sorted from high to low according to the score, and the interface with the highest score is selected as the optimal target interface.

[0095] In a preferred embodiment, the preset priority selection strategy is to sort the values ​​of the score vector from high to low, and select the candidate interface with the highest score vector as the target interface. If there are multiple candidate interfaces corresponding to the highest value of the score vector, a selection is made based on the sorting order of each candidate interface's response time, availability, etc. to obtain the optimal target interface.

[0096] In some embodiments, the above interface call method is also provided with an interface call current limiting strategy, which limits or diverts requests that exceed the call current limiting threshold of the target interface, reduces the request queuing and waiting time caused by too many requests, helps to reduce the request delay, and can avoid service interruption or degradation caused by too many requests, which helps to maintain the continuity and stability of the service. In addition, it can resist the behavior of malicious attackers trying to paralyze the system by sending a large number of requests, which helps to enhance the security of the enterprise information system using the interface call method, protect the system from malicious attacks and destruction, and reduce the risk of data leakage and abuse. Specifically, the call current limiting threshold of the target interface is obtained, and it is determined whether the number of times the current request calls the target interface exceeds the above call current limiting threshold. If the call current limiting threshold is exceeded, the current limiting strategy is triggered, and the corresponding interface call request is added to the cache queue and processed when the target interface is idle; or the service is directly rejected, and a prompt of "the service is busy, please try again later" is returned; the backup downgrade service can also be called to reduce the pressure on the target interface. If the call current limiting threshold is not exceeded, the target interface is called, the request parameters are passed in, and the return result is sent to the requester.

[0097] S400, based on the target interface, using dynamic proxy technology to generate a call proxy for the target interface, and executing an interface call;

[0098] In this embodiment, dynamic proxy technology is used to dynamically generate a proxy object according to the definition of the target interface. The target interface is implemented through the proxy object, and additional logic or operations can be executed when its method is called. When the method of the proxy object is called, the dynamic proxy mechanism is triggered, the preset proxy logic is executed, and the real implementation method of the target interface is finally called. Specifically, through Java's Proxy class and InvocationHandler interface, the proxy class of the target interface is dynamically generated at runtime, and the interface call is intercepted to implement functions such as logging and performance monitoring.

[0099] In some embodiments, before the above step S400, the following steps are included:

[0100] An interface adapter matching the target interface is obtained, wherein the interface adapter is used to convert the request parameters of the interface call request into a data format required by the target interface.

[0101] In this embodiment, the corresponding interface adapter is selected according to the type of the target interface, the request parameters of the interface call request are converted into the JSON or XML format required for the target interface call, and encapsulated to facilitate the generation of a call agent for the target interface and implement the call to the target interface.

[0102] In this embodiment, the interface adapter can also perform verification and encryption on the request parameters of the interface call request to ensure the validity and security of the data.

[0103] S500, using distributed tracing technology to track and record the full-link data generated during the execution of the interface call, performing interface call behavior analysis on the full-link data, and obtaining analysis results;

[0104] In this embodiment, distributed tracing technology is used to capture data generated by the interface calling process in real time. By performing data mining and analysis on the captured data, analysis results such as interface performance indicators and abnormal conditions are obtained. By analyzing the interface, the interface design is dynamically adjusted or the interface calling strategy is optimized, which is beneficial to improving the overall performance of the interface calling method.

[0105] In some embodiments, the step S500 includes:

[0106] According to the preset link tracking rules, determine the key nodes of the interface call;

[0107] Implanting tracking code at key nodes of interface calls, generating tracking identifiers, and attaching the tracking identifiers to the interface call requests;

[0108] Based on a preset tracking data structure, the call data of each node is obtained, the call data is associated with the tracking identifier, a call link of the interface call request is formed, and full link data of the call link is obtained;

[0109] The full-link data is mined and analyzed through big data analysis technology to obtain the frequency, duration and performance indicators of the interface call in the interface call request, and generate analysis results.

[0110] In this embodiment, in the process of implementing link tracking for interface calls, it is necessary to establish link tracking rules based on the system architecture and business processes of the enterprise information system, analyze the calling relationships between different interfaces, determine the key nodes that have a greater impact on the interface call performance and fault diagnosis, such as core service interfaces, database operations, etc., and implant tracking codes in key nodes, such as using AspectJ or bytecode enhancement technology in Java applications to perform aspect interception on the target method. When the tracking code is executed, a globally unique 64-bit tracking identifier is generated using the UUID algorithm based on parameters such as node information and timestamps, and the tracking identifier is attached to the interface call request. In a preferred embodiment, the above-mentioned interface call request can be attached to the request header of the target interface and passed together with the request. When the request reaches the next node, the node extracts the tracking identifier from the request header and associates it with the call data of this node. The call data includes the node name, processing time, etc.

[0111] In one embodiment, the above-mentioned call data is stored in a preset tracking data storage in the form of key-value. After the current node processes the request, if a new downstream call needs to be initiated, the tracking identifier is added to the request header of the new interface call request, and the interface call request is sent to the downstream node. Through the transmission and association records of the tracking identifier, the call data distributed on each node are connected in series. By collecting the call data and tracking identifiers of each node, and forming a complete call link based on the timestamp and call sequence, the full link data of the call link can be obtained.

[0112] In this embodiment, the preset tracking data storage includes the tracking data structure of each node, wherein the tracking data structure includes the call time, input parameters, output parameters, abnormal information and other key data fields of the node corresponding interface, and reserves an extension field. During the node processing process, the processing time, input parameters, output parameters and other key data of the node are recorded in real time, and these data are filled into the preset tracking data structure through the extension field.

[0113] In this embodiment, if an exception occurs during the call process of the node corresponding interface, the detailed information of the exception is recorded in the exception information field of the tracking data structure, including the exception type, exception description, exception stack, etc. The filled tracking data structure is associated with the tracking identifier to form a complete tracking record, and the tracking record is written to the preset tracking data storage. The tracking records in the tracking data storage are indexed, and a mapping relationship between the tracking identifier and the tracking record is established to quickly retrieve the corresponding tracking record according to the node tracking identifier. The tracking data storage is regularly analyzed and counted, and node processing performance reports, exception analysis reports, etc. are generated to provide data support for enterprise information system optimization and problem location.

[0114] In this embodiment, tracking data within a preset time range is obtained from the tracking data storage, and for the obtained tracking data, the tracking identifier of each tracking data is extracted, and the tracking data with the same tracking identifier is grouped into the same group; for each group of tracking data, the node data therein is extracted, and the interface call information contained in the node data is obtained, including the call timestamp, the call method name, the call parameters, etc.; according to the call timestamp in the node data, the node data of each group of tracking data is sorted in chronological order to obtain a node data sequence arranged in the call order; for the sorted node data sequence, according to the interface call information contained therein, the call relationship of each node is associated to reconstruct a complete interface call link; for the reconstructed interface call link, the response time of each node is calculated, that is, the time difference from the initiation of each interface call to the return result; for the reconstructed interface call link, the number of calls within a certain period of time is counted, and the throughput index of each node is calculated according to the number of calls and the time interval, and the analysis result is generated based on the above number of calls, time interval, response time and throughput index.

[0115] In one embodiment, the preset time range is from 0:00 on May 1, 2023 to 24:00 on May 7, 2023, then all the tracking data generated within this week are queried and obtained from the tracking data storage. For the obtained tracking data, the tracking identifier of each data, such as TraceId, is extracted, and the tracking data with the same tracking identifier is grouped according to the tracking identifier, and the tracking data with the same tracking identifier is divided into the same group. Then, for each group of tracking data, the node data therein is extracted, and the interface call information contained in the node data is obtained, including the call timestamp, the call method name, the call parameters, etc. For example, a certain tracking data group contains 3 nodes, corresponding to the calls of interfaces A, B, and C respectively, then the timestamp of each node, the name of the called interface, and the passed parameters are extracted. According to the call timestamp in the node data, the node data of each group of tracking data is sorted in chronological order to obtain a node data sequence arranged in the call order. For the sorted node data sequence, according to the interface call information contained therein, the call relationship of each node is associated to reconstruct a complete interface call link. If node A calls the interface in node B, and node B calls the interface in node C, then the call link A->B->C is reconstructed. For the reconstructed interface call link, calculate the response time of each node, that is, the time difference from the initiation of each interface call to the return result. For example, if the initiation time of node A is T1 and the time when node B returns the result is T2, then the response time of node A is T2-T1. For the reconstructed interface call link, count the number of calls within a certain period of time, and calculate the throughput index of each node based on the number of calls and time interval.

[0116] S600, based on the analysis result, obtaining the frequently called interface in the interface metadata database, and caching the frequently called interface by using a distributed cache technology;

[0117] In this embodiment, by setting a distributed cache table for high-frequency call interfaces, during the interface call process, the interface metadata database and the distributed cache table cooperate with each other to implement the call and unified management of the interface.

[0118] In some embodiments, the step S600 includes:

[0119] Based on the frequency statistics of the interface calls in the analysis results, determine the high-frequency call interface that needs to be cached, and obtain the high-frequency interface information, wherein the high-frequency interface information includes the interface address, call parameters and authentication information;

[0120] The high-frequency interface information is cached using a cache key-value pair method to generate a distributed cache table;

[0121] During the interface call process, the interface information required by the interface call request is preferentially queried from the distributed cache table;

[0122] If the distributed cache table contains high-frequency interface information corresponding to the interface information required by the interface call request, the high-frequency interface information is returned;

[0123] If the high-frequency interface information corresponding to the interface information required by the interface call request does not exist in the distributed cache table, querying the corresponding interface information from the interface metadata database, and synchronizing the interface information to the distributed cache table;

[0124] For the high-frequency calling interface in the distributed cache table, the high-frequency calling interface in the distributed cache table is dynamically updated through a preset cache strategy, and authentication information is generated according to the interface authentication requirement, and the high-frequency interface information is called based on the authentication information.

[0125] In this embodiment, by caching high-frequency call interfaces, the required interface information can be preferentially queried from the distributed cache table during the interface call process, thereby significantly reducing the number of direct accesses to the interface metadata database, improving the response speed and efficiency of the enterprise information system, and further improving the interface call performance. In addition, the introduction of the distributed cache table enables the enterprise information system to expand the cache capacity to cope with the problem of a surge in the number of interfaces caused by the expansion of business scale and the increase in system complexity, thereby improving the scalability and flexibility of the system.

[0126] In this embodiment, the high-frequency call interface in the distributed cache table is dynamically updated through a preset cache strategy. Specifically, within the preset cache time, the call frequency of the high-frequency call interface in the distributed cache table is counted, and the high-frequency call interface and cache capacity in the distributed cache table are dynamically adjusted to balance the cache cost and query efficiency, and continuously optimize the cache performance of the high-frequency call interface.

[0127] In this embodiment, when caching high-frequency interface information, authentication information is also generated according to the interface authentication requirements. This approach ensures that only authorized users or systems can call the corresponding interface, thereby enhancing the security of interface calls.

[0128] S700. For highly concurrent asynchronous interface requests, a message cluster deployment method is used to process concurrent requests.

[0129] In some embodiments, the step S700 includes:

[0130] Based on a preset message structure, encapsulate the asynchronous interface request into a message body, wherein the message body includes interface information and a call status of the asynchronous interface request;

[0131] Determine the message middleware based on the performance requirements of high-concurrency asynchronous interface requests;

[0132] Cluster deployment of the message middleware and setting of multiple node instances;

[0133] Based on a preset partitioning strategy, the message bodies corresponding to the multiple asynchronous interface requests with high concurrency are divided into multiple partitions, and the multiple partitions are distributed to different node instances, so that the multiple asynchronous interface requests are executed concurrently;

[0134] For the message body in each partition, multiple message body replicas are set, and the message body replicas are distributed to different node instances.

[0135] In this embodiment, in order to cope with high-concurrency asynchronous interface requests generated by the business expansion of the enterprise information system, message middleware and cluster deployment are introduced, so that the system can be horizontally expanded as needed to cope with the growing number of concurrent requests without making major adjustments to the core business logic of the enterprise information system.

[0136] In this embodiment, by encapsulating the asynchronous interface request as a message body based on a preset message structure, the interface calling method can flexibly handle different types of asynchronous requests, and also facilitates unified management and maintenance of different asynchronous requests.

[0137] In this embodiment, by using message middleware to process highly concurrent asynchronous interface requests, the load on the system when directly processing these requests can be significantly reduced, thereby improving overall performance and throughput.

[0138] In this embodiment, the determination process of the message middleware needs to evaluate the performance requirements of the enterprise information system, and select the most appropriate message middleware according to the specific system requirements to ensure the efficient and stable operation of the system. Specifically, if the system has high requirements for throughput and data persistence, Kafka is selected as the message middleware to improve the system's processing power and data backup capabilities, thereby meeting the performance evaluation and reliability considerations of high-concurrency asynchronous interface requests; if it is necessary to support multiple message routing modes and flexible queue management, RabbitMQ is used, and by configuring RabbitMQ's multiple exchange types and queue parameters, complex message processing scenarios can be implemented to meet the requirements of scalability analysis.

[0139] In this embodiment, in order to ensure the high availability and load balancing of the message middleware, the message middleware is deployed in a cluster, and distributed storage and redundant backup of messages are realized by configuring multiple node instances. In addition, according to the data characteristics and access mode of the message middleware, a reasonable partitioning strategy is designed so that high-concurrency requests can be effectively distributed to different node instances for processing, avoiding single-point overload and further improving the system's processing capacity and response speed.

[0140] In this embodiment, multiple copies are set for the message body in each partition, and these copies are distributed to different node instances, which effectively prevents the data loss problem caused by a single point of failure. Even if a node fails, the copies on other nodes can continue to ensure the integrity and consistency of the data. In addition, in a preferred embodiment, the copy mechanism also provides the ability to recover data. Once a node returns to normal, data can be synchronized from the copies on other nodes to ensure the continuous and stable operation of the system.

[0141] In this embodiment, the status and progress of all asynchronous interface requests can be centrally managed and monitored through the message middleware, which makes it convenient for operation and maintenance personnel to discover problems and handle them in a timely manner. At the same time, the call status information contained in the message body enables the system to clearly track the processing process of each request, thereby providing more accurate monitoring and alarm functions.

[0142] In this embodiment, by encapsulating the asynchronous interface request as a message body and distributing and processing it through the message middleware, the decoupling between the business logic and the request processing is achieved, the concurrent execution of the asynchronous interface requests is realized, and the interface processing efficiency is improved.

[0143] See also Figure 2 As shown, the present invention also provides an interface calling system, the system comprising:

[0144] The first processing module 201 is used to establish an interface metadata database based on the interface information of each interface;

[0145] The second processing module 202 is used to obtain a candidate interface list of the interface call request from the interface metadata database by using an inverted index technology;

[0146] The third processing module 203 is used to establish an interface call routing model, and the interface call routing model is used to select a target interface from the candidate interface list;

[0147] The fourth processing module 204 is used to generate a calling proxy of the target interface based on the target interface by using a dynamic proxy technology, and execute an interface call;

[0148] The fifth processing module 205 is used to track and record the full-link data generated during the execution of the interface call using a distributed tracking technology, perform interface call behavior analysis on the full-link data, and obtain analysis results;

[0149] The sixth processing module 206 is used to obtain the frequently called interface in the interface metadata database based on the analysis result, and cache the frequently called interface by using a distributed cache technology;

[0150] The seventh processing module 207 is used to process concurrent requests for highly concurrent asynchronous interface requests using a message cluster deployment method.

[0151] It is understandable that if Figure 1 The contents of the interface calling method embodiment shown in the figure are applicable to the interface calling system embodiment. The functions specifically implemented by the interface calling system embodiment are similar to those in the embodiment shown in the figure. Figure 1 The interface calling method embodiment shown is the same as that shown in FIG. Figure 1 The beneficial effects achieved by the interface calling method embodiment shown are also the same.

[0152] It should be noted that the information interaction, execution process and other contents between the above-mentioned systems are based on the same concept as the embodiment of the method of the present invention. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0153] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the system can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0154] See also Figure 3 As shown, an embodiment of the present invention further provides a computer device 3, comprising: a memory 302 and a processor 301 and a computer program 303 stored in the memory 302. When the computer program 303 is executed on the processor 301, an interface calling method as described in any one of the above methods is implemented.

[0155] The computer device 3 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The computer device 3 may include, but is not limited to, a processor 301 and a memory 302. Those skilled in the art will appreciate that Figure 3 It is only an example of computer device 3 and does not constitute a limitation on computer device 3. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components, for example, it may also include input and output devices, network access devices, etc.

[0156] The processor 301 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0157] In some embodiments, the memory 302 may be an internal storage unit of the computer device 3, such as a hard disk or memory of the computer device 3. In other embodiments, the memory 302 may also be an external storage device of the computer device 3, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device 3. Further, the memory 302 may also include both an internal storage unit of the computer device 3 and an external storage device. The memory 302 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program, etc. The memory 302 may also be used to temporarily store data that has been output or is to be output.

[0158] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the interface calling method described in any one of the above methods is implemented.

[0159] In this embodiment, if the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium can at least include: any entity or device that can carry the computer program code to the camera / computer device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. For example, USB flash drive, mobile hard disk, disk or optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0160] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. An interface calling method, characterized in that: include: Based on the interface information of each interface, an interface metadata database is established; Using an inverted indexing technique, a candidate interface list for an interface call request is obtained from the interface metadata database; Establishing an interface call routing model, wherein the interface call routing model is used to select a target interface from the candidate interface list; Based on the target interface, a calling proxy of the target interface is generated by using dynamic proxy technology to execute the interface call; Distributed tracing technology is used to track and record the full-link data generated during the execution of the interface call, and the interface call behavior analysis is performed on the full-link data to obtain the analysis results; Based on the analysis result, the frequently called interfaces in the interface metadata database are obtained, and the frequently called interfaces are cached by using a distributed cache technology; For high-concurrency asynchronous interface requests, a message cluster deployment method is used to process concurrent requests.

2. The method according to claim 1, characterized in that The adopting of the inverted index technology to obtain a candidate interface list of the interface call request from the interface metadata database includes: Performing semantic analysis on the interface call request to obtain keywords of the interface call request, wherein the keywords include interface name, parameter name and return value type; Perform fuzzy matching between the keyword and each interface in the interface metadata database to obtain a candidate interface list.

3. The method according to claim 2, characterized in that The fuzzy matching of the keyword with each interface in the interface metadata database to obtain a candidate interface list includes: Based on the keyword, construct a first semantic vector representation of the interface call request; Based on the interface metadata database, interface information of each interface is acquired, and based on the interface information, a second semantic vector representation of each of the interface information is constructed; Calculating the similarity between the first semantic vector representation and the second semantic vector representation to obtain a matching score between the interface call request and each of the interfaces; All the interfaces are sorted based on the matching scores, the first N interfaces with the highest matching scores are selected as candidate interfaces, and a candidate interface list is generated.

4. The method according to claim 1, characterized in that The establishing of an interface call routing model, wherein the interface call routing model is used to select a target interface from the candidate interface list, comprises: Obtaining interface information of all candidate interfaces and context information of the interface call request; Preprocessing the interface information of the candidate interface based on the context information to obtain key features of the candidate interface; For the key features of the plurality of candidate interfaces, the plurality of key features are sequentially converted into standardized input data, the plurality of standardized data are sequentially input into a pre-trained interface call routing model, and the score vectors of the candidate interfaces are sequentially output; Based on the score vector, the plurality of candidate interfaces are sorted, and a target interface is selected according to a preset priority selection strategy.

5. The method according to claim 1, characterized in that Before the calling agent of the target interface is generated based on the target interface by using the dynamic proxy technology and the interface calling is executed, the method includes: An interface adapter matching the target interface is obtained, wherein the interface adapter is used to convert the request parameters of the interface call request into a data format required by the target interface.

6. The method according to claim 1, characterized in that The distributed tracing technology is used to track and record the full-link data generated during the execution of the interface call, and the interface call behavior analysis is performed on the full-link data to obtain the analysis results, including: According to the preset link tracking rules, determine the key nodes of the interface call; Implanting tracking code at key nodes of interface calls, generating tracking identifiers, and attaching the tracking identifiers to the interface call requests; Based on a preset tracking data structure, the call data of each node is obtained, the call data is associated with the tracking identifier, a call link of the interface call request is formed, and full link data of the call link is obtained; The full-link data is mined and analyzed through big data analysis technology to obtain the frequency, duration and performance indicators of the interface call in the interface call request, and generate analysis results.

7. The method according to claim 1, characterized in that The distributed cache technology is used to cache the high-frequency call interface, including: Based on the frequency statistics of the interface calls in the analysis results, determine the high-frequency call interface that needs to be cached, and obtain the high-frequency interface information, wherein the high-frequency interface information includes the interface address, call parameters and authentication information; The high-frequency interface information is cached using a cache key-value pair method to generate a distributed cache table; During the interface call process, the interface information required by the interface call request is preferentially queried from the distributed cache table; If the distributed cache table contains high-frequency interface information corresponding to the interface information required by the interface call request, the high-frequency interface information is returned; If the high-frequency interface information corresponding to the interface information required by the interface call request does not exist in the distributed cache table, querying the corresponding interface information from the interface metadata database, and synchronizing the interface information to the distributed cache table; For the high-frequency calling interface in the distributed cache table, the high-frequency calling interface in the distributed cache table is dynamically updated through a preset cache strategy, and authentication information is generated according to the interface authentication requirement, and the high-frequency interface information is called based on the authentication information.

8. The method according to claim 1, characterized in that The method for processing concurrent requests using a message cluster deployment method for high-concurrency asynchronous interface requests includes: Based on a preset message structure, encapsulate the asynchronous interface request into a message body, wherein the message body includes interface information and a call status of the asynchronous interface request; Determine the message middleware based on the performance requirements of high-concurrency asynchronous interface requests; Cluster deployment of the message middleware and setting of multiple node instances; Based on a preset partitioning strategy, the message bodies corresponding to the multiple asynchronous interface requests with high concurrency are divided into multiple partitions, and the multiple partitions are distributed to different node instances, so that the multiple asynchronous interface requests are executed concurrently; For the message body in each partition, multiple message body replicas are set, and the message body replicas are distributed to different node instances.

9. An interface calling system, characterized in that: include: The first processing module is used to establish an interface metadata database based on the interface information of each interface; The second processing module is used to obtain a candidate interface list of the interface call request from the interface metadata database by adopting an inverted index technology; The third processing module is used to establish an interface call routing model, and the interface call routing model is used to select a target interface from the candidate interface list; The fourth processing module is used to generate a calling agent of the target interface based on the target interface by using dynamic proxy technology to execute the interface call; The fifth processing module is used to track and record the full-link data generated during the execution of the interface call using distributed tracing technology, perform interface call behavior analysis on the full-link data, and obtain analysis results; The sixth processing module is used for obtaining the frequently called interface in the interface metadata database based on the analysis result, and caching the frequently called interface by using the distributed cache technology; The seventh processing module: is used to process concurrent requests for highly concurrent asynchronous interface requests using a message cluster deployment method.

10. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Task processing method, device and system

    CN107766129A

  • A database distributed caching system and method

    CN109033292A

  • Program interface information recommendation method and device, electronic equipment and readable medium

    CN114385780A

  • API interface performance studying and judging method and system based on link tracking and medium

    CN114528196A

  • Distributed task scheduling method and device, electronic equipment and storage medium

    CN114625533A