CN111338829A - Method and device for calling remote procedure call service - Google Patents
Method and device for calling remote procedure call service Download PDFInfo
- Publication number
- CN111338829A CN111338829A CN202010224776.7A CN202010224776A CN111338829A CN 111338829 A CN111338829 A CN 111338829A CN 202010224776 A CN202010224776 A CN 202010224776A CN 111338829 A CN111338829 A CN 111338829A
- Authority
- CN
- China
- Prior art keywords
- service
- calling
- remote procedure
- target service
- gateway
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/547—Remote procedure calls [RPC]; Web services
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/71—Version control; Configuration management
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention discloses a method and a device for calling a remote procedure call service, wherein the method comprises the following steps: detecting the working state of the gateway, initializing the calling interfaces of one or more remote process calling services in advance according to the working state, and storing the initialized interface objects into a local cache of the gateway; and responding to a calling request of a target service, and calling the target service according to the interface object stored in the local cache. By the method, the initialization of the calling interface of the remote process calling service is automatically triggered according to the working state of the gateway, so that the calling can be quickly completed after the calling request is received, the time consumption of service calling is reduced, and the stability of externally provided service is favorably maintained.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for calling a remote procedure call service.
Background
Remote Procedure Call (RPC) is a protocol that requests services from a Remote computer program over a network without knowledge of the underlying network technology. RPC uses a client/server model, the requesting program is a client and the service provider is a server. A simple scenario for RPC service invocation is as follows: two servers A, B, one application is deployed on the a server, and it is desired to call the function/method provided by the application on the B server, because the two applications are not in a memory space, they cannot be called directly, and further, the semantics of the call and the data of the call are expressed through the network.
However, in practice, the RPC service calling process may cause a timeout or even a failure of the service call due to a long time consumption for creating a service object, initializing a service interface, and the like, which may cause a jolt to the external service, and seriously affect the stability of the service.
Disclosure of Invention
In view of the above, embodiments of the present invention are proposed to provide a method and apparatus for invoking a remote procedure call service that overcome or at least partially solve the above-mentioned problems.
According to an aspect of an embodiment of the present invention, there is provided a method for invoking a remote procedure call service, including:
detecting the working state of the gateway, initializing the calling interfaces of one or more remote process calling services in advance according to the working state, and storing the initialized interface objects into a local cache of the gateway;
and responding to a calling request of a target service, and calling the target service according to the interface object stored in the local cache.
Optionally, the pre-initializing the call interfaces of the one or more remote procedure call services according to the working state further includes:
if the working state is the starting state, sequentially reading the configuration information of each remote procedure call service from a configuration database of the gateway;
and aiming at any remote procedure call service, initializing a call interface of the remote procedure call service according to the configuration information of the remote procedure call service.
Optionally, the pre-initializing the call interfaces of the one or more remote procedure call services according to the working state further includes:
if the working state is the running state, sequentially reading the configuration information of each remote procedure call service from a configuration database of the gateway at regular time;
judging whether a newly added remote procedure call service exists or not according to the configuration information; and if so, initializing a calling interface of the newly added remote procedure calling service according to the configuration information of the newly added remote procedure calling service.
Optionally, the initializing the call interfaces of the one or more remote procedure call services in advance, and storing the initialized interface objects in the local cache of the gateway further includes:
for any remote procedure call service, obtaining server list information for providing the remote procedure call service from a configuration server in a remote procedure call framework; and storing the server list information into a local cache of the gateway.
Optionally, the invoking processing for the target service according to the interface object stored in the local cache further includes:
judging whether an interface object corresponding to the target service exists in a local cache or not; and if so, using the interface object corresponding to the target service to call the target service.
Optionally, the invoking processing for the target service according to the interface object stored in the local cache further includes:
if the interface object corresponding to the target service does not exist in the local cache, further judging whether the configuration information of the target service exists in a configuration database of the gateway or not;
and calling the target service according to the judgment result.
Optionally, the invoking processing for the target service according to the determination result further includes:
if the configuration information of the target service does not exist, acquiring the configuration information of the target service and writing the configuration information into a configuration database of the gateway; and initializing a calling interface of the target service, and calling the target service by using the initialized interface object of the target service.
Optionally, the invoking processing for the target service according to the determination result further includes:
if the configuration information of the target service exists, initializing a calling interface of the target service, and calling the target service by using an initialized interface object of the target service.
Optionally, the remote procedure call framework used by the remote procedure call service is a high-speed service framework.
According to another aspect of the embodiments of the present invention, there is provided an invoking device of a remote procedure call service, including:
detecting the working state of the gateway, initializing the calling interfaces of one or more remote process calling services in advance according to the working state, and storing the initialized interface objects into a local cache of the gateway;
and responding to a calling request of a target service, and calling the target service according to the interface object stored in the local cache.
Optionally, the pre-initializing the call interfaces of the one or more remote procedure call services according to the working state further includes:
if the working state is the starting state, sequentially reading the configuration information of each remote procedure call service from a configuration database of the gateway;
and aiming at any remote procedure call service, initializing a call interface of the remote procedure call service according to the configuration information of the remote procedure call service.
Optionally, the pre-initializing the call interfaces of the one or more remote procedure call services according to the working state further includes:
if the working state is the running state, sequentially reading the configuration information of each remote procedure call service from a configuration database of the gateway at regular time;
judging whether a newly added remote procedure call service exists or not according to the configuration information; and if so, initializing a calling interface of the newly added remote procedure calling service according to the configuration information of the newly added remote procedure calling service.
Optionally, the initializing the call interfaces of the one or more remote procedure call services in advance, and storing the initialized interface objects in the local cache of the gateway further includes:
for any remote procedure call service, obtaining server list information for providing the remote procedure call service from a configuration server in a remote procedure call framework; and storing the server list information into a local cache of the gateway.
Optionally, the invoking processing for the target service according to the interface object stored in the local cache further includes:
judging whether an interface object corresponding to the target service exists in a local cache or not; and if so, using the interface object corresponding to the target service to call the target service.
Optionally, the invoking processing for the target service according to the interface object stored in the local cache further includes:
if the interface object corresponding to the target service does not exist in the local cache, further judging whether the configuration information of the target service exists in a configuration database of the gateway or not;
and calling the target service according to the judgment result.
Optionally, the invoking processing for the target service according to the determination result further includes:
if the configuration information of the target service does not exist, acquiring the configuration information of the target service and writing the configuration information into a configuration database of the gateway; and initializing a calling interface of the target service, and calling the target service by using the initialized interface object of the target service.
Optionally, the invoking processing for the target service according to the determination result further includes:
if the configuration information of the target service exists, initializing a calling interface of the target service, and calling the target service by using an initialized interface object of the target service.
Optionally, the remote procedure call framework used by the remote procedure call service is a high-speed service framework.
According to still another aspect of the embodiments of the present invention, there is provided a server including: the system comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus;
the memory is used for storing at least one executable instruction, and the executable instruction enables the processor to execute the operation corresponding to the calling method of the remote procedure calling service.
According to a further aspect of the embodiments of the present invention, there is provided a computer storage medium, in which at least one executable instruction is stored, where the executable instruction causes a processor to execute an operation corresponding to the method for invoking the remote procedure call service.
According to the method and the device for calling the remote procedure call service, the calling interfaces of one or more RPC services are triggered to be initialized in advance by detecting the working state of the gateway, and the initialized interface objects are stored in the local cache of the gateway, so that the preheating of all the currently registered RPC services is completed; and after receiving a call request of the target service, carrying out call processing according to the interface object in the local cache, wherein if the interface object of the target service is stored in the local cache, the interface object can be directly used without initializing for calling after receiving the call request. Therefore, according to the scheme of the embodiment, the RPC service is preheated in advance, so that the time consumed for initializing the call interface is reduced, and the stability of providing the service to the outside can be improved.
The foregoing description is only an overview of the technical solutions of the embodiments of the present invention, and the embodiments of the present invention can be implemented according to the content of the description in order to make the technical means of the embodiments of the present invention more clearly understood, and the detailed description of the embodiments of the present invention is provided below in order to make the foregoing and other objects, features, and advantages of the embodiments of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the embodiments of the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a flow chart illustrating a method for invoking a remote procedure call service provided by an embodiment of the present invention;
FIG. 2 is a flow diagram illustrating a method for invoking a remote procedure call service provided by another embodiment of the present invention;
FIG. 3 is a schematic diagram illustrating an architecture of a calling device of a remote procedure call service provided by an embodiment of the present invention;
fig. 4 shows a schematic structural diagram of a server provided in an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
Fig. 1 is a flowchart illustrating a method for invoking a remote procedure call service according to an embodiment of the present invention. The method is executed by a gateway of the RPC service provider and is used in the gateway of the provider to process a call request sent from the gateway of the RPC service user.
As shown in fig. 1, the method comprises the steps of:
step S110: detecting the working state of the gateway, initializing the calling interfaces of one or more remote procedure calling services in advance according to the working state, and storing the initialized interface objects into a local cache of the gateway.
Wherein, the gateway is the gateway of the service provider.
Specifically, the gateway of the service provider detects its own working state, and determines a calling interface that needs to be initialized in advance according to the working state, where the calling interface that needs to be initialized in advance refers to a calling interface for which a corresponding interface object is not stored in the local cache. The working states of the gateways are different, and the groups of corresponding interface objects needing to be initialized in advance are also different, wherein the calling interfaces of the whole RPC service need to be initialized when the gateway is started; when the gateway is in operation, only the call interface of the incremental RPC service needs to be initialized.
Further, the initialization processing is performed in advance, compared with the occasion that the initialization processing is performed on the call interface of the corresponding RPC service after the call request is received in the prior art, in this embodiment, the initialization processing of the call interface is automatically triggered according to the working state of the gateway. After the calling interfaces are initialized and the initialized interface objects are stored in the local cache of the gateway, the initialized interface objects corresponding to all currently registered RPC services of the service provider are stored in the local cache of the gateway, namely, the preheating of all currently registered RPC services is completed.
Step S120: and responding to the calling request of the target service, and calling the target service according to the interface object stored in the local cache.
Wherein, the call request of the target service is the call request sent from the gateway of the RPC service user. The target service belongs to one of the RPC services available by the service provider.
After the gateway of the service provider receives the call request of the target service sent from the gateway of the service user, the gateway of the service provider can perform call processing according to the interface object stored in the local cache, wherein if the interface object of the target service is stored in the local cache, the call can be directly performed. Compared with the mode that the corresponding calling interface is initialized for calling after each calling request is received in the prior art, the time consumption for calling can be reduced.
It should be noted that, in the embodiment of the present invention, the service provider and the service user are both opposite, and call any two parties of the RPC service of the other party, and when the RPC service of the other party is called, the party is the service user; when the RPC service is provided for the other party, the other party is the service provider. In addition, according to the scheme of the embodiment of the invention, any gateway which can be used as one party of the service provider initializes the calling interface of the RPC service provided by the gateway in advance for direct use when calling.
According to the method for calling the remote procedure call service, the calling interfaces of one or more RPC services are triggered to be initialized in advance by detecting the working state of the gateway, and the initialized interface objects are stored in the local cache of the gateway, so that the preheating of all the currently registered RPC services is completed; and after receiving a call request of the target service, carrying out call processing according to the interface object in the local cache, wherein if the interface object of the target service is stored in the local cache, the interface object can be directly used without initializing for calling after receiving the call request. Therefore, according to the scheme of the embodiment, the RPC service is preheated in advance, so that the time consumed for initializing the call interface is reduced, and further, stable service can be provided; and the scheme can complete stable calling of the service without human intervention.
Fig. 2 is a flowchart illustrating a method for invoking a remote procedure call service according to another embodiment of the present invention. As shown in fig. 2, the method comprises the steps of:
step S210: detecting the working state of the gateway, initializing the calling interfaces of one or more remote procedure calling services in advance according to the working state, and storing the initialized interface objects into a local cache of the gateway.
Specifically, the gateway of the service provider detects the working state of the gateway, and triggers and executes initialization processing in a corresponding mode according to the working state of the gateway, so as to complete preheating of all currently registered RPC services of the service provider. The working state of the gateway and the corresponding initialization processing mode are as follows:
case one, the startup state.
And if the working state of the gateway is the starting state, sequentially reading the configuration information of each remote procedure call service from the configuration database of the gateway. The configuration database stores the configuration data of the gateway, and the configuration information of all the currently registered RPC services of the service provider is recorded in the configuration database. And the working state of the gateway is a starting state, namely the gateway is just started or just restarted, the local cache of the gateway is emptied at the moment, all the calling interfaces of the RPC services need to be initialized, the configuration information of each RPC service is read from the configuration database of the gateway, and the calling interfaces of the remote procedure calling services are initialized according to the configuration information of the remote procedure calling services subsequently aiming at any remote procedure calling service. Through the method, the initialization of the call interfaces of all the currently registered RPC services is triggered when the gateway is in the starting state, so that the full preheating of the stock RPC services is realized.
Case two, run state.
And if the working state of the gateway is the running state, sequentially reading the configuration information of each remote procedure call service from the configuration database of the gateway at regular time. The working state of the gateway is the running state, namely the gateway is in the normal continuous running process, and in the process, the configuration information of the RPC service in the configuration database is read at regular time through the timer, so that the full RPC service at the moment can be determined. And judging whether a newly added remote procedure call service exists according to the configuration information, wherein the newly added PRC service is an incremental RPC service, specifically, the newly added PRC service does not exist in the previous reading result, and the RPC service corresponding to the newly added read configuration information comprises that the RPC service is not read in the previous timing period and is read in the current timing period, or. The last time the data is in the starting state, the data is not read, and the current timing cycle is read. And if the newly added remote procedure call service exists, initializing a call interface of the newly added remote procedure call service according to the configuration information of the newly added remote procedure call service. In the embodiment of the invention, a specific mode for judging whether the new RPC service exists according to the read configuration information is not limited, when the method is actually implemented, the read configuration information can be compared with the read record of the previous time, and if the read configuration information of the current time is not included in the read record of the previous time, the new RPC service exists; or, the timestamp of the configuration database is added to the plurality of pieces of configuration information read this time, and the configuration information is compared with the time of the previous reading, and if the configuration information with the timestamp later than the time of the previous reading exists, it is determined that the newly added RPC service exists. In addition, if the fact that the newly added RPC service does not exist is judged, the fact that the service is not newly added in the stage of reading the time from the previous time is indicated, and the need of initialization processing does not exist. Through the mode, when the gateway is in the running state, the newly added RPC service is triggered and judged at regular time, and the initialization processing of the call interface of the newly added RPC service is aimed at, so that the call interface of the newly added RPC service is initialized in time, interface objects stored in the local cache are more comprehensive, and the direct use of calling of more RPC services is facilitated.
Further, when performing initialization processing, for any remote procedure call service, obtaining server list information providing the remote procedure call service from a configuration server in a remote procedure call framework; and storing the server list information into a local cache of the gateway. Any RPC service is any RPC service which needs to be preheated, in the case of a starting state, the RPC service which needs to be preheated is the RPC service corresponding to all the read configuration information, and in the case of an operating state, the RPC service which needs to be preheated is the newly added RPC service. And, the remote call framework refers to the RPC framework used by the service provider itself, which may be any existing RPC framework, not to mention here. In some optional embodiments, the remote procedure call framework is an HSF (High-speed service framework).
Recording a server list providing each RPC service in a config server (configuration server) of an RPC frame, immediately and remotely acquiring corresponding server list information from the config server of the RPC frame after determining the RPC service needing to be preheated, and storing the server list into a local cache for direct use during calling; the server list information is one of the attributes contained in the interface object and needs to be acquired from a remote place, and other attributes of the service object, such as an object name, an interface name, a parameter name and the like, are determined by an RPC framework. In practice, in the initialization process of the call interface of the RPC service, the server list information needs to be obtained remotely, and the time consumption is often fluctuated due to the influence of many factors.
Step S220: and responding to the calling request of the target service, and judging whether an interface object corresponding to the target service exists in the local cache. If yes, go to step S230; if not, go to step S240.
The target service belongs to the RPC service that the service provider of this embodiment can provide.
And when the service user application has a calling requirement, initiating SDK calling to the public network gateway, sending the related request data to the gateway of the service user application by the SDK, sending the related request data to the gateway of the service provider by the gateway of the service user application through a private line, and receiving the calling request of the target service by the gateway of the service provider at the moment.
Specifically, after the gateway of the service provider receives the call request of the target service, the gateway of the service provider determines whether an interface object corresponding to the target service is stored in the local cache, and if the interface object exists in the local cache, the initialization process may be omitted, and step S230 is executed to directly use the interface object of the target service in the local cache; otherwise, if the local cache does not exist, step S240 is executed to perform initialization and call.
Step S230: and calling the target service by using the interface object corresponding to the target service.
If the interface object corresponding to the target service exists in the local cache, the interface object can be directly used for calling, and response data are returned to the service provider application after the calling is completed.
Step S240: judging whether the configuration information of the target service exists in a configuration database of the gateway or not; and calling the target service according to the judgment result.
Generally, the issue process of the RPC service includes a development process, a pre-issue process (which may be understood as an analog issue process before issue) and a production process from front to back, and the operating environment of the RPC service is, correspondingly, an issue environment, a pre-issue environment and a production environment. And after the RPC service enters the pre-sending flow, a real call request is simulated to carry out service call, and the requirement of initialization begins to exist at the moment.
Specifically, if an interface object corresponding to the target service does not exist in the local cache, it indicates that the interface object cannot be directly called, and at this time, it is further determined whether configuration information of the target service exists in a configuration database of the gateway, so as to discover the target service as quickly as possible and acquire server list information to perform interface initialization processing.
Further, if the configuration database of the gateway does not contain the configuration information of the target service, it indicates that the target service has not been called in the gateway, that is, the target service is called for the first time currently, more specifically, the target service is called for the first time in a pre-sending environment, and at this time, the configuration information of the target service is obtained and written into the configuration database of the gateway; and initializing the calling interface of the target service, and calling the target service by using the initialized interface object of the target service. By the above manner, for the condition that the target service is first called in the pre-sending environment, on one hand, the configuration information is acquired and written into the configuration database, so that the gateway can subsequently find the configuration information of the newly added target service and preheat the newly added target service; on the other hand, the server list information for providing the target service is obtained from the config server for the call.
If the configuration information of the target service exists in the configuration database of the gateway, the target service is not called for the first time. And the time period T from entering the pre-sending flow to entering the production flow is usually longer than the timing duration T0 for finding the newly added RPC service by periodically reading the configuration information by the gateway, and if the call is a call of the production environment, the target service should be preheated, and the corresponding interface object can be found in the local cache, so that the call can only be a non-first call of the pre-sending environment, more specifically, the time interval T1 between the call request and the first call request is shorter than the timing duration T0 for finding the newly added RPC service by periodically reading the configuration information by the gateway, the newly added target service is not found in time by the gateway and is preheated, and the interface object corresponding to the target service still does not exist in the local cache. In this case, the call interface of the target service is initialized, and the call process for the target service is performed using the initialized interface object of the target service. By the method, the server list information providing the target service is directly acquired from the config server for calling the target service under the condition that the target service is not called for the first time in the pre-sending environment but is not preheated.
It should be noted that, in this step, the above descriptions are all directed to the calling situation of the RPC service that is pre-sent and then enters into production, and in this case, the gateway reads the configuration information regularly during the preheating process and finds that the newly added RPC service is the RPC service that is called for the first time in the pre-sent environment.
In yet other alternative embodiments of the invention, the following special cases may occur: some RPC services skip the pre-production flow and go directly to the production flow, i.e. the RPC service goes directly to the official production without simulating the production. In view of the above special circumstances, in these optional embodiments, after determining that the interface object of the target service does not exist in the local cache, further determining a current operating environment of the target service, and if the operating environment is a pre-distribution environment, indicating that the distribution of the target service does not skip the pre-distribution process, at this time, processing may be performed according to the step of further determining whether the configuration information of the target service exists in the configuration database of the gateway and the subsequent steps. If the target service is a production environment, it indicates that the target service is released without a pre-release process, and at this time, a corresponding call processing mode in the production stage should be adopted for processing, where the call processing mode is an existing mode and is not described herein again. Through the optional mode, the special condition that the pre-issued flow is skipped can be avoided, and further, the RPC service of different issued flows can be ensured to adopt a proper calling processing mode.
In addition, in some optional embodiments of the present invention, the gateway background is provided with a configuration information management page of the RPC service for the user to view and/or edit, and the configuration information management page may add configuration information of the newly added RPC service through the configuration information management page on the basis of the implementation manner of the automatic warm-up and call provided in the foregoing, so that the gateway can find a more comprehensive RPC service in time, and further can perform the warm-up comprehensively, or delete configuration information of the RPC service that cannot be provided externally through the configuration information management page, thereby avoiding the occurrence of invalid call. By this alternative embodiment, automation is combined with manual operation to improve the accuracy of preheating.
According to the method for calling the remote procedure call service, the calling interfaces of one or more RPC services are triggered to be initialized in advance by detecting the working state of the gateway, wherein if the working state is a starting state, the full amount of server list information of the RPC services is remotely acquired from the config server in advance, and if the working state is an operating state, the server list information of newly-added RPC services is remotely acquired from the config server in advance for calling, so that all registered RPC services are preheated in time; after receiving a calling request of the target service, if the interface object corresponding to the target service exists in the local cache, the interface object can be directly used without initializing after receiving the request, so that the calling efficiency is improved; if the interface object corresponding to the target service does not exist in the local cache, a corresponding calling processing mode needs to be further adopted according to whether the configuration information of the target service is stored in the configuration database, and when the configuration information does not exist, the configuration information needs to be obtained and written into the configuration database, so that the gateway can find the newly added RPC service in time and perform initialization processing. Therefore, according to the scheme of the embodiment, the RPC service is preheated in advance, so that long time consumption caused by the fact that the information list of the server is obtained remotely after the call request is received is avoided, and the stability of service call is improved by omitting the initialization process after the request is received; and automatically triggering and detecting the configuration information of the RCP service according to the working state of the gateway, thereby improving the efficiency and the accuracy of service discovery.
Fig. 3 is a schematic structural diagram illustrating a calling device of a remote procedure call service according to an embodiment of the present invention. As shown in fig. 3, the apparatus includes:
the initialization module 310 is adapted to detect a working state of the gateway, initialize one or more call interfaces of the remote procedure call service in advance according to the working state, and store an initialized interface object in a local cache of the gateway;
the calling module 320 is adapted to respond to a calling request of a target service, and perform calling processing for the target service according to the interface object stored in the local cache.
In an optional manner, the initialization module is further adapted to:
if the working state is the starting state, sequentially reading the configuration information of each remote procedure call service from a configuration database of the gateway;
and aiming at any remote procedure call service, initializing a call interface of the remote procedure call service according to the configuration information of the remote procedure call service.
In an optional manner, the initialization module is further adapted to:
if the working state is the running state, sequentially reading the configuration information of each remote procedure call service from a configuration database of the gateway at regular time;
judging whether a newly added remote procedure call service exists or not according to the configuration information; and if so, initializing a calling interface of the newly added remote procedure calling service according to the configuration information of the newly added remote procedure calling service.
In an optional manner, the initialization module is further adapted to:
for any remote procedure call service, obtaining server list information for providing the remote procedure call service from a configuration server in a remote procedure call framework; and storing the server list information into a local cache of the gateway.
In an alternative manner, the invoking module is further adapted to:
judging whether an interface object corresponding to the target service exists in a local cache or not; and if so, using the interface object corresponding to the target service to call the target service.
In an alternative manner, the invoking module is further adapted to:
if the interface object corresponding to the target service does not exist in the local cache, further judging whether the configuration information of the target service exists in a configuration database of the gateway or not;
and calling the target service according to the judgment result.
In an alternative manner, the invoking module is further adapted to:
if the configuration information of the target service does not exist, acquiring the configuration information of the target service and writing the configuration information into a configuration database of the gateway; and initializing a calling interface of the target service, and calling the target service by using the initialized interface object of the target service.
In an alternative manner, the invoking module is further adapted to:
if the configuration information of the target service exists, initializing a calling interface of the target service, and calling the target service by using an initialized interface object of the target service.
In an alternative, the remote procedure call framework used by the remote procedure call service is a high speed service framework.
An embodiment of the present invention provides a non-volatile computer storage medium, where at least one executable instruction is stored in the computer storage medium, and the computer executable instruction may execute a method for invoking a remote procedure invocation service in any of the above method embodiments.
Fig. 4 is a schematic structural diagram of a server according to an embodiment of the present invention, and the specific embodiment of the present invention does not limit the specific implementation of the server.
As shown in fig. 4, the server may include: a processor (processor)402, a Communications Interface 404, a memory 406, and a Communications bus 408.
Wherein: the processor 402, communication interface 404, and memory 406 communicate with each other via a communication bus 408. A communication interface 404 for communicating with network elements of other devices, such as clients or other servers. The processor 402, configured to execute the program 410, may specifically perform relevant steps in the above-described calling method embodiment of the remote procedure call service for a server.
In particular, program 410 may include program code comprising computer operating instructions.
The processor 402 may be a central processing unit CPU, or an application specific Integrated circuit asic, or one or more Integrated circuits configured to implement an embodiment of the present invention. The server comprises one or more processors, which can be the same type of processor, such as one or more CPUs; or may be different types of processors such as one or more CPUs and one or more ASICs.
And a memory 406 for storing a program 410. Memory 406 may comprise high-speed RAM memory, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
The program 410 may specifically be configured to cause the processor 402 to perform the following operations:
detecting the working state of the gateway, initializing the calling interfaces of one or more remote process calling services in advance according to the working state, and storing the initialized interface objects into a local cache of the gateway;
and responding to a calling request of a target service, and calling the target service according to the interface object stored in the local cache.
In an alternative, the program 410 causes the processor 402 to:
if the working state is the starting state, sequentially reading the configuration information of each remote procedure call service from a configuration database of the gateway;
and aiming at any remote procedure call service, initializing a call interface of the remote procedure call service according to the configuration information of the remote procedure call service.
In an alternative, the program 410 causes the processor 402 to:
if the working state is the running state, sequentially reading the configuration information of each remote procedure call service from a configuration database of the gateway at regular time;
judging whether a newly added remote procedure call service exists or not according to the configuration information; and if so, initializing a calling interface of the newly added remote procedure calling service according to the configuration information of the newly added remote procedure calling service.
In an alternative, the program 410 causes the processor 402 to:
for any remote procedure call service, obtaining server list information for providing the remote procedure call service from a configuration server in a remote procedure call framework; and storing the server list information into a local cache of the gateway.
In an alternative, the program 410 causes the processor 402 to:
judging whether an interface object corresponding to the target service exists in a local cache or not; and if so, using the interface object corresponding to the target service to call the target service.
In an alternative, the program 410 causes the processor 402 to:
if the interface object corresponding to the target service does not exist in the local cache, further judging whether the configuration information of the target service exists in a configuration database of the gateway or not;
and calling the target service according to the judgment result.
In an alternative, the program 410 causes the processor 402 to:
if the configuration information of the target service does not exist, acquiring the configuration information of the target service and writing the configuration information into a configuration database of the gateway; and initializing a calling interface of the target service, and calling the target service by using the initialized interface object of the target service.
In an alternative, the program 410 causes the processor 402 to:
if the configuration information of the target service exists, initializing a calling interface of the target service, and calling the target service by using an initialized interface object of the target service.
In an alternative, the remote procedure call framework used by the remote procedure call service is a high speed service framework.
The algorithms or displays presented herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. In addition, embodiments of the present invention are not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of embodiments of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best modes of embodiments of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the embodiments of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that is, the claimed embodiments of the invention require more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functionality of some or all of the components according to embodiments of the present invention. Embodiments of the invention may also be implemented as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing embodiments of the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. Embodiments of the invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names. The steps in the above embodiments should not be construed as limiting the order of execution unless specified otherwise.
Claims (10)
1. A method of invoking a remote procedure call service, comprising:
detecting the working state of the gateway, initializing the calling interfaces of one or more remote process calling services in advance according to the working state, and storing the initialized interface objects into a local cache of the gateway;
and responding to a calling request of a target service, and calling the target service according to the interface object stored in the local cache.
2. The method of claim 1, wherein pre-initializing call interfaces of one or more remote procedure call services according to the operating state further comprises:
if the working state is the starting state, sequentially reading the configuration information of each remote procedure call service from a configuration database of the gateway;
and aiming at any remote procedure call service, initializing a call interface of the remote procedure call service according to the configuration information of the remote procedure call service.
3. The method of claim 1, wherein pre-initializing call interfaces of one or more remote procedure call services according to the operating state further comprises:
if the working state is the running state, sequentially reading the configuration information of each remote procedure call service from a configuration database of the gateway at regular time;
judging whether a newly added remote procedure call service exists or not according to the configuration information; and if so, initializing a calling interface of the newly added remote procedure calling service according to the configuration information of the newly added remote procedure calling service.
4. The method of any one of claims 1-3, wherein the pre-initializing call interfaces of the one or more remote procedure call services and storing the initialized interface objects in a local cache of the gateway further comprises:
for any remote procedure call service, obtaining server list information for providing the remote procedure call service from a configuration server in a remote procedure call framework; and storing the server list information into a local cache of the gateway.
5. The method of any of claims 1-4, wherein the processing the call for the target service according to the interface object stored in the local cache further comprises:
judging whether an interface object corresponding to the target service exists in a local cache or not; and if so, using the interface object corresponding to the target service to call the target service.
6. The method of claim 5, wherein the processing the call for the target service according to the interface object stored in the local cache further comprises:
if the interface object corresponding to the target service does not exist in the local cache, further judging whether the configuration information of the target service exists in a configuration database of the gateway or not;
and calling the target service according to the judgment result.
7. The method of claim 6, wherein the invoking of the target service according to the determination further comprises:
if the configuration information of the target service does not exist, acquiring the configuration information of the target service and writing the configuration information into a configuration database of the gateway; and initializing a calling interface of the target service, and calling the target service by using the initialized interface object of the target service.
8. An invoking device of a remote procedure call service, comprising:
the initialization module is suitable for detecting the working state of the gateway, initializing one or more calling interfaces of the remote procedure calling service in advance according to the working state, and storing an initialized interface object into a local cache of the gateway;
and the calling module is suitable for responding to a calling request of a target service and calling the target service according to the interface object stored in the local cache.
9. A server, comprising: the system comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus;
the memory is configured to store at least one executable instruction that causes the processor to perform an operation corresponding to a calling method of a remote procedure call service as claimed in any one of claims 1-7.
10. A computer storage medium having stored therein at least one executable instruction for causing a processor to perform an operation corresponding to a method of invocation of a remote procedure call service as recited in any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010224776.7A CN111338829B (en) | 2020-03-26 | 2020-03-26 | Calling method and device for remote procedure call service |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010224776.7A CN111338829B (en) | 2020-03-26 | 2020-03-26 | Calling method and device for remote procedure call service |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111338829A true CN111338829A (en) | 2020-06-26 |
CN111338829B CN111338829B (en) | 2023-09-15 |
Family
ID=71184396
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010224776.7A Active CN111338829B (en) | 2020-03-26 | 2020-03-26 | Calling method and device for remote procedure call service |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111338829B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113220485A (en) * | 2021-05-25 | 2021-08-06 | 金蝶软件(中国)有限公司 | Processing method and device for remote procedure call service and readable storage medium |
CN113268360A (en) * | 2021-05-14 | 2021-08-17 | 北京三快在线科技有限公司 | Request processing method, device, server and storage medium |
CN115766885A (en) * | 2022-11-15 | 2023-03-07 | 中国工商银行股份有限公司 | Service preheating method, device, computer equipment, storage medium and program product |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030005127A1 (en) * | 2001-06-29 | 2003-01-02 | International Business Machines Corporation | Method and system for the distributed IP object persistent storage in a large scale network |
CN101410803A (en) * | 2006-01-24 | 2009-04-15 | 思杰***有限公司 | Methods and systems for providing access to a computing environment |
US9442850B1 (en) * | 2008-03-25 | 2016-09-13 | Blue Coat Systems, Inc. | Efficient directory refresh operations in wide area file systems |
CN106998343A (en) * | 2016-01-26 | 2017-08-01 | 阿里巴巴集团控股有限公司 | A kind of remote procedure call processing method, apparatus and system |
CN108093086A (en) * | 2018-01-22 | 2018-05-29 | 微梦创科网络科技(中国)有限公司 | The data transmission method and system of a kind of gateway |
CN108270855A (en) * | 2018-01-15 | 2018-07-10 | 司中明 | A kind of method of platform of internet of things access device |
CN110430275A (en) * | 2019-08-09 | 2019-11-08 | 中国工商银行股份有限公司 | Data processing method, system, calculates equipment and medium at device |
CN110493067A (en) * | 2019-09-05 | 2019-11-22 | ***股份有限公司 | A kind of method and device that API gateway service updates |
CN110784527A (en) * | 2019-10-18 | 2020-02-11 | 三体云智能科技有限公司 | Information management system and method |
-
2020
- 2020-03-26 CN CN202010224776.7A patent/CN111338829B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030005127A1 (en) * | 2001-06-29 | 2003-01-02 | International Business Machines Corporation | Method and system for the distributed IP object persistent storage in a large scale network |
CN101410803A (en) * | 2006-01-24 | 2009-04-15 | 思杰***有限公司 | Methods and systems for providing access to a computing environment |
US9442850B1 (en) * | 2008-03-25 | 2016-09-13 | Blue Coat Systems, Inc. | Efficient directory refresh operations in wide area file systems |
CN106998343A (en) * | 2016-01-26 | 2017-08-01 | 阿里巴巴集团控股有限公司 | A kind of remote procedure call processing method, apparatus and system |
CN108270855A (en) * | 2018-01-15 | 2018-07-10 | 司中明 | A kind of method of platform of internet of things access device |
CN108093086A (en) * | 2018-01-22 | 2018-05-29 | 微梦创科网络科技(中国)有限公司 | The data transmission method and system of a kind of gateway |
CN110430275A (en) * | 2019-08-09 | 2019-11-08 | 中国工商银行股份有限公司 | Data processing method, system, calculates equipment and medium at device |
CN110493067A (en) * | 2019-09-05 | 2019-11-22 | ***股份有限公司 | A kind of method and device that API gateway service updates |
CN110784527A (en) * | 2019-10-18 | 2020-02-11 | 三体云智能科技有限公司 | Information management system and method |
Non-Patent Citations (2)
Title |
---|
杨杰;寇应展;杨永刚;陈财森;: "基于智能客户端的***的设计与开发" * |
许卓明,栗明,董逸生: "基于RPC和基于REST的Web服务交互模型比较分析" * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113268360A (en) * | 2021-05-14 | 2021-08-17 | 北京三快在线科技有限公司 | Request processing method, device, server and storage medium |
CN113220485A (en) * | 2021-05-25 | 2021-08-06 | 金蝶软件(中国)有限公司 | Processing method and device for remote procedure call service and readable storage medium |
CN115766885A (en) * | 2022-11-15 | 2023-03-07 | 中国工商银行股份有限公司 | Service preheating method, device, computer equipment, storage medium and program product |
Also Published As
Publication number | Publication date |
---|---|
CN111338829B (en) | 2023-09-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11570520B2 (en) | Method for data processing and live broadcast system | |
CN111338829A (en) | Method and device for calling remote procedure call service | |
WO2019029457A1 (en) | Method and apparatus for updating application program on client, and electronic device | |
WO2017028697A1 (en) | Method and device for growing or shrinking computer cluster | |
CN108234630B (en) | Data reading method and device based on distributed consistency protocol | |
CN106960054B (en) | Data file access method and device | |
US20130117414A1 (en) | Dynamic Interface to Read Database Through Remote Procedure Call | |
CN110196843B (en) | File distribution method based on container cluster and container cluster | |
CN112988281B (en) | Application starting method and device | |
CN111666113A (en) | Application program starting management method and device, electronic equipment and storage medium | |
WO2019179329A1 (en) | Application program wake-up method and device, terminal and medium | |
CN114827156B (en) | Message scheduling method, device, equipment and storage medium | |
CN112073240A (en) | Blue-green deployment system and method based on registration center component and storage medium | |
WO2020177519A1 (en) | Debugging method executed on smart terminal and software debugging device | |
CN111913764A (en) | Service dependency analysis method, electronic device, and storage medium | |
CN114020340B (en) | Server system and data processing method thereof | |
CN111459619A (en) | Method and device for realizing service based on cloud platform | |
CN111294377B (en) | Dependency network request sending method, terminal device and storage medium | |
CN111200651A (en) | Method, system, device and medium for timed calling of microservice | |
CN111125257B (en) | Dictionary updating method, device, equipment and storage medium | |
CN112689248A (en) | Message processing method and system | |
CN108062224B (en) | Data reading and writing method and device based on file handle and computing equipment | |
CN108769244B (en) | Storage task information acquisition method and related device | |
CN108683612B (en) | Message acquisition method and device | |
WO2024060867A1 (en) | Webpage index information acquisition method and apparatus, computer device, and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |