Remote service invocation methods, devices, electronic equipment and storage media

By using a service interface caching area to obtain and cache service interfaces in remote service calls, the service call process is optimized, the problem of low efficiency in remote service calls is solved, and efficient service calls and system stability are achieved.

CN116166455BActive Publication Date: 2026-03-06INDUSTRIAL AND COMMERCIAL BANK OF CHINA +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-07
Publication Date
2026-03-06

AI Technical Summary

Technical Problem

Existing technologies have low efficiency for remote service calls, especially when using Dubbo's generalized calls, which suffer from long operation times for calling configuration data and unavailability of echo tests.

Method used

By receiving remote service call requests, parsing the call parameters, obtaining the target service interface using the service interface cache area, generating and caching the service interface when necessary, and making calls based on the target service interface, the process of obtaining the service interface is optimized by combining rate limiting rules and metadata monitoring.

Benefits of technology

It improves the efficiency of remote service calls, reduces configuration data operation time, solves the problems of low efficiency and unavailability of echo tests caused by Dubbo generalized calls, and ensures the stability and efficiency of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116166455B_ABST
    Figure CN116166455B_ABST
Patent Text Reader

Abstract

This invention discloses a method, apparatus, electronic device, and storage medium for remote service invocation. Relating to the field of computer technology, the method includes: receiving a remote service invocation request, wherein the remote service invocation request includes at least invocation parameters of a target service, the target service being the service to be invoked by the remote service invocation request; parsing the invocation parameters to obtain a parsing result, wherein the parsing result includes at least service interface information corresponding to the target service; obtaining the target service interface from a service interface cache area based on the parsing result, wherein the service interface cache area is used to store multiple service interfaces, and the target service interface is used to invoke the target service; and invoking the target service based on the target service interface. This invention solves the technical problem of low efficiency in remote service invocation in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and more specifically, to a method, apparatus, electronic device, and storage medium for remote service invocation. Background Technology

[0002] Distributed systems typically employ a unified access layer, where the front-end interfaces of various modules are designed. In the current model, changes to these interfaces require modifications to the access layer code and a restart of the access layer service for the changes to take effect. This coupled access layer interface structure leads to mutual interference between different business modules, making management and maintenance extremely difficult. Furthermore, as the system reaches a certain scale, a basic gateway is needed to handle exception handling, data security, traffic control, and version control, while backend business systems only need to focus on their own business logic. The gateway essentially acts as a front-end layer for the business systems, bringing forward common logic that business systems need to process, avoiding redundant development and improving efficiency. Distributed services internally use RPC (Remote Procedure Call) for inter-service communication and implement service load balancing, fault tolerance, and governance, but they lack a service gateway, preventing the microservice cluster from communicating with external services.

[0003] Dubbo is a high-performance service framework that enables applications to output and input services via high-performance RPC. Currently, Dubbo provides two methods for service calls: direct service interface calls and generic calls. Existing technologies commonly use service gateways, leveraging Dubbo's generic calls to enable external services to communicate with the Dubbo-built service cluster. While generic calls shield external systems from the complexity of microservice internal calls, the complex parameter passing and lengthy configuration data operations during subsequent calls lead to low call efficiency. Furthermore, Dubbo's generic calls can render Dubbo echo testing unavailable.

[0004] There is currently no effective solution to the above problems. Summary of the Invention

[0005] This invention provides a method, apparatus, electronic device, and storage medium for remote service invocation, in order to at least solve the technical problem of low efficiency in remote service invocation in the prior art.

[0006] According to one aspect of the present invention, a remote service invocation method is provided, comprising: receiving a remote service invocation request, wherein the remote service invocation request includes at least invocation parameters of a target service, the target service being the service to be invoked by the remote service invocation request; parsing the invocation parameters to obtain a parsing result, wherein the parsing result includes at least service interface information corresponding to the target service; obtaining a target service interface from a service interface cache area based on the parsing result, wherein the service interface cache area is used to store multiple service interfaces, the target service interface being used to invoke the target service; and invoking the target service based on the target service interface.

[0007] Furthermore, before retrieving the target service interface from the service interface cache area based on the parsing results, metadata information of multiple services is obtained, whereby the metadata information is used to characterize the interface information corresponding to each service; multiple interface files are generated based on the metadata information, whereby each service corresponds to one interface file; the multiple interface files are processed to generate multiple service interfaces, and the multiple service interfaces are stored in the service interface cache area.

[0008] Furthermore, after obtaining the metadata information of multiple services, the root directory is monitored, where the root directory is used to store multiple services; when the first service is detected to exist in the root directory, the metadata information of the first service is obtained, where the first service is a newly added service in the root directory; based on the metadata information of the first service, the service interface corresponding to the first service is generated, and the service interface is stored in the service interface cache area.

[0009] Furthermore, after parsing the call parameters and obtaining the parsing results, the system checks whether the target service meets the rate limiting rules based on the parsing results. The rate limiting rules are used to limit the upper limit of traffic transmission for the target service. If the target service does not meet the rate limiting rules, rate limiting is applied to the target service according to the rate limiting rules.

[0010] Furthermore, the parsing result includes at least a unique identifier for the target service interface. The target service interface is then retrieved from the service interface cache area based on the parsing result, including: detecting whether a service interface corresponding to the unique identifier exists in the service interface cache area; if a service interface corresponding to the unique identifier exists in the service interface cache area, determining the service interface corresponding to the unique identifier as the target service interface; and if a service interface corresponding to the unique identifier does not exist in the service interface cache area, performing a service interface loading operation, wherein the service interface loading operation is used to generate a service interface corresponding to each service based on the metadata information of each service.

[0011] Furthermore, after executing the service interface loading operation, it checks whether the service interface loading operation was successful; if the service interface loading operation was successful, it retrieves the target service interface from the service interface cache area again based on the unique identifier of the target service interface; if the service interface loading operation failed, it is determined that the target service interface does not exist.

[0012] According to another aspect of the present invention, a remote service invocation apparatus is also provided, comprising: a receiving module, configured to receive a remote service invocation request, wherein the remote service invocation request includes at least invocation parameters of a target service, and the target service is the service to be invoked by the remote service invocation request; a parsing module, configured to parse the invocation parameters to obtain a parsing result, wherein the parsing result includes at least service interface information corresponding to the target service; an obtaining module, configured to obtain a target service interface from a service interface cache area based on the parsing result, wherein the service interface cache area is used to store multiple service interfaces, and the target service interface is used to invoke the target service; and an invocation module, configured to invoke the target service based on the target service interface.

[0013] According to another aspect of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer-readable storage medium, and the computer program is configured to execute the above-described remote service invocation method at runtime.

[0014] According to another aspect of the present invention, an electronic device is also provided, the electronic device including one or more processors; a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors are configured to run the programs, wherein the programs are configured to execute the remote service invocation method described above during runtime.

[0015] According to another aspect of the present invention, a computer program product is also provided, including a computer program / instruction, which, when executed by a processor, implements the remote service invocation method described above.

[0016] In this embodiment of the invention, the target service interface is obtained from the service interface cache area based on the parsing result. First, a remote service call request is received, wherein the remote service call request contains at least the call parameters of the target service, and the target service is the service to be called by the remote service call request. Then, the call parameters are parsed to obtain the parsing result, wherein the parsing result includes at least the service interface information corresponding to the target service. Based on the parsing result, the target service interface is obtained from the service interface cache area, wherein the service interface cache area is used to store multiple service interfaces, and the target service interface is used to call the target service. Finally, the target service is called based on the target service interface.

[0017] In the above process, by determining the target service interface from the service interface cache area, the time for configuration data operations during service calls is reduced, thereby improving the efficiency of remote service calls and solving the technical problem of low efficiency of remote service calls in the existing technology.

[0018] Therefore, the solution provided in this application achieves the purpose of calling the target service based on the target service interface, thereby improving the technical effect of remote service call efficiency and solving the technical problem of low efficiency of remote service call in the prior art. Attached Figure Description

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

[0020] Figure 1 This is a schematic diagram of an optional remote service invocation method according to an embodiment of the present invention;

[0021] Figure 2 This is a schematic diagram of an optional distributed system architecture according to an embodiment of the present invention;

[0022] Figure 3 A flowchart of an optional remote service invocation method according to an embodiment of the present invention;

[0023] Figure 4 A flowchart of an optional gateway startup logic according to an embodiment of the present invention;

[0024] Figure 5 This is a schematic diagram of an optional remote service invocation device according to an embodiment of the present invention;

[0025] Figure 6 A schematic diagram of an optional electronic device according to an embodiment of the present invention. Detailed Implementation

[0026] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0027] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0028] It should be noted that all relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) involved in this invention are information and data authorized by the user or fully authorized by all parties. For example, this system has an interface with the relevant user or organization. Before obtaining relevant information, it needs to send an acquisition request to the aforementioned user or organization through the interface, and obtain the relevant information after receiving consent from the aforementioned user or organization.

[0029] Example 1

[0030] According to an embodiment of the present invention, an embodiment of a remote service invocation method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0031] To facilitate understanding of the technical solutions in this application, the following are specific definitions of some key terms used in this application:

[0032] Gateway service: A gateway service is an API gateway that provides a single access point for service access and acts as a proxy for multiple services. Service gateways enable routing, filtering, and common processing across all services. They shield the underlying communication of services, reducing the complexity of service access and resolving communication issues between heterogeneous systems.

[0033] Generalized invocation: Generalized invocation is used when a service consumer lacks the necessary service interface for some reason, such as a cross-language service interface. If it wants to call a specific Java interface, it cannot write individual API calls according to conventions. Dubbo is not a cross-language RPC framework, but by building a simple Java web project, including the Dubbo JAR file, and using Dubbo's generalized invocation feature, and then returning JSON via the web application, cross-language calls can be achieved. In short, generalized invocation means calling a service even when the caller does not have the service provider's API (SDK) and still receiving the result.

[0034] Compilation phase: The compilation phase refers to the process of handing over source code to a compiler to compile it into a file that a computer can execute. In Java, this means compiling Java code into class files. The compilation phase only performs some translation functions; it does not put the code into memory to run it, but only operates on the code as text, such as checking for errors.

[0035] Runtime: Runtime is the period during which the compiled file is handed over to the computer for execution until the program finishes running. Runtime involves loading the code from the disk into memory and executing it.

[0036] Java Reflection: Java reflection allows you to dynamically obtain information and invoke methods on any object at runtime. This is called Java's reflection mechanism. Simply put, reflection means that a program can obtain information about itself at runtime. In Java, given the name of a class, you can obtain all its information through reflection.

[0037] Figure 1 This is a schematic diagram of a remote service invocation method according to an embodiment of the present invention, such as... Figure 1 As shown, the method includes the following steps:

[0038] Step S101: Receive a remote service call request, wherein the remote service call request contains at least the call parameters of the target service, and the target service is the service to be called by the remote service call request.

[0039] In step S101, the system can receive remote service call requests. In this embodiment, the remote service call requests are received through the system's service gateway, which can be a distributed system.

[0040] Optionally, the service gateway provides functions such as routing, filtering, and common processing, shielding the underlying communication of the service. For example... Figure 2As shown, a heterogeneous system initiates an HTTP service request, which is then distributed to a service gateway cluster via an F5 (F5 solution) load balancer or an Nginx load balancer. The system then selects any one of the service gateways in the cluster to receive the remote service request.

[0041] Optionally, the system's service gateway receives remote service call requests, intercepts the requests through the service gateway's servlet container, and obtains the call parameters of the target service based on the HttpRequest.

[0042] Step S102: Parse the call parameters to obtain the parsing result, wherein the parsing result includes at least the service interface information corresponding to the target service.

[0043] In step S102, as Figure 3 As shown, the parsing results include information such as the interface name, interface address, group, application, version, all method names of the interface, method input parameters, and return results corresponding to the target service. The system obtains the above information by parsing the call parameters of the target service contained in the remote service call request.

[0044] Step S103: Obtain the target service interface from the service interface cache area based on the parsing result. The service interface cache area is used to store multiple service interfaces, and the target service interface is used to call the target service.

[0045] Step S104: Call the target service based on the target service interface.

[0046] In steps S103-S104, the parsing result includes at least a unique identifier for the target service interface. The system retrieves the target service interface from the service interface cache area using this unique identifier. The service interface cache area is a JVM cache area generated when the service gateway starts, storing the service interfaces corresponding to all services. Its static variable type is HashMap, with the key being service name + group + version. After retrieving the target service interface, as follows... Figure 3 As shown, Dubbo's RPC calls to the target service begin based on the target service interface. The remote service address is obtained from the ZooKeeper cluster registration center, and then a remote call is initiated.

[0047] Optional, such as Figure 2 As shown, RPC calls can be made through the service gateway cluster to call services in the distributed service cluster, and the remote service address can be obtained from the cluster center registered with ZooKeeper.

[0048] It should be noted that by determining the target service interface from the service interface cache area, the time spent on configuration data operations during service calls is reduced, thereby improving the efficiency of remote service calls and solving the technical problem of low efficiency in remote service calls in existing technologies. Furthermore, by determining the target service interface from the service interface cache area and calling the target interface, the problem of Dubbo echo testing being unusable due to Dubbo's generic calling method in existing technologies is resolved.

[0049] Based on the scheme defined in steps S101 to S104 above, it can be understood that in this embodiment of the invention, the method of obtaining the target service interface from the service interface cache area based on the parsing result firstly involves receiving a remote service call request, wherein the remote service call request at least includes the call parameters of the target service, and the target service is the service to be called by the remote service call request; then, the call parameters are parsed to obtain the parsing result, wherein the parsing result at least includes the service interface information corresponding to the target service; the target service interface is obtained from the service interface cache area based on the parsing result, wherein the service interface cache area is used to store multiple service interfaces, and the target service interface is used to call the target service; finally, the target service is called based on the target service interface.

[0050] It is noteworthy that, in the above process, by determining the target service interface from the service interface cache area, the time for configuration data operations during service calls is reduced, thereby improving the efficiency of remote service calls and solving the technical problem of low efficiency in remote service calls in the existing technology.

[0051] Therefore, the solution provided in this application achieves the purpose of calling the target service based on the target service interface, thereby improving the technical effect of remote service call efficiency and solving the technical problem of low efficiency of remote service call in the prior art.

[0052] In one optional embodiment, before obtaining the target service interface from the service interface cache area based on the parsing result, the system obtains metadata information of multiple services, wherein the metadata information is used to characterize the interface information corresponding to each service; generates multiple interface files based on the metadata information, wherein each service corresponds to one interface file; processes the multiple interface files to generate multiple service interfaces, and stores the multiple service interfaces in the service interface cache area.

[0053] Optionally, in this embodiment, such as Figure 4As shown, when the service gateway starts, its container initializes, the system calls the Context Refreshed Event hook, registers with the ZooKeeper registry, and obtains node information for all service nodes. This node information includes metadata for each service, such as the interface name, path, method name, method parameters, and return value. Then, it clears the interface files (e.g., .class files) generated during the previous service gateway startup in the classes directory. It then uses JavaAssist to generate new interface files (e.g., .class files) based on the obtained metadata for each service and stores these files in the WEB-INF / classes / * directory. Finally, it uses Java reflection to load these new interface files into the JVM, generating service interfaces for each service and storing them in the JVM's service interface cache area. The static variable type of the JVM's service interface cache area is a HashMap, with the key being the service name, group, and version.

[0054] Optionally, during the service gateway startup process, it's necessary to register with the ZooKeeper registry and retrieve metadata information for each service from it. However, Dubbo's own service registration doesn't actually include this information. Therefore, it's necessary to extend the Dubbo meta-service to register the service's metadata information with the registry. Specifically, this involves designing a registry service node, storing all service nodes in the ` / servermeta` directory. For example, `com.xxx.apiServer` would be stored as ` / servermeta / com.xxx.apiServer`. Metadata information is stored under this node, for example, a JSON object like `[{method:testA,params:[java.lang.String],version:1.0},{method:testA,params:[java.lang.String],version:1.0}]`. Then, the registration interface is extended to register the metadata information simultaneously with service registration.

[0055] It should be noted that by pre-generating the service interface corresponding to each service and storing the service interface in the JVM's service interface cache area, the time for configuration data operations during subsequent service calls is reduced, thereby improving the efficiency of remote service calls.

[0056] Furthermore, after obtaining the metadata information of multiple services, the system monitors the root directory, which is used to store multiple services; when the first service is detected in the root directory, the system obtains the metadata information of the first service, which is a newly added service in the root directory; based on the metadata information of the first service, the system generates the service interface corresponding to the first service and stores the service interface in the service interface cache area.

[0057] Optional, such as Figure 2 As shown, the service gateway cluster can perform service acquisition and monitoring operations on the ZooKeeper registry. After acquiring metadata information for multiple services, when registering with the ZooKeeper registry, the system dynamically monitors the node where the root directory is located. When a new service is added to the root directory, a service interface is generated based on the metadata information of the new service, and the service interface is stored in the service interface cache area.

[0058] Optional, such as Figure 2 As shown, when the system's service gateway starts up, and the container initializes simultaneously, it loads the service configuration file to obtain basic configuration information, including thread pool basic information, rate limiting rules, load balancing strategies, and other information. Then, it initializes the service gateway's servlet container.

[0059] It should be noted that by monitoring the service root directory, newly added services can be discovered in a timely manner, and service interfaces can be generated, reducing the number of failures to retrieve the target service interface from the service interface cache area, thereby improving the efficiency of remote service calls.

[0060] Furthermore, after parsing the call parameters and obtaining the parsing results, the system checks whether the target service meets the rate limiting rules based on the parsing results. The rate limiting rules are used to limit the upper limit of traffic transmission of the target service. If the target service does not meet the rate limiting rules, rate limiting processing is performed on the target service according to the rate limiting rules.

[0061] Optional, such as Figure 3 As shown, after parsing the call parameters and obtaining the parsing results, the system determines whether to apply rate limiting to the target service by checking whether the target service meets the rate limiting rules based on the parsing results. The rate limiting rule is a key consisting of the service name, group, and version, along with a corresponding value (e.g., traffic transmission parameters). If the target service does not meet the rate limiting rules, rate limiting is applied to the target service according to the rules. For example, if the traffic transmission parameter value for the target service is 1000, and the traffic transmission parameter value for the rate limiting rule is 800, then the target service does not meet the rate limiting rules, and rate limiting is applied to the target service.

[0062] It should be noted that by applying rate limiting rules to the target service, when the rate limiting rules are not met, it can be ensured that an anomaly in one microservice will not cause excessive traffic, thereby preventing other microservices from becoming unusable and improving system stability.

[0063] Furthermore, the parsing result includes at least a unique identifier for the target service interface. The target service interface is then retrieved from the service interface cache area based on the parsing result, including: detecting whether a service interface corresponding to the unique identifier exists in the service interface cache area; if a service interface corresponding to the unique identifier exists in the service interface cache area, determining the service interface corresponding to the unique identifier as the target service interface; and if a service interface corresponding to the unique identifier does not exist in the service interface cache area, performing a service interface loading operation, wherein the service interface loading operation is used to generate a service interface corresponding to each service based on the metadata information of each service.

[0064] Optional, such as Figure 3 As shown, when the target service meets the rate limiting rules, the unique identifier of the target service interface included in the parsing result is used to check whether there is a service interface in the service interface cache area that corresponds to the unique identifier. If there is a service interface in the service interface cache area that corresponds to the unique identifier, the service interface corresponding to the unique identifier is determined to be the target service interface, and the target service interface is successfully obtained from the service interface cache area. If there is no service interface in the service interface cache area that corresponds to the unique identifier, a service interface loading operation is performed. The service interface cache area and the service interface are reloaded to obtain the service interface corresponding to the unique identifier.

[0065] Optionally, the above rate limiting is implemented through Sentinel rate limiting interception, and its rate limiting parameters are obtained during container initialization of the service management system. Optionally, the above rate limiting can also be implemented through Hystrix components or self-developed solutions.

[0066] It should be noted that by using the unique identifier of the target service interface included in the parsing result to detect whether there is a service interface in the service interface cache area corresponding to the unique identifier, the system obtains the service interface in a shorter time, thereby improving the efficiency of remote service calls.

[0067] Furthermore, after executing the service interface loading operation, the system checks whether the service interface loading operation was successful. If the service interface loading operation is successful, the system retrieves the target service interface from the service interface cache area again based on the unique identifier of the target service interface. If the service interface loading operation fails, the system determines that the target service interface does not exist.

[0068] Optional, such as Figure 3As shown, after executing the service interface loading operation, the system checks whether the service interface loading operation was successful. If the service interface loading operation is successful, the system retrieves the target service interface from the service interface cache area again based on the unique identifier of the target service interface. If the service interface loading operation fails, the system determines that the target service interface does not exist and returns an exception RPC call.

[0069] It should be noted that by detecting whether the service interface loading operation was successfully executed, the target service interface can be obtained without processing complex parameters. The service interface can be directly reloaded and the target service interface can be obtained from the service interface cache area, which improves the efficiency of remote service calls.

[0070] Therefore, this invention provides a remote service invocation method that improves the efficiency of remote service invocation by determining the target service interface from the service interface cache area, reducing the time spent on configuration data operations during subsequent calls, and solving the technical problem of low efficiency in remote service invocation in existing technologies. By creating a service interface and storing it in the service interface cache area, the service is ultimately invoked using Dubbo's native RPC method, ensuring service performance and avoiding the situation where echo testing is unavailable. Furthermore, by using ZooKeeper event listening, it is ensured that new services do not need to be restarted when they are launched, further improving service invocation efficiency.

[0071] Example 2

[0072] According to an embodiment of the present invention, a remote service invocation device is provided, wherein, Figure 5 A schematic diagram of an optional remote service invocation device according to an embodiment of the present invention, as shown below. Figure 5 As shown, the device includes:

[0073] The receiving module 501 is used to receive a remote service call request, wherein the remote service call request contains at least the call parameters of the target service, and the target service is the service to be called by the remote service call request; the parsing module 502 is used to parse the call parameters to obtain the parsing result, wherein the parsing result includes at least the service interface information corresponding to the target service; the obtaining module 503 is used to obtain the target service interface from the service interface cache area based on the parsing result, wherein the service interface cache area is used to store multiple service interfaces, and the target service interface is used to call the target service; the calling module 504 is used to call the target service based on the target service interface.

[0074] It should be noted that the receiving module 501, parsing module 502, obtaining module 503 and calling module 504 mentioned above correspond to steps S101 to S104 in the above embodiments. The four modules and the corresponding steps implement the same examples and application scenarios, but are not limited to the content disclosed in the above embodiment 1.

[0075] Optionally, the remote service invocation device further includes: a first acquisition module, a first generation module, and a first processing module. The first acquisition module is used to acquire metadata information of multiple services before acquiring the target service interface from the service interface cache area based on the parsing result, wherein the metadata information is used to characterize the interface information corresponding to each service; the first generation module is used to generate multiple interface files based on the metadata information, wherein each service corresponds to one interface file; the first processing module is used to process the multiple interface files to generate multiple service interfaces and store the multiple service interfaces in the service interface cache area.

[0076] Optionally, the remote service invocation device further includes: a monitoring module, a second acquisition module, and a second generation module. The monitoring module monitors the root directory after acquiring metadata information for multiple services, where the root directory stores multiple services. The second acquisition module acquires the metadata information of a first service when it detects the existence of a first service in the root directory, where the first service is a newly added service in the root directory. The second generation module generates a service interface corresponding to the first service based on its metadata information and stores the service interface in a service interface cache area.

[0077] Optionally, the remote service invocation device further includes a first detection module and a second processing module. The first detection module is used to parse the invocation parameters and, after obtaining the parsing result, detect whether the target service meets the rate limiting rules based on the parsing result, wherein the rate limiting rules are used to limit the upper limit of traffic transmission of the target service; the second processing module is used to perform rate limiting processing on the target service according to the rate limiting rules when the target service does not meet the rate limiting rules.

[0078] Optionally, the acquisition module further includes: a second detection module, a first determination module, and a first execution module. The second detection module is used to parse the result, which includes at least a unique identifier of the target service interface, and detect whether a service interface corresponding to the unique identifier exists in the service interface cache area. The first determination module is used to determine the service interface corresponding to the unique identifier as the target service interface when a service interface corresponding to the unique identifier exists in the service interface cache area. The first execution module is used to perform a service interface loading operation when a service interface corresponding to the unique identifier does not exist in the service interface cache area, wherein the service interface loading operation is used to generate a service interface corresponding to each service based on the metadata information of each service.

[0079] Optionally, the remote service invocation device further includes: a third detection module, a third acquisition module, and a second determination module. The third detection module is used to detect whether the service interface loading operation was successfully executed after the service interface loading operation is performed; the third acquisition module is used to retrieve the target service interface from the service interface cache area again based on the unique identifier of the target service interface when the service interface loading operation is successfully executed; the second determination module is used to determine that the target service interface does not exist when the service interface loading operation fails.

[0080] Example 3

[0081] According to another aspect of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer-readable storage medium, and the computer program is configured to execute the above-described remote service invocation method at runtime.

[0082] Example 4

[0083] According to another aspect of the present invention, an electronic device is also provided, wherein, Figure 6 This is a schematic diagram of an optional electronic device according to an embodiment of the present invention, such as... Figure 6 As shown, the electronic device includes one or more processors; and a memory for storing one or more programs, which, when executed by one or more processors, enable the one or more processors to run the programs, wherein the programs are configured to execute the aforementioned remote service invocation method during runtime.

[0084] like Figure 6 As shown, this application embodiment provides an electronic device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs the following steps:

[0085] Receive a remote service call request, wherein the remote service call request contains at least the call parameters of the target service, and the target service is the service to be called by the remote service call request; parse the call parameters to obtain the parsing result, wherein the parsing result includes at least the service interface information corresponding to the target service; obtain the target service interface from the service interface cache area based on the parsing result, wherein the service interface cache area is used to store multiple service interfaces, and the target service interface is used to call the target service; call the target service based on the target service interface.

[0086] Optionally, the processor may also perform the following steps when executing the program: before obtaining the target service interface from the service interface cache area based on the parsing result, obtain metadata information of multiple services, wherein the metadata information is used to characterize the interface information corresponding to each service; generate multiple interface files based on the metadata information, wherein each service corresponds to one interface file; process the multiple interface files to generate multiple service interfaces, and store the multiple service interfaces in the service interface cache area.

[0087] Optionally, the processor may also perform the following steps when executing the program: after obtaining metadata information of multiple services, monitor the root directory, where the root directory is used to store multiple services; when a first service is detected in the root directory, obtain the metadata information of the first service, where the first service is a newly added service in the root directory; generate a service interface corresponding to the first service based on the metadata information of the first service, and store the service interface in the service interface cache area.

[0088] Optionally, the processor may also perform the following steps when executing the program: after parsing the call parameters and obtaining the parsing result, detect whether the target service meets the rate limiting rules based on the parsing result, wherein the rate limiting rules are used to limit the traffic transmission limit of the target service; if the target service does not meet the rate limiting rules, rate limiting processing is performed on the target service according to the rate limiting rules.

[0089] Optionally, the processor, when executing the program, also implements the following steps: the parsing result includes at least a unique identifier of the target service interface; based on the parsing result, the target service interface is obtained from the service interface cache area, including: detecting whether a service interface corresponding to the unique identifier exists in the service interface cache area; if a service interface corresponding to the unique identifier exists in the service interface cache area, determining the service interface corresponding to the unique identifier as the target service interface; if a service interface corresponding to the unique identifier does not exist in the service interface cache area, performing a service interface loading operation, wherein the service interface loading operation is used to generate a service interface corresponding to each service based on the metadata information of each service.

[0090] Optionally, the processor may also perform the following steps when executing the program: after performing the service interface loading operation, check whether the service interface loading operation was successful; if the service interface loading operation was successful, retrieve the target service interface from the service interface cache area again based on the unique identifier of the target service interface; if the service interface loading operation failed, determine that the target service interface does not exist.

[0091] Example 5

[0092] According to another aspect of the present invention, a computer program product is also provided, including a computer program / instruction, which, when executed by a processor, implements the remote service invocation method described above.

[0093] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0094] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0095] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between units or modules may be electrical or other forms.

[0096] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0097] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0098] If the integrated unit is implemented as 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 technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0099] The above are merely preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method of remote service invocation, characterized by, The method comprises: receiving a remote service call request, wherein the remote service call request at least contains a call parameter of a target service, and the target service is a service to be called by the remote service call request; parsing the call parameter to obtain a parsing result, wherein the parsing result at least includes service interface information corresponding to the target service; obtaining a target service interface from a service interface cache area based on the parsing result, wherein the service interface cache area is used to store a plurality of service interfaces, and the target service interface is used to call the target service; calling the target service based on the target service interface; wherein, before obtaining the target service interface from the service interface cache area based on the parsing result, the method further comprises: obtaining metadata information of a plurality of services, wherein the metadata information is used to represent the interface information corresponding to each of the services; generating a plurality of interface files based on the metadata information, wherein each of the services corresponds to one of the interface files; processing a plurality of the interface files to generate a plurality of the service interfaces, and storing the plurality of the service interfaces into the service interface cache area; the parsing result at least includes a unique identifier of the target service interface, and obtaining the target service interface from the service interface cache area based on the parsing result comprises: detecting whether there is a service interface corresponding to the unique identifier in the service interface cache area; when there is a service interface corresponding to the unique identifier in the service interface cache area, determining that the service interface corresponding to the unique identifier is the target service interface; when there is no service interface corresponding to the unique identifier in the service interface cache area, performing a service interface loading operation, wherein the service interface loading operation is used to generate a service interface corresponding to each of the services based on the metadata information of each of the services.

2. The method of claim 1, wherein, After obtaining the metadata information of a plurality of services, the method further comprises: monitoring a root directory, wherein the root directory is used to store a plurality of the services; when it is monitored that there is a first service in the root directory, obtaining metadata information of the first service, wherein the first service is a newly added service in the root directory; generating a service interface corresponding to the first service based on the metadata information of the first service, and storing the service interface into the service interface cache area.

3. The method of claim 1, wherein, After parsing the call parameter to obtain a parsing result, the method further comprises: detecting whether the target service meets a flow limiting rule based on the parsing result, wherein the flow limiting rule is used to limit the upper limit of traffic transmission of the target service; when the target service does not meet the flow limiting rule, performing flow limiting processing on the target service according to the flow limiting rule.

4. The method of claim 1, wherein, After performing the service interface loading operation, the method further comprises: detecting whether the service interface loading operation is successfully performed; when the service interface loading operation is successfully performed, re-obtaining the target service interface from the service interface cache area according to the unique identifier of the target service interface. When the service interface loading operation fails, it is determined that the target service interface does not exist.

5. A remote service invocation apparatus, characterized by, The method comprises the following steps: The receiving module is configured to receive a remote service invocation request, wherein the remote service invocation request comprises at least an invocation parameter of a target service, and the target service is a service to be invoked by the remote service invocation request. The parsing module is configured to parse the invocation parameter to obtain a parsing result, wherein the parsing result comprises at least service interface information corresponding to the target service. The obtaining module is configured to obtain a target service interface from a service interface cache area based on the parsing result, wherein the service interface cache area is configured to store a plurality of service interfaces, and the target service interface is configured to invoke the target service. The calling module is configured to invoke the target service based on the target service interface. The device further comprises a first obtaining module configured to obtain metadata information of a plurality of services before obtaining the target service interface from the service interface cache area based on the parsing result, wherein the metadata information is configured to represent interface information corresponding to each service; a first generating module configured to generate a plurality of interface files based on the metadata information, wherein each service corresponds to an interface file; and a first processing module configured to process the plurality of interface files to generate a plurality of service interfaces, and store the plurality of service interfaces in the service interface cache area. The obtaining module further comprises a second detecting module configured to detect whether a service interface corresponding to a unique identifier of the target service interface exists in the service interface cache area; a first determining module configured to determine that the service interface corresponding to the unique identifier is the target service interface when the service interface corresponding to the unique identifier exists in the service interface cache area; and a first executing module configured to execute a service interface loading operation when the service interface corresponding to the unique identifier does not exist in the service interface cache area, wherein the service interface loading operation is configured to generate a service interface corresponding to each service based on metadata information of each service.

6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the remote service invocation method of any one of claims 1 to 4 when running.

7. An electronic device, comprising: The electronic device comprises one or more processors. The memory is configured to store one or more programs, and the one or more programs enable the one or more processors to implement a program for running when executed by the one or more processors, wherein the program is configured to execute the remote service invocation method of any one of claims 1 to 4 when running.

8. A computer program product comprising computer programs / instructions, characterized in that, The computer program / instruction is executed by the processor to implement the remote service invocation method of any one of claims 1 to 4.

Citation Information

Patent Citations

  • Device suitable for portable storage and transfer of micro-plastic samples

    CN218288587U

  • Registration method and apparatus

    WO2021109640A1