CN111917870A - Request processing method, system, device, electronic equipment and storage medium - Google Patents

Request processing method, system, device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111917870A
CN111917870A CN202010753860.8A CN202010753860A CN111917870A CN 111917870 A CN111917870 A CN 111917870A CN 202010753860 A CN202010753860 A CN 202010753860A CN 111917870 A CN111917870 A CN 111917870A
Authority
CN
China
Prior art keywords
request
agent
service
service instance
registered
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
CN202010753860.8A
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.)
Guangzhou Jinhong Network Media Co ltd
Original Assignee
Guangzhou Jinhong Network Media 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 Guangzhou Jinhong Network Media Co ltd filed Critical Guangzhou Jinhong Network Media Co ltd
Priority to CN202010753860.8A priority Critical patent/CN111917870A/en
Publication of CN111917870A publication Critical patent/CN111917870A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/562Brokering proxy services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/63Routing a service request depending on the request content or context

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application discloses a request processing method, a system, a device, electronic equipment and a storage medium, and relates to the technical field of electronic equipment. The method is applied to a target agent terminal in a request processing system, the request processing system comprises a plurality of agent terminals and a plurality of service instances, the target agent terminal is any one of the agent terminals, each agent terminal in the agent terminals is in communication connection with at least one other agent terminal, and one or more service instances are registered in each agent terminal. The method comprises the following steps: receiving a request sent by a request initiator, wherein the request initiator is a service instance registered at the target agent terminal; searching a service instance with processing capacity for the request from the service instances registered at the target agent end to serve as a request receiver; and sending the request to the request receiver for processing by the request receiver. The technical scheme realizes decentralized registration and management of the service instance and reduces network overhead.

Description

Request processing method, system, device, electronic equipment and storage medium
Technical Field
The present application relates to the field of communications technologies, and in particular, to a request processing method, system, apparatus, electronic device, and storage medium.
Background
With the increasing of internet applications, in the face of massive user requests, a general solution of an application server can be provided through a distributed system architecture. In a distributed system architecture, the service instance registration is typically centralized, which may result in a large network overhead.
Disclosure of Invention
In view of the above problems, the present application provides a request processing method, system, device, electronic device and storage medium to improve the above problems.
In a first aspect, an embodiment of the present application provides a request processing method, which is applied to a target agent in a request processing system, where the request processing system includes a plurality of agent terminals and a plurality of service instances, the target agent is any one of the plurality of agent terminals, each agent terminal in the plurality of agent terminals is in communication connection with at least one other agent terminal, and each agent terminal registers one or more service instances, where the method includes: receiving a request sent by a request initiator, wherein the request initiator is a service instance registered at the target agent terminal; searching a service instance with processing capacity for the request from the service instances registered at the target agent end to serve as a request receiver; and sending the request to the request receiver for processing by the request receiver.
In a second aspect, an embodiment of the present application provides a request processing system, including a plurality of agent terminals and a plurality of service instances, where each agent terminal in the plurality of agent terminals is in communication connection with at least one other agent terminal, and each agent terminal registers one or more service instances, where when any one service instance is used as a request initiator, it is used to send a request to the registered agent terminal; the agent end is used for receiving a request sent by a request initiator; searching a service instance with processing capacity for the request from the service instances registered at the agent end to serve as a request receiver; sending the request to the request receiver; the request receiver is used for processing the received request.
In a third aspect, an embodiment of the present application provides a request processing apparatus, which is applied to a target agent in a request processing system, where the request processing system includes a plurality of agent terminals and a plurality of service instances, the target agent is any one of the plurality of agent terminals, each of the plurality of agent terminals is in communication connection with at least one other agent terminal, and each agent terminal registers one or more service instances, and the apparatus includes: a request receiving module, configured to receive a request sent by a request initiator, where the request initiator is a service instance registered at the target agent; the searching module is used for searching the service instance which has the processing capacity to the request from the service instances registered at the target agent end to be used as a request receiving party; and the request sending module is used for sending the request to the request receiving party for processing by the request receiving party.
In a fourth aspect, an embodiment of the present application provides an electronic device, including: one or more processors; a memory; a broker and one or more service instances stored in the memory and configured to be executed by the one or more processors, the one or more service instances registered at the broker, the broker being executed by the processors for performing the above-described method.
In a fifth aspect, the present application provides a computer-readable storage medium, in which a program code is stored, and the program code can be called by a processor to execute the above method.
The request processing method, the request processing system, the request processing device, the electronic equipment and the storage medium are applied to a proxy side in the request processing system. The request processing system comprises a plurality of agent terminals and a plurality of service instances, wherein each agent terminal is registered with one or more service instances. The agent end can receive a request sent by a service instance which is registered at the agent end and used as a request initiator, search a service instance which has processing capacity for the request from the registered service instances as a request receiver, and send the received request to the request receiver. In the technical scheme, the request processing system comprises a plurality of agent terminals, each agent terminal is respectively registered with a service instance, and the service instances interact with the registered agent terminals, so that the problem of large network overhead caused by the fact that all the service instances in the system need to be registered to the same service discovery component under the centralized condition is solved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic diagram illustrating a request processing system according to an embodiment of the present application.
Fig. 2 is a diagram illustrating a network architecture of a request processing system according to an embodiment of the present application.
Fig. 3 is a flowchart illustrating a request processing method according to an embodiment of the present application.
Fig. 4 is a flowchart illustrating a request processing method according to another embodiment of the present application.
Fig. 5 is a diagram illustrating a service type mapping table according to an embodiment of the present application.
Fig. 6 is a schematic diagram illustrating a request transmission provided in an embodiment of the present application.
Fig. 7 shows another schematic diagram of request transmission provided in the embodiment of the present application.
Fig. 8 is a functional block diagram of a request processing apparatus according to an embodiment of the present application.
Fig. 9 shows a block diagram of an electronic device provided in an embodiment of the present application.
Fig. 10 is a storage unit according to an embodiment of the present application, configured to store or carry program code for implementing a request processing method according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application.
A single machine has limited computing and storage capabilities, and requires many machines to cooperatively process data in the presence of huge amounts of data, such as through a distributed system. A distributed system is a system of computer nodes that communicate over a network and that work in concert to accomplish a common task. The distributed system can provide services similar to a single machine from the macroscopic view, but the distributed system is cooperatively processed by a plurality of machines, so that the processing bottleneck of the single machine can be broken through, the calculation and storage tasks which cannot be completed by a single computer can be completed, more machines can be utilized, and more data can be processed.
In a distributed system, different services may be split according to different specific functions or services, that is, each service may be used to implement a function or process a service. For example, the user management service for managing user information, the order processing service for processing an order, the message sending service for sending a message to a user, and the like, which are not limited in the embodiment of the present application.
Wherein each service may deploy one or more instances for implementing the functions to be implemented by the service. When multiple instances are deployed in a service, the multiple instances may have the same functionality, may run simultaneously, and collectively process the received request, i.e., multiple instances of the same service are all the functionality to be implemented for implementing the service. Each service instance may be understood as a server client running a process, a program or software of the electronic device in which the service instance is installed.
Meanwhile, inside the distributed system, there may be a dependency relationship between different services, and a user request may require communication among multiple services, and the communication mode generally is request and reply, for example, one service initiates a request to another service, and another service replies to the request. Due to the large number of service instances in the separate system, management is usually required.
A Service Discovery component (Service Discovery) may be configured in the distributed system, i.e., information for managing each Service instance, such as name, IP address, port, etc. of the Service instance. Under the condition of configuring the service discovery component, each service instance in the distributed system is registered in the service discovery component, so that a request initiator needing to initiate a request can determine the service instance to be sent by the request from the service instance registered in the service discovery component and send the request to the service instance to be sent.
The inventor has found that in a distributed system, each service instance may be configured in a different computer, and may also be configured in a computer in a different room, or in a computer in a different room in a different region. When registering through the centralized registration method of the service discovery component, the service instance and the service discovery component may not be in one computer, may not be in one machine room, or may not be in one area.
Therefore, through research, the inventors propose a request processing method, a request processing system, a request processing device, an electronic device and a storage medium, which are provided by the examples of the present application. As shown in fig. 1 and fig. 2, the request processing system 100 includes a plurality of agents 101, each for registering and managing a service instance 102. Referring to fig. 1, different agent terminals 101 register one or more service instances 102 respectively, and each agent terminal 101 is in communication connection with at least one other agent terminal 101, so that decentralized management of the service instances 102 is realized, and network overhead is effectively reduced.
The communication connection between the agent 101 and at least one other agent 101 is direct connection, that is, there is no other agent between the agents in communication connection. The agent can be an agent object and can be a delivery component for communications between service instances 102. The communication connection between the agent 101 and the agent 101 is not limited, and may be a TCP connection. The service instance 102 is registered in the agent 101, and may be in communication connection with the agent 101, and registers its registration information in the agent 101 through the communication connection, for example, the service instance connected to the agent in fig. 1 is the service instance registered in the agent. The connection mode between the service instance and the proxy end is not limited in the embodiment of the present application, and may be a TCP connection, for example. Each agent can manage the service instance registered therein and process the request sent by the service instance.
Specifically, please refer to fig. 3, which illustrates a request processing method provided in an embodiment of the present application, and the request processing method is applied to a proxy side in a request processing system. In the embodiment of the present application, a proxy is taken as an example to describe processing of a request of a registered service instance by the proxy. For convenience of description, the proxy for explanation is defined as a target proxy in the embodiments of the present application. It will be appreciated that the target agent may be any agent in the request processing system. As shown in fig. 3, the request processing method may include the following steps.
Step S110: and receiving a request sent by a request initiator, wherein the request initiator is a service instance registered at the target agent terminal.
In the request processing system, any service instance may send a request that needs to be processed by another service instance in order to implement a corresponding function. When the service instance initiates a request, the request may be sent to the agent end registered by the service instance, that is, the target agent end may receive the request sent by the service instance registered by the target agent end.
In the embodiment of the present application, a service instance for initiating a request is defined as a request initiator, that is, a target proxy receives a request sent by the request initiator.
Step S120: and searching the service instance which has the processing capacity for the request from the service instances registered at the target agent end to be used as a request receiver.
Therefore, when the target agent end receives the request, the target agent end can search the service instance which has the processing capacity for the request from the service instances registered in the target agent end, define the searched service instance as a request receiver, and tabulate the searched service instance for receiving the request.
Step S130: and sending the request to the request receiver for processing by the request receiver.
And the target agent end sends the received request to the request receiving party for processing the request by the request receiving party.
In the embodiment of the present application, a request processing system may include a plurality of agent terminals, each agent terminal is connected to at least one of the other agent terminals, and each agent terminal may register one or more service instances. When the service instance needs to initiate a request, the request is sent to the registered agent end, when the agent end receives the request, the agent end searches the service instance with processing capacity for the request from the registered service instance to process, so that the service instance in the request processing system is dispersedly registered at different agent ends, the different agent ends manage the registered service instance, and network overhead in the service instance registration and request sending processes is reduced.
Compared with the previous embodiment, in the embodiment, the method further includes a processing mode that the proxy does not find the service instance with processing capability for the received request in the registered service instances. As shown in fig. 4, the method provided by this embodiment includes:
step S210: and receiving a request sent by a request initiator, wherein the request initiator is a service instance registered at the target agent terminal.
In the embodiment of the present application, a service instance that sends a request to a proxy is defined as a request initiator, and any one service instance may serve as a request initiator to initiate a request to a proxy registered by the service instance.
When other service instances are needed to provide a certain service, the service instances can send requests to the agent end. The request indicates that the service instance requires services to be provided by other service instances, or functions to be performed or tasks to be performed by other service instances.
In the embodiment of the present application, the request may include a request type, where the request type indicates a request type of the request, and indicates which type of request needs to be completed by another service instance, or indicates what function needs to be implemented by another service instance, and what task is to be completed. The indication manner of the request type is not limited in the embodiment of the present application, for example, each request type may correspond to a type identifier, and the type identifiers corresponding to different request types are different.
Optionally, in this embodiment of the application, the request may further include request content, which may indicate content that specifically requires functions implemented by other service instances, specific service content provided, or content of a completed service.
For example, one service instance may function to send messages to users on a birthday, and before sending a message, it may be necessary to obtain information about the user to determine which users to send the message to. The service instance can be used as a request initiator to send a request for acquiring the user information to the registered agent end, wherein the request comprises the request type which is the user information type and indicates that the user information is to be acquired from other service instances; the request may include request content that is information content specifically to be obtained, thereby instructing other service instances to return information content specifically to be obtained.
Step S220: and searching the service instance which has the processing capacity for the request from the service instances registered at the target agent end to be used as a request receiver. If the service instance with the processing capability to the request is found in the service instances registered by the target agent terminal, executing step S230; if the service instance having the processing capability for the request is not found in the service instances registered in the target agent, step S240 is executed.
When the target agent end receives the request sent by the service instance registered in the target agent end, whether the service instance registered by the target agent end can process the request can be judged.
In the embodiment of the present application, the target agent may search for a service instance having a processing capability for the request from among service instances registered in the target agent. If the service instance with the processing capability to the request is found, it can be determined that the service instance capable of processing the request exists in the registered service instances, and the found service instance is used as a request receiving party. Optionally, the target agent may search for a service instance having a processing capability for the request from all service instances registered in the target agent, or may search for a service instance having a processing capability for the request from all service instances registered in the target agent except for the request receiver.
Each service instance can support one or more request types, and the request types supported by the service instances indicate that the service instances have processing capacity for the request types and can provide services required by the request types. That is, each service instance may have processing capabilities for one or more request types.
The request type supported by each service instance can inform the registered proxy end, and the proxy end can store the corresponding relation between the request type and the service instance, wherein the service instance has processing capacity for the corresponding request type. For example, when each service instance registers with the proxy, the registration information may include the request types supported by the service instance. That is, when each service instance registers to the agent, the request type supported by itself is registered in the agent, so that the agent can obtain and store the request type supported by each service instance registered in the agent.
When searching for a service instance having processing capability for a received request from registered service instances, the target agent may search for whether there is a request type of the request in a correspondence between stored request types and service instances, and if so, use the service instance corresponding to the searched request type as a request receiver.
In a specific implementation manner, the correspondence between the request type and the service instance stored in the agent may be stored by using a service type mapping table. Specifically, each agent may store a service type mapping table, where the service type mapping table includes a correspondence between each service instance registered in the agent and the request type. If the service instance is registered in the agent, the identity of the service instance is also registered in the agent, and the identities of different service instances are different, in the correspondence, the identity of the service instance shown in fig. 5 may correspond to the type identifier of the request type, S1, S2, and S3 in fig. 5 identify different service instances, and R1 to R5 identify different request types. It is to be understood that the target agent acts as any one of the agents in which the service type mapping table is stored.
When the target agent terminal searches for the service instance with processing capability to the request, the service instance corresponding to the request type of the request can be searched from the service type mapping table stored in the target agent terminal, and the service instance is used as a request receiving party. That is, if the target agent finds the request type of the received request in the stored service type mapping table, the service instance corresponding to the request type found in the service mapping table is used as the request receiver.
Optionally, in this embodiment of the application, each agent may register multiple instances, and if a service instance registered by the target agent has a processing capability for the request, only one service instance is found, and the found service instance is used as a request receiver. In the service instances registered by the target agent, more than one service instance with processing capacity for the request may be required, and therefore, one service instance needs to be selected as a request receiver.
In an embodiment, it may be sequentially searched whether each service instance has processing capability for the request, and the first searched service instance is used as a request receiver. For example, in the service type mapping table shown in fig. 5, the request type is searched from top to bottom, and when the request type of the request is found, the service instance corresponding to the found request type is used as the request receiver. If the request type of the received request is R3, the first service instance found in the service type mapping table shown in fig. 5 is S1.
In another embodiment, a service instance having processing capability for the request type may be found among all registered service instances. If two or more service instances having processing capability for the request type of the request are found, one service instance may be selected from the two or more found service instances as the request receiver.
Optionally, in this embodiment, one service instance may be randomly selected from the found service instances as the request receiver.
Optionally, in this embodiment, the service instance with the smallest number of requests currently being processed may be selected from the service instances as the request receiver. Namely, the number of unprocessed requests in each service instance is determined, and the service instance with the least number is taken as a request receiver. Optionally, after the agent sends the request to the service instance registered therein, the number of requests sent to the service instance may be recorded; after the service instance completes processing the request, the service instance may feed back to the registered proxy, so that the proxy may determine the number of requests being processed in the service instance according to the number of requests sent to the service instance and the number of requests completed by the service instance. Optionally, the service instance may also feed back the number of requests being processed to the registered proxy end, so that the proxy end may determine the number of requests being processed by each service instance according to the feedback of the service instance, where the feedback may be timing feedback, or may be feedback once when the service instance completes one request, or feedback at a feedback request time.
Optionally, in this embodiment, the service instance with the smallest number of requests currently being processed may be selected from the service instances as the request receiver. If the selected service instance is one, taking the selected service instance as a request receiver; and if more than one service instance with the least number of requests currently being processed and more than one selected service instance are currently processed, determining one service instance from the selected service instances as a request receiver. When one service instance is determined from the selected service instances to serve as a request receiving party, one service instance can be randomly determined; the service instance in which the last request received is furthest from the current time may also be the request recipient. That is, if more than one service instance has the same number of requests currently processed and is less than that of other service instances, the time of the last received request of each service instance may be determined from the more than one service instance, and the service instance corresponding to the time farthest from the current time is taken as the request receiver. The time sequence of sending the request to the service instance by the agent end can be used for representing the time sequence of receiving the request by the service instance, the agent end can record the time of sending the request to each service instance, the time of the last request sent to each service instance in more than one selected service instance is determined, and the service instance corresponding to the time farthest from the current time is used as a request receiving party.
In the embodiment of the present application, if two or more service instances having processing capability for the request type of the request are found, one service instance may also be selected as the request receiver through other selection policies.
Step S230: and sending the request to the request receiver for processing by the request receiver.
The target agent end sends the request sent by the request initiator to the request receiver so that the request receiver can process the request. I.e. the request type of the request supported by the request receiver, can complete the task required to be completed by the request, and realize the function to be realized by the request.
Optionally, the request receiver may reply after processing the request. The reply may include the result of the processing, may include information required by the request, and the like. For example, if the request from the request initiator returns user information to the request receiver, the reply from the request receiver includes the user information required in the request.
The reply may return a reply to the request originator along the transmission path of the request. Specifically, the target agent may receive a reply sent by the request receiving party, where the reply is a processing of the request; the reply is returned to the requesting recipient.
Step S240: and searching whether a service instance with processing capacity for the request is registered in the agent end which is in communication connection with the target agent end.
If the service instance with the processing capability for the request is not found in the service instances registered by the target agent, the service instances registered by the target agent are described, and the request sent by the request receiver has no processing capability, the target agent can select one agent from other agent, and the service instances registered by the selected agent include the service instance with the processing capability for the request, so that the request is sent to the agent, and then the agent sends the request to the service instance with the processing capability for the request.
In the embodiment of the present application, if a service instance with processing capability for the request is not found in the service instances registered in the target agent, the target agent may find whether a service instance with processing capability for the request is registered in an adjacent agent. For each agent, the adjacent agents are agents directly connected to each other in communication, and there is no other agent between the adjacent agents. That is, the target agent may search whether a service instance having a processing capability for the request is registered in the agent of the communication connection, and use the searched agent as the agent to which the request is to be sent.
In an embodiment, each agent may store the request types supported by its neighboring agent, and the request type supported by each agent is the request type supported by each service instance registered by the agent. In this embodiment of the present application, the request types supported by each agent may be stored in the neighboring agent in the form of a list or an index, and in this embodiment of the present application, the list or the index stored in the request types supported by each agent is defined as a service index. Each agent end stores the service index of other agent ends of the communication connection, and the service index of each agent end comprises the request type of the service instance registered in the agent end and having the processing capacity.
For example, agent a1 is adjacent to two agents, i.e. agent a2 and agent A3, two service instances, i.e. service instances s1 and s2, service instance s1 supports request types r1 and r2, and service instance s2 supports request types r4 and r3, are registered in agent a 2; two service instances s3 and s4 are registered in the broker a3, s3 supports the request type r4, s4 supports the request type r1 and r 4. The service index I1 of the agent a2 includes the request types r1, r2 and r 3; the service index I2 of the agent a3 includes request types r1 and r 4. The service index I1 of the agent a2 and the service index I2 of the agent A3 are stored in the agent a 1. It is understood that the service index of agent a1 is also stored in agent a2 and agent A3.
In this embodiment, when the target agent searches whether a service instance having a processing capability for the request is registered in the adjacent agent, the target agent may search whether the service index of the agent communicatively connected to the target agent includes the request type of the request, or whether the service index of the adjacent agent stored in the target agent includes the request type of the request. The service indexes of the neighboring agents stored by the target agent are service indexes of other agents neighboring the target agent, and in the above example, the service indexes stored in the agent a1 are the service index I1 and the service index I2.
If the service index includes the request type of the request, the agent terminal to which the searched service index belongs is used as the searched agent terminal, that is, the agent terminal to which the searched service index belongs is determined to be the agent terminal for the request type supporting the request. The agent side to which the service index belongs indicates that the service index is the service index of the agent side, and the request type in the service index is the request type supported by the agent side. As in the above example, the agent a1 is a target agent, and the request type of the received request is the service index stored in the request type r2, then the service index I1 can be found to include the request type r2, and the agent a2 belonging to the service index I1 is the found agent, which indicates that the agent a2 registers a service instance supporting the request type r 2.
In another embodiment, the target agent may send the consultation information to the neighboring agent, where the consultation information includes the request type for consulting whether the neighboring agent supports the request type in the consultation information. And if the agent end which receives the consultation information registers the service instance which supports the request type, feeding back the information which supports the request type. If the target agent receives the request type supported by the feedback of the adjacent agent, the adjacent agent can be determined to be the searched agent.
In this embodiment of the present application, if the target agent has multiple adjacent agents, and more than one agent in the multiple agents has a processing capability for the request, the target agent may search for a service instance that has a processing capability for the request and is registered in the multiple agents, and may select one agent from the searched multiple agents as an agent that needs to send the request.
Optionally, the target agent may randomly select one agent from the plurality of found agents having processing capability for the request.
Optionally, the target agent may also select one agent from the plurality of searched agents according to a predetermined selection policy. For example, the agent with the fewest registered service instances is selected, the agent with the fewest supported request types is selected, and the agent with the closest communication distance is selected. If more than one agent terminal is still selected under one selection strategy, the agent terminals can be further randomly selected or further selected by combining other selection strategies. For example, if more than one agent having a processing capability for the request has the least and the same registered service instances, the agent having the closest communication distance may be selected from the more than one agent.
Optionally, in this embodiment of the present application, the target agent may also search, from all the agents, whether a service instance having a processing capability for the request is registered.
Because each agent end is in communication connection with at least one agent end in the request processing system, all the agent ends in the request processing system have direct or indirect connection relation, and each agent end can acquire the service indexes of all other agent ends through the transmission of the service indexes.
In this embodiment, the target agent may search from all stored service indexes whether the request type of the request is included; and if the service index comprises the request type of the request, taking the agent terminal to which the searched service index belongs as the searched agent terminal.
In addition, there may be multiple agent terminals supporting the request type of the request in all the agent terminals, and the target agent terminal may select the closest agent terminal as the agent terminal to be searched, that is, the agent terminal to be sent the request.
In the service indexes of other agent terminals stored in each agent terminal, the distance relationship between each other agent terminal and the agent terminal can be recorded, wherein for a certain agent terminal, the more the information of other agent terminals reaches the agent terminal which needs to pass by, the farther the information is from the agent terminal; if the number of the agents which need to pass through the communication system is the same, the closer the communication distance is to the communication system.
Step S250: and if the service instance with the processing capacity for the request is registered in the agent end in communication connection with the target agent end, sending the request to the searched agent end so that the searched agent end sends the request to the service instance with the processing capacity for the request to process.
And the target agent end sends the request to the searched agent end, namely, the request is sent to the agent end which determines to send the request, so that the agent end which receives the request sends the request to the service instance which is registered by the agent end and has processing capacity for the request.
When the agent terminal that receives the request sent by the target agent terminal selects a service instance with processing capability for the request from the service instances registered by the agent terminal, the selection manner may refer to the manner described above that when the target agent terminal receives the request sent by the request initiator, the agent terminal selects a service instance with processing capability from the registered service instances.
After the request is processed by the request receiver, a reply may be returned to the request receiver along the transmission path of the request. Specifically, the request receiver may return a reply to the registered agent, the registered agent returns the reply to the target agent, and the target agent returns the reply to the request initiator, so that the request initiator obtains a desired result or obtains a processing result of the request.
In addition, the target agent end may also receive the request sent by other agent ends. That is, when the other proxy end receives the request sent by the request initiator registered therein, there is no service instance having processing capability for the request in the service instances registered in itself, and it is determined by the search that there is a service instance having processing capability for the request registered in the target proxy end, the request is sent to the target proxy end. The target agent end receives the request sent by the adjacent agent end, and can determine that a service instance with processing capacity for the request is registered in the target agent end. The target agent terminal can take the service instance which has the processing capacity for the request in the registered service instances as a request receiver. Specifically, the target agent may select one service instance having a processing capability for the request from all registered service instances as a request receiving party, and the specific selection manner may refer to a corresponding selection manner in the foregoing embodiments, which is not described herein again. The target agent end sends the request received from other agent ends to the request receiver for processing by the request receiver.
Optionally, in this embodiment of the present application, if no service instance having a processing capability for the request is registered in the proxy end in communication connection with the target proxy end, a notification message may be returned to the request initiator. That is, no service instance having processing capability for the request is registered in the target agent, and no service instance having processing capability for the request is registered in any agent in the neighboring agent of the target agent, a notification message may be sent to the request initiator to notify the request receiver that the service instance having processing capability for the request is not found. The notification message may also notify the requesting recipient of a routing error, initiated by the requesting recipient retrying the request. If the request receiver retries to initiate the request, if the adjacent agent end connected with the target agent end is changed or the service instance registered by the target agent end is changed, a new service instance may support the request and the request has processing capacity.
In addition, if the proxy end in communication connection with the target proxy end does not register a service instance with processing capability for the request, it is very probable that the request processing system does not have a service instance with processing capability for the request, and the notification message returned to the request receiver can also be used for warning, notifying the request receiver of a request error, a request type error, and the like.
In the embodiment of the application, the request processing system comprises a plurality of agent terminals, and each agent terminal is directly connected with at least one other agent terminal in a communication manner, so that all agent terminals in the request processing system realize direct or indirect connection. Each agent side is registered with one or more service instances, all the service instances in the request processing system are dispersedly registered in the plurality of agent sides, and therefore the registration of the service instances in the request processing system is decentralized. When receiving a request sent by a service instance registered in the proxy, the proxy searches for the service instance with processing capability from the service instance registered in the proxy, and if the service instance with processing capability for the request is not found, the proxy can be searched for from other proxy ends in communication connection, specifically, the proxy registered with the service instance with processing capability for the request is searched for. Therefore, the registration of the service instances in the request processing system and the processing of the request are decentralized, the network overhead caused by the fact that all the service instances are registered in one service component is reduced, and the system risk caused by the fact that a central service discovery component is crashed under the centralization condition is also reduced.
The request processing system provided by the embodiment of the present application may be a distributed system, and as shown in fig. 1, the request processing system includes a plurality of agent terminals and a plurality of service instances. Each agent end in the agent ends is in communication connection with at least one other agent end, each agent end is registered with one or more service instances, and each service instance is registered in only one agent end at the same time.
In the request processing system, a plurality of agent terminals are deployed in a plurality of points, and can be deployed in corresponding electronic devices together with service instances.
Optionally, each agent and the service instance registered in the agent are deployed in the same electronic device.
Optionally, in the electronic device configured with the agent, if a service instance is configured, the service instance configured in the electronic device is registered in the agent configured in the electronic device. If only the service instance is configured in the electronic device and the agent end is not configured, the service instance can be registered in the agent end configured in other electronic devices. For example, the method is configured to the agent end closest to the user, and the closest may be the shortest communication distance, the shortest communication calculation time, and the like.
In the request processing system, when the agent end is started, if the agent end is not the first started agent end in the system, other agent ends can be connected.
Specifically, a configuration file may be stored in the agent, where the configuration file includes information of one or more of the agent started in the system, and the agent in the configuration file is defined as a seed node. The information of the agent end in the configuration file may be used to find the agent end to connect and distinguish each agent end, for example, the information includes an IP address, port information, an identity of the agent end, and the like.
When the agent terminal is started, according to the information of each agent terminal in the configuration file, one or more seed nodes are connected in a communication mode, the connected seed nodes are recorded as the agent terminals adjacent to the seed nodes, and the information of the adjacent agent terminals is recorded. For example, a neighbor list may be included in the agent side, in which neighbor agents, or agents that are in direct communication with each other, are recorded.
In the embodiment of the present application, the seed node may be configured as needed. For example, the selected seed nodes are distributed, agent terminals are selected from different machine rooms as seed nodes, and agent terminals are selected from different machine rooms in different areas as seed nodes. For another example, the system may further include an agent end that does not register the service instance, and is used as a seed node, where the seed node is configured in a separate electronic device, and only the seed node is configured in the electronic device, and the service instance is not configured, so as to avoid that the seed node is also unavailable due to damage to the electronic device caused by an error in the operation process of the service instance.
For the electronic device with the seed node deployed alone, that is, if the electronic device in the request processing system is configured with only the seed node without the service instance, and the configured seed node is not registered with the service instance, in the request processing system, each agent end in the plurality of agent ends may be in communication connection with at least one other agent end, at least two or more agent ends are registered with the service instance, each service instance is registered with only one agent end, and one agent end may register one or more service instances, or may not register the service instance. The agent side that is not registered with the service instance may be used as a seed node.
In addition, in the request processing system, each agent can periodically check whether its neighboring agent is abnormal. Specifically, each agent may send health check information to the adjacent agent at regular time, and check whether the health check information of the adjacent agent is received at regular time, where the health check information is information informing that the adjacent agent exists. If the agent end does not receive the health check information sent by a certain adjacent agent end after exceeding the preset time length, the adjacent agent end is considered to be abnormal, the adjacent agent end is not taken as the adjacent agent end any more, and is moved out from the adjacent agent end recorded by the agent end, and if the adjacent agent end is recorded through the adjacent list, the adjacent agent end is moved out from the adjacent list. Optionally, the preset duration may be longer than a time interval for the agent to send the health check information, for example, the preset duration is longer than the time interval for sending the health check information, shorter than twice the time interval for sending the health check information, or is other times larger than 1 time. Of course, in the embodiment of the present application, the way for the agent to check whether the adjacent agent is abnormal is not limited in the embodiment of the present application, and the connection abnormality is checked, and the health check information is not received after the preset time period is exceeded, and the like can be used as the criterion for judging the abnormality of the adjacent agent.
In this embodiment of the present application, each agent may send agent information known per se to the adjacent agent connected thereto, and since each agent is in communication connection with at least one other agent, each agent may obtain distribution information of all agents in the request acquisition system. In addition, because the agent terminals in the system may be updated, each agent terminal may periodically send a known agent terminal to an adjacent agent terminal, so that each agent terminal in the system may periodically update the agent terminal distribution information in the system.
The agent end in the system can be in communication connection with other agent ends according to the agent end distribution information. If a certain agent end is only in direct communication connection with one agent end in the system, but the adjacent agent end is detected to be abnormal, the agent end can move the adjacent agent end out of the adjacent list, reselect the agent end for communication connection according to the agent end distribution information in the system, record the agent end as the adjacent agent end, process the agent end as the adjacent agent end, and write the agent end into the adjacent list.
In embodiments of the present application, the service instance may register with the proxy, for example, register with the service instance through a TCP communication connection. The service instance may be included in the registration information may include service instance functionality, such as including in the registration information the types of requests that the service instance may support, i.e. for which types of requests the service instance has processing capabilities.
In the embodiment of the present application, the service instance may include configuration information, where the configuration information includes agent information and priorities of different agents, and the service instance registers an agent with the highest priority among the agents. In the configuration information, the agent side with the lowest priority may be an agent side from near to far from the service instance, that is, the closer to the service instance, the higher the priority of the agent side, the highest priority of the agent side arranged in the same electronic device as the service instance, and usually, the service instance in the same electronic device is registered in the agent side in the electronic device. The distance from the service instance may be from near to far, and the distance may be a communication distance, and the distance may also be a physical distance since the distance of the physical distance may reflect the distance of the communication distance to some extent.
In the proxy side, the registration information of the registered service instance may be stored, and the registration information may be stored in correspondence with the service instance, for example, the service instance and the request type may be stored in correspondence with the service type mapping table. Optionally, the agent end may choose not to perform persistent storage, but store the persistent storage in the memory, so that the storage complexity may be reduced, and if the agent end fails to be connected to the service instance, the connection is interrupted and the agent end stores the connection in the memory, and the registration information of the service instance may be automatically deleted without performing additional deletion operation, thereby improving the convenience of the system. In addition, as described above, each agent may also send the request types supported by itself to the adjacent agent, for example, send the formed service index to the adjacent agent, where the service index may serve as the agent to determine which types of requests the adjacent agent can handle, and may also serve as the purpose of implementing data backup. Moreover, the data backup is only the request type supported by the backup agent, wherein if a plurality of registered service instances support the same request type, only one backup is carried out, and the backup data is reduced. That is, in each agent, the request types specifically corresponding to the service instances registered to itself and the service indexes of the adjacent agents can be stored, so that the amount of stored data is effectively reduced, and the expansion of the number of the whole service instances of the system is avoided.
The service instance and the registered agent side can also check whether each other is abnormal or not at regular time. The specific way of checking whether the proxy end is abnormal is not limited in the embodiment of the application, and when the connection is checked to be abnormal, health check information is not received after the preset time length is exceeded, and the like can be used as a criterion for judging the abnormality of the adjacent proxy end. The health check information is taken as an example for explanation, whether the agent end and the service instance are abnormal or not can be checked, whether the agent end and the adjacent agent end are abnormal or not can be checked, and the agent end can send the health check information to the service instance registered in the agent end at regular time to show the normal existence of the agent end and the service instance; the service instance can also send health check information to the registered agent terminal at regular time, which indicates the normal existence of the service instance. The specific content of the health examination information is not limited in the embodiments of the present application.
If the agent end does not receive the health check information sent by one registered service instance within the preset time range, the agent end can judge that the service instance is abnormal, and the service instance is no longer used as the service instance registered in the agent end. For example, the agent side stores an instance list, wherein the instance list comprises each service instance registered in the agent side, and for an abnormal service instance, the abnormal service instance can be removed from the instance list and is no longer communicated with the abnormal service instance, so that the communication between the abnormal service instance and the abnormal service instance is prevented from being failed. And for the abnormal service instance, the abnormal service instance can be registered again at the proxy end, becomes the registered service instance of the proxy end again after registration, and is added into the instance list. The preset duration may be equal to a time interval for the service instance to send the health check information, may be greater than the time interval for the service instance to send the health check information, may also be greater than the time interval for the service instance to send the health check information, and is less than a multiple of the time interval for the service instance to send the health check information, where the multiple is greater than 1 time.
If the service instance does not receive the health check information sent by the registered agent end within the preset time range, the abnormality of the agent end can be judged. The preset duration may be equal to the time interval for the agent to send the health check information, may be greater than the time interval for the agent to send the health check information, may also be greater than the time interval for the agent to send the health check information, and is less than the multiple of the time interval for the agent to send the health check information, where the multiple is greater than 1 time.
If finding that the registered agent end is abnormal, the service instance can register to other agent ends. The service instance reselects the agent terminal for registration, specifically, the agent terminal can be selected according to the configuration information in the service instance, and the agent terminal with the highest priority which is currently selected is selected for registration. For example, the agent with the highest priority is selected for registration at this time. If one agent end is configured in one electronic device, the service instance selects the agent end in other electronic devices to register when discovering that the registered agent end of the same electronic device is abnormal. In order to ensure data consistency, the service instance is registered only at one proxy end at the same time, the registration of the proxy end registered last time is invalid, and if the service instance is still connected with the proxy end registered last time, the connection can be disconnected.
In the request processing system, when any one service instance is used as a request initiator, the service instance is used for sending a request to a registered proxy end, and the proxy end is used for receiving the request sent by the request initiator; searching a service instance with processing capacity for the request from the service instances registered at the agent end to serve as a request receiver; sending the request to the request receiver; the request receiver is used for processing the received request.
That is to say, in the request processing system, the service instances are registered to the agent side in a connection manner, and any one of the service instances can serve as a request initiator to send a request to the registered agent side. When the proxy end receives the request sent by the request initiator, it can search whether there is a service instance having processing capability for the request in each registered service instance.
And if the agent end which receives the request sent by the request initiator finds the service instance, sending the request to the service instance registered in the agent end. Fig. 6 is a schematic diagram illustrating a transmission process of a request when the agent a1 finds that the request has a processing capability for the request in the service instance S12 registered in itself after receiving the request of the service instance S11.
If the agent end does not find the service instance with the processing capacity for the request in the service instances registered in the agent end, whether the service instance with the processing capacity for the request is registered in the adjacent agent end or not is found. If the service instance with the processing capacity for the request is registered in the adjacent agent terminal, the request is sent to the adjacent agent terminal, and the adjacent agent terminal searches the registered specific service instance with the processing capacity for the request and sends the service instance to the searched service instance. As shown in the sending schematic diagram shown in fig. 7, if the agent a1 finds out no service instance having processing capability for the request in the service instances registered in itself and finds out a service instance having processing capability for the request registered in the adjacent agent a2, the agent a1 sends the request to the agent a2, and the agent a2 finds out the service instance S22 having processing capability for the request from the service instances registered in itself and sends the request to the service instance S22. It should be understood that fig. 6 and 7 are only illustrative of the request sending process, and do not represent the existence of all agents in the request processing system.
In the embodiment of the application, the request can be forwarded by only one layer, that is, after the agent terminal receives the request from the request initiator, the request is forwarded to the adjacent agent terminal at most, and the adjacent agent terminal is sent to the request receiver registered in the adjacent agent terminal; if the service instance with the processing capability for the request is not registered in the agent end adjacent to the agent end, the service instance is not sent to the agent end farther away, and delay of the whole communication process, which is amplified by multi-layer forwarding, is avoided.
The request recipient is one of the service instances in the request processing system. And after the request receiver receives the request, processing the request and replying. The reply may be returned to the request originator along a path to the request recipient.
It can be understood that, in the embodiment of the present application, as a service instance of a request initiator, it may also be a request receiver when needed; but also as a service instance of the request receiver, or as a request initiator if needed.
The request processing system of the embodiment of the application provides a lightweight internal service communication scheme for the distributed system, and does not need to introduce an external data storage system and additional deployment resources. And configuring a plurality of agent terminals to mutually discover and register service instances to realize decentralization. In the agent side, based on the memory storage data, the storage data are the registration information of each service instance of local registration and the service index of other agent sides in different places, and the request reply of the communication of the internal service is delivered by the agent side.
In the request processing system, the agent end can be deployed on a machine where the service instance is located and delivers communication data for all the service instances, so that the service instance does not need to pay attention to the deployment situation of a communication opposite end, and only needs to deliver a request to the agent end in a single direction.
In the embodiment of the application, the service instance may not need to be registered in one central node, but may be registered in a nearby agent, for example, the agent configured on the same electronic device performs registration, thereby reducing network overhead. Meanwhile, a plurality of machines can be arranged in the same machine room, each machine serves as an electronic device, a plurality of machines in the same machine room can be respectively provided with an agent end, even if the agent end on one machine is in abnormal conditions such as downtime, service instances on the machine can be switched nearby, the service instances can be quickly switched to the agent ends configured by other machines in the same machine room, and the time required by fault switching is reduced.
In addition, in the embodiment of the present application, the agent may store the registration information of the service instance in the memory, and notify the known neighboring agent to achieve the purpose of data backup. Moreover, the backup may not be a copy of the full data, that is, the backup in the agent is not a complete correspondence between the service instance and the request type in the adjacent agent, but may be a key index, that is, which types are supported by the adjacent agent, and even if there are a plurality of service instances supporting the same request type, there is only one index actually needed to be backed up. In general, the agent only stores the service information registered to the agent, and only one index is stored for other agent, so that the data volume cannot linearly increase along with the increase of the number of the whole service instances of the system, the storage cost is low, the problem of expansion of the copy data volume is solved, and the disaster tolerance risk is reduced.
In addition, in the embodiment of the application, the service instance serving as the request initiator initiates the request, information of a request receiver does not need to be concerned, the request only needs to be submitted to the proxy end, and the proxy end performs processing such as routing and the like, so that the complexity of implementation of the request initiator is reduced. Moreover, even if the implementation logic needs to be adjusted, in a system, the number of the proxy ends is far smaller than that of the service instances, so that the adjustment workload is smaller, and the complexity and the adjustment cost for realizing communication are reduced.
In addition, in the embodiment of the application, the agent can be deployed to the machine along with the service instance, that is, the agent and the service instance registered to the agent can be deployed to the same electronic device, even if the agent is newly added to achieve decentralization in the system, additional resources do not need to be generally allocated, the deployment is simple, and the resource dependence is less.
In the scheme of the embodiment of the application, because the communication is delivered by the agent end, the whole communication link can be monitored at the agent end, the communication quality in the system can be conveniently evaluated integrally, and the tracking of the communication quality is realized.
The embodiment of the present application further provides a request processing apparatus 400, which can be applied to a target agent in a request processing system. As shown in fig. 1, the request processing system includes a plurality of agent terminals and a plurality of service instances, the target agent terminal is any one of the plurality of agent terminals, each agent terminal of the plurality of agent terminals is in communication connection with at least one other agent terminal, and each agent terminal registers one or more service instances. Referring to fig. 8, the apparatus 400 may include: a request receiving module 410, configured to receive a request sent by a request initiator, where the request initiator is a service instance registered at the target agent; a searching module 420, configured to search, from the service instances registered at the target agent, a service instance having a processing capability for the request as a request receiver; a request sending module 430, configured to send the request to the request receiving party, where the request is used for processing by the request receiving party.
Optionally, the searching module 420 may be further configured to search, if no service instance with processing capability to the request is found in the service instances registered in the target agent, whether a service instance with processing capability to the request is registered in an agent communicatively connected to the target agent; if so, the request sending module 430 may be configured to send the request to the found agent, so that the found agent sends the request to the service instance having the processing capability for the request for processing.
Optionally, the request received by the agent end includes a request type, each service instance has a processing capability for one or more request types, each agent end stores service indexes of other agent ends in communication connection, and the service index of each agent end includes a request type that the service instance registered in the agent end has a processing capability. The finding module 420 is configured to find whether a service instance having a processing capability for the request is registered in an agent communicatively connected to the target agent, and may include: searching whether the service index of the agent end in communication connection with the target agent end comprises the request type of the request; and if the service index comprises the request type of the request, taking the agent terminal to which the searched service index belongs as the searched agent terminal.
Optionally, the apparatus 400 may further include an information feedback module, configured to return a notification message to the request initiator if no service instance having a processing capability for the request is registered in the agent end of the target agent end in communication connection.
Optionally, the request receiving module 410 may be further configured to receive a request sent by an adjacent agent; the searching module can be further used for taking a service instance which has processing capacity for the request in the registered service instances as a request receiver; the request sending module may be further configured to send the request to the request receiving party for processing by the request receiving party.
Optionally, the method for searching for a service instance having a processing capability for the request from the service instances registered in the target agent end by using the searching module 420 includes: and searching a service instance corresponding to the request type of the request from a service type mapping table stored in the target agent end to be used as a request receiver.
Optionally, the apparatus may further include a reply receiving module, configured to receive a reply sent by the request receiving party, where the reply is a processing of the request; and the reply returning module is used for returning the reply to the request receiving party.
It will be clear to those skilled in the art that, for convenience and brevity of description, the various method embodiments described above may be referred to one another; for the specific working processes of the above-described devices and modules, reference may be made to corresponding processes in the foregoing method embodiments, which are not described herein again.
In the several embodiments provided in the present application, the coupling between the modules may be electrical, mechanical or other type of coupling.
In addition, functional modules in the embodiments of the present application may be integrated into one processing module, or each of the modules may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. Each module may be configured in different electronic devices, or may be configured in the same electronic device, and the embodiments of the present application are not limited thereto.
Referring to fig. 9, a block diagram of an electronic device 600 according to an embodiment of the present disclosure is shown. The electronic device may be a computer, and service instances in the distributed system may be configured in the electronic device, and a delivery component for communication between the service instances may also be configured in the electronic device, such as an agent in the embodiment of the present application.
The electronic device may include one or more processors 610 (only one shown), memory 620, and configured with an agent side and one or more service instances. Wherein the memory 620 may be electrically connected to the processor 610, and the agent and the one or more service instances are stored in the memory 620 and configured to be executed by the one or more processors 610. The one or more service instances are registered at the broker, which is executed by a processor for performing the method described in the previous embodiment for the corresponding broker.
In addition, the electronic device may further include a memory, configured to store, by the agent terminal, registration information of each service instance registered in the agent terminal, such as a service type mapping table, and may also store service types supported by other agent terminals, such as a service index of an adjacent agent terminal.
In the electronic device 600, the processor 610 may include one or more processing cores. The processor 610 interfaces with various components throughout the electronic device 600 using various interfaces and circuitry to perform various functions of the electronic device 600 and process data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 620 and invoking data stored in the memory 620. Alternatively, the processor 610 may be implemented in hardware using at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 610 may integrate one or more of a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a modem, and the like. Wherein, the CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing display content; the modem is used to handle wireless communications. It is understood that the modem may not be integrated into the processor 610, but may be implemented by a communication chip.
The Memory 620 may include a Random Access Memory (RAM) or a Read-Only Memory (Read-Only Memory). The memory 620 may be used to store instructions, programs, code sets, or instruction sets. The memory 620 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function, instructions for implementing the various method embodiments described above, and the like. The stored data area may also store data created by the electronic device in use, and the like.
Referring to fig. 10, a block diagram of a computer-readable storage medium according to an embodiment of the present application is shown. The computer-readable storage medium 700 has stored therein program code that can be called by a processor to execute the methods described in the above-described method embodiments.
The computer-readable storage medium 700 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer-readable storage medium 700 includes a non-volatile computer-readable storage medium. The computer readable storage medium 700 has storage space for program code 710 to perform any of the method steps of the method described above. The program code can be read from or written to one or more computer program products. The program code 710 may be compressed, for example, in a suitable form.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not necessarily depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (10)

1. A request processing method is applied to a target agent terminal in a request processing system, the request processing system comprises a plurality of agent terminals and a plurality of service instances, the target agent terminal is any one of the agent terminals, each agent terminal in the agent terminals is in communication connection with at least one other agent terminal, and each agent terminal is registered with one or more service instances, the method comprises the following steps:
receiving a request sent by a request initiator, wherein the request initiator is a service instance registered at the target agent terminal;
searching a service instance with processing capacity for the request from the service instances registered at the target agent end to serve as a request receiver;
and sending the request to the request receiver for processing by the request receiver.
2. The method of claim 1, further comprising:
if the service instance with the processing capacity for the request is not found in the service instances registered by the target agent end, finding whether the service instance with the processing capacity for the request is registered in the agent end in communication connection with the target agent end;
and if so, sending the request to the searched agent end, so that the searched agent end sends the request to a service instance with processing capacity for the request to process.
3. The method according to claim 2, wherein the request received by the agent includes a request type, each service instance has processing capability for one or more request types, each agent stores service indexes of other agents in communication connection, the service index of each agent includes a request type that the service instance registered in the agent has processing capability, and the searching whether the agent in communication connection with the target agent registers the service instance having processing capability for the request includes:
searching whether the service index of the agent end in communication connection with the target agent end comprises the request type of the request;
and if the service index comprises the request type of the request, taking the agent terminal to which the searched service index belongs as the searched agent terminal.
4. The method according to claim 2 or 3, wherein if no service instance having processing capability for the request is registered in the agent end of the target agent end communication connection, a notification message is returned to the request initiator.
5. The method of claim 1, further comprising:
receiving a request sent by an adjacent agent terminal;
taking a service instance which has processing capacity for the request in the registered service instances as a request receiver;
and sending the request to the request receiver for processing by the request receiver.
6. The method according to claim 1, wherein the request received by the proxy end includes a request type, each service instance has processing capability for one or more request types, each proxy end stores therein a service type mapping table, the service type mapping table includes a correspondence between each service instance registered in the proxy end and the request type, and the searching for the service instance having processing capability for the request from the service instances registered in the target proxy end as a request receiver includes:
and searching a service instance corresponding to the request type of the request from a service type mapping table stored in the target agent end to be used as a request receiver.
7. A request processing system is characterized by comprising a plurality of agent terminals and a plurality of service instances, each agent terminal in the plurality of agent terminals is in communication connection with at least one other agent terminal, each agent terminal is registered with one or more service instances, wherein,
when any one service instance is used as a request initiator, the service instance is used for sending a request to a registered agent terminal;
the agent end is used for receiving a request sent by a request initiator; searching a service instance with processing capacity for the request from the service instances registered at the agent end to serve as a request receiver; sending the request to the request receiver;
the request receiver is used for processing the received request.
8. A request processing apparatus, applied to a target agent in a request processing system, where the request processing system includes a plurality of agents and a plurality of service instances, the target agent is any one of the plurality of agents, each of the plurality of agents is in communication connection with at least one other agent, and each agent has one or more service instances registered therein, the apparatus comprising:
a request receiving module, configured to receive a request sent by a request initiator, where the request initiator is a service instance registered at the target agent;
the searching module is used for searching the service instance which has the processing capacity to the request from the service instances registered at the target agent end to be used as a request receiving party;
and the request sending module is used for sending the request to the request receiving party for processing by the request receiving party.
9. An electronic device, comprising:
one or more processors;
a memory;
a broker and one or more service instances stored in the memory and configured to be executed by the one or more processors, the one or more service instances registered at the broker, the broker executed by the processors for performing the method of any of claims 1-6.
10. A computer-readable storage medium, having stored thereon program code that can be invoked by a processor to perform the method according to any one of claims 1 to 6.
CN202010753860.8A 2020-07-30 2020-07-30 Request processing method, system, device, electronic equipment and storage medium Pending CN111917870A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010753860.8A CN111917870A (en) 2020-07-30 2020-07-30 Request processing method, system, device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010753860.8A CN111917870A (en) 2020-07-30 2020-07-30 Request processing method, system, device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111917870A true CN111917870A (en) 2020-11-10

Family

ID=73286395

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010753860.8A Pending CN111917870A (en) 2020-07-30 2020-07-30 Request processing method, system, device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111917870A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113452766A (en) * 2021-06-22 2021-09-28 青岛海尔科技有限公司 Node switching method and device, storage medium and electronic device
CN115883655A (en) * 2022-12-07 2023-03-31 中科驭数(北京)科技有限公司 Service request processing method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160337329A1 (en) * 2015-05-11 2016-11-17 Kapil Sood Technologies for secure bootstrapping of virtual network functions
CN109246251A (en) * 2018-11-13 2019-01-18 杭州数梦工场科技有限公司 A kind of micro services call method, device, system, equipment and readable storage medium storing program for executing
CN109981716A (en) * 2017-12-28 2019-07-05 北京奇虎科技有限公司 A kind of micro services call method and device
CN110830538A (en) * 2018-08-13 2020-02-21 华为技术有限公司 Message transmission method, device and storage medium
CN110830543A (en) * 2018-08-13 2020-02-21 华为技术有限公司 Communication method and communication device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160337329A1 (en) * 2015-05-11 2016-11-17 Kapil Sood Technologies for secure bootstrapping of virtual network functions
CN109981716A (en) * 2017-12-28 2019-07-05 北京奇虎科技有限公司 A kind of micro services call method and device
CN110830538A (en) * 2018-08-13 2020-02-21 华为技术有限公司 Message transmission method, device and storage medium
CN110830543A (en) * 2018-08-13 2020-02-21 华为技术有限公司 Communication method and communication device
CN109246251A (en) * 2018-11-13 2019-01-18 杭州数梦工场科技有限公司 A kind of micro services call method, device, system, equipment and readable storage medium storing program for executing

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
谭一鸣: ""基于微服务架构的平台化服务框架的设计与实现"", 《中国优秀硕士论文全文数据库》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113452766A (en) * 2021-06-22 2021-09-28 青岛海尔科技有限公司 Node switching method and device, storage medium and electronic device
CN113452766B (en) * 2021-06-22 2023-10-24 青岛海尔科技有限公司 Node switching method and device, storage medium and electronic device
CN115883655A (en) * 2022-12-07 2023-03-31 中科驭数(北京)科技有限公司 Service request processing method and device, electronic equipment and storage medium
CN115883655B (en) * 2022-12-07 2024-06-07 中科驭数(北京)科技有限公司 Service request processing method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN111615066B (en) Distributed micro-service registration and calling method based on broadcast
CN110365748B (en) Service data processing method and device, storage medium and electronic device
KR102392120B1 (en) Processing method, device and system for nf component abnormality
CN111343237A (en) Server cluster communication method, communication device and computer storage medium
US9390156B2 (en) Distributed directory environment using clustered LDAP servers
US9760370B2 (en) Load balancing using predictable state partitioning
CN111917870A (en) Request processing method, system, device, electronic equipment and storage medium
CN112788089A (en) Network communication control method of multi-edge cloud, edge operation device and system
CN114364031A (en) Service providing method, device and storage medium
CN110119314B (en) Server calling method and device, server and storage medium
CN107547605B (en) message reading and writing method based on node queue and node equipment
CN110661836B (en) Message routing method, device and system, and storage medium
CN113157441B (en) Distributed decentralized load balancing method and system
CN101977220B (en) Method and device for matching functional modules with different versions among function subsystems
US20230188625A1 (en) Service request handling
CN110611688A (en) Method, electronic device and computer program product for searching nodes
CN113805788B (en) Distributed storage system and exception handling method and related device thereof
US11757987B2 (en) Load balancing systems and methods
CN114048028A (en) Service calling method and device, storage medium and electronic equipment
CN110830279B (en) Management method and device for management service
CN113542319A (en) Service providing entity change notification method, device and system used in Dubbo framework
CN110958182B (en) Communication method and related equipment
CN115412530B (en) Domain name resolution method and system for service under multi-cluster scene
CN110430268B (en) Static resource routing method and device based on distributed service
CN115997377B (en) Method and apparatus for removing stale context in a service instance providing micro-services

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
EE01 Entry into force of recordation of patent licensing contract
EE01 Entry into force of recordation of patent licensing contract

Application publication date: 20201110

Assignee: GUANGZHOU HUADUO NETWORK TECHNOLOGY Co.,Ltd.

Assignor: Guangzhou Jinhong network media Co.,Ltd.

Contract record no.: X2021440000051

Denomination of invention: Request processing method, system, apparatus, electronic device and storage medium

License type: Common License

Record date: 20210208

RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20201110