CN114221996A - Service calling method and device, electronic equipment and storage medium - Google Patents

Service calling method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114221996A
CN114221996A CN202111362496.3A CN202111362496A CN114221996A CN 114221996 A CN114221996 A CN 114221996A CN 202111362496 A CN202111362496 A CN 202111362496A CN 114221996 A CN114221996 A CN 114221996A
Authority
CN
China
Prior art keywords
service
user request
target service
path
requested
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.)
Pending
Application number
CN202111362496.3A
Other languages
Chinese (zh)
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.)
Pioneering Huikang Technology Co ltd
Original Assignee
Pioneering Huikang 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 Pioneering Huikang Technology Co ltd filed Critical Pioneering Huikang Technology Co ltd
Priority to CN202111362496.3A priority Critical patent/CN114221996A/en
Publication of CN114221996A publication Critical patent/CN114221996A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the invention provides a service calling method, a service calling device, an electronic device and a medium. The method comprises the following steps: deploying the updated target service while providing the target service before updating, receiving a user request aiming at the target service, determining whether the user request is a test request or a non-test request, and determining a path of the service requested by the user request; the service requested by the non-test request comprises a target service before updating, the service requested by the test request comprises an updated target service, the requested target service is called according to a path of the service requested by the user request, the updated target service and the target service before updating are provided simultaneously when the service is upgraded, and the requests of the non-test user and the test user are shunted automatically, so that the test user can use the updated service normally while the non-test user continues to use the service before updating, the upgraded service can be debugged quickly, and the stability of the service is guaranteed.

Description

Service calling method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a service invocation method, a service invocation apparatus, an electronic device, and a readable storage medium.
Background
Microservice is a software development technology, a variant of service-oriented architecture style, that calls for dividing a single application into a set of small services that are coordinated and coordinated to provide ultimate value to the user. Each service runs in an independent process, and the services communicate with each other by adopting a lightweight communication mechanism. Each service is built around a specific business and can be deployed independently to a production environment, a production-like environment, and the like. In addition, a unified and centralized service management mechanism should be avoided as much as possible, and for a specific service, a suitable language and tool should be selected and constructed according to the context.
In the micro-service architecture, the service upgrade may affect the normal operation of the original service. If the upgrade of the service and the stability of the original service are both required, a plurality of sets of environments need to be prepared. When the original service is upgraded, it is difficult to ensure that the online system can stably provide the service, and the use of the online user is influenced.
Disclosure of Invention
The embodiment of the invention aims to provide a service calling method, a service calling device, electronic equipment and a storage medium, so that the technical problems that when the original service is upgraded, an online system is difficult to ensure to stably provide the service, and the use of an online user is influenced are solved.
In order to solve the above problem, in a first aspect of the present invention, there is provided a service invocation method, including:
deploying the updated target service while providing the target service before updating;
receiving a user request for a target service;
determining that the user request is a test request or a non-test request and a path of a service requested by the user request; wherein the service requested by the non-test request comprises the target service before updating, and the service requested by the test request comprises the target service after updating;
and calling the requested target service according to the path of the service requested by the user request.
Optionally, the determining that the user request is a test request or a non-test request, and the path of the service requested by the user request includes:
if the user request carries a preset identifier corresponding to the updated target service, the user request is a test request, and at least one service requested by the user request, and the identifier information and the version information of the updated target service corresponding to the preset identifier are determined;
and generating a path of the at least one service according to the user request, the identification information and the version information.
Optionally, before the target service before the update is deployed while the target service before the update is provided, the method further includes:
and configuring the preset identification, and the corresponding identification information and version information of the updated target service.
Optionally, the invoking the requested target service according to the path of the service requested by the user request includes:
determining the path of a target service node corresponding to each service according to the path of the service requested by the user request;
and forwarding the user request to a target service node corresponding to the target service for processing according to the path of the target service node corresponding to each service.
Optionally, the determining, according to the path of the service requested by the user request, the path of the target service node corresponding to each service includes:
acquiring service nodes which are registered correspondingly to services except the target service from a first cache;
acquiring a service node registered correspondingly to the target service from a second cache according to the identification information and the version information;
distributing target service nodes corresponding to the services to the user request from service nodes corresponding to the services;
and generating a path of a target service node corresponding to each service according to the path of the service requested by the user request and the target service node corresponding to each service.
Optionally, the determining that the user request is a test request or a non-test request, and the path of the service requested by the user request includes:
if the user request does not carry the preset identification corresponding to the updated target service, the user request is a non-test request, and at least one service requested by the user request is determined;
and generating a path of the at least one service according to the user request.
In a second aspect of the present invention, there is provided a service invocation apparatus, including:
the service deployment module is used for deploying the updated target service while providing the target service before updating;
a request receiving module for receiving a user request for a target service;
a path determination module for determining whether the user request is a test request or a non-test request and a path of a service requested by the user request; wherein the service requested by the non-test request comprises the target service before updating, and the service requested by the test request comprises the target service after updating;
and the service calling module is used for calling the requested target service according to the path of the service requested by the user request.
Optionally, the path determining module includes:
a first service determining submodule, configured to determine that the user request is a test request if the user request carries a preset identifier corresponding to the updated target service, and determine at least one service requested by the user request, and identifier information and version information of the updated target service corresponding to the preset identifier;
and the first path generation submodule is used for generating a path of the at least one service according to the user request, the identification information and the version information.
Optionally, the apparatus further comprises:
and the configuration module is used for configuring the preset identifier, and the corresponding identifier information and version information of the updated target service while providing the target service before updating and before deploying the updated target service.
Optionally, the service invoking module includes:
the path determining submodule is used for determining the path of a target service node corresponding to each service according to the path of the service requested by the user request;
and the forwarding sub-module is used for forwarding the user request to a target service node corresponding to the target service for processing according to the path of the target service node corresponding to each service.
Optionally, the path determining sub-module includes:
a first node obtaining unit, configured to obtain, from a first cache, a service node in which services other than the target service are correspondingly registered;
a second node obtaining unit, configured to obtain, from a second cache, a service node registered corresponding to the target service according to the identification information and the version information;
the distribution unit is used for distributing target service nodes corresponding to the services for the user request from service nodes corresponding to the services;
and the path generating unit is used for generating paths of the target service nodes corresponding to the services according to the paths of the services requested by the user request and the target service nodes corresponding to the services.
Optionally, the path determining module includes:
a second service determining submodule, configured to determine that the user request is a non-test request and at least one service requested by the user request if the user request does not carry a preset identifier corresponding to the updated target service;
and the second path generation submodule is used for generating a path of the at least one service according to the user request.
In a third aspect of the present invention, an electronic device is provided, which includes a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps as described above when executing a program stored in the memory.
In a fourth aspect of the present invention, there is provided a computer readable storage medium having a computer program stored thereon, wherein the program is adapted to implement the method as described in any of the above when executed by a processor.
According to the embodiment of the invention, the updated target service is deployed while the target service before updating is provided, the user request aiming at the target service is received, and the user request is determined to be a test request or a non-test request and a path of the service requested by the user request; the service requested by the non-test request comprises the target service before updating, the service requested by the test request comprises the target service after updating, the requested target service is called according to the path of the service requested by the user request, when the service is upgraded, the updated target service and the target service before updating are provided at the same time, and the request of the non-test user and the request of the test user are automatically shunted, so that the test user can normally use the updated service while the non-test user continues to normally use the service before updating, the upgraded service can be quickly debugged, and the stability of the service is ensured.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
FIG. 1 is a flow diagram illustrating the steps of one embodiment of a service invocation method of the present invention;
FIG. 2 shows a schematic diagram of paths for different users requesting a requested service;
FIG. 3 is a flow diagram illustrating the steps of one embodiment of a service invocation method of the present invention;
FIG. 4 is a diagram illustrating request forking during service invocation;
FIG. 5 is a block diagram illustrating the architecture of an embodiment of a service invocation device in accordance with the present invention;
fig. 6 shows a schematic diagram of an electronic device according to an embodiment of the invention.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
Referring to fig. 1, a flowchart illustrating steps of a service invocation method according to an embodiment of the present invention is shown, which may specifically include the following steps:
step 101, while providing the target service before updating, deploying the updated target service.
In an embodiment of the invention, the target service is a service that needs to be updated. Each update may upgrade one or more target services. In order to have service updating and ensure the stability of the original service, in the updating process, the target service before updating is continuously provided, and the target service after updating is deployed, so that the target service before updating and the target service after updating are simultaneously provided.
In the embodiment of the present invention, one implementation manner of deploying services is to inject services in a plug-in manner, each service component provides services to the outside, and a calling program depends on interface services and does not depend on service implementation. Service implementations may be specified at integration time, i.e., deployment or runtime, binding service interfaces and their implementations, rather than compile-time connections. A plug-in is a mechanism for binding, which not only eliminates dependency, but also postpones the decision on which implementation class to use until configuration or deployment. When injecting services in a plug-in based manner, the interfaces and implementations of the services are separated first, and then the interfaces and implementations are bound according to deployment or configuration during operation.
Step 102, receiving a user request for a target service.
In the embodiment of the present invention, the user request can be divided into a test request and a non-test request, where the non-test request is a normal request, and the test request is a request for testing a service specifically. The user request for the target service means that the service requested by the user request includes the target service, and may be the target service after updating or the target service before updating.
Step 103, determining whether the user request is a test request or a non-test request and a path of a service requested by the user request; wherein the service requested by the non-test request comprises the target service before updating, and the service requested by the test request comprises the target service after updating.
In the embodiment of the present invention, for the target service, the service requested by the non-test request includes a target service before updating, and the service requested by the test request includes a target service after updating.
In the embodiment of the invention, after receiving the user request aiming at the target service, different user requests are automatically distinguished. Specific implementations of determining whether a user request is a test request or a non-test request may include a variety of implementations. For example, a preset identifier is configured for the updated target service in advance, it is agreed that if a user request is a test request, the user request needs to carry the preset identifier, the user request is analyzed after receiving the user request for the target service, if the user request carries the preset identifier, it is determined that the user request is the test request, and if the user request does not carry the preset identifier, it is determined that the user request is a non-test request. Any suitable implementation may be specifically adopted, and the embodiment of the present invention is not limited thereto.
In the embodiment of the invention, the service requested by the user request comprises one or more services. The path of the service requested by the user request is used to indicate the services that are passed through in sequence when the user request is processed. And subsequently processing the user request, and carrying the path of the service requested by the user request when each service is called, so that the user request is sequentially forwarded to each service according to the path of the service requested by the user request.
If the service requested by the user request comprises one service and the user request is a test request, the service requested by the user request comprises an updated target service, and at the moment, the path of the service requested by the user request is only the updated target service.
If the service requested by the user request comprises one service and the user request is a non-test request, the service requested by the user request comprises a target service before updating, and at the moment, the path of the service requested by the user request is only the target service before updating.
If the service requested by the user request comprises a plurality of services, if the user request is a test request, the service requested by the user request comprises at least one updated target service, at this time, the path of the service requested by the user request is a plurality of services and the processing sequence thereof, wherein one or more services are the updated target service.
If the service requested by the user request comprises a plurality of services, if the user request is a non-test request, the service requested by the user request comprises at least one target service before updating, at the moment, the path of the service requested by the user request comprises a plurality of services and the processing sequence thereof, wherein one or more services are the target service before updating.
For example, a schematic diagram of the path of the service requested by the different user request is shown in fig. 2. The user request sent by the formal user is a non-test request, and the user request sent by the test user is a test request. The service through which the non-test request passes and the service through which the test request passes have different paths, specifically: the paths of the services requested by the non-test requests are in order server01, server02 and server03, while the paths of the services requested by the test requests are in order server01, server02 v2 and server 03. Among them, server02 is the target service before update, and server02 v2 is the target service after update.
And 104, calling the requested target service according to the path of the service requested by the user request.
In the embodiment of the invention, when the user request is processed, the user request is forwarded according to the path of the service requested by the user request, and each service is called, wherein the service comprises a target service. The specific implementation manner for invoking the requested target service may include various manners according to the path of the service requested by the user request. For example, according to the path of the service requested by the user request, the path of the target service node corresponding to each service is determined, and according to the path of the target service node corresponding to each service, the user request is forwarded to the target service node corresponding to the target service for processing. Any suitable implementation may be specifically adopted, and the embodiment of the present invention is not limited thereto.
According to the embodiment of the invention, the updated target service is deployed while the target service before updating is provided, the user request aiming at the target service is received, and the user request is determined to be a test request or a non-test request and a path of the service requested by the user request; the service requested by the non-test request comprises the target service before updating, the service requested by the test request comprises the target service after updating, the requested target service is called according to the path of the service requested by the user request, when the service is upgraded, the updated target service and the target service before updating are provided at the same time, and the request of the non-test user and the request of the test user are automatically shunted, so that the test user can normally use the updated service while the non-test user continues to normally use the service before updating, the upgraded service can be quickly debugged, and the stability of the service is ensured.
Referring to fig. 3, a flowchart illustrating steps of a service invocation method according to an embodiment of the present invention is shown, which may specifically include the following steps:
step 201, while providing the target service before updating, deploying the updated target service.
In the embodiment of the present invention, the specific implementation manner of this step may refer to the description in the foregoing embodiment, and details are not described herein.
At step 202, a user request for a target service is received.
In the embodiment of the present invention, the specific implementation manner of this step may refer to the description in the foregoing embodiment, and details are not described herein.
In the embodiment of the present invention, after step 202 is executed, step 203 or step 205 is executed.
Step 203, if the user request carries a preset identifier corresponding to the updated target service, the user request is a test request, and at least one service requested by the user request, and the identifier information and version information of the updated target service corresponding to the preset identifier are determined;
in the embodiment of the invention, in order to distinguish the non-test request from the test request, the corresponding preset identifier is configured for the updated target service in advance. And if the user request carries the preset identification, the user request is a test request. And simultaneously determining at least one service requested by the user request, and determining the identification information and the version information of the updated target service corresponding to the preset identification according to the preset identification. The identification information includes, but is not limited to, a service name, or any other suitable information uniquely identifying the target service, which is not limited in this embodiment of the present invention. The version information includes, but is not limited to, a version number, or any other suitable information that uniquely identifies the version of the target service, which is not limited in this embodiment of the present invention.
For example, the schematic diagram of request splitting in the service invocation process shown in fig. 4. The user first initiates a request through nginx/rpc service. Wherein nginx (engine x, an open source software) is a high performance HTTP (Hyper Text Transfer Protocol) and reverse proxy Web (World Wide Web) server, and also provides IMAP (Internet Message Access Protocol) service/POP 3(Post Office Protocol-Version 3, Post Office Protocol Version 3)/SMTP (Simple Mail Transfer Protocol) service rpc (Remote Procedure Call) is a communication technique for programs and processes running between multitasking operating systems or networked computers, a service Version selection component, including a test request selector and a test non-collector selection request is a test request when a non-collector request is determined, the method comprises the steps of inquiring a corresponding service name and a service version according to a preset identifier in a request through a local storage mode localStore or a remote storage mode remoteStore, and if the preset identifier is inquired, selecting a user request by a test request selector SpecifyCaseSelector. The local storage manner localStore may be cafneine (a high-performance cache library), and the Remote storage manner remoteStore may be mysql (a relational Database management system), mongo (a Database based on distributed file storage), redis (Remote Dictionary Server), Oracle (an Oracle Database management system), or sqlserver (a relational Database management system).
Step 204, generating a path of the at least one service according to the user request, the identification information and the version information.
In an embodiment of the invention, the order of invocation of at least one service may be determined according to a user request. Since the at least one service includes the updated target service, for the target service, the path of the at least one service is not the path of the target service before the update, and the path of the target service after the update needs to be generated according to the identification information and the version information. For the target service, the generated path carries the identification information and version information configured corresponding to the preset identification.
In the embodiment of the present invention, after step 204 is executed, step 207 is executed.
In an optional embodiment of the present invention, before the providing the target service before the update and before deploying the target service after the update, the method may further include: and configuring the preset identification, and the corresponding identification information and version information of the updated target service.
And taking a preset identifier and the corresponding updated identifier information and version information of the target service as configuration information. A plurality of preset identifiers may be configured as needed, which is not limited in the embodiment of the present invention. For example, according to the update requirement of the target service, the version number of the target service is configured, and the special identifier DescID (i.e. the preset identifier) of the test request, the name of the requested service and the version of the service are configured in the database. And then the updated target service is on-line.
Step 205, if the user request does not carry the preset identifier corresponding to the updated target service, the user request is a non-test request, and at least one service requested by the user request is determined.
In the embodiment of the invention, if the user request does not carry the preset identifier, the user request is a non-test request. While determining at least one service requested by the user request.
For example, as shown in fig. 4, when it is determined that the user request is a non-test request, the user request is selected by the non-test request selector TrafficSelector through a local storage manner or a remote storage manner remotesore, and if the user request does not carry a preset identifier.
Step 206, generating a path of the at least one service according to the user request.
In an embodiment of the invention, the order of invocation of at least one service may be determined according to a user request. And generating a path of the target service before updating according to the original mode.
In the embodiment of the present invention, after step 206 is executed, step 207 is executed.
Step 207, determining the path of the target service node corresponding to each service according to the path of the service requested by the user request.
In the embodiment of the present invention, the service is provided by a service node, and the service node may be a server or the like providing the service. And respectively distributing corresponding target service nodes for each requested service. And then determining the path of a target service node corresponding to each service according to the path of the requested service.
For example, as shown in fig. 4, the gray scale upgrading module gray bunny further includes a service registration node manager, which may obtain the service nodes registered for each service from the registry and monitor the service nodes registered for each service. And distributing target service nodes for each service according to the service nodes correspondingly registered by each service, and determining the paths of the target service nodes.
In an optional embodiment of the present invention, in a specific implementation manner of determining a path of a target service node corresponding to each service according to a path of a service requested by the user request, the determining may include: acquiring service nodes which are registered correspondingly to services except the target service from a first cache; acquiring a service node registered correspondingly to the target service from a second cache according to the identification information and the version information; distributing target service nodes corresponding to the services to the user request from service nodes corresponding to the services; and generating a path of a target service node corresponding to each service according to the path of the service requested by the user request and the target service node corresponding to each service.
The first cache stores service nodes registered corresponding to services before updating, and the second cache stores service nodes registered corresponding to services after updating. Therefore, the service nodes correspondingly registered by the services except the target service can be obtained from the first cache, and the service nodes correspondingly registered by the target service can be searched and obtained from the second cache according to the identification information and the version information. And respectively allocating target service nodes corresponding to the services to the user request from the service nodes corresponding to the services. Any suitable existing method may be specifically used to allocate the target service node, which is not limited in this embodiment of the present invention. And generating the path of the target service node corresponding to each service according to the sequence of the path of the service requested by the user request and the target service node corresponding to each service, so that the path of the target service node is consistent with the path of the service in sequence.
For example, as shown in fig. 4, the service node registered in the service registration node management component DefaultGrayServiceManager caches the service node registered corresponding to the service through the default cache defaultCache and the grayscale cache grayscache. The service registration node management component defaultGrayServiceManager monitors the registration center and acquires the latest service nodes registered corresponding to each service from the registration center. Among them, the registry supports zoo managers, nacos (Dynamic Naming and Configuration Service), eureka (a Service discovery framework), and the like.
And 208, forwarding the user request to a target service node corresponding to the target service for processing according to the path of the target service node corresponding to each service.
In the embodiment of the invention, the user request is forwarded according to the path of the target service node corresponding to each service, so that the user request is forwarded to the target service node corresponding to the target service for processing. And when the user request is a test request, forwarding the user request to a target service node corresponding to the updated target service for processing. When the user request is a non-test request, the user request is forwarded to a target service node corresponding to the target service before updating for processing.
For example, as shown in fig. 4, after passing through the granny module, the user request is shunted, a part of the passed services are all online services, i.e. target services before updating, and a part of the passed services include services to be released, i.e. target services after updating.
According to the embodiment of the invention, an updated target service is deployed while a target service before update is provided, a user request for the target service is received, if the user request carries a preset identifier corresponding to the updated target service, the user request is a test request, at least one service requested by the user request is determined, the identifier information and the version information of the updated target service corresponding to the preset identifier are generated, a path of the at least one service is generated according to the user request, the identifier information and the version information, if the user request does not carry the preset identifier corresponding to the updated target service, the user request is a non-test request, the at least one service requested by the user request is determined, and the path of the at least one service is generated according to the user request, and according to the paths of the services requested by the user requests, determining the paths of target service nodes corresponding to the services, and forwarding the user requests to the target service nodes corresponding to the target services for processing, so that when the services are upgraded, the updated target services and the target services before updating are provided at the same time, and the requests of non-test users and test users are automatically shunted, thereby ensuring that the non-test users can continue to normally use the services before updating and the test users can also normally use the updated services, so that the upgraded services can be quickly debugged, and the stability of the provided services is ensured.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the illustrated order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments of the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
Referring to fig. 5, a block diagram of a service invocation device according to an embodiment of the present invention is shown, which may specifically include the following steps:
a service deployment module 301, configured to deploy an updated target service while providing the target service before updating;
a request receiving module 302 for receiving a user request for a target service;
a path determination module 303, configured to determine whether the user request is a test request or a non-test request, and a path of a service requested by the user request; wherein the service requested by the non-test request comprises the target service before updating, and the service requested by the test request comprises the target service after updating;
a service invoking module 304, configured to invoke the requested target service according to the path of the service requested by the user request.
In an optional embodiment of the invention, the path determining module comprises:
a first service determining submodule, configured to determine that the user request is a test request if the user request carries a preset identifier corresponding to the updated target service, and determine at least one service requested by the user request, and identifier information and version information of the updated target service corresponding to the preset identifier;
and the first path generation submodule is used for generating a path of the at least one service according to the user request, the identification information and the version information.
In an optional embodiment of the invention, the apparatus further comprises:
and the configuration module is used for configuring the preset identifier, and the corresponding identifier information and version information of the updated target service while providing the target service before updating and before deploying the updated target service.
In an optional embodiment of the present invention, the service invocation module includes:
the path determining submodule is used for determining the path of a target service node corresponding to each service according to the path of the service requested by the user request;
and the forwarding sub-module is used for forwarding the user request to a target service node corresponding to the target service for processing according to the path of the target service node corresponding to each service.
In an optional embodiment of the invention, the path determination sub-module comprises:
a first node obtaining unit, configured to obtain, from a first cache, a service node in which services other than the target service are correspondingly registered;
a second node obtaining unit, configured to obtain, from a second cache, a service node registered corresponding to the target service according to the identification information and the version information;
the distribution unit is used for distributing target service nodes corresponding to the services for the user request from service nodes corresponding to the services;
and the path generating unit is used for generating paths of the target service nodes corresponding to the services according to the paths of the services requested by the user request and the target service nodes corresponding to the services.
In an optional embodiment of the invention, the path determining module comprises:
a second service determining submodule, configured to determine that the user request is a non-test request and at least one service requested by the user request if the user request does not carry a preset identifier corresponding to the updated target service;
and the second path generation submodule is used for generating a path of the at least one service according to the user request.
According to the embodiment of the invention, the updated target service is deployed while the target service before updating is provided, the user request aiming at the target service is received, and the user request is determined to be a test request or a non-test request and a path of the service requested by the user request; the service requested by the non-test request comprises the target service before updating, the service requested by the test request comprises the target service after updating, the requested target service is called according to the path of the service requested by the user request, when the service is upgraded, the updated target service and the target service before updating are provided at the same time, and the request of the non-test user and the request of the test user are automatically shunted, so that the test user can normally use the updated service while the non-test user continues to normally use the service before updating, the upgraded service can be quickly debugged, and the stability of the service is ensured.
An embodiment of the present invention further provides an electronic device, as shown in fig. 6, which includes a processor 901, a communication interface 902, a memory 903, and a communication bus 904, where the processor 901, the communication interface 902, and the memory 903 complete mutual communication through the communication bus 904,
a memory 903 for storing computer programs;
the processor 901 is configured to implement the steps described in any of the foregoing method embodiments when executing the program stored in the memory 903.
The communication bus mentioned in the above terminal may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the terminal and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
In yet another embodiment of the present invention, a computer-readable storage medium is further provided, which has instructions stored therein, and when the instructions are executed on a computer, the instructions cause the computer to execute the service calling method in any one of the above embodiments.
In yet another embodiment, a computer program product containing instructions is provided, which when run on a computer, causes the computer to perform the service invocation method described in any of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. A service invocation method, characterized by comprising:
deploying the updated target service while providing the target service before updating;
receiving a user request for a target service;
determining that the user request is a test request or a non-test request and a path of a service requested by the user request; wherein the service requested by the non-test request comprises the target service before updating, and the service requested by the test request comprises the target service after updating;
and calling the requested target service according to the path of the service requested by the user request.
2. The method of claim 1, wherein the determining that the user request is a test request or a non-test request and the path of the service requested by the user request comprises:
if the user request carries a preset identifier corresponding to the updated target service, the user request is a test request, and at least one service requested by the user request, and the identifier information and the version information of the updated target service corresponding to the preset identifier are determined;
and generating a path of the at least one service according to the user request, the identification information and the version information.
3. The method of claim 2, wherein before deploying the updated target service while providing the pre-updated target service, the method further comprises:
and configuring the preset identification, and the corresponding identification information and version information of the updated target service.
4. The method of claim 2, wherein invoking the requested target service according to the path of the requested service requested by the user comprises:
determining the path of a target service node corresponding to each service according to the path of the service requested by the user request;
and forwarding the user request to a target service node corresponding to the target service for processing according to the path of the target service node corresponding to each service.
5. The method of claim 4, wherein the determining the path of the target service node corresponding to each service according to the path of the service requested by the user request comprises:
acquiring service nodes which are registered correspondingly to services except the target service from a first cache;
acquiring a service node registered correspondingly to the target service from a second cache according to the identification information and the version information;
distributing target service nodes corresponding to the services to the user request from service nodes corresponding to the services;
and generating a path of a target service node corresponding to each service according to the path of the service requested by the user request and the target service node corresponding to each service.
6. The method of claim 1, wherein the determining that the user request is a test request or a non-test request and the path of the service requested by the user request comprises:
if the user request does not carry the preset identification corresponding to the updated target service, the user request is a non-test request, and at least one service requested by the user request is determined;
and generating a path of the at least one service according to the user request.
7. A service invocation apparatus, characterized by comprising:
the service deployment module is used for deploying the updated target service while providing the target service before updating;
a request receiving module for receiving a user request for a target service;
a path determination module for determining whether the user request is a test request or a non-test request and a path of a service requested by the user request; wherein the service requested by the non-test request comprises the target service before updating, and the service requested by the test request comprises the target service after updating;
and the service calling module is used for calling the requested target service according to the path of the service requested by the user request.
8. The apparatus of claim 7, wherein the path determination module comprises:
a first service determining submodule, configured to determine that the user request is a test request if the user request carries a preset identifier corresponding to the updated target service, and determine at least one service requested by the user request, and identifier information and version information of the updated target service corresponding to the preset identifier;
and the first path generation submodule is used for generating a path of the at least one service according to the user request, the identification information and the version information.
9. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1-6 when executing a program stored in the memory.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-6.
CN202111362496.3A 2021-11-17 2021-11-17 Service calling method and device, electronic equipment and storage medium Pending CN114221996A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111362496.3A CN114221996A (en) 2021-11-17 2021-11-17 Service calling method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111362496.3A CN114221996A (en) 2021-11-17 2021-11-17 Service calling method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114221996A true CN114221996A (en) 2022-03-22

Family

ID=80697403

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111362496.3A Pending CN114221996A (en) 2021-11-17 2021-11-17 Service calling method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114221996A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115103028A (en) * 2022-07-22 2022-09-23 深圳竹云科技股份有限公司 SaaS application request processing method and device and computer equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107979508A (en) * 2017-11-24 2018-05-01 深圳乐信软件技术有限公司 Micro services test method and device
CN110032393A (en) * 2019-04-18 2019-07-19 恒生电子股份有限公司 A kind of micro services dissemination method, device, equipment and medium
US20190324897A1 (en) * 2018-04-20 2019-10-24 Sap Se Test automation system for distributed heterogenous environments

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107979508A (en) * 2017-11-24 2018-05-01 深圳乐信软件技术有限公司 Micro services test method and device
US20190324897A1 (en) * 2018-04-20 2019-10-24 Sap Se Test automation system for distributed heterogenous environments
CN110032393A (en) * 2019-04-18 2019-07-19 恒生电子股份有限公司 A kind of micro services dissemination method, device, equipment and medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115103028A (en) * 2022-07-22 2022-09-23 深圳竹云科技股份有限公司 SaaS application request processing method and device and computer equipment

Similar Documents

Publication Publication Date Title
CN107666525B (en) Method and device for IP allocation of cluster container
CN112965700B (en) Routing-based micro-service processing method and device, computer equipment and medium
US20150067167A1 (en) Hot pluggable extensions for access management system
US9438645B2 (en) Correlating computing network events
CN105630684B (en) Software Development Kit recognition methods and device
CN111090423B (en) Webhook framework system and method for realizing active calling and event triggering
US20050223101A1 (en) Computer-implemented method, system and program product for resolving prerequisites for native applications utilizing an open service gateway initiative ( OSGi) framework
JP2016521897A (en) Application upgrade method and apparatus
US10616068B2 (en) Identification of networking component application programming interfaces
US11349958B1 (en) Deployment of software releases on datacenters configured in cloud platforms
CN113141405B (en) Service access method, middleware system, electronic device, and storage medium
CN110716734B (en) Method, device, electronic equipment and medium for upgrading software
CN111510330B (en) Interface management device, method and storage medium
CN109104368B (en) Connection request method, device, server and computer readable storage medium
CN109032620A (en) The configuration file generation method and device of application program
US20230086377A1 (en) Dynamic automation of prerequisite component deployment in disconnected environments
CN111831567B (en) Application test environment configuration method, device, system and medium
CN116257438A (en) Updating method of interface test case and related equipment
CN114221996A (en) Service calling method and device, electronic equipment and storage medium
CN110333884A (en) Method for upgrading software, distributed system and device
CN112748962A (en) Application loading method and device, electronic equipment and computer readable medium
CN111712795A (en) Method, apparatus, computer program product and readable medium for evaluating application deployment
CN111382953A (en) Dynamic process generation method and device
CN109375946B (en) Method and system for managing component package of node package manager
CN115396501B (en) Information processing method and device, electronic equipment and readable 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