CN111338829B - Calling method and device for remote procedure call service - Google Patents

Calling method and device for remote procedure call service Download PDF

Info

Publication number
CN111338829B
CN111338829B CN202010224776.7A CN202010224776A CN111338829B CN 111338829 B CN111338829 B CN 111338829B CN 202010224776 A CN202010224776 A CN 202010224776A CN 111338829 B CN111338829 B CN 111338829B
Authority
CN
China
Prior art keywords
service
remote procedure
target service
procedure call
calling
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.)
Active
Application number
CN202010224776.7A
Other languages
Chinese (zh)
Other versions
CN111338829A (en
Inventor
周耀华
王小冬
王旭峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Koubei Shanghai Information Technology Co Ltd
Original Assignee
Koubei Shanghai Information Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Koubei Shanghai Information Technology Co Ltd filed Critical Koubei Shanghai Information Technology Co Ltd
Priority to CN202010224776.7A priority Critical patent/CN111338829B/en
Publication of CN111338829A publication Critical patent/CN111338829A/en
Application granted granted Critical
Publication of CN111338829B publication Critical patent/CN111338829B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Abstract

The invention discloses a calling method and a device of a remote procedure call service, wherein the method comprises the following steps: detecting the working state of a gateway, carrying out initialization processing on 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; and responding to a call request of the target service, and performing call processing on 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 procedure call service is automatically triggered according to the working state of the gateway, so that the call can be completed quickly after the call request is received, the time consumption of service call is reduced, and the stability of the external service is maintained.

Description

Calling method and device for remote procedure call service
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 (Remote Procedure Call, RPC for short) is a protocol that requests services from a remote computer program over a network without requiring knowledge of the underlying network technology. The RPC adopts a client/server mode, where the requesting program is a client and the service provider is a server. One simple scenario for RPC service invocation is as follows: two servers A, B, one application deployed on the a server, want to call the functions/methods provided by the application on the B server, and since the two applications are not in one memory space, cannot be directly called, and further express the semantics of the call and communicate the data of the call through the network.
However, in practice, the process of calling the RPC service may cause timeout or even failure of service call due to excessively long time consumption in creating a service object, initializing a service interface, etc., resulting in jolt of providing the service to the outside and seriously affecting the stability of providing the service.
Disclosure of Invention
In view of the foregoing, embodiments of the present invention are provided to provide a method and apparatus for calling a remote procedure call service that overcomes or at least partially solves the foregoing problems.
According to an aspect of an embodiment of the present invention, there is provided a method for calling a remote procedure call service, including:
detecting the working state of a gateway, carrying out initialization processing on 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;
and responding to a call request of the target service, and performing call processing on the target service according to the interface object stored in the local cache.
Optionally, the initializing the call interfaces of the one or more remote procedure call services in advance according to the working state further includes:
if the working state is the starting state, the configuration information of each remote procedure call service is sequentially read from the configuration database of the gateway;
And initializing a call interface of the remote procedure call service according to the configuration information of the remote procedure call service aiming at any remote procedure call service.
Optionally, the initializing the call interfaces of the one or more remote procedure call services in advance according to the working state further includes:
if the working state is the running state, sequentially reading 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 according to the configuration information; if yes, 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.
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, acquiring 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 calling 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; if yes, the interface object corresponding to the target service is used for calling the target service.
Optionally, the calling 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;
and carrying out calling processing aiming at the target service according to the judging result.
Optionally, the performing the call processing for the target service according to the determination result further includes:
if the configuration information of the target service does not exist, the configuration information of the target service is obtained and written into a configuration database of a gateway; and initializing the call interface of the target service, and calling the target service by using the initialized interface object of the target service.
Optionally, the performing the call 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 the 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 embodiment of the present invention, there is provided a calling device of a remote procedure call service, including:
detecting the working state of a gateway, carrying out initialization processing on 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;
and responding to a call request of the target service, and performing call processing on the target service according to the interface object stored in the local cache.
Optionally, the initializing the call interfaces of the one or more remote procedure call services in advance according to the working state further includes:
if the working state is the starting state, the configuration information of each remote procedure call service is sequentially read from the configuration database of the gateway;
And initializing a call interface of the remote procedure call service according to the configuration information of the remote procedure call service aiming at any remote procedure call service.
Optionally, the initializing the call interfaces of the one or more remote procedure call services in advance according to the working state further includes:
if the working state is the running state, sequentially reading 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 according to the configuration information; if yes, 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.
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, acquiring 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 calling 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; if yes, the interface object corresponding to the target service is used for calling the target service.
Optionally, the calling 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;
and carrying out calling processing aiming at the target service according to the judging result.
Optionally, the performing the call processing for the target service according to the determination result further includes:
if the configuration information of the target service does not exist, the configuration information of the target service is obtained and written into a configuration database of a gateway; and initializing the call interface of the target service, and calling the target service by using the initialized interface object of the target service.
Optionally, the performing the call 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 the 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 embodiment of the present invention, there is provided a server including: the device comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete communication with each other 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 call service.
According to still another aspect of the embodiments of the present invention, there is provided a computer storage medium having stored therein at least one executable instruction for causing a processor to perform operations corresponding to a calling method of a remote procedure call service as described above.
According to the method and the device for calling the remote procedure call service, the working state of the gateway is detected to trigger the call interfaces of one or more RPC services to be initialized in advance, and the initialized interface objects are stored in the local cache of the gateway to finish preheating of all the currently registered RPC services; and after receiving the call request of the target service, performing 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 call after receiving the call request. Therefore, according to the scheme of the embodiment, the RPC service is preheated in advance, so that the time consumption for initializing the calling interface is reduced, and the stability of externally provided services can be improved.
The foregoing description is only an overview of the technical solutions of the embodiments of the present invention, and may be implemented according to the content of the specification, so that the technical means of the embodiments of the present invention can be more clearly understood, and the following specific implementation of the embodiments of the present invention will be more apparent.
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 invention. Also, like reference numerals are used to designate like parts throughout the figures. In the drawings:
FIG. 1 is a flow chart illustrating a method of invoking a remote procedure call service provided by an embodiment of the present invention;
FIG. 2 is a flow chart illustrating a method of invoking a remote procedure call service provided in accordance with another embodiment of the present invention;
FIG. 3 is a schematic diagram of a remote procedure call service call device according to an embodiment of the present invention;
fig. 4 shows a schematic structural diagram of a server according to 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 present invention are shown in the drawings, it should be understood that the present invention may 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 shows a flowchart of a method for calling a remote procedure call service according to an embodiment of the present invention. The method is performed by a gateway of an RPC service provider and is used in the gateway of the provider to process a call request sent from the gateway of an RPC service consumer.
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 in a local cache of the gateway.
The gateway is the gateway of the service provider.
Specifically, the gateway of the service provider detects its own working state, and determines, according to the working state, a call interface that needs to be initialized in advance, where the call interface that needs to be initialized in advance refers to a call interface that does not store an interface object corresponding to the call interface in the local cache. The working states of the gateways are different, and the groups corresponding to the interface objects needing to be initialized in advance are also different, wherein the gateways need to initialize the calling interfaces of the full RPC service when being started; the gateway is in operation, and only the calling interface of the incremental RPC service is initialized.
Further, compared with the prior art that the initialization processing is performed on the calling interface of the corresponding RPC service after receiving the call request, in this embodiment, the initialization processing of the calling interface is automatically triggered according to the working state of the gateway. After initializing the call interfaces and storing the initialized interface objects in the local cache of the gateway, the local cache of the gateway stores the initialized interface objects corresponding to all the currently registered RPC services of the service provider, namely, the preheating of all the currently registered RPC services is completed.
Step S120: and responding to the call request of the target service, and performing call processing on the target service according to the interface object stored in the local cache.
Wherein the call request of the target service is a call request sent from the gateway of the RPC service consumer. The target service belongs to one of the RPC services provided 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 in the prior art that after each call request is received, the corresponding call interface is initialized for call, so that the time consumption of call can be reduced.
It should be noted that, in the embodiment of the present invention, the service provider and the service consumer are opposite to each other, 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 consumer; when the RPC service is provided to the counterpart, the counterpart is a service provider. In addition, according to the scheme of the embodiment of the invention, any gateway which can be used as a service provider can initialize the calling interface of the RPC service provided by the gateway in advance for direct use in calling.
According to the calling method of the remote procedure call service provided by the embodiment, the working state of the gateway is detected to trigger the call interfaces of one or more RPC services to be initialized in advance, and the initialized interface objects are stored in the local cache of the gateway to finish the preheating of all the currently registered RPC services; and after receiving the call request of the target service, performing 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 call after receiving the call request. Therefore, according to the scheme of the embodiment, the RPC service is preheated in advance, so that the time consumption for initializing a calling interface is reduced, and stable service can be provided; and the scheme can finish the stable call of the service without manual intervention.
Fig. 2 is a flowchart illustrating a method for calling 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 in a local cache of the gateway.
Specifically, the gateway of the service provider detects the working state of the gateway, and performs initialization processing in a corresponding manner according to the triggering of the working state of the gateway, so as to complete the preheating of all the currently registered RPC services of the service provider. The working state of the gateway and the corresponding initialization processing mode are as follows:
in case one, the state is started.
And if the working state of the gateway is the starting state, the configuration information of each remote procedure call service is sequentially read 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 being the starting state means that the gateway is just started or just restarted, at the moment, the local cache of the gateway is emptied, all the calling interfaces of the RPC service need to be initialized, the configuration information of each RPC service is read from the configuration database of the gateway, and then the calling interfaces of the remote procedure calling service are initialized according to the configuration information of the remote procedure calling service for any remote procedure calling service. By the method, when the gateway is in the starting state, the initialization of the calling interfaces of all the currently registered RPC services is triggered, and all the RPC services are preheated.
And in the second case, the running state.
And if the working state of the gateway is an operation state, sequentially reading configuration information of each remote procedure call service from a configuration database of the gateway at regular time. The working state of the gateway is an operation state, namely, the gateway is in a normal continuous operation process, and in the process, the configuration information of the RPC service in the configuration database is read regularly through a timer, so that the total RPC service can be determined at the moment. 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 RPC service corresponding to the configuration information read by the previous reading is not existed, and the newly added RPC service comprises the RPC service which is not read in a previous timing period and is read in a current timing period, or the RPC service is read in the current timing period. Not read before in the start-up state, but read in the current timing cycle. If the new remote procedure call service exists, initializing a call interface of the new remote procedure call service according to the configuration information of the new remote procedure call service. In the embodiment of the invention, the specific mode of judging whether the newly-appeared RPC service exists according to the read configuration information is not limited, and in actual implementation, the newly-added RPC service can be judged by comparing the read configuration information with the previous reading record, if the read configuration information does not exist in the previous reading record and the read configuration information exists; alternatively, the timestamp added to the configuration database in the plurality of pieces of configuration information read at this time may be compared with the time of the previous reading, and if there is configuration information whose timestamp is later than the time of the previous reading, it may be determined that there is a newly added RPC service. If it is determined that there is no newly added RPC service, it indicates that no new service is added in the period from the previous reading to the current reading, and there is no need to perform initialization processing. By the method, when the gateway is in the running state, the initialization processing of judging the newly added RPC service and aiming at the calling interface of the newly added RPC service is triggered at fixed time, and the calling interface of the newly added RPC service is initialized in time, so that the interface objects stored in the local cache are more comprehensive, and the direct use of more RPC service calls is facilitated.
Further, during initialization processing, for any remote procedure call service, server list information for providing the remote procedure call service is obtained from a configuration server in a remote procedure call framework; the server list information is stored in a local cache of the gateway. Any RPC service herein refers to any RPC service that needs to be preheated, where in the case of the startup state, the RPC service that needs to be preheated is the RPC service corresponding to all the read configuration information, and in the case of the running state, the RPC service that needs to be preheated is the newly added RPC service. And, the remote call framework refers to an RPC framework used by the service provider itself, which may be any existing RPC framework, and is not listed here. In some alternative embodiments, the remote procedure call framework is a High-speed service framework (HSF).
A server list for providing each RPC service is recorded in a config server (configuration server) of the RPC framework, corresponding server list information is obtained from the config server of the RPC framework immediately after the RPC service needing to be preheated is determined, and the server list is stored into a local cache for direct use in calling; the server list information is one of the attributes contained in the interface object, which needs to be obtained from a remote location, while other attributes of the service object, such as an object name, an interface name, a parameter name, etc., are determined by the RPC framework. In practice, in the process of initializing the call interface of the RPC service, the server list information needs to be acquired remotely, and the time consumption is generally affected by many factors and fluctuates.
Step S220: and responding to the call 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, step S240 is performed.
The target service belongs to an RPC service that can be provided by the service provider of the present embodiment.
And when the call requirement exists for the service user application, initiating an SDK call to the public network gateway, and transmitting related request data to the gateway of the service user application by the SDK.
Specifically, after the gateway of the service provider receives the call request of the target service, the gateway of the service provider determines whether the local cache stores the interface object corresponding to the target service, if so, 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 carrying out calling processing aiming at 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 processing, and response data is returned to the service provider application after the calling processing is completed.
Step S240: judging whether the configuration information of the target service exists in a configuration database of the gateway; and carrying out calling processing aiming at the target service according to the judging result.
In general, the release process of the RPC service includes, from front to back, a development process, a prefire process (which may be understood as a simulated release process before release), and a production process in sequence, and correspondingly, the operation environment of the RPC service is a release environment, a prefire environment, and a production environment in sequence. And when the RPC service enters the prefoaming flow, the real call request is simulated to carry out service call, and the initialization requirement begins at the moment.
Specifically, if the 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 the configuration database of the gateway has the configuration information of the target service, 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 information of the target service does not exist in the configuration database of the gateway, the target service is not called in the gateway, namely, the current first call is more specifically the first call in the prefire 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 call interface of the target service, and calling the target service by using the initialized interface object of the target service. By the method, aiming at the condition that the target service is called for the first time in the prefire environment, on one hand, configuration information is acquired and written into a configuration database, so that the gateway can find the configuration information of the newly added target service and preheat the newly added target service; on the other hand, server list information for providing the target service is acquired 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 indicated not to be called for the first time. And, the time period T from entering the prefire process to entering the production process is usually longer than the time duration T0 of the gateway for regularly reading the configuration information to find the newly added RPC service, if the call is the call of the production environment, the target service should be preheated, and the corresponding interface object can be found in the local cache, so the call can only be the non-first call of the prefire environment, more specifically, the time interval T1 between the call request and the first call request is shorter than the time duration T0 of the gateway for regularly reading the configuration information to find the newly added RPC service, the gateway does not find the newly added target service in time and preheat, and the interface object corresponding to the target service still does not exist in the local cache. At this time, the call interface of the target service is initialized, and the initialized interface object of the target service is used to perform call processing for the target service. By the method, aiming at the condition that the target service is not called for the first time in the prefire environment, but the target service is not preheated at the same time, the server list information for providing the target service is directly obtained from the config server so as to be called for the time.
It should be noted that, in this step, the description made in the foregoing is the call case for the RPC service that goes through the prefire and then goes into production, and in this case, the gateway reads the configuration information at regular time and discovers that the newly added RPC service is the RPC service that goes through the prefire in the prefire environment and goes through the first call.
In alternative embodiments of the invention, the following special cases may occur: some RPC services skip the prefire process and go directly into the production process, i.e., the RPC service goes directly into the formal production without simulating the production. In consideration of the above special cases, in these optional embodiments, after it is determined that there is no interface object of the target service in the local cache, the running environment where the target service is currently located is further determined, if the running environment is the prefire environment, it indicates that the distribution of the target service does not skip the prefire procedure, where the step of further determining whether there is configuration information of the target service in the configuration database of the gateway and the subsequent steps thereof may be processed according to the foregoing. If the environment is produced, the release of the target service is indicated to skip the pre-release process, and at the moment, a corresponding calling processing mode of a production stage is adopted for processing, wherein the calling processing mode is an existing mode and is not repeated here. By the aid of the optional mode, special conditions of skipping the prefire flows can be avoided, and further proper calling processing modes can be adopted for RPC services of different release flows.
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 viewing and/or editing by a user, where the configuration information management page may add configuration information of the newly added RPC service based on the foregoing provided implementation manner of automatic preheating and calling, so that the gateway may find more comprehensive RPC service in time, and thus may perform preheating comprehensively, or delete configuration information of the RPC service that cannot be provided externally through the configuration information management page, so as to avoid invalid calling. By this alternative embodiment, the automatic and manual combination will be achieved, improving the accuracy of preheating.
According to the calling method of the remote procedure call service provided by the embodiment, the operation state of the gateway is detected to trigger the call interfaces of one or more RPC services to perform initialization processing in advance, wherein if the operation state is a starting state, server list information of the whole RPC services is obtained from the config server in advance, and if the operation state is an operating state, server list information of the newly added RPC services is obtained from the config server in advance so as to be called, and then all registered RPC services are preheated in time; and after receiving the call 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 call efficiency is improved; if the interface object corresponding to the target service does not exist in the local cache, a corresponding calling processing mode is needed to be 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 is needed to be acquired first 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 is avoided for remotely acquiring the server information list after a call request is received, and the stability of service call is improved by omitting an initialization process after the request is received; and automatically triggering and detecting configuration information of the RCP service according to the working state of the gateway, thereby improving the efficiency and accuracy of service discovery.
Fig. 3 is a schematic structural diagram of 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, perform initialization processing on call interfaces of one or more remote procedure call services in advance according to the working state, and store the initialized interface objects in a local cache of the gateway;
and the calling module 320 is adapted to respond to a calling request of a target service and perform calling processing on the target service according to the interface object stored in the local cache.
In an alternative, the initialization module is further adapted to:
if the working state is the starting state, the configuration information of each remote procedure call service is sequentially read from the configuration database of the gateway;
and initializing a call interface of the remote procedure call service according to the configuration information of the remote procedure call service aiming at any remote procedure call service.
In an alternative, the initialization module is further adapted to:
if the working state is the running state, sequentially reading 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 according to the configuration information; if yes, 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 an alternative, the initialization module is further adapted to:
for any remote procedure call service, acquiring 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 calling module is further adapted to:
judging whether an interface object corresponding to the target service exists in a local cache; if yes, the interface object corresponding to the target service is used for calling the target service.
In an alternative, the calling 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;
and carrying out calling processing aiming at the target service according to the judging result.
In an alternative, the calling module is further adapted to:
if the configuration information of the target service does not exist, the configuration information of the target service is obtained and written into a configuration database of a gateway; and initializing the call interface of the target service, and calling the target service by using the initialized interface object of the target service.
In an alternative, the calling 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 the 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.
Embodiments of the present invention provide a non-volatile computer storage medium storing at least one executable instruction that may perform the method for invoking a remote procedure call service in any of the method embodiments described above.
Fig. 4 shows a schematic structural diagram of a server according to an embodiment of the present invention, which is not limited to a specific implementation of the server according to the embodiment of the present invention.
As shown in fig. 4, the server may include: a processor 402, a communication interface (Communications Interface) 404, a memory 406, and a communication bus 408.
Wherein: processor 402, communication interface 404, and memory 406 communicate with each other via communication bus 408. A communication interface 404 for communicating with network elements of other devices, such as clients or other servers. Processor 402 is configured to execute program 410 and may specifically perform the relevant steps of the calling method embodiment of the remote procedure call service for a server described above.
In particular, program 410 may include program code including computer-operating instructions.
The processor 402 may be a central processing unit CPU, or a specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement embodiments of the present invention. The one or more processors included by the server may be the same type of processor, such as one or more CPUs; but may also be different types of processors such as one or more CPUs and one or more ASICs.
Memory 406 for storing programs 410. Memory 406 may comprise high-speed RAM memory or may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
Program 410 may be specifically operable to cause processor 402 to:
detecting the working state of a gateway, carrying out initialization processing on 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;
and responding to a call request of the target service, and performing call processing on 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, the configuration information of each remote procedure call service is sequentially read from the configuration database of the gateway;
and initializing a call interface of the remote procedure call service according to the configuration information of the remote procedure call service aiming at any 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 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 according to the configuration information; if yes, 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 an alternative, the program 410 causes the processor 402 to:
for any remote procedure call service, acquiring 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; if yes, the interface object corresponding to the target service is used for calling 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;
and carrying out calling processing aiming at the target service according to the judging result.
In an alternative, the program 410 causes the processor 402 to:
if the configuration information of the target service does not exist, the configuration information of the target service is obtained and written into a configuration database of a gateway; and initializing the call 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 the 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 a construction of such a system is apparent from the description above. In addition, embodiments of the present invention are not directed to any particular programming language. It will be appreciated that the teachings of embodiments of the present invention described herein may be implemented in a variety of programming languages, and the above description of specific languages is provided for disclosure of enablement and best mode of the embodiments of the present invention.
In the description provided herein, numerous specific details are set forth. However, it is understood 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 above 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 construed as reflecting the intention that: i.e., an embodiment of the invention that is claimed, requires 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 apparatus of the embodiments may be adaptively changed and disposed in one or more apparatuses different from the embodiments. 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. Any combination of all features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or units of any method or apparatus so disclosed, may be used in combination, except insofar as at least some of such features and/or processes or units 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 but not others included in other embodiments, 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 can be used in any combination.
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 some or all of the functionality of some or all of the components according to embodiments of the present invention may be implemented in practice using a microprocessor or Digital Signal Processor (DSP). Embodiments of the present invention may also be implemented as a device or apparatus program (e.g., a computer program and a computer program product) for performing a portion or all of the methods described herein. Such a program embodying the embodiments of the present invention may be stored on a computer readable medium, or may have the form of one or more signals. Such signals may be downloaded from an internet website, provided on a carrier signal, or provided 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 use of the words first, second, third, etc. do not denote any order. These words may be interpreted as names. The steps in the above embodiments should not be construed as limiting the order of execution unless specifically stated.

Claims (16)

1. A method of invoking a remote procedure call service, comprising:
detecting the working state of a gateway, carrying out initialization processing on 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;
Responding to a call request of a target service, and performing call processing for the target service according to the interface object stored in the local cache;
the call processing 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; if yes, calling processing aiming at the target service is carried out by using an interface object corresponding to the target service;
if the interface object corresponding to the target service does not exist in the local cache, judging the current running environment of the target service, if the running environment is the prefire environment, judging whether the configuration information of the target service exists in a configuration database of the gateway, and calling the target service according to a judging result;
if the environment is produced, adopting a corresponding calling processing mode in the production stage to process.
2. The method of claim 1, wherein the 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, the configuration information of each remote procedure call service is sequentially read from the configuration database of the gateway;
And initializing a call interface of the remote procedure call service according to the configuration information of the remote procedure call service aiming at any remote procedure call service.
3. The method of claim 1, wherein the 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 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 according to the configuration information; if yes, 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.
4. A method according to any one of claims 1-3, wherein 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 comprises:
for any remote procedure call service, acquiring 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 claim 1, wherein the invoking the target service according to the determination result further comprises:
if the configuration information of the target service does not exist, the configuration information of the target service is obtained and written into a configuration database of a gateway; and initializing the call interface of the target service, and calling the target service by using the initialized interface object of the target service.
6. The method of claim 5, wherein the invoking the target service according to the determination result further comprises:
if the configuration information of the target service exists, initializing a calling interface of the target service, and calling the target service by using the initialized interface object of the target service.
7. A method according to any of claims 1-3, wherein the remote procedure call framework used by the remote procedure call service is a high speed service framework.
8. A call apparatus of a remote procedure call service, comprising:
the initialization module is suitable for detecting the working state of the gateway, carrying out initialization processing on 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;
The calling module is suitable for responding to a calling request of the target service and carrying out calling processing on the target service according to the interface object stored in the local cache;
wherein the calling module is further adapted to:
judging whether an interface object corresponding to the target service exists in a local cache; if yes, calling processing aiming at the target service is carried out by using an interface object corresponding to the target service;
if the interface object corresponding to the target service does not exist in the local cache, judging the current running environment of the target service, if the running environment is the prefire environment, judging whether the configuration information of the target service exists in a configuration database of the gateway, and calling the target service according to a judging result;
if the environment is produced, adopting a corresponding calling processing mode in the production stage to process.
9. The apparatus of claim 8, wherein the initialization module is further adapted to:
if the working state is the starting state, the configuration information of each remote procedure call service is sequentially read from the configuration database of the gateway;
and initializing a call interface of the remote procedure call service according to the configuration information of the remote procedure call service aiming at any remote procedure call service.
10. The apparatus of claim 8, wherein the initialization module is further adapted to:
if the working state is the running state, sequentially reading 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 according to the configuration information; if yes, 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.
11. The apparatus of any of claims 8-10, wherein the initialization module is further adapted to:
for any remote procedure call service, acquiring 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.
12. The apparatus of claim 8, wherein the invocation module is further adapted to:
if the configuration information of the target service does not exist, the configuration information of the target service is obtained and written into a configuration database of a gateway; and initializing the call interface of the target service, and calling the target service by using the initialized interface object of the target service.
13. The apparatus of claim 12, wherein the invocation module is further adapted to:
if the configuration information of the target service exists, the calling interface of the target service is initially carried out
And initializing, and calling the target service by using the initialized interface object of the target service.
14. The apparatus of any of claims 8-10, wherein a remote procedure call framework used by the remote procedure call service is a high speed service framework.
15. A server, comprising: the device comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete communication with each other through the communication bus;
the memory is configured to store at least one executable instruction that causes the processor to perform operations corresponding to a calling method of a remote procedure call service according to any one of claims 1 to 7.
16. A computer storage medium having stored therein at least one executable instruction for causing a processor to perform operations corresponding to a method of invoking a remote procedure call service according to any of claims 1-7.
CN202010224776.7A 2020-03-26 2020-03-26 Calling method and device for remote procedure call service Active CN111338829B (en)

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 CN111338829A (en) 2020-06-26
CN111338829B true 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)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113268360A (en) * 2021-05-14 2021-08-17 北京三快在线科技有限公司 Request processing method, device, server and storage medium
CN113220485B (en) * 2021-05-25 2023-05-05 金蝶软件(中国)有限公司 Processing method and device for remote procedure call service and readable storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
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

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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)

* Cited by examiner, † Cited by third party
Title
杨杰 ; 寇应展 ; 杨永刚 ; 陈财森 ; .基于智能客户端的短信平台的设计与开发.微计算机信息.2008,(09),全文. *
许卓明,栗明,董逸生.基于RPC和基于REST的Web服务交互模型比较分析.计算机工程.2003,(20),全文. *

Also Published As

Publication number Publication date
CN111338829A (en) 2020-06-26

Similar Documents

Publication Publication Date Title
CN109981716B (en) Micro-service calling method and device
WO2015055074A1 (en) Method and device for dynamically loading and invoking program
CN110968331B (en) Method and device for running application program
CN111338829B (en) Calling method and device for remote procedure call service
JP2015507298A (en) Dynamic code insertion into a running process
CN111666113A (en) Application program starting management method and device, electronic equipment and storage medium
CN113434249A (en) Mirror image synchronization method and device, docker host and storage medium
US20050114644A1 (en) Deterministic system and method for implementing software distributed between a desktop and a remote device
WO2020177519A1 (en) Debugging method executed on smart terminal and software debugging device
CN111913764A (en) Service dependency analysis method, electronic device, and storage medium
CN111200651A (en) Method, system, device and medium for timed calling of microservice
CN114328097A (en) File monitoring method and device, electronic equipment and storage medium
CN112256351B (en) Method for realizing Feign component, method and device for calling micro-service
CN109729121B (en) Cloud storage system and method for realizing custom data processing in cloud storage system
US20190354427A1 (en) File synchronizing service status monitoring and error handling
CN111294377B (en) Dependency network request sending method, terminal device and storage medium
CN110730197B (en) Service discovery method and system
CN110704041A (en) Software development method and device
CN109218338B (en) Information processing system, method and device
WO2018121652A1 (en) Method and device for connecting wireless access point through application in user equipment
CN115237481A (en) Method, device and equipment for driving external equipment and storage medium
CN111338898B (en) Application state acquisition method and device, electronic equipment and readable storage medium
CN110262912B (en) Calling method and device for procedure call gRPC
JP4063573B2 (en) Device driver installation / execution method, installation / execution method, and program
CN113010206A (en) Containerization method, system and device for WEB application system

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