Request processing method, device, distributed system, electronic device and storage medium
By building a message site on the client side and sending requests to the multicast address, the development complexity problem when responding to multiple servers is solved, and simplified request processing processes and code logic are achieved.
Patent Information
- Application Number
- CN202410717684.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-04
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-06-04
AI Technical Summary
In the request-response mode, when multiple servers need to respond, the client needs to send requests separately, resulting in increased development complexity and complicated code logic.
After receiving the user request, the client constructs a message scene, including the multicast addresses of multiple responders, message numbers, and storage areas for content data, and sends a user request to the multicast address, simplifying request processing for multiple responders. process.
It reduces the difficulty of development, reduces the amount of code, simplifies the development process, and avoids the complexity of multiple requests and processing logic.
Smart Images

Figure CN118283119B
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the field of communication technology, and in particular, to a request processing method, device, distributed system, electronic device, and storage medium. Background Art
[0002] In the request-response model, one entity (called the client) sends a request to another entity (called the server). After receiving the request, the server processes it and sends a response to the client. If there are multiple servers that need to respond, the client needs to send a corresponding request to each server separately, which means that the client needs to repeat the request response multiple times, which increases the difficulty of development. Summary of the invention
[0003] To reduce the difficulty of development, the embodiments of the present application provide a request processing method, device, distributed system, electronic device and storage medium.
[0004] In a first aspect of the present application, a request processing method is provided, which is applied to a requesting party and includes:
[0005] In response to receiving a user request, constructing a message site corresponding to the received user request, the message site including multicast addresses of multiple responders that need to respond to the received user request, a message number of the received user request, and a storage area for storing content data requested by the received user request, the storage area corresponding to the message number;
[0006] A user request is sent to the multicast address once, where the sent user request includes the message number.
[0007] In one practicable manner, constructing a message scene corresponding to a received user request includes:
[0008] Allocating multicast addresses to multiple responders that need to respond to received user requests;
[0009] Assigning a request number to the received user request;
[0010] A storage area is allocated for content data requested by a received user request.
[0011] In one achievable manner, the user request sent to the multicast address includes a response address, and the response address is a unicast address of the requester.
[0012] In an achievable manner, the response message sent by the responder includes the response address, the message number, an identity identifier, and content data; the method further includes:
[0013] In response to receiving a response message sent by at least one responder, the content data and the identity identifier are stored in a corresponding storage area based on the message number.
[0014] In one achievable manner, the present invention further includes:
[0015] Determining the number of responders that respond to the requester based on the identity identifier;
[0016] If the quantity is equal to the preset expected quantity, the confirmation request process ends.
[0017] In one achievable manner, the present invention further includes:
[0018] The time starts from the moment when a user request is sent to the multicast address;
[0019] Determining the number of responders that respond to the requester based on the identity identifier;
[0020] If the number is equal to the preset expected number within the preset time period, the confirmation request process ends;
[0021] After exceeding the preset time period, if the number is less than the preset expected number, it is determined that an abnormality occurs in the request process.
[0022] In a second aspect of the present application, a request processing method is provided, which is applied to a responder, comprising:
[0023] In response to receiving a user request sent by the requesting party, sending a response message to the requesting party based on the response address, so that the requesting party can store the requested content data and the identity of the responding party in a corresponding storage area based on the message number;
[0024] The user request sent by the requester includes the response address and the message number, and the response message sent by the responder includes the message number, the identity identifier, the response address and the content data.
[0025] In a third aspect of the present application, a request processing device is provided, which is applied to a requesting party and includes:
[0026] A construction module, configured to construct, in response to receiving a user request, a message scene corresponding to the received user request, wherein the message scene includes multicast addresses of multiple responders that need to respond to the received user request, a message number of the received user request, and a storage area for storing content data requested by the received user request, wherein the storage area corresponds to the message number;
[0027] The first sending module is used to send a user request to the multicast address once, and the sent user request carries the message number.
[0028] In a fourth aspect of the present application, a request processing device is provided, which is applied to a responder, including:
[0029] A second sending module is used to send a response message to the requester based on the response address in response to receiving the user request sent by the requester, so that the requester can store the content data requested by the requester to the corresponding storage area based on the message number;
[0030] The user request sent by the requester carries a response address and a message number, and the response message sent by the responder carries a message number, an identity identifier, and a response address.
[0031] In a fifth aspect of the present application, a distributed system is provided, comprising:
[0032] At least one requestor, each requestor being used to:
[0033] In response to receiving a user request, construct a message site corresponding to the received user request, the message site including multicast addresses of multiple responders that need to respond to the received user request, a message number of the received user request, and a storage area for storing content data requested by the received user request, the storage area corresponding to the message number;
[0034] Sending a user request to the multicast address once, where the sent user request includes the message number and the response address, and the response address is the unicast address of the requester;
[0035] At least one responder, each responder being used to:
[0036] In response to receiving a user request sent by the requesting party, sending a response message to the requesting party based on the response address, so that the requesting party can store the requested content data and the identity of the responding party in a corresponding storage area based on the message number;
[0037] The response message sent by the responder includes the message number, the identity identifier, the response address and the content data.
[0038] In a sixth aspect of the present application, an electronic device is provided, comprising a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, a request processing method as described in any one of the first aspect or the second aspect is implemented.
[0039] In a seventh aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the request processing method as described in any one of the first aspect or the second aspect is implemented.
[0040] In the request processing method, device, distributed system, electronic device and storage medium provided by the embodiments of the present application, after the requesting party (such as a client) receives a user request, a message scene is constructed for the user request. The message scene includes the multicast addresses of multiple responding parties that need to respond to the received user request, the message number of the received user request, and a storage area for storing the content data requested by the received user request. When the message scene is completed or when the message scene is constructed, a user request is sent to the multicast address once, thereby achieving the goal of obtaining multiple different responses by sending a request once on the requesting party, greatly simplifying the complexity of programming and development caused by the method of constantly rotating requests that require multiple responses, and reducing the difficulty of development.
[0041] It should be understood that the contents described in the Summary of the Invention are not intended to limit the key or important features of the embodiments of the present application, nor are they intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The above and other features, advantages and aspects of the embodiments of the present application will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:
[0043] Figure 1 An example diagram showing an example of interaction between a requester and multiple responders in the related art;
[0044] Figure 2 A schematic diagram showing an exemplary environment in which embodiments of the present application can be implemented;
[0045] Figure 3 A schematic diagram showing the interaction process between a requester and a responder according to an embodiment of the present application
[0046] Figure 4 A flowchart of a requester processing method according to an embodiment of the present application is shown;
[0047] Figure 5 A flowchart showing a requester processing method according to another embodiment of the present application is shown;
[0048] Figure 6 A block diagram of a requester processing device according to an embodiment of the present application is shown;
[0049] Figure 7 A block diagram of a requester processing device according to another embodiment of the present application is shown;
[0050] Figure 8 A schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present application is shown. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0052] In the description of the embodiments of the present application, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The term "some embodiments" should be understood as "at least some embodiments". Other explicit and implicit definitions may also be included below.
[0053] The term "in response to" means that the corresponding event occurs or the condition is satisfied. It will be understood that the timing of the execution of the subsequent action executed in response to the event or condition is not necessarily strongly related to the time when the event occurs or the condition is satisfied. In some cases, the subsequent action may be executed immediately when the event occurs or the condition is satisfied; in other cases, the subsequent action may be executed some time after the event occurs or the condition is satisfied.
[0054] In the related art, in the request-response mode, if there are multiple servers that need to respond, the client needs to send a corresponding request to each server. Figure 1 To further explain it in detail, Figure 1 The scenario of the interaction example between the requester and multiple responders is shown. The scenario includes one requester and two responders. The request "hello" sent by the requester needs to be responded to by responders 1 and 2 respectively, that is, the requester needs to send a request "hello" to responder 1 once and send a request "hello" to responder 2 once. After responder 1 receives the request, it replies "world" to the requester, and responder 2 also replies "world" to the requester after receiving the request. After receiving the "world" reply from responder 1, the requester needs to process it, and after receiving the "world" reply from responder 2, the requester also needs to process it.
[0055] In the process of implementing the above functions of the requester, the developer needs to repeatedly and multiple times develop the process of the requester sending the request to the responder and the process of processing the reply message of each responder, which results in more codes and more complex logic in the development process, increasing the difficulty of development. To this end, the embodiment of the present application provides a request processing scheme that can simplify the development process and reduce the difficulty of development. Specifically, according to the embodiment of the present application, the requester should have the following functions after the developer completes the development: in response to receiving a user request, construct a message scene corresponding to the received user request. Further, send a user request to the multicast address once. Among them, the message scene includes the multicast addresses of multiple responders that need to respond to the received user request, the message number of the received user request, and a storage area for storing the content data requested by the received user request, and the storage area corresponds to the message number.
[0056] It will be more clearly understood through the following description that according to each embodiment of the present application, the requester constructs a message scene corresponding to the received user request in response to receiving the user request, and sends the user request once to the multicast address. On the one hand, when implementing the function of the above-mentioned requester, the developer only needs to develop the requester to construct a message scene for one user request. In this way, it is possible to avoid developing multiple processing logics for one user request (for example, the process of sending a user request to one responder is called one processing logic), the code logic is simple, and the development difficulty is reduced. On the other hand, when implementing the function of the above-mentioned requester sending the user request, the developer only needs to develop a function of sending the user request to the multicast address process. Compared with developing multiple sending of user requests (for example, the process of sending the user request to one responder is called one sending), the amount of code is less, which reduces the development difficulty.
[0057] Example Environment
[0058] Various exemplary implementations of the solution will be described in detail below with reference to the accompanying drawings. Figure 2 , which shows a schematic diagram of an example environment 200 in which the embodiments of the present application can be implemented. In the exemplary environment 200, a client 210 and multiple servers 220 can communicate.
[0059] In the environment 200, when the client 210 receives a user request, it can build a message scene based on the user request.
[0060] In some embodiments, the message site includes the multicast addresses of multiple servers 220 that need to respond to the received user request, the message number of the received user request, and a storage area for storing content data requested by the received user request.
[0061] It is worth noting that the client 210 constructs a corresponding message scene each time it receives a user request.
[0062] In some embodiments, if the client 210 receives a new user request after the previous request has not been processed, a new storage area needs to be allocated for it when constructing a message scene corresponding to the new user request. In order to prevent the content data that should be stored in the storage area corresponding to the previous user request from being stored in the newly allocated storage area, it is necessary to associate the storage area with the message number, that is, the storage area where the content data is stored can be distinguished by the message number.
[0063] In the environment 200, the client 210 can send a user request to the multicast address in the message site once after the message site is constructed, or send a user request to the multicast address once while constructing the message site. It should be noted that no matter which method the client 210 uses to send the user request to the multicast address, it is based on the fact that the client 210 has already allocated the multicast address.
[0064] In some embodiments, the client 210 may include a virtual client and a physical client. As an example, the client may include, but is not limited to, a mobile device, a fixed device, or a portable device, including a mobile phone, a desktop computer, a laptop computer, a notebook computer, a netbook computer, a tablet computer, a media computer, a multimedia tablet, a personal communication system (PCS) device, a personal navigation device, a personal digital assistant (PDA), an audio / video player, a digital camera / camcorder, a positioning device, a television receiver, a radio broadcast receiver, an e-book device, a virtual reality (VR) all-in-one machine, a game console, a game book, or any combination of the foregoing, including accessories and peripherals of these devices or any combination thereof.
[0065] In environment 200, upon receiving a user request sent by client 210, server 220 may send a response message to client 210 based on a response address, so that client 210 may store the content data requested by the user request and the identity of server 220 in a corresponding storage area based on the message number.
[0066] The user request sent by the client 210 includes a response address and a message number, and the response message sent by the server 220 includes a message number, an identity identifier, a response address, and content data.
[0067] In some embodiments, the server 220 can be implemented by any type of device, including virtual and physical devices. Examples of such devices may include, but are not limited to, mainframes, edge computing nodes, rack servers, router computers, server computers, personal computers, mainframe computers, laptop computers, tablet computers, desktop computers, etc. In some embodiments, the device may include a virtual machine, a container, or a bare metal server.
[0068] According to some embodiments of the present application, when the client 210 receives a user request, it can build a message scene based on the user request; after the message scene is built, or while building the message scene, the client 210 can send a user request to the multicast address. According to some embodiments of the present application, the server 220 can receive a user request sent by the client 210 and send a response message to the client 210 based on the response address in the user request sent by the client 210. This will be described in conjunction with Figure 3 Described in further detail.
[0069] Example Interaction
[0070] References below Figure 3 To describe exemplary embodiments according to the present application. Figure 3 FIG. 1 shows a schematic diagram of an interaction example according to some embodiments of the present application. It should be understood that Figure 3 The interaction between the requester and the responder shown in is only an example, and various designs may exist in practice. For example, the number of responders may be different and / or the number of requesters may be different and / or the number of user requests may be different. The scope of the present application is not limited in this respect.
[0071] In some embodiments, the requester may receive the user request based on web forms, API calls, buttons and controls in a graphical user interface (GUI), a command line interface (CLI), an Internet of Things (IoT) device, a message queue and event-driven architecture, a real-time communication protocol, image and voice input, etc. It should be understood that the above-mentioned methods are only exemplary, and other methods may also be used to receive or obtain the user request.
[0072] In some embodiments, after receiving a user request (eg, Reqa), the requester may construct a corresponding message context (Reqa Context) based on the user request. It should be understood that when the requester receives different user requests, it needs to construct a corresponding message context for each user request.
[0073] In some embodiments, when constructing a message scene for each user request among multiple user requests, the corresponding message scene can be constructed in the order in which the messages are received from the users, or the construction order can be selected based on the time consumed in constructing the message scenes, or the message scenes can be constructed based on other orders, and the present application does not impose any restrictions on this.
[0074] In some embodiments, the message context (Reqa Context) constructed by the requester may include, for example, but is not limited to, the multicast address A of responders 1, 2, and 3 that need to respond to the user request (Reqa), the message number of the user request (Reqa), and a storage area for storing content data requested by the received user request.
[0075] In order to realize the above functions of the client 210, developers need to develop the client 210 so that it can respond to receiving a user request and build a message scene based on the user request.
[0076] Specifically, the function of building a message scene can be split into three separate functions. For example, a multicast address is allocated to multiple responders that need to respond to the received user request. For example, a request number is allocated to the received user request. For example, a storage area is allocated for the content data requested by the received user request. This will greatly simplify the development difficulty of developers in program implementation. The detailed implementation of each function will be described below.
[0077] In some embodiments, before allocating the multicast address, the identity of at least one responder that needs to respond to the user request sent by the requester is first determined.
[0078] For example, the identity of at least one responder may be pre-set. For example, for user request a, the responders that need to respond to user request a may include responders a1, a2, and a3; for example, for user request b, the responders that need to respond to user request b may include responders b1 and b2. The correspondence between them may be pre-configured in the requester. After the requester receives the user request, it may query the correspondence table of user request-responders that need to respond, and determine the identity of the responder that needs to respond.
[0079] For example, the identity of at least one responder may be determined by the requester based on the user request. For example, if the user request includes the identifier of the required responder, the requester may determine the identity of the required responder based on the identifier of the responder included in the user request.
[0080] In some embodiments, after determining the identity of at least one responder, the requester may configure the same multicast address for at least one responder, so that at least one responder configured with the same multicast address can monitor user requests sent by the requester in a group.
[0081] For example, responders 1, 2, ..., n are in the same network segment, and responders that need to respond to received user requests include responders 1, 2, and 3, where n>3. The same multicast address A, such as 239.1.1.1, is configured for responders 1, 2, and 3. When a requester sends a request to the multicast address, all responders configured with the multicast address can receive the request.
[0082] In some embodiments, the message number can be used as a unique identifier of the user request during the entire data request process.
[0083] In some embodiments, the message number may be randomly generated. It should be noted that when the message number is randomly generated, it should be ensured that the randomly generated message number is unique.
[0084] In some embodiments, the message number may be generated based on a specific order, that is, a message number is sequentially assigned to each user request in a specific order according to the order in which the client receives the user requests.
[0085] For example, the message number may be Reqa.
[0086] In some embodiments, the allocated storage area needs to correspond to the message number, that is, one message number corresponds to one storage area, so that the data requested by the user request can be stored in the corresponding storage area.
[0087] For example, the storage area can be divided according to a partition key (such as user ID, timestamp, etc.). When the requester receives a user request, it can determine in which partition the data requested by the user request is stored based on the partition key, and establish a correspondence between the partition and the message number.
[0088] In some embodiments, if the requesting party receives a new user request after the previous request has not been processed, it is necessary to construct a new message scene to prevent the content data that should be stored in the storage area corresponding to the previous user request from being stored in the newly allocated storage area.
[0089] In some embodiments, to simplify the process of the requester receiving response messages sent by multiple responders, a unicast address may be configured on the requester, and the unicast address may be used as the reply address of the responder.
[0090] In some embodiments, when the requester sends a user request to the responder, the unicast address of the requester can be added as a response address to the sent user request. Compared with developing multiple ports on the client for receiving data sent by the responder, this method further reduces the complexity of development.
[0091] For example, the user request sent by the requesting party to the multicast address A may include the following content:
[0092] Request message: Reqa;
[0093] Request content: hello;
[0094] Request address: multicast address A;
[0095] Response address: unicast address of the requester.
[0096] It should be noted that the user request sent to the multicast address in the requesting direction is formed after processing the user request received by the requesting party, that is, the message number in the constructed message field is added to the user request, so that the responding party carries the message number when sending the response message, thereby storing the corresponding data in the corresponding storage area.
[0097] In some embodiments, if the requesting party receives multiple user requests, after processing each user request (building the corresponding message site and adding the message number to the user request) is completed, each user request is sent once to its corresponding multicast address.
[0098] According to some embodiments of the present application, after the requesting party receives each user request, a message site is constructed for each user request, and the message site includes the multicast addresses of multiple responders who need to respond to the received user request, the message number of the received user request, and a storage area for storing the content data requested by the received user request. After the message site is constructed or while the message site is constructed, a user request is sent to the multicast address once. When the developer implements the above functions through code, compared with the complexity of implementing the unicast mode through code (the requesting party needs to maintain the address list of each responder and send a request to each responder separately), it is only necessary to develop the function of building the message site and the function of sending a request to a multicast address, which greatly simplifies the complexity of programming and development caused by the method of constantly rotating requests requiring multiple responses, thereby reducing the difficulty of development.
[0099] In some embodiments, the responder responds to receiving a user request (Reqa) sent by the requester, and sends a response message based on the response address requester in the user request. The user request sent by the requester includes a response address and a message number, and the response address is a unicast address of the requester. The response message sent by the responder includes a message number, an identity, a response address, and content data, so that the requester can store the content data requested by the user request and the identity of the responder in the corresponding storage area based on the message number.
[0100] For example, the response message sent by responder 1 may include the following content:
[0101] Response to request: Reqa;
[0102] Response content: world;
[0103] Response identity: Respondent 1;
[0104] Response address: unicast address of the requester.
[0105] For example, the response message sent by responder 2 may include the following content:
[0106] Response to request: Reqa;
[0107] Response content: world;
[0108] Response identity: Respondent 2;
[0109] Response address: unicast address of the requester.
[0110] In some embodiments, the message number in the response message may be the same as the message number assigned by the requesting party to the user request.
[0111] In some embodiments, the message number in the response message may be generated by the responder, and uniquely corresponds to the message number assigned by the requester to the user request.
[0112] In some embodiments, the identity identifier may be an identifier of the responder.
[0113] In some embodiments, after receiving the response message sent by the responder, the requester processes and stores it in a format such as: responder 1: response data and metadata; responder 2: response data and metadata.
[0114] According to some embodiments of the present application, when storing the response data sent by the responder, the requester can determine the corresponding storage area based on the message number, and store the identity identification and content data in the response message in the corresponding storage area. Compared with the unicast mode (the requester needs to maintain the storage area of each responder and store the content data sent by each responder separately), it is necessary to configure an interface for each responder. In the embodiments of the present application, only one port needs to be configured to uniformly store the response messages sent by each responder, which greatly reduces the amount of code and simplifies the code logic, further reducing the difficulty of development. Figure 3 To further describe the end of the request process.
[0115] In some embodiments, the requester may determine the number of responders that respond to the requester based on the identity identifier. For example, the requester may determine the number of responders based on the number of identity identifiers in the response message it receives. After determining the number of responders, the requester may determine whether the number is equal to the expected number. For example, the expected number may be determined based on the number of responders that need to respond to the user request. If so, the confirmation request process ends; if not, the response message sent by the service end continues to be received.
[0116] According to the embodiment of the present application, by setting the expected number to determine whether to end the current request process, the code logic and the amount of code can be greatly simplified during the development process, thereby reducing the difficulty of development.
[0117] Furthermore, if a server fails during a request process, the request process can be terminated in the following manner to save resources.
[0118] The requesting party starts timing from the moment it sends a user request to the multicast address, and determines the number of responders that respond to the requesting party based on the identity identifier, and determines whether the current duration exceeds the preset duration. If not and the number of responding responders is equal to the preset expected number, the requesting party confirms that the request process is over; if yes and the number of responding responders is less than the preset expected number, the requesting party confirms that an abnormality has occurred in the request process.
[0119] For example, the expected number is set to 3 and the timeout period is 30 seconds. If the number of responders that respond within 30 seconds is 3, the confirmation request process ends; if the number of responders that respond is less than 3 after 30 seconds, the confirmation request process is abnormal.
[0120] Through the above description of the functions of the requester and responder, compared with the unicast mode, the functions are simpler and the implementation logic is also simpler, so that developers can effectively reduce the difficulty of development during development.
[0121] Example Method
[0122] Figure 4 A flowchart of a requester processing method according to an embodiment of the present application is shown. In some embodiments, the method may be Figure 3 Executed at the requester as shown.
[0123] Step 410: In response to receiving a user request, construct a message site corresponding to the received user request. Step 420: Send a user request to the multicast address once.
[0124] Among them, the message site includes the multicast addresses of multiple responders who need to respond to the received user request, the message number of the received user request, and a storage area for storing content data requested by the received user request, and the storage area corresponds to the message number; the sent user request includes the message number.
[0125] In some embodiments, step 410 includes: allocating multicast addresses to multiple responders that need to respond to the received user request; allocating request numbers to the received user request; and allocating storage areas to the content data requested by the received user request.
[0126] In some embodiments, the user request sent to the multicast address includes a response address, and the response address is a unicast address of the requester.
[0127] In some embodiments, the response message sent by the responder includes the response address, the message number, an identity identifier and content data; the method also includes: in response to receiving a response message sent by at least one responder, storing the content data and the identity identifier in a corresponding storage area based on the message number.
[0128] In some embodiments, the method further includes: determining the number of responders that respond to the requester based on the identity identifier; if the number is equal to a preset expected number, the confirmation request process ends.
[0129] In some embodiments, the method further includes: starting timing from the moment a user request is sent to the multicast address; determining the number of responders that respond to the requester based on the identity identifier; within a preset time period, if the number is equal to a preset expected number, confirming the end of the request process; after exceeding the preset time period, if the number is less than the preset expected number, determining that an abnormality has occurred in the request process.
[0130] Figure 5 A flowchart of a requester processing method according to another embodiment of the present application is shown. In some embodiments, the method may be Figure 3 Executed at the responder as shown.
[0131] Step 510, in response to receiving the user request sent by the requesting party, a response message is sent to the requesting party based on the response address, so that the requesting party can store the content data requested by the user request and the identity of the responding party in the corresponding storage area based on the message number.
[0132] The user request sent by the requester includes the response address and the message number, and the response message sent by the responder includes the message number, the identity identifier, the response address and the content data.
[0133] Example Devices, Systems, and Apparatus
[0134] The embodiments of the present application also provide corresponding devices, systems and equipment for implementing the above methods or processes. Figure 6 A block diagram of a requester processing device according to an embodiment of the present application is shown. The device can implement part of the method according to the embodiment of the present application. The device includes a construction module 610 and a first sending module 620.
[0135] Construction module 610 is used to construct a message scene corresponding to the received user request in response to receiving the user request, and the message scene includes the multicast addresses of multiple responders who need to respond to the received user request, the message number of the received user request, and a storage area for storing content data requested by the received user request, and the storage area corresponds to the message number.
[0136] The first sending module 620 is configured to send a user request to the multicast address once, where the sent user request carries the message number.
[0137] In some embodiments, the construction module 610 is specifically used to: allocate multicast addresses to multiple responders that need to respond to the received user request; allocate request numbers to the received user request; and allocate storage areas for content data requested by the received user request.
[0138] In some embodiments, the user request sent to the multicast address includes a response address, and the response address is a unicast address of the requester.
[0139] In some embodiments, the response message sent by the responder includes the response address, the message number, an identity identifier and content data; the device also includes a storage module, which is used to: in response to receiving a response message sent by at least one responder, store the content data and the identity identifier in a corresponding storage area based on the message number.
[0140] In some embodiments, the device further includes: a first determination module, used to determine the number of responders that respond to the requester based on the identity identifier; and a second determination module, used to confirm that the request process is completed when the number is equal to a preset expected number.
[0141] In some embodiments, the device also includes: a timing module, which is used to start timing from the moment when a user request is sent to the multicast address; a third determination module, which is used to determine the number of responders that respond to the requester based on the identity identifier; a fourth confirmation module, which is used to confirm that the request process is finished within a preset time period if the number is equal to a preset expected number; and a fifth confirmation module, which is used to determine that an abnormality has occurred in the request process if the number is less than a preset expected number after exceeding a preset time period.
[0142] Figure 7 A block diagram of a requester processing device according to another embodiment of the present application is shown. The device can implement part of the method according to the embodiment of the present application. The device includes a second sending module 710.
[0143] The second sending module 710 is used to send a response message to the requester based on the response address in response to receiving a user request sent by the requester, so that the requester can store the content data requested by the requester to the corresponding storage area based on the message number.
[0144] The user request sent by the requester carries a response address and a message number, and the response message sent by the responder carries a message number, an identity identifier, and a response address.
[0145] The embodiment of the present application also provides a distributed system, including at least one requester and at least one responder. Each requester is used to: in response to receiving a user request, construct a message site corresponding to the received user request, the message site includes the multicast addresses of multiple responders that need to respond to the received user request, the message number of the received user request, and a storage area for storing the content data requested by the received user request, the storage area corresponds to the message number; send a user request to the multicast address once, the sent user request includes the message number and the response address, the response address is the unicast address of the requester; each responder is used to: in response to receiving the user request sent by the requester, send a response message to the requester based on the response address, so that the requester can store the requested content data and the identity of the responder in the corresponding storage area based on the message number; the response message sent by the responder includes the message number, the identity, the response address and the content data.
[0146] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the described module can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0147] An electronic device is provided in an embodiment of the present application, such as Figure 8 As shown, Figure 8 The electronic device 800 shown includes: a processor 801 and a memory 803. The processor 801 and the memory 803 are connected, such as through a bus 802. Optionally, the electronic device 800 may also include a transceiver 804. It should be noted that in actual applications, the transceiver 804 is not limited to one, and the structure of the electronic device 800 does not constitute a limitation on the embodiments of the present application.
[0148] Processor 801 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 801 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
[0149] The bus 802 may include a path to transmit information between the above components. The bus 802 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 802 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0150] The memory 803 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0151] The memory 803 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 801. The processor 801 is used to execute the application code stored in the memory 803 to implement the content shown in the above method embodiment.
[0152] Among them, electronic devices include but are not limited to: mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 8 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0153] An embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer can execute the corresponding content in the aforementioned method embodiment.
[0154] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0155] The above description is only a partial implementation method of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A request processing method, applied to a requesting party, characterized in that: include: In response to receiving a user request, constructing a message site corresponding to the received user request, the message site including multicast addresses of multiple responders that need to respond to the received user request, a message number of the received user request, and a storage area for storing content data requested by the received user request, the storage area corresponding to the message number, wherein each time a user request is received, a corresponding message site is constructed; Sending a user request to the multicast address once, where the sent user request includes the message number and a response address, where the response address is a unicast address of the requester; In response to receiving a response message sent by at least one responder, storing the content data and the identity identifier in a corresponding storage area based on the message number, the response message including the response address, the message number, the identity identifier and the content data; The time starts from the moment when a user request is sent to the multicast address; Determining the number of responders that respond to the requester based on the identity identifier; If the number is equal to the preset expected number within the preset time period, the confirmation request process ends; After exceeding the preset time period, if the number is less than the preset expected number, it is determined that an abnormality occurs in the request process.
2. The method according to claim 1, characterized in that Construct a message field corresponding to the received user request, including: Allocating multicast addresses to multiple responders that need to respond to received user requests; Assigning a request number to the received user request; A storage area is allocated for content data requested by a received user request.
3. A request processing device, applied to a requesting party, characterized in that: include: A construction module, configured to construct a message scene corresponding to the received user request in response to receiving the user request, wherein the message scene includes multicast addresses of multiple responders that need to respond to the received user request, a message number of the received user request, and a storage area for storing content data requested by the received user request, wherein the storage area corresponds to the message number, wherein a corresponding message scene is constructed for each received user request; A first sending module is used to send a user request to the multicast address, where the sent user request carries the message number and a response address, and the response address is a unicast address of the requester; A storage module, configured to store the content data and the identity identifier in a corresponding storage area based on the message number in response to receiving a response message sent by at least one responder, wherein the response message includes the response address, the message number, the identity identifier and the content data; A timing module, used to start timing from the moment a user request is sent to the multicast address; A first determining module, configured to determine the number of responders that respond to the requester based on the identity identifier; A second determination module, configured to confirm that the request process ends if the number is equal to a preset expected number within a preset time period; The third determination module is used to determine that an abnormality occurs in the request process if the number is less than a preset expected number after a preset time period has passed.
4. A distributed system, characterized in that: include: At least one requestor, each requestor being used to: In response to receiving a user request, construct a message site corresponding to the received user request, the message site including multicast addresses of multiple responders that need to respond to the received user request, a message number of the received user request, and a storage area for storing content data requested by the received user request, the storage area corresponding to the message number, wherein each time a user request is received, a message site for response is constructed; Sending a user request to the multicast address once, where the sent user request includes the message number and a response address, where the response address is the unicast address of the requester; In response to receiving a response message sent by at least one responder, storing the content data and the identity identifier in a corresponding storage area based on the message number, the response message including the response address, the message number, the identity identifier and the content data; The time starts from the moment when a user request is sent to the multicast address; Determining the number of responders that respond to the requester based on the identity identifier; If the number is equal to the preset expected number within the preset time period, the confirmation request process ends; After the preset time period has expired, if the number is less than the preset expected number, it is determined that an abnormality has occurred in the request process; At least one responder, each responder being used to: In response to receiving a user request sent by the requesting party, sending a response message to the requesting party based on the response address, so that the requesting party can store the requested content data and the identity of the responding party in a corresponding storage area based on the message number; The response message sent by the responder includes the message number, the identity identifier, the response address and the content data.
5. An electronic device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the computer program, the request processing method according to claim 1 or 2 is implemented.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the request processing method according to claim 1 or 2 is implemented.
