Service request processing method and device based on large-scale cluster, equipment and medium
By parsing and judging the service request path, information is injected into the service registry or service gateway to obtain the target service, which solves the problem of low service request processing efficiency in large-scale microservice architecture and achieves efficient service request management.
Patent Information
- Application Number
- CN202111645206.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2026-01-09
- Estimated Expiration
- 2041-12-30
AI Technical Summary
In large-scale microservice architectures, service request processing efficiency is low, mainly due to the complex calling relationships between microservices, which leads to overly fine-grained service management and complex governance.
By receiving service requests from clients, parsing the request identifier and endpoint information, determining the request path, and injecting information into the service registry or service gateway to obtain the target service, the system can process service requests within or across clusters.
It reduces the management difficulty caused by fine-grained and numerous services, avoids the intrusion of native service instances, and improves the efficiency of service request processing.
Smart Images

Figure CN114296880B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of cloud computing, and in particular to a service request processing method and device based on a large-scale cluster, equipment and a medium. BACKGROUND
[0002] Microservice architecture divides a complex system into several small services, each of which can be independently developed, deployed and scaled; microservice architecture and containers (Docker / Kubernetes) are a perfect match, which can further simplify microservice delivery and strengthen the flexibility and robustness of the overall system. However, the distributed application architecture composed of a large number of microservices also increases the complexity of operation, debugging and security management.
[0003] In the implementation of large-scale system applications, there are a large number of microservices, and the calling relationship between microservices is complex. However, as the number of services increases, the management through the service mesh also increases exponentially in the interaction relationship, which brings the problem of too fine service management granularity and complex service governance, thereby causing low efficiency of service request processing. SUMMARY
[0004] The purpose of the embodiments of the present application is to provide a service request processing method, device, equipment and medium based on a large-scale cluster to improve the efficiency of service request processing.
[0005] In order to solve the above technical problems, the embodiments of the present application provide a service request processing method based on a large-scale cluster, comprising:
[0006] receiving a service request of a client and parsing the service request to obtain a service request identifier, request end information and target end information;
[0007] judging a request path corresponding to the service request based on the service request identifier to obtain a judgment result, wherein the request path includes an intra-cluster service request and a cross-cluster service request;
[0008] if the judgment result is the intra-cluster service request, injecting the request end information and the target end information into header information to obtain a target application domain and a target service corresponding to the service request in a service registry center, calling the target service in the target application domain, and processing the service request through the target service;
[0009] if the judgment result is the cross-cluster service request, injecting the request end information and the target end information into the header information, and injecting the header information into cluster relationship information through a service gateway to obtain the target service and process the service request through the target service.
[0010] To solve the above technical problems, the embodiment of the application provides a service request processing device based on a large-scale cluster, which comprises:
[0011] a service request receiving module, which is used for receiving a service request of a client and analyzing the service request to obtain a service request identifier, request end information and target end information;
[0012] a request path judging module, which is used for judging a request path corresponding to the service request based on the service request identifier to obtain a judging result, wherein the request path comprises an intra-cluster service request and a cross-cluster service request;
[0013] an intra-cluster request processing module, which is used for, if the judging result is the intra-cluster service request, injecting the request end information and the target end information into header information to obtain a target application domain and a target service corresponding to the service request in a service registration center, calling the target service in the target application domain, and processing the service request through the target service;
[0014] a cross-cluster request processing module, which is used for, if the judging result is the cross-cluster service request, injecting the request end information and the target end information into the header information, injecting the header information into cluster relationship information through a service gateway to obtain the target service, and processing the service request through the target service.
[0015] To solve the above technical problems, the embodiment of the application provides a computer device, which comprises one or more processors and a memory for storing one or more programs, so that the one or more processors implement the service request processing method based on a large-scale cluster.
[0016] To solve the above technical problems, the embodiment of the application provides a computer device, which comprises one or more processors and a memory for storing one or more programs, so that the one or more processors implement the service request processing method based on a large-scale cluster.
[0017] The embodiment of the application provides a service request processing method, device and equipment based on a large-scale cluster and a medium. The method comprises the following steps: receiving a service request of a client, and analyzing the service request to obtain a service request identifier, request end information and target end information; judging a request path corresponding to the service request based on the service request identifier, and obtaining a judgment result, wherein the request path comprises an intra-cluster service request and a cross-cluster service request; if the judgment result is the intra-cluster service request, injecting the request end information and the target end information into header information, obtaining a target application domain and a target service corresponding to the service request in a service registration center, calling the target service in the target application domain, and processing the service request through the target service; and if the judgment result is the cross-cluster service request, injecting the request end information and the target end information into the header information, injecting the header information into cluster relationship information through a service gateway, obtaining the target service, and processing the service request through the target service. The embodiment of the application judges the request path corresponding to the service request, if the request path is the intra-cluster service request, the target service is called through the injection of the header information, if the request path is the cross-cluster service request, the target service is called through the service gateway, the management difficulty caused by the service granularity and the large number of services under the cluster is reduced, the invasion of the original service instance is avoided, and therefore the efficiency of the service request processing is improved. BRIEF DESCRIPTION OF DRAWINGS
[0018] In order to more clearly illustrate the scheme in the application, the drawings needed in the description of the embodiments of the application will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative labor.
[0019] Figure 1 is an implementation flowchart of a sub-process in the service request processing method based on a large-scale cluster provided by the embodiment of the application;
[0020] Figure 2 is another implementation flowchart of a sub-process in the service request processing method based on a large-scale cluster provided by the embodiment of the application;
[0021] Figure 3 is another implementation flowchart of a sub-process in the service request processing method based on a large-scale cluster provided by the embodiment of the application;
[0022] Figure 4 is another implementation flowchart of a sub-process in the service request processing method based on a large-scale cluster provided by the embodiment of the application;
[0023] Figure 5is another implementation flowchart of the sub-process in the service request processing method based on large-scale cluster provided by the embodiment of the present application;
[0024] Figure 6 is another implementation flowchart of the sub-process in the service request processing method based on large-scale cluster provided by the embodiment of the present application;
[0025] Figure 7 is another implementation flowchart of the sub-process in the service request processing method based on large-scale cluster provided by the embodiment of the present application;
[0026] Figure 8 is a schematic diagram of the service request processing device based on large-scale cluster provided by the embodiment of the present application;
[0027] Figure 9 is a schematic diagram of the computer device provided by the embodiment of the present application. DETAILED DESCRIPTION
[0028] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description herein is for describing particular embodiments only and is not intended to be limiting of the application; the description and the drawings are to be regarded as illustrative in nature and are not intended to limit the application; the terminology used in the description and the claims of the present application and the above description of the drawings includes the terms specifically mentioned above as well as their derivatives.
[0029] Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are they necessarily mutually exclusive of one another. As will be apparent to one of ordinary skill in the art, embodiments described herein can be combined with other embodiments.
[0030] In order to make the technical personnel in the art better understand the scheme of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings.
[0031] The application will be described in detail below with reference to the drawings and embodiments.
[0032] It should be noted that the service request processing method based on large-scale cluster provided by the embodiments of the present application is generally executed by a server, and accordingly, the service request processing device based on large-scale cluster is generally configured in the server.
[0033] Please refer toFigure 1 , Figure 1 An embodiment of a service request processing method based on a large-scale cluster is shown.
[0034] It should be noted that the method of the present application is not limited to the sequence of the flow shown, and includes the following steps: Figure 1
[0035] S1: receiving a service request of a client and parsing the service request to obtain a service request identifier, request end information and target end information.
[0036] Specifically, when the client needs to call a related service, the client generates a service request and sends the service request to the server. After receiving the service request, the server parses the service request to obtain a service request identifier, request end information and target end information. The service request identifier is the identifier corresponding to the target service that needs to be called, which is used to determine the service cluster where the service is located. The request end information is information generated based on the client, and the request end information includes the IP address information and account information of the client. The target end information is information generated based on the target service requested, and the target end information includes the target service name, etc.
[0037] Please refer to Figure 2 , Figure 2 An embodiment after step S1 is shown, described as follows:
[0038] S1A: recording the initiation time and response time of the service request of the client, and recording the receiving time and response return time of the service request of the server.
[0039] S1B: generating log information based on the initiation time, response time, receiving time, response return time and header information.
[0040] Specifically, after the step S1, the embodiment records the initiation time and response time of the service request of the client in the service interaction process, records the receiving time and response return time of the service request of the server, collects header information (Header), such as x-request-id, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, x-b3-sampled, x-b3-flags, x-ot-span-context, etc., and generates log information based on the initiation time, response time, receiving time, response return time and header information. Further, the log information is injected and forwarded to the service provider, so as to facilitate the traceability of the service. The service provider is the client that generates and provides the related service. The header information is the string sent by the server before transmitting the HTML file to the browser in the HTTP protocol, and a blank line is required to separate the header information and the HTML file.
[0041] In the embodiment, the initiation time and response time of the service request of the client are recorded, the receiving time and response return time of the service request of the server are recorded, and log information is generated based on the initiation time, response time, receiving time, response return time and header information, so as to facilitate the analysis and traceability of the service call process according to the generated log information.
[0042] S2: Based on the service request identifier, the request path corresponding to the service request is judged, and a judgment result is obtained, wherein the request path includes intra-cluster service request and cross-cluster service request.
[0043] Specifically, since the interaction process of the service may occur in the client and the same cluster, or may occur in the client and different clusters, the target service to be called is judged to be in the same cluster with the client or in different clusters with the client through the service request identifier. If the judgment result is that the target service to be called is in the same cluster with the client, it is an intra-cluster service request, and if not, it is a cross-cluster service request.
[0044] S3: If the judgment result is the intra-cluster service request, the request end information and the target end information are injected into the header information, so as to obtain the target application domain and the target service corresponding to the service request in the service registration center, call the target service in the target application domain, and process the service request through the target service.
[0045] Please refer to Figure 3 , Figure 3 A specific implementation of step S3 is shown, which is described in detail as follows:
[0046] S31: If the judgment result is an intra-cluster service request, inject the request end information and the target end information into the header information to generate a link tracking log identifier.
[0047] S32: Based on the link tracking log identifier, traverse the service registry center to obtain the target application domain and the target service corresponding to the service request.
[0048] S33: Analyze the domain name corresponding to the target application domain to call the target service and process the service request through the target service.
[0049] Specifically, if the judgment result is an intra-cluster service request, the request end information and the target end information are injected into the header information to generate a link tracking log identifier. At this time, the request end information and the target end information can be used as a Span message, that is, the Span message is injected into the header information to generate a link tracking log identifier. Then, the corresponding target application domain and target service are tracked to the service registry center through the link tracking log identifier. Then, the domain name corresponding to the target application domain is analyzed to call the target service and process the service request through the target service.
[0050] Further, the service mesh technology is adopted. Whenever a service initiates an external call, the client creates a new Span message. The injection of a Span message can realize the interaction process of a complete set of services, that is, from the beginning of the request from the client to the reception of the response from the service side. Under the multi-level service mesh, when cross-cluster service calls are made, the information of the service cluster is injected in the service gateway to show the call information and traceability of the overall cluster. The adoption of the service mesh technology realizes the division and independent autonomy of the service cluster under a large particle, thereby reducing the management difficulty caused by the fine service granularity and large number of services under a single cluster.
[0051] In this embodiment, if the judgment result is an intra-cluster service request, the request end information and the target end information are injected into the header information to generate a link tracking log identifier. Then, based on the link tracking log identifier, the corresponding target application domain and target service corresponding to the service request are obtained by traversing the service registry center. Then, the domain name corresponding to the target application domain is analyzed to call the target service and process the service request through the target service. In this way, the service request calling is realized in the intra-cluster service request, the invasion of the original service instance is avoided, and the efficiency of service request processing is effectively improved.
[0052] Please refer to Figure 4 , Figure 4 A specific implementation of step S33 is shown as follows:
[0053] S331: The domain name corresponding to the target application domain is resolved by the CoreDNS resolution method to obtain the IP address of the target service deployment unit Pod.
[0054] S332: Based on the IP address of the target service deployment unit Pod, the target service is called, and the service request is processed through the target service.
[0055] Specifically, CoreDNS is a domain name discovery project hosted in CNCF, which is natively integrated with Kubernetes. Its goal is to become a reference solution for cloud-native DNS servers and service discovery. CoreDNS resolves domain names by configuring the CoreDNS domain name resolution method, which can resolve application domains and obtain the real IP address of the service deployment unit Pod. The service deployment unit Pod refers to the concept of deploying, managing and orchestrating containerized applications proposed by Kubernetes, and is also the smallest deployment unit in Kubernetes. In the embodiment of the present application, the CoreDNS resolution method is used to resolve the domain name corresponding to the target application domain to obtain the IP address of the target service deployment unit Pod. Based on the IP address of the target service deployment unit Pod, the target service is called, and the service request is processed through the target service, realizing the service call between the clusters, which is conducive to improving the efficiency of service request processing.
[0056] Please refer to Figure 5 , Figure 5 A specific implementation before step S3 is shown as follows:
[0057] S3A: Obtain multiple services, compile and package the multiple services to generate service images, and place the service images into a service image repository.
[0058] S3B: Obtain the application domain corresponding to the service, and based on the application domain, deploy the service in the corresponding cluster.
[0059] S3C: In the service registry center, the application domain in the cluster is taken as a root node and initialized to obtain the root node corresponding to the application domain.
[0060] Specifically, the cluster includes multiple services, each service has its corresponding business function, each business function is taken as an application domain cluster, and each application domain cluster is registered as a root node to obtain the root node corresponding to the application domain cluster. Therefore, multiple services are obtained first, and then the multiple services are compiled and packaged into service images. The mirroring is a file storage form and a type of redundancy. Data on one disk exists a complete copy on another disk, which is mirroring. Then the service images are placed in a service image warehouse, the business function of each service is obtained, that is, the application domain of the service is obtained, and the application domain is planned and configured to the corresponding cluster. Then, in the service registration center, the application domain in the cluster is taken as a root node and is initialized to obtain the root node corresponding to the application domain. In the embodiment, when the service is deployed and released, the related service containers are registered with the application domain cluster name as the root node according to the division of the application domain. The services under the node can automatically discover the services corresponding to the root node to realize cross-service calling in the application domain.
[0061] Referring to Figure 6 , Figure 6 A specific implementation mode after step S3C is shown, and is described as follows:
[0062] S3D: If it is detected that the service sends a change, a service change notification is generated in the service registration center.
[0063] S3E: The service change notification is sent to the client to enable the client to obtain the service change content and store the service change content in the local of the client.
[0064] Specifically, the service is monitored through the service registration center. When it is detected that the service sends a change, the service change content is obtained, and a corresponding service change notification is generated. The service change notification is sent to the client. After the client receives the service change notification, the corresponding service change content is obtained, and the service change content is stored in the local of the client. In the embodiment, if it is detected that the service sends a change, a service change notification is generated in the service registration center. The service change notification is sent to the client to enable the client to obtain the service change content and store the service change content in the local of the client. The service is monitored. When the service changes, the service content in the local of the client is updated in real time.
[0065] S4: If the judgment result is a cross-cluster service request, the request end information and the target end information are injected into the header information, and the header information is injected into the cluster relationship information through the service gateway to obtain the target service and process the service request through the target service.
[0066] Referring to Figure 7 , Figure 7An embodiment of step S4 is shown as follows:
[0067] S41: If the judgment result is a cross-cluster service request, inject the request end information and the target end information into the header information to obtain target header information.
[0068] S42: Inject the target header information into the cluster relationship information by using the service gateway to generate cluster information.
[0069] S43: In the cluster relationship information, the target service is obtained by collecting and forwarding the cluster information, and the service request is processed by the target service.
[0070] Specifically, if the judgment result is a cross-cluster service request, the request end information and the target end information are injected into the header information to obtain target header information. Then, the embodiment of the application retains a registration interface to the outside by using the service gateway, and can inject the target header information into the cluster relationship information to generate cluster information, for example, the generated cluster information is x-src-cluster-id and x-dst-cluster-id. Then, in the cluster relationship information, the target service is obtained by collecting and forwarding the cluster information, and the service request is processed by the target service.
[0071] Further, when the cross-cluster service request is needed, the calling relationship between services is fully considered whether it is important and whether it is exposed to the outside. The embodiment of the application separates and isolates the clusters according to the application domain, and the embodiment of the application also registers and exposes to the outside by using the service gateway to realize the service calling outside the cluster, reduce the possibility of over-expansion of services under the cluster domain, and reduce the coupling between services. After the cross-cluster calling service is completed, the service is registered on the application service gateway in the form of an interface to realize the cross-domain interaction between systems. At the same time, the clusters are separated and isolated according to the application domain, which can effectively reduce the number of services in a single cluster, reduce the complexity of cluster management, and reduce the impact of abnormal service stop or degradation of a service on the overall system service.
[0072] In the embodiment, a service request of a receiving client is received, and the service request is parsed to obtain a service request identifier, request end information and target end information; based on the service request identifier, a request path corresponding to the service request is judged to obtain a judgment result, wherein the request path includes an intra-cluster service request and a cross-cluster service request; if the judgment result is the intra-cluster service request, the request end information and the target end information are injected into header information to obtain a target application domain and a target service corresponding to the service request in a service registry center, and the target service is called in the target application domain, and the service request is processed through the target service; if the judgment result is the cross-cluster service request, the request end information and the target end information are injected into the header information, and the header information is injected into cluster relationship information through a service gateway to obtain the target service, and the service request is processed through the target service. Through judging the request path corresponding to the service request, if the request path is the intra-cluster service request, the target service is called by injecting the header information, and if the request path is the cross-cluster service request, the target service is called by the service gateway, the management difficulty caused by the fine service granularity and the large number of services under the cluster is reduced, and the invasion of the original service instance is avoided, thereby the efficiency of processing the service request is improved.
[0073] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by a computer program instructing related hardware, and the computer program can be stored in a computer readable storage medium. When the program is executed, the processes of the above-mentioned embodiments of each method can be included. The storage medium can be a non-volatile storage medium such as a magnetic disc, an optical disc, a read-only memory (ROM), or a random access memory (RAM).
[0074] Please refer to Figure 8 , as an implementation of the method shown in Figure 1 , the present application provides an embodiment of a service request processing device based on a large-scale cluster. The device embodiment corresponds to the method embodiment shown in Figure 1 , and the device can be applied to various electronic devices.
[0075] As shown in Figure 8 , the service request processing device based on a large-scale cluster in the embodiment includes a service request receiving module 51, a request path judging module 52, an intra-cluster request processing module 53 and a cross-cluster request processing module 54, wherein:
[0076] The service request receiving module 51 is configured to receive a service request of a client, and parse the service request to obtain a service request identifier, request end information, and target end information.
[0077] The request path judging module 52 is configured to judge a request path corresponding to the service request based on the service request identifier to obtain a judgment result, wherein the request path comprises an intra-cluster service request and a cross-cluster service request.
[0078] The intra-cluster request processing module 53 is configured to, if the judgment result is the intra-cluster service request, inject the request end information and the target end information into header information, obtain a target application domain and a target service corresponding to the service request in a service registry center, and invoke the target service in the target application domain, and process the service request through the target service.
[0079] The cross-cluster request processing module 54 is configured to, if the judgment result is the cross-cluster service request, inject the request end information and the target end information into the header information, inject the header information into cluster relationship information through a service gateway, obtain the target service, and process the service request through the target service.
[0080] Further, the intra-cluster request processing module 53 comprises:
[0081] The link tracking log identifier generating unit is configured to, if the judgment result is the intra-cluster service request, inject the request end information and the target end information into the header information, and generate a link tracking log identifier.
[0082] The service registry center traversing unit is configured to traverse the service registry center based on the link tracking log identifier to obtain the target application domain and the target service corresponding to the service request.
[0083] The domain name resolving unit is configured to resolve a domain name corresponding to the target application domain to invoke the target service and process the service request through the target service.
[0084] Further, the domain name resolving unit comprises:
[0085] The IP address generating sub-unit is configured to resolve the domain name corresponding to the target application domain through a CoreDNS resolving manner to obtain an IP address of a Pod of a target service deployment unit.
[0086] The service request processing unit is configured to invoke the target service based on the IP address of the Pod of the target service deployment unit, and process the service request through the target service.
[0087] Further, the intra-cluster request processing module 53 further comprises:
[0088] The service image storage module is configured to acquire multiple services, compile and package the multiple services, generate service images, and place the service images in a service image repository.
[0089] The application domain configuration module is configured to acquire an application domain corresponding to the service and configure the service in a corresponding cluster based on the application domain.
[0090] The root node generation module is configured to initialize the application domain as a root node in the service registry center, and obtain a root node corresponding to the application domain.
[0091] Further, the root node generation module further comprises:
[0092] The service change notification generation module is configured to generate a service change notification in the service registry center if a service change is detected.
[0093] The service change content storage module is configured to send the service change notification to a client, so that the client acquires service change content and stores the service change content in the local client.
[0094] Further, the service request receiving module 51 further comprises:
[0095] The time recording module is configured to record the initiation time and response time of the service request of the client, and record the receiving time and response return time of the service request of the server.
[0096] The log information generation module is configured to generate log information based on the initiation time, response time, receiving time, response return time and header information.
[0097] Further, the cross-cluster request processing module 54 comprises:
[0098] The target header information generation unit is configured to inject the request end information and the target end information into the header information to obtain target header information if the judgment result is a cross-cluster service request.
[0099] The cluster information generation unit is configured to inject the target header information into the cluster relationship information by using the service gateway to generate cluster information.
[0100] The target service acquisition unit is configured to acquire the target service by collecting and forwarding the cluster information in the cluster relationship information, and process the service request through the target service.
[0101] To solve the above technical problems, the embodiments of the present application further provide a computer device. For details, please refer to Figure 9 , Figure 9 The basic structure block diagram of the computer device of the present embodiment is shown in the figure.
[0102] The computer device 6 comprises a memory 61, a processor 62, and a network interface 63 which are communicatively connected by a system bus. It should be noted that the computer device 6 is shown with three components, the memory 61, the processor 62, and the network interface 63, but it should be understood that not all of the illustrated components need be implemented, and that more or fewer components can be implemented instead. As will be appreciated by one of ordinary skill in the art, the computer device is a device capable of automatically processing numerical and / or information according to pre-set or stored instructions, and its hardware includes, but is not limited to, a microprocessor, an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a digital signal processor (DSP), an embedded device, and the like.
[0103] The computer device can be a desktop computer, a notebook computer, a palm computer, a cloud server, or the like. The computer device can interact with a user through a keyboard, a mouse, a remote controller, a touchpad, a voice control device, or the like.
[0104] The memory 61 comprises at least one type of readable storage medium, including a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., an SD or DX memory, or the like), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, or the like. In some embodiments, the memory 61 can be an internal storage unit of the computer device 6, such as a hard disk or a memory of the computer device 6. In other embodiments, the memory 61 can also be an external storage device of the computer device 6, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, or the like. Of course, the memory 61 can also include both an internal storage unit and an external storage device of the computer device 6. In the present embodiment, the memory 61 is generally used to store an operating system and various application software installed in the computer device 6, such as program codes of the service request processing method based on a large-scale cluster, and the like. In addition, the memory 61 can also be used to temporarily store various data that have been output or will be output.
[0105] The processor 62 may, in some embodiments, be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 62 is generally used to control the overall operation of the computer device 6. In the present embodiment, the processor 62 is configured to run program codes or process data stored in the memory 61, such as program codes of the above-mentioned large-scale cluster-based service request processing method, to implement various embodiments of the large-scale cluster-based service request processing method.
[0106] The network interface 63 may include a wireless network interface or a wired network interface, and is generally used to establish a communication connection between the computer device 6 and other electronic devices.
[0107] The present application also provides another embodiment, i.e., to provide a computer readable storage medium, which stores a computer program, and the computer program can be executed by at least one processor to make the at least one processor execute the steps of a large-scale cluster-based service request processing method as described above.
[0108] From the above description of the embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software and the necessary general hardware platform, of course, they can also be implemented by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a plurality of instructions for making a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the methods of various embodiments of the present application.
[0109] The blockchain referred to in the present application is a new application mode of distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm and other computer technologies. The blockchain is essentially a decentralized database, which is a series of data blocks associated using cryptographic methods, each data block containing information of a batch of network transactions, used to verify the validity (anti-fake) of the information and generate the next block. The blockchain can include a blockchain underlying platform, a platform product service layer, and an application service layer, etc.
[0110] Obviously, the above-described embodiments are only some embodiments but not all the embodiments of the present application, the preferred embodiments of the present application are shown in the drawings, but do not limit the patent scope of the present application. The present application can be implemented in many different forms, and conversely, the purpose of providing these embodiments is to make the disclosure of the present application more thorough and comprehensive. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent replacements to some technical features therein. Any equivalent structure made by using the content of the specification and drawings, directly or indirectly applied to other related technical fields, is also within the patent protection scope of the present application.
Claims
1. A service request processing method based on a large-scale cluster, characterized by, The application comprises the following steps: Receiving a service request of a client and parsing the service request to obtain a service request identifier, request end information and target end information, the service request identifier being an identifier corresponding to a target service to be called, used to determine a service cluster where the service is located; Based on the service request identifier, determining a request path corresponding to the service request to obtain a determination result, wherein the request path comprises an intra-cluster service request and a cross-cluster service request, if the target service to be called and the client are in the same cluster, the determination result is the intra-cluster service request, and if the target service to be called and the client are in different clusters, the determination result is the cross-cluster service request; Obtaining a plurality of services, compiling and packaging the plurality of services, generating a service image, and placing the service image into a service image repository; Obtaining an application domain corresponding to the service, and based on the application domain, deploying the service in a corresponding cluster; In the service registry center, taking the application domain in the cluster as a root node and performing initialization processing to obtain a root node corresponding to the application domain; If the determination result is the intra-cluster service request, injecting the request end information and the target end information into the header information to obtain the target application domain and the target service corresponding to the service request in the service registry center, calling the target service in the target application domain, and processing the service request through the target service, including: if the determination result is the intra-cluster service request, injecting the request end information and the target end information into the header information to generate a link tracking log identifier; based on the link tracking log identifier, traversing the service registry center to obtain the target application domain and the target service corresponding to the service request; parsing the domain name corresponding to the target application domain to call the target service and process the service request through the target service; If the determination result is the cross-cluster service request, injecting the request end information and the target end information into the header information, and through the service gateway, injecting the header information into cluster relationship information to obtain the target service and process the service request through the target service, including: if the determination result is the cross-cluster service request, injecting the request end information and the target end information into the header information to obtain target header information; using the service gateway, injecting the target header information into cluster relationship information to generate cluster information; in the cluster relationship information, collecting and forwarding the cluster information to obtain the target service and process the service request through the target service.
2. The service request processing method based on a large-scale cluster according to claim 1, characterized in that, The parsing of the domain name corresponding to the target application domain to call the target service and process the service request through the target service comprises: Resolving the domain name corresponding to the target application domain through a CoreDNS resolution method to obtain the IP address of a target service deployment unit Pod. Based on the IP address of the target service deployment unit Pod, the target service is called, and the service request is processed through the target service.
3. The large-scale cluster-based service request processing method of claim 1, wherein, After the application domain in the cluster is taken as a root node and initialized in the service registry center to obtain the root node corresponding to the application domain, the method further comprises: If the service sending change is monitored, a service change notification is generated in the service registry center; The service change notification is sent to the client to enable the client to obtain the service change content and store the service change content in the client local.
4. The service request processing method based on a large-scale cluster according to claim 1, characterized in that, After the service request of the client is received and the service request is parsed to obtain the service request identifier, request end information, and target end information, the method further comprises: The initiation time and response time of the service request of the client are recorded, and the receiving time and response return time of the server for the service request are recorded; Based on the initiation time, the response time, the receiving time, the response return time, and the header information, log information is generated.
5. A service request processing apparatus based on a large-scale cluster, characterized by comprising: Comprise: The service request receiving module is configured to receive the service request of the client, and parse the service request to obtain the service request identifier, request end information, and target end information, the service request identifier being an identifier corresponding to a target service to be called, used to determine the service cluster where the service is located; The request path judgment module is configured to determine the request path corresponding to the service request based on the service request identifier to obtain a determination result, wherein the request path comprises an intra-cluster service request and a cross-cluster service request, if the target service to be called and the client are in the same cluster, the determination result is the intra-cluster service request, and if the target service to be called and the client are in different clusters, the determination result is the cross-cluster service request; The intra-cluster request processing module is configured to, if the determination result is the intra-cluster service request, inject the request end information and the target end information into the header information, to obtain the target application domain and the target service corresponding to the service request in the service registry center, call the target service in the target application domain, and process the service request through the target service; The service image storage module is configured to obtain multiple services, compile and package the multiple services to generate service images, and place the service images into a service image warehouse; The application domain configuration module is configured to obtain an application domain corresponding to a service, and configure the service in a corresponding cluster based on the application domain; The root node generation module is configured to take the application domain in the cluster as a root node and perform initialization processing in the service registry center to obtain a root node corresponding to the application domain; The cross-cluster request processing module is configured to, if the determination result is the cross-cluster service request, inject the request end information and the target end information into the header information, and inject the header information into cluster relationship information through a service gateway to obtain the target service and process the service request through the target service. The intra-cluster request processing module comprises: The link tracking log identification generation unit is configured to, if the judgment result is an intra-cluster service request, inject the request end information and the target end information into the header information to generate a link tracking log identification; The service registry center traversal unit is configured to traverse the service registry center based on the link tracking log identification to obtain a target application domain and a target service corresponding to the service request; The domain name resolution unit is configured to resolve a domain name corresponding to the target application domain to call the target service and process the service request through the target service; The cross-cluster request processing module comprises: The target header information generation unit is configured to, if the judgment result is a cross-cluster service request, inject the request end information and the target end information into the header information to obtain target header information; The cluster information generation unit is configured to inject the target header information into cluster relationship information by using a service gateway to generate cluster information; The target service acquisition unit is configured to acquire the target service by collecting and forwarding the cluster information in the cluster relationship information and process the service request through the target service.
6. A computer device, comprising: The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the service request processing method based on a large-scale cluster according to any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the service request processing method based on a large-scale cluster according to any one of claims 1 to 4.
Citation Information
Patent Citations
Processing method and device for API request
CN108881448A
Data processing method and device based on cluster access
CN111026709A
Method and system for realizing cross-domain and cross-center communication in enterprise-level micro-service platform
CN111147588A
Domain name resolution method and device, electronic equipment and storage medium
CN113691647A