Request processing method, cloud service container, electronic device and storage medium
By identifying the request protocol type and directly transmitting it to the service process through the service processing component in the cloud service container, the incompatibility problem between HTTP and RPC protocols is solved, and multi-protocol compatibility processing is achieved, improving the development and operation efficiency of microservice architecture.
Patent Information
- Application Number
- PCT/CN2025/112755
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-08-05
- Filing Date
- 2025-08-05
- Publication Date
- 2026-02-12
AI Technical Summary
The incompatibility between the HTTP and RPC protocols results in the inability to reuse request information in microservice architectures, increasing development workload and operational costs.
The service processing component in the cloud service container determines the protocol type of the request and transmits it to the service process through the corresponding channel. The service process generates response information within the process, eliminating the need for protocol conversion and achieving compatible processing of multiple protocol types.
It reduced the workload of the development process, improved the operating efficiency of the architecture, enabled compatible processing of requests of multiple protocol types, and reduced resource and time waste.
Smart Images

Figure CN2025112755_12022026_PF_FP_ABST
Abstract
Description
A request processing method, cloud service container, electronic device and storage medium
[0001] Cross-reference to Related Applications
[0002] This application claims priority to Chinese Patent Application No. 202411067105.9, filed on August 5, 2024, the disclosure of which is incorporated herein in its entirety as part of the present application. TECHNICAL FIELD
[0003] Embodiments of the present disclosure relate to a request processing method, cloud service container, electronic device and storage medium. BACKGROUND
[0004] The microservice architecture of a distributed system usually needs to process request information based on Hypertext Transfer Protocol (HTTP) and Remote Procedure Call Protocol (RPC).
[0005] However, the HTTP protocol and the RPC protocol are not compatible. If the request processing is based on the RPC service, the request information based on the HTTP protocol needs to be converted into the request information based on the RPC format, and vice versa. For the same kind of request information based on different protocol types, the RPC service or the HTTP service in the microservice architecture cannot realize the reuse of information, resulting in a large amount of development work. SUMMARY
[0006] The present disclosure provides a request processing method, cloud service container, electronic device and storage medium, which realizes compatible processing of requests corresponding to multiple protocol types without protocol conversion, reduces the workload in the development process, and improves the running efficiency of the architecture.
[0007] In a first aspect, embodiments of the present disclosure provide a request processing method, which comprises:
[0008] determining a first protocol type of a first request;
[0009] transmitting the first request to a service process through a channel corresponding to the first protocol type;
[0010] generating response information of the first request in the service process according to a protocol format corresponding to the first protocol type;
[0011] sending the response information.
[0012] In a second aspect, embodiments of the present disclosure further provide a cloud service container, which comprises:
[0013] a service processing component configured to determine a first protocol type of a first request, and transmit the first request to a service process through a channel corresponding to the first protocol type;
[0014] a service process configured to generate response information of the first request in a protocol format corresponding to the first protocol type within the service process, and send the response information.
[0015] In a third aspect, the embodiments of the present disclosure further provide an electronic device, which comprises:
[0016] one or more processing devices;
[0017] a storage device configured to store one or more programs,
[0018] When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the request processing method provided in the first aspect.
[0019] In a fourth aspect, the embodiments of the present disclosure further provide a storage medium containing computer executable instructions, which, when executed by a computer processor, are used to perform the request processing method provided in the first aspect. BRIEF DESCRIPTION OF DRAWINGS
[0020] The above and other features, advantages, and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the original and elements are not necessarily drawn according to the scale.
[0021] FIG. 1 is a structural example diagram of a microservice architecture of a distributed system provided by an embodiment of the present disclosure;
[0022] FIG. 2 is a structural example diagram of another microservice architecture of a distributed system provided by an embodiment of the present disclosure;
[0023] FIG. 3 is a flow diagram of a request processing method provided by an embodiment of the present disclosure;
[0024] FIG. 4 is a flow diagram of another request processing method provided by an embodiment of the present disclosure;
[0025] FIG. 5 is a structural example diagram of another microservice architecture of a distributed system provided by an embodiment of the present disclosure;
[0026] FIG. 6 is a structural diagram of a cloud service container provided by an embodiment of the present disclosure;
[0027] FIG. 7 is a structural schematic diagram of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0028] Embodiments of the present disclosure will be described in more detail with reference to the drawings. While certain embodiments of the present disclosure are shown in the drawings, it is understood that the present disclosure can be embodied in various forms and should not be interpreted as being limited to the embodiments set forth herein. Rather, these embodiments are provided so that the present disclosure will be thorough and complete, and fully convey the scope of the present disclosure to those skilled in the art.
[0029] It should be understood that the various steps in the method embodiments of the present disclosure can be performed in different orders and / or in parallel. In addition, the method embodiments can include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0030] The term "comprising" and variations thereof as used herein are used inclusively, i.e., "comprising but not limited to". The term "based on" is "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Related definitions will be given in the description below.
[0031] It should be noted that the terms "first", "second", and the like in the present disclosure are merely used to distinguish different devices, modules or units, and do not imply the order or interdependence of the functions performed by these devices, modules or units.
[0032] It should be noted that the terms "one", "multiple" in the present disclosure are illustrative and not restrictive, and those skilled in the art should understand that "one or more" should be understood unless otherwise explicitly indicated in the context.
[0033] The names of the messages or information exchanged between the devices in the embodiments of the present disclosure are merely for illustrative purposes, and are not intended to limit the scope of the messages or information.
[0034] It can be understood that, before using the technical solutions disclosed in the embodiments of the present disclosure, the type of personal information involved in the present disclosure, the scope of use, the use scenario, etc. should be informed to the user and the authorization of the user should be obtained in accordance with relevant laws and regulations.
[0035] For example, in response to receiving an active request of a user, prompt information is sent to the user to explicitly prompt the user that the operation requested to be performed will require obtaining and using personal information of the user. Thus, the user can autonomously select whether to provide personal information to the software or hardware, such as an electronic device, an application program, a server or a storage medium, performing the operation of the technical solution of the present disclosure according to the prompt information.
[0036] As an optional but non-limiting implementation, in response to receiving an active request of a user, the manner of sending prompt information to the user may, for example, be a pop-up window manner, in which the prompt information can be presented in the form of text. In addition, the pop-up window can also carry selection controls for the user to select "agree" or "disagree" to provide personal information to the electronic device.
[0037] It can be understood that the above notification and obtaining user authorization process is only illustrative and does not limit the implementation of the present disclosure, and other manners meeting relevant laws and regulations can also be applied to the implementation of the present disclosure.
[0038] It can be understood that the data (including but not limited to the data itself, the obtaining or use of the data) involved in the technical solution should comply with the requirements of relevant laws and regulations and relevant provisions.
[0039] In the micro-service architecture of a distributed system, the back-end service needs to provide ports for different scenarios. Different scenarios have different requirements for data transmission efficiency and link quality, so various application layer protocols have been derived, and the most common application layer protocols are Hypertext Transfer Protocol (HTTP) and Remote Procedure Call Protocol (RPC).
[0040] FIG. 1 is a structural example diagram of a micro-service architecture of a distributed system provided by an embodiment of the present disclosure. As shown in FIG. 1, the micro-service architecture of the distributed system includes a client, an internal service, an HTTP service, a service processing component (MeshProxy), an RPC detection port (RPC Port) and an RPC service.
[0041] In the micro-service architecture of the distributed system as shown in FIG. 1, the client can be a mobile phone software or a WEB site, which needs to use the HTTP protocol and return the data in the JSON / PB format; the internal service is a kind of network service, which can correspond to a plurality of different service types. The HTTP service provides the HTTP port, implements the general processing logic of the HTTP gateway, including the flow limiting, data injection, etc.; can convert the HTTP request into the RPC request, forwards the request, and converts the RPC response data into the HTTP data (protocol conversion + request forwarding). The service processing component provides some general service processing capabilities, which can process the HTTP request or the proxy of the RPC request, and cannot process both requests, and can be allowed to be processed in the HTTP service or the RPC service; if the request is the HTTP protocol, the request is forwarded to the HTTP gateway (HTTPGateway) process for processing; if the request is the RPC protocol, the request is forwarded to the RPC process for processing; the data returned by the HTTP / RPC process is returned. The RPC service is used to receive the RPC request through the PRC detection port; reads and writes the corresponding data from the memory or the database storing the data; implements the data acquisition code logic; encodes the data according to the RPC response format, and returns.
[0042] When the request is the HTTP request issued by the client, the interaction process of the micro-service architecture is as follows:
[0043] The client sends the HTTP request to the HTTP service through the port; the HTTP service converts the HTTP format request into the RPC format request through the internal service processing component, and forwards the RPC format request to another service processing component through the port; the service processing component transmits the request through the service processing component, the RPC service obtains the request transferred by the service processing component through the RPC detection port, reads and writes the data corresponding to the request information from the memory or the database based on the request, forms the RPC format response information, and returns the response information to the HTTP service through the port; the HTTP service receives the RPC format response information through the port and converts the response information into the HTTP format response information, and returns the HTTP format response information to the client.
[0044] When the request is the RPC request issued by the internal service, the interaction process of the micro-service architecture is as follows:
[0045] The internal service directly sends the RPC request through the port, transmits the request through the service processing component, the RPC service obtains the request transferred by the service processing component through the RPC detection port, reads and writes the data corresponding to the request information from the memory or the database based on the request, forms the RPC format response information, and returns the response information to the internal service through the port.
[0046] The distributed system microservice architecture based on the forced protocol splitting service approach sometimes causes the development efficiency to decrease. Many ports provide the same data from the business perspective HTTP port and RPC detection port (such as the ports for obtaining specific information in the HTTP / RPC service), but the codes must be developed in the HTTP service and the RPC service respectively to meet the access requirements of the client and the internal service, in which the codes in the HTTP service are usually only used to convert the request parameters into the parameters of the RPC service, forward the request to the RPC service, and convert the response data of the RPC service into the data format required by the HTTP to return to the client, which consumes extra time; when the port increases the field or adds a new port, the codes of the HTTP service and the RPC service need to be modified simultaneously, which requires double work based on one problem; the HTTP / RPC two different services need to be deployed and operated online simultaneously, which increases the operation and maintenance cost.
[0047] To solve the above technical problems, an HTTP gateway supporting protocol conversion capability is evolved, the application gateway is responsible for receiving the HTTP request and completing the conversion from the HTTP protocol to the RPC protocol, when the business needs to expose an existing RPC port to the public network, only needs to access the HTTP gateway and perform a small amount of configuration, without modifying the two services.
[0048] FIG. 2 is a structural example diagram of another distributed system microservice architecture provided by the embodiment of the disclosure. As shown in FIG. 2, it includes a client, an internal service, a service processing component (MeshProxy), an HTTP gateway (HTTPGateway) and an RPC service.
[0049] In the distributed system microservice architecture as shown in FIG. 2, the function of the HTTP service is migrated to the HTTP gateway, without retaining a separate HTTP service, the HTTP gateway only processes the HTTP request proxy and does not process the RPC request; the general processing logic of the HTTP gateway is implemented, including flow limiting, data injection, etc.; the HTTP request is converted into the RPC request, the request is forwarded, and the RPC response data is converted into the HTTP data (protocol conversion + request forwarding). The service processing component receives the HTTP request and the RPC request simultaneously, and identifies whether the protocol type of the request is HTTP or RPC; if the request is the HTTP protocol, it is forwarded to the HTTP gateway (HTTP Gateway) process for processing; if the request is the RPC protocol, it is forwarded to the RPC service process for processing; the data returned by the HTTP / RPC process is returned to the corresponding request sender.
[0050] The interaction process of the microservice architecture is as follows:
[0051] The client or the internal service sends a corresponding request to the service processing component;
[0052] When the service processing component identifies that the type of the request is the HTTP protocol type sent by the client, the request is sent to the HTTP gateway, the HTTP gateway converts the request into an RPC format request, and sends the RPC format request, the process of the RPC service obtains the RPC format request sent by the HTTP gateway through an RPC detection port, reads and writes data corresponding to the request information from a memory or a database based on the request, forms RPC format response information, and returns the response information to the HTTP gateway through back transmission; the HTTP gateway receives the RPC format response information and converts the response information into HTTP format response information, and returns the HTTP format response information to the client through the service processing component;
[0053] When the service processing component identifies that the type of the request is the RPC protocol type sent by the internal service, the service processing component transmits the request, the RPC service can directly obtain the RPC request through the RPC detection port, and reads and writes data corresponding to the request information from a memory or a database based on the request, forms RPC format response information, and directly returns the response information to the internal service through the service processing component.
[0054] If the distributed system is a newly developed system, the micro-service architecture shown in FIG. 2 can be better applied, which realizes the general logic + protocol conversion + request forwarding capability based on the HTTP gateway, and does not need to develop the HTTP service separately, can effectively reduce the coding work of protocol conversion, and improves the development efficiency.
[0055] However, a large number of distributed systems are currently implemented based on microservice architectures as shown in FIG. 1, and therefore, it is necessary to consolidate the HTTP / RPC services with repeated functions to achieve architecture simplification. Although the HTTP / RPC ports logically provide the same information acquisition function, the definitions of the two ports can be very different, and in the process of upgrading the online system, the following problems can easily occur, causing the application gateway to bear a lot of business functions. First, the HTTP and RPC port fields are not completely aligned, and the HTTP gateway needs to do a lot of additional conversion processing. For example, if the response information is a picture, the HTTP service will return the complete URL address, and the RPC service will only return the relative address of the picture, which cannot be directly provided to the client; second, there is a migration problem of the public code library relied on by the HTTP service. Specifically, there are many business logics in the API public library based on HTTP request information customization. Since the RPC service cannot completely replicate the HTTP request context, these functions cannot be smoothly migrated to the RPC service; third, the functions that the HTTP gateway needs to bear lack standardized definitions, and therefore, a lot of time is often needed to determine which functions to put into the application gateway and which functions to put into the RPC service.
[0056] To solve the above technical problems, the embodiment of the disclosure provides a request processing method, and FIG. 3 is a flowchart of a request processing method provided by the embodiment of the disclosure. The embodiment of the disclosure is applicable to the case of processing the obtained service request. The method can be executed by a cloud service container. The container can be implemented in the form of software and / or hardware. Optionally, the container is implemented by an electronic device. The electronic device can be a mobile terminal, a PC terminal, or a server.
[0057] As shown in FIG. 3, the method comprises the following steps.
[0058] S110, determining a first protocol type of a first request.
[0059] The first request can be understood as a query request or a processing request, or other types of requests, obtained from a request sender. The request sender can be understood as a terminal or a service that sends the first request, for example, a client, an intranet service, or other software or hardware with request generation and sending capabilities. The first protocol type can be understood as the rules and standards used when the first request is sent, at least including the HTTP and RPC.
[0060] Specifically, the service processing component in the cloud service container obtains the first request sent by the request sender based on the corresponding communication protocol, and identifies the first protocol type corresponding to the first request.
[0061] The service processing is a process of managing, coordinating and optimizing the interaction between multiple services in a micro-service architecture, aiming to ensure that different services can work efficiently and stably in a distributed environment, thereby improving the scalability, reliability and performance of the overall system.
[0062] S120, transmitting the first request to the service process through a channel corresponding to the first protocol type.
[0063] The channel can be understood as a path in the cloud service platform for transmitting the first request to the service process. It at least includes a transmission path outside the service process and a transmission path on the service process. The transmission path outside the service process can be understood as a gateway, and the transmission path on the service process can be understood as a way for the service process to receive the first request, such as a port or a set communication mechanism. The set communication mechanism can be shared memory or inter-process communication (Unix domain socket), and the present disclosure does not limit it.
[0064] The service process can be understood as a process for processing requests. The service process can process requests of at least two protocol types. The service process can be a hypertext transfer service process based on the hypertext transfer protocol, or a remote procedure call service process based on the remote procedure call protocol. The present embodiment does not limit it.
[0065] Specifically, the protocols supported by the cloud service container have corresponding transmission channels in the cloud service container. After receiving the first request, the service processing component in the cloud service container transmits the first request to the service process through the channel corresponding to the first protocol type. The service process receives the first request through the channel corresponding to the first protocol type.
[0066] For example, after the cloud service container receives the first request, when the first protocol type of the first request is consistent with the service type of the service process, the service processing component in the cloud service container directly sends the first request to the service process based on the original channel corresponding to the service; when the first protocol type of the first request is inconsistent with the service type of the service process, the service processing component in the cloud service container sends the first request to the port corresponding to the first protocol type on the service process through the gateway corresponding to the first protocol type, and transmits the first request to the service process through the port.
[0067] S130, generating response information of the first request in the service process according to the protocol format corresponding to the first protocol type.
[0068] The response information of the first request can be understood as information obtained by the service process based on the first request after processing the first request.
[0069] Specifically, after receiving the first request, the service process in the cloud service container processes the first request based on the first request, and encapsulates the processing result into a protocol format corresponding to the first protocol type to form the final response information.
[0070] For example, when the first request is a query request, the service process accesses a corresponding database based on a query instruction contained in the first request to perform a corresponding query operation and obtain a query result. When the first protocol type of the first request is the hypertext transfer protocol, the query result is encapsulated into a query result in the hypertext transfer protocol format as the response information of the first request.
[0071] S140, sending the response information.
[0072] Specifically, the response information is returned to the request issuer of the first request via the original path.
[0073] For example, in the cloud service container, when the first protocol type is consistent with the service type of the service process, the service process directly sends the response information to the service processing component based on the original channel corresponding to the service, and the service processing component returns the response information to the request issuer of the first request outside the cloud service container; when the first protocol type is inconsistent with the service type of the service process, the service process transmits the response information to the corresponding gateway via a port corresponding to the protocol type of the response information, and the gateway transmits the response information to the service processing component, and finally the service processing component returns the response information to the request issuer of the first request outside the cloud service container.
[0074] The technical scheme of the embodiment of the disclosure includes determining a first protocol type of a first request, transmitting the first request to a service process via a channel corresponding to the first protocol type, generating response information of the first request in the service process according to a protocol format corresponding to the first protocol type, and sending the response information. In the above technical scheme, the transmission of the request into the service process is realized based on the corresponding protocol type channel, one service process detects two ports and processes two protocols, and when the service process processes the request, protocol conversion is not required, the compatible processing of the requests corresponding to multiple protocol types can be realized, the workload in the development process is reduced, and the running efficiency of the architecture is improved.
[0075] On the basis of the above embodiment, a variant embodiment of the above embodiment is proposed. It should be noted that, in order to make the description brief, only the differences between the variant embodiment and the above embodiment are described in the variant embodiment.
[0076] In one embodiment, the first protocol type includes a hypertext transfer protocol or a remote procedure call protocol; the service process is a process of a remote procedure call service, and accordingly, the transmitting the first request to the service process through a channel corresponding to the first protocol type includes:
[0077] S1201, in the case where the first protocol type is a hypertext transfer protocol, transmitting the first request to a process of a remote procedure call service through a hypertext transfer gateway.
[0078] The hypertext transfer gateway can be understood as a gateway based on the hypertext transfer protocol, i.e., an HTTP gateway. The remote procedure call service can be understood as a service based on the remote procedure call protocol, i.e., an RPC service. The RPC service is a collection of remotely callable functions or methods, which defines operations that can be requested by remote clients for execution and related input and output parameters. The process of the remote procedure call service, i.e., the RPC service process, can be understood as a program instance that actually runs and processes remote call requests (the first request).
[0079] Specifically, the distributed system micro-service architecture (or cloud service container) employed by the embodiments of the present disclosure supports both the hypertext transfer protocol and the remote procedure call protocol. When the service process is a process of a remote procedure call service (the RPC service process), the request based on the remote procedure call protocol can be directly transmitted to the RPC service process through a detection port or other communication mechanism on the RPC service process, and therefore, there is no need to set a corresponding gateway. The request based on the hypertext transfer protocol cannot be directly discovered by the original RPC detection port or other communication mechanism on the RPC service process, and therefore, an HTTP gateway and an HTTP detection port or other communication mechanism based on the hypertext transfer protocol are set on the RPC service process, so that the RPC service process can obtain the request information based on the hypertext transfer protocol.
[0080] Specifically, when the first protocol type of the first request is the hypertext transfer protocol and the service process is a process of a remote procedure call service, the service processing component forwards the first request through a hypertext transfer gateway, and the RPC service process obtains the first request based on the hypertext transfer protocol through an HTTP detection port or other communication mechanism.
[0081] S1202, in the case where the first protocol type is a remote procedure call protocol, transmitting the first request to the process of the remote procedure call service.
[0082] Specifically, when the service process is a process serving remote procedure call (RPC service process), the request based on the remote procedure call protocol can be directly transmitted to the RPC service process through a detection port or other communication mechanism on the RPC service process. Therefore, when the first protocol type of the first request is the remote procedure call protocol and the service process is a process serving remote procedure call, the service processing component transmits the first request, and the RPC service process obtains the first request based on the remote procedure call protocol through the RPC detection port or other communication mechanism.
[0083] In one embodiment, the first protocol type includes a hypertext transfer protocol or a remote procedure call protocol; the service process is a process serving hypertext transfer; accordingly, the transmitting the first request to the service process through a channel corresponding to the first protocol type includes:
[0084] S1203, in the case where the first protocol type is a hypertext transfer protocol, transmitting the first request to a process serving hypertext transfer through a hypertext transfer gateway.
[0085] The process serving hypertext transfer, i.e., the HTTP service process, can be understood as a program instance that actually runs and processes the first request.
[0086] Specifically, the distributed system micro-service architecture (or cloud service container) adopted by the embodiments of the present disclosure supports both the remote procedure call protocol and the hypertext transfer protocol. When the first protocol type of the first request is the hypertext transfer protocol and the service process is a process serving hypertext transfer (HTTP service process), the service processing component forwards the first request through a hypertext transfer gateway, and the HTTP service process obtains the first request based on the hypertext transfer protocol through an HTTP detection port or other communication mechanism.
[0087] S1204, in the case where the first protocol type is a remote procedure call protocol, transmitting the first request to the process serving hypertext transfer.
[0088] Specifically, when the first protocol type of the first request is the remote procedure call protocol and the service process is a process serving hypertext transfer (HTTP service process), the service processing component forwards the first request, and the HTTP service process obtains the first request based on the remote procedure call protocol through an RPC detection port or other communication mechanism.
[0089] FIG. 4 is another flowchart of a request processing method provided by the embodiments of the present disclosure, as shown in FIG. 4, the method includes:
[0090] S210, determine a first protocol type of a first request.
[0091] S220, transmit the first request to a service process through a channel corresponding to the first protocol type.
[0092] S230, generate response information of the first request in a protocol format corresponding to the first protocol type in the service process.
[0093] S240, send the response information.
[0094] S250, generate response information of the requested content of the first request in a protocol format corresponding to a second protocol type, the second protocol type including protocol types supported by the service process other than the first protocol type.
[0095] The second protocol type can be understood as a rule and standard of data transmission, at least including the Hypertext Transfer Protocol HTTP and the Remote Procedure Call Protocol RPC, the second protocol type including protocol types supported by the service process other than the first protocol type, for example, when the protocol types supported by the service process include the Hypertext Transfer Protocol and the Remote Procedure Call Protocol, the first protocol type is the Hypertext Transfer Protocol, and the second protocol type is the Remote Procedure Call Protocol, and vice versa. It can be understood that the protocol types supported by the service process are not only the above two protocols, and the second protocol type can include at least one type.
[0096] Specifically, when the service process in the cloud service container receives the first request sent by the request sender, processes the request based on the first request, and forms the corresponding processing result, in addition to generating response information in the corresponding format of the processing result according to the first request, for the same function and field port, the response information in the protocol format corresponding to the second protocol type can also be generated based on the request content of the first request and stored for subsequent demand.
[0097] For example, when the protocol types supported by the service process include the Hypertext Transfer Protocol and the Remote Procedure Call Protocol, the first request is an image query request, and the first protocol type corresponding to the first request is the Hypertext Transfer Protocol, in addition to generating response information based on the Hypertext Transfer Protocol for the image query request, response information based on the Remote Procedure Call Protocol can also be generated and stored.
[0098] Specifically, the service process performs request processing based on the first request, forms a corresponding processing result, generates response information based on the first protocol type, and for ports with the same function and field, can directly store the processing result in a code file, and when a request based on the second protocol type is subsequently received, generates corresponding response information based on the corresponding protocol format.
[0099] In one embodiment, the method further comprises:
[0100] In a case where the second request of the second protocol type is acquired, the response information corresponding to the second request is acquired and transmitted, and the requested content of the second request is the same as the requested content of the first request.
[0101] The second request can be understood as request information of the protocol format corresponding to the second protocol type, and the requested content of the second request is the same as the requested content of the first request, for example, both are query requests for an image.
[0102] Specifically, when the cloud service container acquires a second request of the second protocol type sent by a request sender such as another client or a service, the service process acquires the response information corresponding to the second protocol type generated in advance, and transmits the response information to the request sender.
[0103] Specifically, as described above, when the service process stores a code file based on the first request and receives a second request with the same content as the first request, the service process forms response information of the protocol format corresponding to the second protocol type based on the second protocol type corresponding to the second request, and transmits the response information to the request sender.
[0104] The above technical solution can effectively realize the reusability of the micro-service architecture, improve the processing efficiency, and avoid the problems of resource waste and time waste caused by multiple processing of the same request.
[0105] FIG. 5 is a structural example diagram of another distributed system micro-service architecture provided by the embodiment of the present disclosure. FIG. 5 takes a service process as an example of a remote procedure call service process (RPC service process), sets up a hypertext transfer protocol gateway (HTTP gateway) between the service processing component and the RPC service process, and sets up an HTTP detection port on the RPC service process. It can be understood that when the service process is a hypertext transfer service process (HTTP service process), a hypertext transfer protocol gateway (PRPC gateway) is set up between the service processing component and the HTTP service process, and an HTTP detection port is set up on the RPC service process.
[0106] As shown in FIG. 5, when the service process is the process of remote procedure call service, the distributed system microservice architecture includes a client, an internal service, a service processing component (MeshProxy), an HTTP gateway (HTTPGateway), an HTTP detection port (HTTP Port), an RPC detection port (RPC Port), and an RPC service process.
[0107] In the distributed system microservice architecture as shown in FIG. 5, each component has the following functions:
[0108] The service processing component receives both HTTP requests and RPC requests, and identifies whether the protocol type of the request is HTTP or RPC; if the request is an HTTP protocol, it is forwarded to the HTTP gateway process for processing; if the request is an RPC protocol, it is forwarded to the RPC service process for processing; the data returned by the HTTP / RPC process is returned to the client or internal service. The HTTP gateway only processes HTTP request proxies and does not process RPC requests; it can implement general processing logic for the HTTP gateway; after the HTTP request is verified, it is directly forwarded to the HTTP port of the business service, and no longer undertakes the conversion of the HTTP protocol to the RPC protocol. The RPC service process receives both HTTP requests and RPC requests; HTTP protocol and RPC protocol requests use different ports for detection, i.e., HTTP detection port and RPC detection port; implement underlying business processing code, such as obtaining specific information from a storage or a database; encode the information directly into the required format and return the data; if it is an HTTP request, return it in the HTTP protocol format; if it is an RPC request, return it in the RPC protocol format.
[0109] The interaction flow of the microservice architecture is as follows:
[0110] The client or internal service sends a request in the corresponding format to the service processing component (the client sends an HTTP request, and the internal service sends an RPC request);
[0111] The service processing component receives both HTTP requests and RPC requests, and identifies whether the protocol type of the request is HTTP or RPC;
[0112] If the protocol type is HTTP, the HTTP request is forwarded to the HTTP gateway for processing; after the HTTP gateway verifies and processes the HTTP request, it sends the processed HTTP request to the RPC service thread; the RPC service thread obtains the HTTP request through the set HTTP detection port, accesses the associated storage or database to process the HTTP request accordingly, forms the corresponding HTTP format response information, and returns the response information to the client via the original path;
[0113] If the protocol type is RPC, the RPC request is directly sent to the RPC service process, the RPC service process obtains the RPC request through the RPC detection port, accesses the associated memory or database to process the RPC request, forms response information corresponding to the RPC format, and returns the response information to the internal service according to the original path.
[0114] FIG. 6 is a schematic diagram of a cloud service container structure provided by an embodiment of the present disclosure. As shown in FIG. 6, the cloud service container includes a service processing component 310 and a service process 320.
[0115] The service processing component 310 is configured to determine a first protocol type of a first request, and transmit the first request to the service process through a channel corresponding to the first protocol type.
[0116] The service process 320 is configured to generate response information of the first request in the service process according to a protocol format corresponding to the first protocol type, and send the response information.
[0117] The technical solution provided by the embodiment of the present disclosure realizes the transmission of the request into the service process based on the corresponding protocol type channel, and the service process can process at least two protocols. When the service process processes the request, protocol conversion is not required, the compatible processing of the requests corresponding to multiple protocol types can be realized, the workload in the development process is reduced, and the running efficiency of the architecture is improved.
[0118] In an embodiment, the service processing component 310 includes:
[0119] The protocol type determination unit is configured to determine a first protocol type of a first request.
[0120] The request transmission unit is configured to transmit the first request to the service process through a channel corresponding to the first protocol type.
[0121] In an embodiment, the service process 320 is specifically configured to:
[0122] Generate response information of the first request in the service process according to a protocol format corresponding to the first protocol type.
[0123] Send the response information.
[0124] In an embodiment, the first protocol type includes a hypertext transfer protocol or a remote procedure call protocol; and the service process is a process of a remote procedure call service.
[0125] In an embodiment, the request transmission unit is specifically configured to:
[0126] in the case that the first protocol type is the hypertext transfer protocol, transmitting the first request to a process of the hypertext transfer service through a hypertext transfer gateway;
[0127] in the case that the first protocol type is the remote procedure call protocol, transmitting the first request to the process of the remote procedure call service.
[0128] In an embodiment, the first protocol type includes the hypertext transfer protocol or the remote procedure call protocol; and the service process is a process of a hypertext transfer service.
[0129] In an embodiment, the request transmitting unit is specifically configured to:
[0130] in the case that the first protocol type is the hypertext transfer protocol, transmitting the first request to a process of the hypertext transfer service through a hypertext transfer gateway;
[0131] in the case that the first protocol type is the remote procedure call protocol, transmitting the first request to the process of the hypertext transfer service.
[0132] In an embodiment, the cloud service container further includes:
[0133] a response information generating module configured to generate response information of content requested by the first request according to a protocol format corresponding to a second protocol type, the second protocol type including a protocol type supported by the service process other than the first protocol type.
[0134] In an embodiment, the cloud service container further includes:
[0135] a response information transmitting module configured to, in the case that a second request of the second protocol type is acquired, acquire and transmit response information corresponding to the second request, the content requested by the second request being the same as the content requested by the first request.
[0136] The cloud service container provided by the embodiments of the present disclosure can execute the request processing method provided by any of the embodiments of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
[0137] It is worth noting that each unit and module included in the cloud service container is only divided according to functional logic, but is not limited to the above division, as long as the corresponding functions can be implemented; in addition, the specific names of each functional unit are only for easy mutual differentiation, and are not used to limit the protection scope of the embodiments of the present disclosure.
[0138] FIG. 7 is a structural schematic diagram of an electronic device according to an embodiment of the present disclosure. Referring to FIG. 7, a structural schematic diagram of an electronic device (e.g., a terminal device or a server in FIG. 7) 400 suitable for implementing an embodiment of the present disclosure is shown.
[0139] one or more processing apparatuses;
[0140] a storage apparatus configured to store one or more programs,
[0141] When the one or more programs are executed by the one or more processing apparatuses, the one or more processing apparatuses implement the request processing method according to any one of the above embodiments.
[0142] The terminal device in an embodiment of the present disclosure can include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (Personal Digital Assistant), a PAD (Tablet Personal Computer), a PMP (Portable Multimedia Player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a fixed terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in FIG. 7 is merely an example, and should not impose any limitation on the functions and use range of an embodiment of the present disclosure.
[0143] As shown in FIG. 7, the electronic device 400 can include a processing apparatus (e.g., a central processing unit, a graphics processing unit, or the like) 401, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 402 or loaded into a random access memory (RAM) 403 from a storage apparatus 408. In the RAM 403, various programs and data required for the operation of the electronic device 400 are also stored. The processing apparatus 401, the ROM 402, and the RAM 403 are connected to each other through a bus 404. An input / output (I / O) port 405 is also connected to the bus 404.
[0144] Generally, the following apparatuses can be connected to the I / O port 405: an input apparatus 406 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, and the like; an output apparatus 407 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, and the like; a storage apparatus 408 including, for example, a magnetic tape, a hard disk, and the like; and a communication apparatus 409. The communication apparatus 409 can allow the electronic device 400 to communicate with other devices wirelessly or by wire to exchange data. Although FIG. 7 shows the electronic device 400 having various apparatuses, it should be understood that it is not required to implement or have all the apparatuses shown. More or fewer apparatuses can be alternatively implemented or had.
[0145] In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts can be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for executing the methods illustrated by the flowcharts. In such embodiments, the computer program can be downloaded and installed from the network by the communication apparatus 409, or installed from the storage apparatus 408, or installed from the ROM 402. When the computer program is executed by the processing apparatus 401, the above-mentioned functions defined in the methods of the embodiments of the present disclosure are executed.
[0146] The names of the messages or information exchanged between the plurality of apparatuses in the embodiments of the present disclosure are only for illustrative purposes, and are not intended to limit the scope of the messages or information.
[0147] The electronic device provided by the embodiments of the present disclosure and the request processing method provided by the above-mentioned embodiments belong to the same inventive concept, and the technical details not described in detail in the present embodiment can be referred to the above-mentioned embodiments, and the present embodiment has the same beneficial effects as the above-mentioned embodiments.
[0148] The embodiments of the present disclosure provide a computer storage medium, which stores a computer program, and the program is executed by a processor to implement the request processing method provided by the above-mentioned embodiments.
[0149] It should be noted that the computer readable medium of the present disclosure described above can be a computer readable signal medium or a computer readable storage medium or any combination of the above two.
[0150] The computer storage medium can be a storage medium of computer executable instructions, and the computer executable instructions are used to execute the method provided by the present disclosure when executed by a computer processor.
[0151] The computer readable storage medium can be, for example but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the computer readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the disclosure, the computer readable storage medium can be any tangible medium that contains or stores a program used by or in connection with an instruction execution system, apparatus, or device. In the disclosure, the computer readable signal medium can include a data signal propagated in baseband or propagated as a carrier wave in a propagated data signal that can contain computer readable program code. Such a propagated data signal can take any of a variety of forms, including but not limited to electro-magnetic, optical, or any suitable combination thereof. Computer readable signal medium can be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate or transport program for use by or in connection with an instruction execution system, apparatus, or device. Program code contained on a computer readable medium can be transmitted by any suitable medium, including but not limited to wire, cable, RF, etc., or any suitable combination of the foregoing.
[0152] In some embodiments, the client, server, or both can communicate using any current known or future developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), the Internet, and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any current known or future developed networks.
[0153] The computer readable medium described above can be included in the electronic device described above; or can exist separately from the electronic device described above.
[0154] The computer readable medium described above carries one or more programs, when the one or more programs are executed by the electronic device, cause the electronic device to: determine a first protocol type of a first request; transmit the first request to a service process through a channel corresponding to the first protocol type; generate response information of the first request in the service process according to a protocol format corresponding to the first protocol type; and send the response information.
[0155] Computer program code for carrying out operations of the present disclosure can be written in any one or more programming languages, including object oriented programming languages such as Java, Smalltalk, C++, as well as conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).
[0156] The flow diagrams and the block diagrams in the drawings are meant as methodological and functional description of implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flow diagrams or block diagrams can represent a module, a segment, or a portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks may
[0157] The modules or units described in the embodiments of the present disclosure can be implemented by software, or by hardware, or by a combination of software and hardware. In some cases, the name of the module or unit does not constitute a limitation on the module or unit itself. For example, the service processing component can also be described as a component unit that acquires and transmits a first request.
[0158] The functions described in the foregoing description can be implemented in part or in whole through one or more hardware logic components. For example, and without limitation, illustrative types of hardware logic components that can be used include Field-programmable Gate Arrays (FPGAs), Program-specific Integrated Circuits (ASICs), Program-specific Standard Products (ASSPs), System-on-a-chip systems (SOCs), Complex Programmable Logic Devices (CPLDs), etc.
[0159] In the context of this disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium will include one or more of: a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0160] In the embodiments of the present disclosure, the first protocol type of the first request is determined, the first request is transmitted to a service process through a channel corresponding to the first protocol type, response information of the first request is generated in the service process according to a protocol format corresponding to the first protocol type, and the response information is sent. In the above technical solution, the transmission of the request into the service process is realized based on the corresponding protocol type channel, one service process can detect two ports and process two protocols at the same time, when the service process processes the request, protocol conversion is not needed, the compatible processing of the requests corresponding to multiple protocol types can be realized, the workload in the development process is reduced, and the running efficiency of the architecture is improved.
[0161] According to one or more embodiments of the present disclosure, example 1 provides a request processing method, comprising:
[0162] determining a first protocol type of a first request;
[0163] transmitting the first request to a service process through a channel corresponding to the first protocol type;
[0164] generating response information of the first request in the service process according to a protocol format corresponding to the first protocol type;
[0165] sending the response information.
[0166] According to one or more embodiments of the present disclosure, example 2 provides the method according to example 1, wherein the first protocol type includes a hypertext transfer protocol or a remote procedure call protocol; and the service process is a process of a remote procedure call service.
[0167] According to one or more embodiments of the present disclosure, example 3 provides the method according to example 2, wherein the transmitting the first request to the service process through the channel corresponding to the first protocol type comprises:
[0168] in the case that the first protocol type is the hypertext transfer protocol, transmitting the first request to a process of the hypertext transfer service via a hypertext transfer gateway;
[0169] in the case that the first protocol type is the remote procedure call protocol, transmitting the first request to the process of the remote procedure call service.
[0170] According to one or more embodiments of the present disclosure, example 4, the method according to example 1, the first protocol type comprises a hypertext transfer protocol or a remote procedure call protocol; and the service process is a process of a hypertext transfer service.
[0171] According to one or more embodiments of the present disclosure, example 5, the method according to example 4, the transmitting the first request to the service process via a channel corresponding to the first protocol type comprises:
[0172] in the case that the first protocol type is the hypertext transfer protocol, transmitting the first request to a process of the hypertext transfer service via a hypertext transfer gateway;
[0173] in the case that the first protocol type is the remote procedure call protocol, transmitting the first request to the process of the hypertext transfer service.
[0174] According to one or more embodiments of the present disclosure, example 6, the method according to example 1, after generating the response information of the first request in the service process according to a protocol format corresponding to the first protocol type, further comprising:
[0175] generating the response information of the content requested by the first request according to a protocol format corresponding to a second protocol type, the second protocol type comprising a protocol type supported by the service process other than the first protocol type.
[0176] According to one or more embodiments of the present disclosure, example 7, the method according to example 6, further comprising: in the case that a second request of the second protocol type is obtained, obtaining and transmitting the response information corresponding to the second request, the content requested by the second request being the same as the content requested by the first request. The above description is merely preferred embodiments of the present disclosure and a description of the principles of the technology applied. Those skilled in the art should understand that the scope of the disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combinations of the above technical features, and should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features disclosed in the present disclosure (but not limited to) having similar functions to form technical solutions.
[0177] Moreover, while operations are depicted in a particular order, this should not be understood as requiring such an order unless otherwise specifically stated. In certain circumstances, multitasking and parallel processing can be advantageous. Likewise, while several specific implementation details have been discussed, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable sub-combination.
[0178] Although the subject matter has been described in language specific to structural features and / or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.
Claims
1. A request processing method comprising: determining a first protocol type of a first request; transmitting the first request to a service process through a channel corresponding to the first protocol type; generating response information of the first request in a protocol format corresponding to the first protocol type within the service process; and sending the response information.
2. The method of claim 1, wherein, The first protocol type comprises a hypertext transfer protocol or a remote procedure call protocol; and the service process is a process of a remote procedure call service.
3. The method of claim 2, wherein, The transmitting the first request to the service process through the channel corresponding to the first protocol type comprises: in a case where the first protocol type is the hypertext transfer protocol, transmitting the first request to the process of the remote procedure call service through a hypertext transfer gateway; and in a case where the first protocol type is the remote procedure call protocol, transmitting the first request to the process of the remote procedure call service.
4. The method of claim 1, wherein, The first protocol type comprises a hypertext transfer protocol or a remote procedure call protocol; and the service process is a process of a hypertext transfer service.
5. The method of claim 4, wherein, The transmitting the first request to the service process through the channel corresponding to the first protocol type comprises: in a case where the first protocol type is the hypertext transfer protocol, transmitting the first request to the process of the hypertext transfer service through a hypertext transfer gateway; and in a case where the first protocol type is the remote procedure call protocol, transmitting the first request to the process of the hypertext transfer service.
6. The method according to any one of claims 1 to 5, wherein, After the generating the response information of the first request in the protocol format corresponding to the first protocol type within the service process, the method further comprises: generating response information of content requested by the first request in a protocol format corresponding to a second protocol type, the second protocol type comprising a protocol type supported by the service process other than the first protocol type.
7. The method of claim 6, further comprising: in a case where a second request of the second protocol type is acquired, acquiring and transmitting response information corresponding to the second request, the content requested by the second request being the same as the content requested by the first request.
8. A cloud service container comprising: a service processing component configured to determine a first protocol type of a first request, and transmit the first request to a service process through a channel corresponding to the first protocol type; a service process configured to generate response information of the first request in a protocol format corresponding to the first protocol type within the service process, and send the response information.
9. An electronic device comprising: one or more processing devices; a storage device configured to store one or more programs, when the one or more programs are executed by the one or more processing devices, the one or more processing devices implement a request processing method as claimed in any one of claims 1-7.
10. A storage medium containing computer-executable instructions for performing a request processing method as claimed in any one of claims 1-7 when executed by a computer processor.
Citation Information
Patent Citations
Data processing method, device and system, computing equipment and medium
CN110430275A
Message processing method and device, computing equipment and readable storage medium
CN112615822A
Multi-protocol service calling method and device, equipment and medium
CN117119079A
Process level authentication for client device access to a server system
US20230370455A1