WO2023125755A1 - Service request processing method and apparatus based on large-scale cluster, and device and medium - Google Patents

Service request processing method and apparatus based on large-scale cluster, and device and medium Download PDF

Info

Publication number
WO2023125755A1
WO2023125755A1 PCT/CN2022/143185 CN2022143185W WO2023125755A1 WO 2023125755 A1 WO2023125755 A1 WO 2023125755A1 CN 2022143185 W CN2022143185 W CN 2022143185W WO 2023125755 A1 WO2023125755 A1 WO 2023125755A1
Authority
WO
WIPO (PCT)
Prior art keywords
service
target
service request
cluster
information
Prior art date
Application number
PCT/CN2022/143185
Other languages
French (fr)
Chinese (zh)
Inventor
陈鑫远
左绘
陈洲
王广玥
Original Assignee
天翼物联科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 天翼物联科技有限公司 filed Critical 天翼物联科技有限公司
Publication of WO2023125755A1 publication Critical patent/WO2023125755A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines

Definitions

  • the present application relates to the technical field of cloud computing, and in particular to a large-scale cluster-based service request processing method, device, equipment and medium.
  • the microservice architecture divides the complex system into several small services, and each service can be independently developed, deployed, and scaled; the microservice architecture and containers (Docker/Kubernetes) are a match made in heaven, which can further simplify the delivery of microservices and enhance the elasticity of the overall system and robustness.
  • a distributed application architecture composed of a large number of microservices will also increase the complexity of operation and maintenance, debugging, and security management.
  • the purpose of the embodiments of the present application is to propose a large-scale cluster-based service request processing method, device, device, and medium, so as to improve service request processing efficiency.
  • the embodiment of the present application provides a large-scale cluster-based service request processing method, including:
  • the service request identifier Based on the service request identifier, judge a request path corresponding to the service request, and obtain a judgment result, wherein the request path includes an intra-cluster service request and a cross-cluster service request;
  • the judgment result is a service request in the cluster, inject the requester information and the target information into the header information, so as to obtain the target application domain and target service corresponding to the service request in the service registration center , and invoking the target service in the target application domain, and processing the service request through the target service;
  • the judgment result is the cross-cluster service request, inject the requester information and the target information into the header information, and inject the header information into the cluster relationship information through the service gateway , to obtain the target service, and process the service request through the target service.
  • an embodiment of the present application provides a large-scale cluster-based service request processing device, including:
  • the service request receiving module is used to receive the service request of the client, and analyze the service request to obtain the service request identifier, requester information and target information;
  • a request path judging module configured to judge a request path corresponding to the service request based on the service request identifier, and obtain a judgment result, wherein the request path includes an intra-cluster service request and a cross-cluster service request;
  • An intra-cluster request processing module configured to inject the requester information and the target information into the header information if the judgment result is the intra-cluster service request, so as to obtain the service request in the service registration center Corresponding target application domain and target service, and invoking the target service in the target application domain, and processing the service request through the target service;
  • a cross-cluster request processing module configured to inject the requester information and the target information into the header information if the judgment result is the cross-cluster service request, and send the The header information is injected into the cluster relationship information to obtain the target service, and process the service request through the target service.
  • a technical solution adopted by the present invention is to provide a computer device, including one or more processors; and a memory for storing one or more programs, so that the one or more processors realize the above-mentioned Any one of the large-scale cluster-based service request processing methods.
  • a technical solution adopted by the present invention is: a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, any of the above-mentioned items can be realized.
  • the described large-scale cluster-based service request processing method is:
  • Embodiments of the present invention provide a large-scale cluster-based service request processing method, device, equipment, and medium.
  • the method includes: receiving a service request from the client, and parsing the service request to obtain the service request identifier, requester information, and target information; based on the service request identifier, judging the request path corresponding to the service request, and obtaining the judgment result, wherein , the request path includes an intra-cluster service request and a cross-cluster service request; if the judgment result is an intra-cluster service request, inject the requester information and target information into the header information to obtain the target application corresponding to the service request in the service registry Domain and target service, and call the target service in the target application domain, and process the service request through the target service; if the judgment result is a cross-cluster service request, inject the requester information and target information into the header information, and pass the The gateway injects the header information into the cluster relationship information to obtain the target service, and processes the service request through the target service.
  • the target service is invoked by injecting header information, and if the request path is a cross-cluster service request, the service gateway is used , to call the target service, which reduces the management difficulty brought about by the fine-grained service in the cluster and the large number of services, and avoids the intrusion of the original service instance, which is conducive to improving the efficiency of service request processing.
  • FIG. 1 is a flow chart of an implementation of a sub-process in a large-scale cluster-based service request processing method provided by an embodiment of the present application.
  • Fig. 2 is another implementation flowchart of the sub-process in the large-scale cluster-based service request processing method provided by the embodiment of the present application.
  • Fig. 3 is another implementation flowchart of a sub-process in the large-scale cluster-based service request processing method provided by the embodiment of the present application.
  • Fig. 4 is another implementation flowchart of a sub-process in the large-scale cluster-based service request processing method provided by the embodiment of the present application.
  • Fig. 5 is another implementation flowchart of a sub-process in the large-scale cluster-based service request processing method provided by the embodiment of the present application.
  • Fig. 6 is another implementation flowchart of a sub-process in the large-scale cluster-based service request processing method provided by the embodiment of the present application.
  • Fig. 7 is another implementation flowchart of the sub-process in the large-scale cluster-based service request processing method provided by the embodiment of the present application.
  • FIG. 8 is a schematic diagram of a large-scale cluster-based service request processing device provided by an embodiment of the present application.
  • Fig. 9 is a schematic diagram of a computer device provided by an embodiment of the present application.
  • the large-scale cluster-based service request processing method provided in the embodiment of the present application is generally executed by a server, and correspondingly, the large-scale cluster-based service request processing device is generally configured in the server.
  • FIG. 1 shows a specific implementation manner of a large-scale cluster-based service request processing method.
  • S1 Receive the service request from the client, and parse the service request to obtain the service request identifier, requester information, and target information.
  • the client when the client needs to call related services, the client generates a service request and sends the service request to the server.
  • the server parses the service request to obtain the service request identifier, the request end information and target information.
  • the service request identifier is an identifier corresponding to the target service that needs to be invoked, and is used to determine the service cluster where the service is located.
  • the requester information is information generated based on the client, where the requester information includes the client's IP address information and account information.
  • the target information is information generated based on the requested target service, where the target information includes the target service name and the like.
  • Fig. 2 shows a specific implementation after step S1, which is described in detail as follows:
  • S1A Record the initiation time and response time of the client to the service request, and record the receiving time and response return time of the server to the service request.
  • S1B Generate log information based on the initiation time, response time, reception time, response return time, and header information.
  • this embodiment records the client's initiation time and response time to the service request, and the server's reception time and response return time to the service request during the service interaction process, and collects the information from the header Header, such as collecting the following header information: x-request-id, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, x-b3-sampled, x-b3-flags and x -ot-span-context, etc., and then generate log information based on the initiation time, response time, reception time, response return time and header information.
  • the header Header such as collecting the following header information: x-request-id, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, x-b3-sampled, x-b3-flags and x -ot-span-context, etc
  • the log information is injected and forwarded to the service provider to facilitate service traceability.
  • the service provider is a client that generates and provides related services.
  • the header information is also the header (header), and the header information is a character string sent by the server before transmitting the HTML data to the browser with the HTTP protocol, and an empty line is required between the header information and the HTML file to separate.
  • S2 Based on the service request identifier, determine the request path corresponding to the service request, and obtain a judgment result, wherein the request path includes an intra-cluster service request and a cross-cluster service request.
  • the interaction process of the service may occur in the same cluster as the client and in a different cluster, it can be judged that the target service to be invoked is in the same cluster as the client through the service request identifier , or in a different cluster from the client. If the judgment result is that the target service to be invoked is in the same cluster as the client, it is an intra-cluster service request; if not, it is a cross-cluster service request.
  • Fig. 3 has shown a kind of specific implementation of step S3, described in detail as follows:
  • S32 Based on the link tracking log identifier, traverse the service registration center to obtain the target application domain and target service corresponding to the service request.
  • the judgment result is a service request within the cluster, inject the requester information and target information into the header information to generate a link tracking log identifier.
  • the requester information and target information at this time can be used as a Span message, or Inject the Span message into the header information, generate a link tracking log ID, and then go to the service registration center to track the corresponding target application domain and target service through the link tracking log ID, and then analyze the domain name corresponding to the target application domain to call the target service, and handle service requests through the target service.
  • the client whenever the service initiates an external call, the client will create a new Span message.
  • the injection of a Span message can realize a complete set of service interaction processes, that is, from the client sending a request to receiving the server's response.
  • the information of the service cluster is injected into the service gateway to display the call information and traceability of the overall cluster.
  • the service grid technology is used to realize the division and independent autonomy of the service cluster under the large granularity, and reduce the management difficulty brought about by the fine granularity of the service and the large number of services under a single cluster.
  • the judgment result is a service request in the cluster
  • inject the requester information and target information into the header information to generate a link tracking log identifier
  • traverse the service registration center based on the link tracking log identifier to obtain The target application domain and target service corresponding to the service request, and then resolve the domain name corresponding to the target application domain to call the target service, and process the service request through the target service, so that the service request in the cluster can realize the request call of the service, and avoid the native service
  • the intrusion of instances effectively improves the efficiency of service request processing.
  • Fig. 4 has shown a kind of specific implementation manner of step S33, describe in detail as follows:
  • S331 Resolve the domain name corresponding to the target application domain through CoreDNS resolution, and obtain the IP address of the target service deployment unit Pod.
  • S332 Call the target service based on the IP address of the target service deployment unit Pod, and process the service request through the target service.
  • CoreDNS is a domain name discovery project hosted by CNCF, natively integrated with Kubernetes, and its goal is to become a reference solution for cloud-native DNS servers and service discovery; and the CoreDNS resolution method is to configure domain name resolution through CoreDNS, It can analyze the application domain and obtain the IP address of the real service deployment unit Pod.
  • the service deployment unit Pod refers to the concept proposed by Kubernetes for deploying, managing, and orchestrating containerized applications, and it is also the smallest deployment unit in Kubernetes.
  • the domain name corresponding to the target application domain is resolved through the CoreDNS resolution method, and the IP address of the target service deployment unit Pod is obtained, and then based on the IP address of the target service deployment unit Pod, the target service is invoked, and processed by the target service Service requests, realize service calls between clusters, and help improve the efficiency of service request processing.
  • FIG. 5 shows a specific implementation before step S3, which is described in detail as follows:
  • S3A Obtain multiple services, compile and package multiple services, generate service mirrors, and place the service mirrors into the service mirror warehouse.
  • S3B Obtain the application domain corresponding to the service, and allocate the service to the corresponding cluster based on the application domain.
  • S3C In the service registration center, the application domain in the cluster is used as the root node and initialized to obtain the root node corresponding to the application domain.
  • the cluster includes a variety of services, and each service has its corresponding business function.
  • Each business function is regarded as an application domain cluster, and it is registered as each application domain cluster as the root node, so that Get the root node corresponding to the application domain cluster. Therefore, multiple services are obtained first, and then multiple services are compiled and packaged into service mirrors.
  • mirroring is a form of file storage and a type of redundancy. The data on one disk is stored on another disk. An identical copy exists on the mirror.
  • the service mirror warehouse obtain the business function of each service, that is, obtain the application domain of the service, plan and configure it into the corresponding cluster;
  • the application domain is used as the root node and is initialized to obtain the root node corresponding to the application domain.
  • the relevant service container is registered with the application domain cluster name as the root node, and the services under this node can automatically discover the service corresponding to the root node, realizing this Cross-service calls under the application domain.
  • FIG. 6 shows a specific implementation after step S3C, which is described in detail as follows:
  • S3E Send the service change notification to the client, so that the client obtains the service change content and stores the service change content locally in the client.
  • the service is monitored through the service registration center, and when a service change is detected, the service change content is obtained, and a corresponding service change notification is generated, and the service change notification is sent to the client, and the client receives the service change notification After that, the corresponding service change content is obtained, and then the service change content is stored locally on the client.
  • a service change notification is generated in the service registration center, and the service change notification is sent to the client, so that the client obtains the service change content and stores the service change content locally in the client , to monitor the service, and update the local service content of the client in real time when the service changes.
  • Fig. 7 shows a specific implementation of step S4, which is described in detail as follows:
  • S43 In the cluster relationship information, the cluster information is collected and forwarded to obtain the target service, and the service request is processed through the target service.
  • the requester information and target information are injected into the header information to obtain the target header information, and then the embodiment of this application reserves a registration interface externally through the service gateway, and the target header
  • the internal information is injected into the cluster relationship information to generate cluster information, for example, the generated cluster messages are x-src-cluster-id and x-dst-cluster-id, and then in the cluster relationship information, the cluster information is collected and forwarded Process to obtain the target service and process the service request through the target service.
  • the embodiment of this application distinguishes and isolates the clusters according to the application domain, and the embodiment of the application also registers through the service gateway and Expose to the outside to achieve service calls outside the cluster, reduce the possibility of excessive expansion of services under the cluster domain, and also reduce the coupling between services.
  • After completing the cross-cluster call service register such service on the application service gateway through the interface to realize cross-domain interaction between systems.
  • distinguishing and isolating clusters according to application domains can effectively reduce the number of services in a single cluster, reduce the complexity of cluster management, and reduce the impact of a certain service on the overall system service due to abnormal shutdown or degradation.
  • the service request from the client is received, and the service request is parsed to obtain the service request identifier, requester information, and target information; based on the service request identifier, the request path corresponding to the service request is judged, and the judgment result is obtained, wherein , the request path includes an intra-cluster service request and a cross-cluster service request; if the judgment result is an intra-cluster service request, inject the requester information and target information into the header information to obtain the target application corresponding to the service request in the service registry Domain and target service, and call the target service in the target application domain, and process the service request through the target service; if the judgment result is a cross-cluster service request, inject the requester information and target information into the header information, and pass the The gateway injects the header information into the cluster relationship information to obtain the target service, and processes the service request through the target service.
  • the target service is invoked by injecting header information, and if the request path is a cross-cluster service request, the service gateway is used , to call the target service, which reduces the management difficulty brought about by the fine-grained service in the cluster and the large number of services, and avoids the intrusion of the original service instance, which is conducive to improving the efficiency of service request processing.
  • the computer program can be stored in a computer-readable storage medium. During execution, it may include the processes of the embodiments of the above-mentioned methods.
  • the aforementioned storage medium may be a nonvolatile storage medium such as a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM).
  • this application provides an embodiment of a large-scale cluster-based service request processing device, which is similar to the method embodiment shown in FIG. 1
  • the device can be specifically applied to various electronic devices.
  • the large-scale cluster-based service request processing device of this embodiment includes: a service request receiving module 51, a request path judgment module 52, an intra-cluster request processing module 53, and a cross-cluster request processing module 54, wherein:
  • the service request receiving module 51 is configured to receive the service request from the client, and analyze the service request to obtain the service request identifier, requester information and target information;
  • the request path judging module 52 is configured to judge the request path corresponding to the service request based on the service request identifier, and obtain a judgment result, wherein the request path includes an intra-cluster service request and a cross-cluster service request;
  • the intra-cluster request processing module 53 is configured to inject the requester information and target information into the header information if the judgment result is an intra-cluster service request, so as to obtain the target application domain and target service corresponding to the service request in the service registration center, And call the target service in the target application domain, and process the service request through the target service;
  • the cross-cluster request processing module 54 is used to inject the requester information and the target information into the header information if the judgment result is a cross-cluster service request, and inject the header information into the cluster relationship information through the service gateway, so as to Get the target service, and process the service request through the target service.
  • the intra-cluster request processing module 53 includes:
  • a link tracking log identification generation unit configured to inject requester information and target information into the header information if the judgment result is a service request within the cluster, to generate a link tracking log identification
  • the service registration center traversal unit is configured to traverse the service registration center based on the link tracking log identifier, and obtain the target application domain and target service corresponding to the service request;
  • the domain name resolution unit is configured to resolve the domain name corresponding to the target application domain, so as to call the target service, and process the service request through the target service.
  • the domain name resolution unit includes:
  • the IP address generation subunit is used to resolve the domain name corresponding to the target application domain through the CoreDNS resolution method, and obtain the IP address of the target service deployment unit Pod;
  • the service request processing unit is configured to call the target service based on the IP address of the target service deployment unit Pod, and process the service request through the target service.
  • intra-cluster request processing module 53 also includes:
  • the service image storage module is used to obtain various services, compile and package the various services, generate a service image, and put the service image into the service image warehouse;
  • the application domain configuration module is used to obtain the application domain corresponding to the service, and allocate the service to the corresponding cluster based on the application domain;
  • the root node generating module is configured to use the application domain in the cluster as the root node in the service registration center and perform initialization processing to obtain the root node corresponding to the application domain.
  • root node generation module it also includes:
  • the service change notification generation module is used to generate a service change notification in the service registration center if the service is monitored to send a change;
  • the service change content storage module is configured to send the service change notification to the client, so that the client obtains the service change content and stores the service change content locally in the client.
  • the service request receiving module 51 it also includes:
  • the time recording module is used to record the client's initiation time and response time to the service request, and record the server's reception time and response return time to the service request;
  • the log information generation module is configured to generate log information based on initiation time, response time, reception time, response return time and header information.
  • cross-cluster request processing module 54 includes:
  • a target header information generation unit configured to inject requester information and target information into the header information to obtain the target header information if the judgment result is a cross-cluster service request;
  • the cluster information generation unit is used to inject the target header information into the cluster relationship information by using the 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.
  • FIG. 9 is a block diagram of the basic structure of the computer device in this embodiment.
  • the computer device 6 includes a memory 61 , a processor 62 , and a network interface 63 connected to each other through a system bus. It should be noted that the figure only shows a computer device 6 with three components memory 61, processor 62, and network interface 63, but it should be understood that it is not required to implement all the components shown, and alternative implementation more or fewer components.
  • the computer device here is a device that can automatically perform numerical calculation and/or information processing according to preset or stored instructions, and its hardware includes but is not limited to microprocessors, dedicated Integrated circuit (Application Specific Integrated Circuit, ASIC), programmable gate array (Field-Programmable Gate Array, FPGA), digital processor (Digital Signal Processor, DSP), embedded devices, etc.
  • ASIC Application Specific Integrated Circuit
  • FPGA Field-Programmable Gate Array
  • DSP Digital Signal Processor
  • the computer equipment may be computing equipment such as desktop computers, notebooks, palmtop computers, and cloud servers. Computer equipment can interact with users through keyboards, mice, remote controls, touch pads, or voice-activated devices.
  • the memory 61 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory ( SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc.
  • the memory 61 may be an internal storage unit of the computer device 6 , such as a hard disk or internal memory of the computer device 6 .
  • the memory 61 can also be an external storage device of the computer device 6, such as a plug-in hard disk equipped on the computer device 6, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, flash memory card (Flash Card), etc.
  • the memory 61 may also include both the internal storage unit of the computer device 6 and its external storage device.
  • the memory 61 is generally used to store the operating system and various application software installed in the computer device 6, such as program codes of a large-scale cluster-based service request processing method, and the like.
  • the memory 61 can also be used to temporarily store various types of data that have been output or will be output.
  • the processor 62 may be a central processing unit (Central Processing Unit, CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments.
  • the processor 62 is generally used to control the overall operation of the computer device 6 .
  • the processor 62 is used to run the program code or process data stored in the memory 61, for example, run the program code of the above-mentioned large-scale cluster-based service request processing method, so as to implement the large-scale cluster-based service request processing method various embodiments.
  • the network interface 63 may include a wireless network interface or a wired network interface, and the network interface 63 is generally used to establish a communication connection between the computer device 6 and other electronic devices.
  • the present application also provides another implementation manner, which is to provide a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and the computer program can be executed by at least one processor, so that at least one processor performs the above-mentioned The steps of a large-scale cluster-based service request processing method.
  • the methods of the above embodiments can be implemented by means of software plus a necessary general-purpose hardware platform, and of course also by hardware, but in many cases the former is better implementation.
  • the technical solution of the present application can be embodied in the form of a software product in essence or the part that contributes to the prior art, and the computer software product is stored in a storage medium (such as ROM/RAM, disk, CD) contains several instructions to make a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the method of each embodiment of the present application.
  • a terminal device which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.
  • the block chain referred to in the present invention is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
  • Blockchain essentially a decentralized database, is a series of data blocks associated with each other using cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify its Validity of information (anti-counterfeiting) and generation of the next block.
  • the blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The present application relates to the technical field of cloud computing, and discloses a service request processing method and apparatus based on a large-scale cluster, and a device and a medium. The method comprises: receiving and analyzing a service request of a client to obtain a service request identifier, request end information, and target end information; determining a request path corresponding to the service request; if the service request is determined to be an in-cluster service request, injecting the request end information and the target end information into header information so as 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 by means of the target service; and if the service request is determined to be a 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 by means of a service gateway to obtain the target service to process the service request. The present invention reduces the management difficulty of the service under the cluster, and improves the service request processing efficiency.

Description

基于大规模集群的服务请求处理方法、装置、设备及介质Service request processing method, device, device and medium based on large-scale cluster 技术领域technical field
本申请涉及云计算技术领域,尤其涉及一种基于大规模集群的服务请求处理方法、装置、设备及介质。The present application relates to the technical field of cloud computing, and in particular to a large-scale cluster-based service request processing method, device, equipment and medium.
背景技术Background technique
微服务架构将复杂系统切分若干小服务,每个服务可以被独立地开发、部署和伸缩;微服务架构和容器(Docker/Kubernetes)是天作之合,可以进一步简化微服务交付,加强整体系统的弹性和健壮性。然而由大量的微服务构成的分布式应用架构也会增加运维、调试、和安全管理的复杂性。The microservice architecture divides the complex system into several small services, and each service can be independently developed, deployed, and scaled; the microservice architecture and containers (Docker/Kubernetes) are a match made in heaven, which can further simplify the delivery of microservices and enhance the elasticity of the overall system and robustness. However, a distributed application architecture composed of a large number of microservices will also increase the complexity of operation and maintenance, debugging, and security management.
在实现面向大规模系统应用时,存在大量的微服务,微服务之间的调用关系复杂,然而随着服务数量增多,通过服务网格进行管理也存在交互关系以指数方式进行增长,带来服务管理粒度过细和服务治理复杂的问题,从而导致服务请求处理的效率较低。When implementing large-scale system applications, there are a large number of micro-services, and the calling relationship between micro-services is complex. However, as the number of services increases, there are also interactive relationships that grow exponentially through service grid management, bringing service The fine-grained management and complex service governance issues lead to low efficiency in service request processing.
发明内容Contents of the invention
本申请实施例的目的在于提出一种基于大规模集群的服务请求处理方法、装置、设备及介质,以提高服务请求处理的效率。The purpose of the embodiments of the present application is to propose a large-scale cluster-based service request processing method, device, device, and medium, so as to improve service request processing efficiency.
为了解决上述技术问题,本申请实施例提供一种基于大规模集群的服务请求处理方法,包括:In order to solve the above technical problems, the embodiment of the present application provides a large-scale cluster-based service request processing method, including:
接收客户端的服务请求,并对所述服务请求进行解析,以获取服务请求标识、请求端信息以及目标端信息;Receive a service request from the client, and parse the service request to obtain the service request identifier, requester information, and target information;
基于所述服务请求标识,判断所述服务请求对应的请求路径,得到判断结果,其中,所述请求路径包括集群内服务请求和跨集群服务请求;Based on the service request identifier, judge a request path corresponding to the service request, and 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 a service request in the cluster, inject the requester information and the target information into the header information, so as to obtain the target application domain and target service corresponding to the service request in the service registration center , and invoking the target service in the target application domain, and processing the service request through the target service;
若所述判断结果为所述跨集群服务请求,则将所述请求端信息以及所述目标端信息注入所述头部信息中,并通过服务网关,将所述头部信息注入到集群关系信息中,以获取所述目标服务,并通过所述目标服务处理所述服务请求。If the judgment result is the cross-cluster service request, inject the requester information and the target information into the header information, and inject the header information into the cluster relationship information through the service gateway , to obtain the target service, and process the service request through the target service.
为了解决上述技术问题,本申请实施例提供一种基于大规模集群的服务请求处理装置,包括:In order to solve the above technical problems, an embodiment of the present application provides a large-scale cluster-based service request processing device, including:
服务请求接收模块,用于接收客户端的服务请求,并对所述服务请求进行解析,以获取服 务请求标识、请求端信息以及目标端信息;The service request receiving module is used to receive the service request of the client, and analyze the service request to obtain the service request identifier, requester information and target information;
请求路径判断模块,用于基于所述服务请求标识,判断所述服务请求对应的请求路径,得到判断结果,其中,所述请求路径包括集群内服务请求和跨集群服务请求;A request path judging module, configured to judge a request path corresponding to the service request based on the service request identifier, and obtain a judgment result, wherein the request path includes an intra-cluster service request and a cross-cluster service request;
集群内请求处理模块,用于若所述判断结果为所述集群内服务请求,则将所述请求端信息以及所述目标端信息注入头部信息中,以在服务注册中心获取所述服务请求对应的目标应用域和目标服务,以及在所述目标应用域中调用所述目标服务,并通过所述目标服务处理所述服务请求;An intra-cluster request processing module, configured to inject the requester information and the target information into the header information if the judgment result is the intra-cluster service request, so as to obtain the service request in the service registration center Corresponding target application domain and target service, and invoking the target service in the target application domain, and processing the service request through the target service;
跨集群请求处理模块,用于若所述判断结果为所述跨集群服务请求,则将所述请求端信息以及所述目标端信息注入所述头部信息中,并通过服务网关,将所述头部信息注入到集群关系信息中,以获取所述目标服务,并通过所述目标服务处理所述服务请求。A cross-cluster request processing module, configured to inject the requester information and the target information into the header information if the judgment result is the cross-cluster service request, and send the The header information is injected into the cluster relationship information to obtain the target service, and process the service request through the target service.
为解决上述技术问题,本发明采用的一个技术方案是:提供一种计算机设备,包括,一个或多个处理器;存储器,用于存储一个或多个程序,使得一个或多个处理器实现上述任意一项所述的基于大规模集群的服务请求处理方法。In order to solve the above-mentioned technical problems, a technical solution adopted by the present invention is to provide a computer device, including one or more processors; and a memory for storing one or more programs, so that the one or more processors realize the above-mentioned Any one of the large-scale cluster-based service request processing methods.
为解决上述技术问题,本发明采用的一个技术方案是:一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现上述任意一项所述的基于大规模集群的服务请求处理方法。In order to solve the above-mentioned technical problems, a technical solution adopted by the present invention is: a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, any of the above-mentioned items can be realized. The described large-scale cluster-based service request processing method.
本发明实施例提供了一种基于大规模集群的服务请求处理方法、装置、设备及介质。其中,方法包括:接收客户端的服务请求,并对服务请求进行解析,以获取服务请求标识、请求端信息以及目标端信息;基于服务请求标识,判断服务请求对应的请求路径,得到判断结果,其中,请求路径包括集群内服务请求和跨集群服务请求;若判断结果为集群内服务请求,则将请求端信息以及目标端信息注入头部信息中,以在服务注册中心获取服务请求对应的目标应用域和目标服务,以及在目标应用域中调用目标服务,并通过目标服务处理服务请求;若判断结果为跨集群服务请求,则将请求端信息以及目标端信息注入头部信息中,并通过服务网关,将头部信息注入到集群关系信息中,以获取目标服务,并通过目标服务处理服务请求。本发明实施例通过判断服务请求对应的请求路径,若请求路径为集群内服务请求,则利用注入头部信息的方式,调用目标服务,以及若请求路径为跨集群服务请求,利用服务网关的方式,进行调用目标服务,实现降低了集群下服务粒度细、服务数量多带来的管理难度,同时避免了原生的服务实例的侵入,从而有利于提高服务请求处理的效率。Embodiments of the present invention provide a large-scale cluster-based service request processing method, device, equipment, and medium. Wherein, the method includes: receiving a service request from the client, and parsing the service request to obtain the service request identifier, requester information, and target information; based on the service request identifier, judging the request path corresponding to the service request, and obtaining the judgment result, wherein , the request path includes an intra-cluster service request and a cross-cluster service request; if the judgment result is an intra-cluster service request, inject the requester information and target information into the header information to obtain the target application corresponding to the service request in the service registry Domain and target service, and call the target service in the target application domain, and process the service request through the target service; if the judgment result is a cross-cluster service request, inject the requester information and target information into the header information, and pass the The gateway injects the header information into the cluster relationship information to obtain the target service, and processes the service request through the target service. In the embodiment of the present invention, by judging the request path corresponding to the service request, if the request path is an intra-cluster service request, the target service is invoked by injecting header information, and if the request path is a cross-cluster service request, the service gateway is used , to call the target service, which reduces the management difficulty brought about by the fine-grained service in the cluster and the large number of services, and avoids the intrusion of the original service instance, which is conducive to improving the efficiency of service request processing.
附图说明Description of drawings
为了更清楚地说明本申请中的方案,下面将对本申请实施例描述中所需要使用的附图作一个简单介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the solution in this application more clearly, a brief introduction will be given below to the accompanying drawings that need to be used in the description of the embodiments of the application. Obviously, the accompanying drawings in the following description are some embodiments of the application. Ordinary technicians can also obtain other drawings based on these drawings on the premise of not paying creative work.
图1是本申请实施例提供的基于大规模集群的服务请求处理方法中子流程的一实现流程图。FIG. 1 is a flow chart of an implementation of a sub-process in a large-scale cluster-based service request processing method provided by an embodiment of the present application.
图2是本申请实施例提供的基于大规模集群的服务请求处理方法中子流程的又一实现流程图。Fig. 2 is another implementation flowchart of the sub-process in the large-scale cluster-based service request processing method provided by the embodiment of the present application.
图3是本申请实施例提供的基于大规模集群的服务请求处理方法中子流程的又一实现流程图。Fig. 3 is another implementation flowchart of a sub-process in the large-scale cluster-based service request processing method provided by the embodiment of the present application.
图4是本申请实施例提供的基于大规模集群的服务请求处理方法中子流程的又一实现流程图。Fig. 4 is another implementation flowchart of a sub-process in the large-scale cluster-based service request processing method provided by the embodiment of the present application.
图5是本申请实施例提供的基于大规模集群的服务请求处理方法中子流程的又一实现流程图。Fig. 5 is another implementation flowchart of a sub-process in the large-scale cluster-based service request processing method provided by the embodiment of the present application.
图6是本申请实施例提供的基于大规模集群的服务请求处理方法中子流程的又一实现流程图。Fig. 6 is another implementation flowchart of a sub-process in the large-scale cluster-based service request processing method provided by the embodiment of the present application.
图7是本申请实施例提供的基于大规模集群的服务请求处理方法中子流程的又一实现流程图。Fig. 7 is another implementation flowchart of the sub-process in the large-scale cluster-based service request processing method provided by the embodiment of the present application.
图8是本申请实施例提供的基于大规模集群的服务请求处理装置示意图。FIG. 8 is a schematic diagram of a large-scale cluster-based service request processing device provided by an embodiment of the present application.
图9是本申请实施例提供的计算机设备的示意图。Fig. 9 is a schematic diagram of a computer device provided by an embodiment of the present application.
具体实施方式Detailed ways
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同;本文中在申请的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本申请;本申请的说明书和权利要求书及上述附图说明中的术语“包括”和“具有”以及它们的任何变形,意图在于覆盖不排他的包含。本申请的说明书和权利要求书或上述附图中的术语“第一”、“第二”等是用于区别不同对象,而不是用于描述特定顺序。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field of the application; the terms used herein in the description of the application are only to describe specific embodiments The purpose is not to limit the present application; the terms "comprising" and "having" and any variations thereof in the specification and claims of the present application and the description of the above drawings are intended to cover non-exclusive inclusion. The terms "first", "second" and the like in the description and claims of the present application or the above drawings are used to distinguish different objects, rather than to describe a specific order.
在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。Reference herein to an "embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the present application. The occurrences of this phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is understood explicitly and implicitly by those skilled in the art that the embodiments described herein can be combined with other embodiments.
为了使本技术领域的人员更好地理解本申请方案,下面将结合附图,对本申请实施例中的技术方案进行清楚、完整地描述。In order to enable those skilled in the art to better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
下面结合附图和实施方式对本发明进行详细说明。The present invention will be described in detail below in conjunction with the accompanying drawings and embodiments.
需要说明的是,本申请实施例所提供的基于大规模集群的服务请求处理方法一般由服务器执行,相应地,基于大规模集群的服务请求处理装置一般配置于服务器中。It should be noted that the large-scale cluster-based service request processing method provided in the embodiment of the present application is generally executed by a server, and correspondingly, the large-scale cluster-based service request processing device is generally configured in the server.
请参阅图1,图1示出了基于大规模集群的服务请求处理方法的一种具体实施方式。Please refer to FIG. 1 . FIG. 1 shows a specific implementation manner of a large-scale cluster-based service request processing method.
需注意的是,若有实质上相同的结果,本发明的方法并不以图1所示的流程顺序为限,该方法包括如下步骤:It should be noted that if there are substantially the same results, the method of the present invention is not limited to the flow sequence shown in Figure 1, and the method includes the following steps:
S1:接收客户端的服务请求,并对服务请求进行解析,以获取服务请求标识、请求端信息以及目标端信息。S1: Receive the service request from the client, and parse the service request to obtain the service request identifier, requester information, and target information.
具体地,在客户端需要进行调用相关服务时,客户端则生成服务请求,并将服务请求发送到服务器,服务器接收到服务请求后,将该服务请求进行解析,以获取服务请求标识、请求端信息以及目标端信息。其中,服务请求标识为需要调用的目标服务对应的标识,用以判断服务所处于的服务集群。请求端信息为基于客户端生成的信息,其中,请求端信息包括客户端的IP地址信息和账户信息等。目标端信息为基于所请求的目标服务生成的信息,其中,目标端信息包括目标服务名称等。Specifically, when the client needs to call related services, 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 the service request identifier, the request end information and target information. Wherein, the service request identifier is an identifier corresponding to the target service that needs to be invoked, and is used to determine the service cluster where the service is located. The requester information is information generated based on the client, where the requester information includes the client's IP address information and account information. The target information is information generated based on the requested target service, where the target information includes the target service name and the like.
请参阅图2,图2示出了步骤S1之后的一种具体实施方式,详叙如下:Referring to Fig. 2, Fig. 2 shows a specific implementation after step S1, which is described in detail as follows:
S1A:记录客户端对服务请求的发起时间和响应时间,以及记录服务器对服务请求的接收时间和响应返回时间。S1A: Record the initiation time and response time of the client to the service request, and record the receiving time and response return time of the server to the service request.
S1B:基于发起时间、响应时间、接收时间、响应返回时间以及头部信息,生成日志信息。S1B: Generate log information based on the initiation time, response time, reception time, response return time, and header information.
具体地,在上述步骤S1之后,本实施例通过在服务交互过程中,记录客户端对服务请求的发起时间和响应时间,以及记录服务器对服务请求的接收时间和响应返回时间,并从收集头部信息(Header),例如收集以下头部信息:x-request-id、x-b3-traceid、x-b3-spanid、x-b3-parentspanid、x-b3-sampled、x-b3-flags以及x-ot-span-context等,再基于发起时间、响应时间、接收时间、响应返回时间以及头部信息,生成日志信息。进一步地,将日志信息注入并转发到服务提供方,便于进行服务的追溯。其中,服务提供方为生成和提供相关服务的客户端。其中,头部信息也即标头(header),该头部信息是服务器以HTTP协议传HTML资料到浏览器前所送出的字串,在头部信息与HTML文件之间尚需空一行分隔。Specifically, after the above step S1, this embodiment records the client's initiation time and response time to the service request, and the server's reception time and response return time to the service request during the service interaction process, and collects the information from the header Header, such as collecting the following header information: x-request-id, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, x-b3-sampled, x-b3-flags and x -ot-span-context, etc., and then generate log information based on the initiation time, response time, reception time, response return time and header information. Furthermore, the log information is injected and forwarded to the service provider to facilitate service traceability. Wherein, the service provider is a client that generates and provides related services. Wherein, the header information is also the header (header), and the header information is a character string sent by the server before transmitting the HTML data to the browser with the HTTP protocol, and an empty line is required between the header information and the HTML file to separate.
本实施例中,通过记录客户端对服务请求的发起时间和响应时间,以及记录服务器对服务请求的接收时间和响应返回时间,再基于发起时间、响应时间、接收时间、响应返回时间以及头部信息,生成日志信息,便于根据所生成的日志信息,对服务调用过程的分析和溯源。In this embodiment, by recording the client's initiation time and response time to the service request, and recording the server's reception time and response return time to the service request, based on the initiation time, response time, reception time, response return time and header Information, generate log information, which is convenient for analysis and traceability of the service invocation process based on the generated log information.
S2:基于服务请求标识,判断服务请求对应的请求路径,得到判断结果,其中,请求路径包括集群内服务请求和跨集群服务请求。S2: Based on the service request identifier, determine the request path corresponding to the service request, and obtain a judgment result, wherein the request path includes an intra-cluster service request and a cross-cluster service request.
具体地,由于服务的交互过程可能发生在客户端与同一集群内,也有可能发生在客户端与不同的集群内,所以通过服务请求标识,判断所要调用的目标服务是与客户端处于同一集群内,还是与客户端处于不同的集群内。若是判断结果为所要调用的目标服务是与客户端处于同一集群内,则是集群内服务请求,若否,则是属于跨集群服务请求。Specifically, since the interaction process of the service may occur in the same cluster as the client and in a different cluster, it can be judged that the target service to be invoked is in the same cluster as the client through the service request identifier , or in a different cluster from the client. If the judgment result is that the target service to be invoked is in the same cluster as the client, it is an intra-cluster service request; if not, it is a cross-cluster service request.
S3:若判断结果为集群内服务请求,则将请求端信息以及目标端信息注入头部信息中,以在服务注册中心获取服务请求对应的目标应用域和目标服务,以及在目标应用域中调用目标服务,并通过目标服务处理服务请求。S3: If the judgment result is a service request in the cluster, inject the requester information and target information into the header information to obtain the target application domain and target service corresponding to the service request in the service registry, and call it in the target application domain target service, and handle service requests through the target service.
请参阅图3,图3示出了步骤S3的一种具体实施方式,详叙如下:Please refer to Fig. 3, Fig. 3 has shown a kind of specific implementation of step S3, described in detail as follows:
S31:若判断结果为集群内服务请求,则将请求端信息以及目标端信息注入头部信息中,生成链路追踪日志标识。S31: If the judgment result is an intra-cluster service request, inject the requester information and target information into the header information to generate a link tracking log identifier.
S32:基于链路追踪日志标识,遍历服务注册中心,获取服务请求对应的目标应用域和目标服务。S32: Based on the link tracking log identifier, traverse the service registration center to obtain the target application domain and target service corresponding to the service request.
S33:解析目标应用域对应的域名,以调用目标服务,并通过目标服务处理服务请求。S33: Resolving the domain name corresponding to the target application domain to call the target service, and process the service request through the target service.
具体地,若判断结果为集群内服务请求,则将请求端信息以及目标端信息注入头部信息中,生成链路追踪日志标识,此时的请求端信息以及目标端信息可以作为Span消息,也即将Span消息注入头部信息中,生成链路追踪日志标识,再通过链路追踪日志标识去服务注册中心追踪到对应的目标应用域和目标服务,再解析目标应用域对应的域名,以调用目标服务,并通过目标服务处理服务请求。Specifically, if the judgment result is a service request within the cluster, inject the requester information and target information into the header information to generate a link tracking log identifier. The requester information and target information at this time can be used as a Span message, or Inject the Span message into the header information, generate a link tracking log ID, and then go to the service registration center to track the corresponding target application domain and target service through the link tracking log ID, and then analyze the domain name corresponding to the target application domain to call the target service, and handle service requests through the target service.
进一步地,采用服务网格技术,每当服务发起外部调用时,客户端会创建一个新的Span消息。一个Span消息的注入可以实现一组完整服务的交互过程,也即从客户端发出请求开始到接收到服务方的响应为止。运用多级服务网格下,在跨集群服务调用时,在服务网关中注入服务集群的信息,以展示整体集群的调用信息和追溯关系。利用采用服务网格技术实现了大颗粒下的服务集群的划分和独立自治,降低单一集群下服务粒度细、服务数量多带来的管理难度。Furthermore, using the service grid technology, whenever the service initiates an external call, the client will create a new Span message. The injection of a Span message can realize a complete set of service interaction processes, that is, from the client sending a request to receiving the server's response. Under the multi-level service grid, when cross-cluster service calls are made, the information of the service cluster is injected into the service gateway to display the call information and traceability of the overall cluster. The service grid technology is used to realize the division and independent autonomy of the service cluster under the large granularity, and reduce the management difficulty brought about by the fine granularity of the service and the large number of services under a single cluster.
本实施例中,若判断结果为集群内服务请求,则将请求端信息以及目标端信息注入头部信息中,生成链路追踪日志标识,再基于链路追踪日志标识,遍历服务注册中心,获取服务请求对应的目标应用域和目标服务,然后解析目标应用域对应的域名,以调用目标服务,并通过目标服务处理服务请求,使得在集群内服务请求,实现服务的请求调用,避免原生的服务实例的侵入,有效提高了服务请求处理的效率。In this embodiment, if the judgment result is a service request in the cluster, inject the requester information and target information into the header information to generate a link tracking log identifier, and then traverse the service registration center based on the link tracking log identifier to obtain The target application domain and target service corresponding to the service request, and then resolve the domain name corresponding to the target application domain to call the target service, and process the service request through the target service, so that the service request in the cluster can realize the request call of the service, and avoid the native service The intrusion of instances effectively improves the efficiency of service request processing.
请参阅图4,图4示出了步骤S33的一种具体实施方式,详叙如下:Please refer to Fig. 4, Fig. 4 has shown a kind of specific implementation manner of step S33, describe in detail as follows:
S331:通过CoreDNS解析方式,解析目标应用域对应的域名,得到目标服务部署单元Pod的IP地址。S331: Resolve the domain name corresponding to the target application domain through CoreDNS resolution, and obtain the IP address of the target service deployment unit Pod.
S332:基于目标服务部署单元Pod的IP地址,调用目标服务,并通过目标服务处理服务请求。S332: Call the target service based on the IP address of the target service deployment unit Pod, and process the service request through the target service.
具体地,CoreDNS作为CNCF中托管的一个域名发现的项目,原生集成Kubernetes,它的目标是成为云原生的DNS服务器和服务发现的参考解决方案;而CoreDNS解析方式是通过CoreDNS配置域名解析的方式,其能够对应用域进行解析,获取到真实的服务部署单元Pod的IP地址。其中,服务部署单元Pod是指Kubernetes为部署、管理、编排容器化应用提出的概念,也是Kubernetes中的最小部署单元。在本申请实施例中,通过CoreDNS解析方式,解析目标应用域对应的域名,得到目标服务部署单元Pod的IP地址,再基于目标服务部署单元Pod的IP地址,调用目标服务,并通过目标服务处理服务请求,实现集群内部间的服务调用,有利于提高服务请求处理的效率。Specifically, CoreDNS is a domain name discovery project hosted by CNCF, natively integrated with Kubernetes, and its goal is to become a reference solution for cloud-native DNS servers and service discovery; and the CoreDNS resolution method is to configure domain name resolution through CoreDNS, It can analyze the application domain and obtain the IP address of the real service deployment unit Pod. Among them, the service deployment unit Pod refers to the concept proposed by Kubernetes for deploying, managing, and orchestrating containerized applications, and it is also the smallest deployment unit in Kubernetes. In this embodiment of the application, the domain name corresponding to the target application domain is resolved through the CoreDNS resolution method, and the IP address of the target service deployment unit Pod is obtained, and then based on the IP address of the target service deployment unit Pod, the target service is invoked, and processed by the target service Service requests, realize service calls between clusters, and help improve the efficiency of service request processing.
请参阅图5,图5示出了步骤S3之前的一种具体实施方式,详叙如下:Please refer to FIG. 5, which shows a specific implementation before step S3, which is described in detail as follows:
S3A:获取多种服务,并将多种服务进行编译打包,生成服务镜像,并将服务镜像置入到服务镜像仓库中。S3A: Obtain multiple services, compile and package multiple services, generate service mirrors, and place the service mirrors into the service mirror warehouse.
S3B:获取服务对应的应用域,并基于应用域,将服务配于对应的集群中。S3B: Obtain the application domain corresponding to the service, and allocate the service to the corresponding cluster based on the application domain.
S3C:在服务注册中心中,对集群中的应用域作为根节点并进行初始化处理,得到应用域对应的根节点。S3C: In the service registration center, the application domain in the cluster is used as the root node and initialized to obtain the root node corresponding to the application domain.
具体地,集群中包括多种服务,每种服务都有其对应的业务功能,将每一种业务功能作为一种应用域集群,将其作为每一种应用域集群作为根节点进行注册,从而得到应用域集群对应的根节点。所以先获取到多种服务,再对多种服务进行编译打包成服务镜像,其中,镜像(Mirroring)是一种文件存储形式,是冗余的一种类型,一个磁盘上的数据在另一个磁盘上存在一个完全相同的副本即为镜像。然后再将其置入服务镜像仓库中,获取每一种服务的业务功能,也即获取服务的应用域,将其规划和配置到相应的集群中;然后在服务注册中心中,对集群中的应用域作为根节点并进行初始化处理,得到应用域对应的根节点。本实施例中,在服务部署发布时,根据应用域的划分,将相关的服务容器以应用域集群名作为根节点进行注册,在该节点下的服务可以自动发现根节点对应的服务,实现本应用域下的跨服务调用。Specifically, the cluster includes a variety of services, and each service has its corresponding business function. Each business function is regarded as an application domain cluster, and it is registered as each application domain cluster as the root node, so that Get the root node corresponding to the application domain cluster. Therefore, multiple services are obtained first, and then multiple services are compiled and packaged into service mirrors. Among them, mirroring (Mirroring) is a form of file storage and a type of redundancy. The data on one disk is stored on another disk. An identical copy exists on the mirror. Then put it into the service mirror warehouse, obtain the business function of each service, that is, obtain the application domain of the service, plan and configure it into the corresponding cluster; The application domain is used as the root node and is initialized to obtain the root node corresponding to the application domain. In this embodiment, when the service is deployed and released, according to the division of the application domain, the relevant service container is registered with the application domain cluster name as the root node, and the services under this node can automatically discover the service corresponding to the root node, realizing this Cross-service calls under the application domain.
请参阅图6,图6示出了步骤S3C之后的一种具体实施方式,详叙如下:Please refer to FIG. 6. FIG. 6 shows a specific implementation after step S3C, which is described in detail as follows:
S3D:若监听到服务发送变更,则在服务注册中心生成服务变更通知。S3D: If a service change is detected, a service change notification will be generated in the service registration center.
S3E:将服务变更通知发送到客户端,以使得客户端获取服务变更内容以及将服务变更内容存储于客户端本地中。S3E: Send the service change notification to the client, so that the client obtains the service change content and stores the service change content locally in the client.
具体地,通过服务注册中心对服务进行监控,当监听到服务发送变更时,获取服务变更内容,并生成对应的服务变更通知,将该服务变更通知发送到客户端,客户端接收到服务变更通知后,获取对应的服务变更内容,再将其服务变更内容存储于客户端本地中。本实施例中,若监听到服务发送变更,则在服务注册中心生成服务变更通知,将服务变更通知发送到客户端,以使得客户端获取服务变更内容以及将服务变更内容存储于客户端本地中,实现对服务进行监听,在服务发生变更时,实时更新客户端本地的服务内容。Specifically, the service is monitored through the service registration center, and when a service change is detected, the service change content is obtained, and a corresponding service change notification is generated, and the service change notification is sent to the client, and the client receives the service change notification After that, the corresponding service change content is obtained, and then the service change content is stored locally on the client. In this embodiment, if the service transmission change is monitored, a service change notification is generated in the service registration center, and the service change notification is sent to the client, so that the client obtains the service change content and stores the service change content locally in the client , to monitor the service, and update the local service content of the client in real time when the service changes.
S4:若判断结果为跨集群服务请求,则将请求端信息以及目标端信息注入头部信息中,并通过服务网关,将头部信息注入到集群关系信息中,以获取目标服务,并通过目标服务处理服务请求。S4: If the judgment result is a cross-cluster service request, inject the requester information and target information into the header information, and inject the header information into the cluster relationship information through the service gateway to obtain the target service, and pass the target The service handles service requests.
请参阅图7,图7示出了步骤S4的一种具体实施方式,详叙如下:Referring to Fig. 7, Fig. 7 shows a specific implementation of step S4, which is described in detail as follows:
S41:若判断结果为跨集群服务请求,则将请求端信息以及目标端信息注入头部信息中,得到目标头部信息。S41: If the judging result is a cross-cluster service request, inject the requester information and the target information into the header information to obtain the target header information.
S42:采用服务网关,将目标头部信息注入到集群关系信息中,生成集群信息。S42: Using the service gateway, injecting the target header information into the cluster relationship information to generate cluster information.
S43:在集群关系信息中,通过对集群信息进行收集和转发处理,以获取目标服务,并通过目标服务处理服务请求。S43: In the cluster relationship information, the cluster information is collected and forwarded to obtain the target service, and the service request is processed through the target service.
具体地,若判断结果为跨集群服务请求,将请求端信息以及目标端信息注入头部信息,得到目标头部信息,然后本申请实施例通过服务网关向外部保留一个注册接口,能够将目标头部信息注入到集群关系信息中,生成集群信息,例如生成的集群消息为x-src-cluster-id和x-dst-cluster-id,然后在集群关系信息中,通过对集群信息进行收集和转发处理,以获取目标服务,并通过目标服务处理服务请求。Specifically, if the judgment result is a cross-cluster service request, the requester information and target information are injected into the header information to obtain the target header information, and then the embodiment of this application reserves a registration interface externally through the service gateway, and the target header The internal information is injected into the cluster relationship information to generate cluster information, for example, the generated cluster messages are x-src-cluster-id and x-dst-cluster-id, and then in the cluster relationship information, the cluster information is collected and forwarded Process to obtain the target service and process the service request through the target service.
进一步地,跨集群的服务请求时,需要充分考虑其服务间的调用关系是否重要和是否对外暴露,本申请实施例根据应用域将集群进行区分隔离,并且本申请实施例还通过服务网关注册并暴露到外部,实现提供集群外的服务调用,减少集群域下的服务过度膨胀的可能,同时也降低服务间的耦合。在完成跨集群调用的服务后,将此类服务通过接口的方式注册到应用服务网关上,实现系统间的跨域交互。同时根据应用域将集群进行区分隔离,可以有效的降低单个集群内服务的数量,减少集群管理的复杂性,同时降低某个服务因异常停服或降质带来的对整体系统服务的影响。Furthermore, when requesting cross-cluster services, it is necessary to fully consider whether the call relationship between services is important and whether it is exposed to the outside world. The embodiment of this application distinguishes and isolates the clusters according to the application domain, and the embodiment of the application also registers through the service gateway and Expose to the outside to achieve service calls outside the cluster, reduce the possibility of excessive expansion of services under the cluster domain, and also reduce the coupling between services. After completing the cross-cluster call service, register such service on the application service gateway through the interface to realize cross-domain interaction between systems. At the same time, distinguishing and isolating clusters according to application domains can effectively reduce the number of services in a single cluster, reduce the complexity of cluster management, and reduce the impact of a certain service on the overall system service due to abnormal shutdown or degradation.
本实施例中,接收客户端的服务请求,并对服务请求进行解析,以获取服务请求标识、请求端信息以及目标端信息;基于服务请求标识,判断服务请求对应的请求路径,得到判断结果,其中,请求路径包括集群内服务请求和跨集群服务请求;若判断结果为集群内服务请求,则将请求端信息以及目标端信息注入头部信息中,以在服务注册中心获取服务请求对应的目标应用域和目标服务,以及在目标应用域中调用目标服务,并通过目标服务处理服务请求;若判断结果为跨集群服务请求,则将请求端信息以及目标端信息注入头部信息中,并通过服务网关,将头部信息注入到集群关系信息中,以获取目标服务,并通过目标服务处理服务请求。本发明实施例通过判断服务请求对应的请求路径,若请求路径为集群内服务请求,则利用注入头部信息的方式,调用目标服务,以及若请求路径为跨集群服务请求,利用服务网关的方式,进行调用目标服务,实现降低了集群下服务粒度细、服务数量多带来的管理难度,同时避免了原生的服务实例的侵入,从而有利于提高服务请求处理的效率。In this embodiment, the service request from the client is received, and the service request is parsed to obtain the service request identifier, requester information, and target information; based on the service request identifier, the request path corresponding to the service request is judged, and the judgment result is obtained, wherein , the request path includes an intra-cluster service request and a cross-cluster service request; if the judgment result is an intra-cluster service request, inject the requester information and target information into the header information to obtain the target application corresponding to the service request in the service registry Domain and target service, and call the target service in the target application domain, and process the service request through the target service; if the judgment result is a cross-cluster service request, inject the requester information and target information into the header information, and pass the The gateway injects the header information into the cluster relationship information to obtain the target service, and processes the service request through the target service. In the embodiment of the present invention, by judging the request path corresponding to the service request, if the request path is an intra-cluster service request, the target service is invoked by injecting header information, and if the request path is a cross-cluster service request, the service gateway is used , to call the target service, which reduces the management difficulty brought about by the fine-grained service in the cluster and the large number of services, and avoids the intrusion of the original service instance, which is conducive to improving the efficiency of service request processing.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,该计算机程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,前述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等非易失性存储介质,或随机存储记忆体(Random Access Memory,RAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be realized by instructing related hardware through a computer program. The computer program can be stored in a computer-readable storage medium. During execution, it may include the processes of the embodiments of the above-mentioned methods. Wherein, the aforementioned storage medium may be a nonvolatile storage medium such as a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM).
请参考图8,作为对上述图1所示方法的实现,本申请提供了一种基于大规模集群的服务请求处理装置的一个实施例,该装置实施例与图1所示的方法实施例相对应,该装置具体可以应用于各种电子设备中。Please refer to FIG. 8. As an implementation of the method shown in FIG. 1 above, this application provides an embodiment of a large-scale cluster-based service request processing device, which is similar to the method embodiment shown in FIG. 1 Correspondingly, the device can be specifically applied to various electronic devices.
如图8所示,本实施例的基于大规模集群的服务请求处理装置包括:服务请求接收模块51、请求路径判断模块52、集群内请求处理模块53、跨集群请求处理模块54,其中:As shown in FIG. 8 , the large-scale cluster-based service request processing device of this embodiment includes: a service request receiving module 51, a request path judgment module 52, an intra-cluster request processing module 53, and a cross-cluster request processing module 54, wherein:
服务请求接收模块51,用于接收客户端的服务请求,并对服务请求进行解析,以获取服务请求标识、请求端信息以及目标端信息;The service request receiving module 51 is configured to receive the service request from the client, and analyze the service request to obtain the service request identifier, requester information and target information;
请求路径判断模块52,用于基于服务请求标识,判断服务请求对应的请求路径,得到判断结果,其中,请求路径包括集群内服务请求和跨集群服务请求;The request path judging module 52 is configured to judge the request path corresponding to the service request based on the service request identifier, and obtain a judgment result, wherein the request path includes an intra-cluster service request and a cross-cluster service request;
集群内请求处理模块53,用于若判断结果为集群内服务请求,则将请求端信息以及目标端信息注入头部信息中,以在服务注册中心获取服务请求对应的目标应用域和目标服务,以及在目标应用域中调用目标服务,并通过目标服务处理服务请求;The intra-cluster request processing module 53 is configured to inject the requester information and target information into the header information if the judgment result is an intra-cluster service request, so as to obtain the target application domain and target service corresponding to the service request in the service registration center, And call the target service in the target application domain, and process the service request through the target service;
跨集群请求处理模块54,用于若判断结果为跨集群服务请求,则将请求端信息以及目标端信息注入头部信息中,并通过服务网关,将头部信息注入到集群关系信息中,以获取目标服务,并通过目标服务处理服务请求。The cross-cluster request processing module 54 is used to inject the requester information and the target information into the header information if the judgment result is a cross-cluster service request, and inject the header information into the cluster relationship information through the service gateway, so as to Get the target service, and process the service request through the target service.
进一步地,集群内请求处理模块53包括:Further, the intra-cluster request processing module 53 includes:
链路追踪日志标识生成单元,用于若判断结果为集群内服务请求,则将请求端信息以及目标端信息注入头部信息中,生成链路追踪日志标识;A link tracking log identification generation unit, configured to inject requester information and target information into the header information if the judgment result is a service request within the cluster, to generate a link tracking log identification;
服务注册中心遍历单元,用于基于链路追踪日志标识,遍历服务注册中心,获取服务请求对应的目标应用域和目标服务;The service registration center traversal unit is configured to traverse the service registration center based on the link tracking log identifier, and obtain the target application domain and target service corresponding to the service request;
域名解析单元,用于解析目标应用域对应的域名,以调用目标服务,并通过目标服务处理服务请求。The domain name resolution unit is configured to resolve the domain name corresponding to the target application domain, so as to call the target service, and process the service request through the target service.
进一步地,域名解析单元包括:Further, the domain name resolution unit includes:
IP地址生成子单元,用于通过CoreDNS解析方式,解析目标应用域对应的域名,得到目标服务部署单元Pod的IP地址;The IP address generation subunit is used to resolve the domain name corresponding to the target application domain through the CoreDNS resolution method, and obtain the IP address of the target service deployment unit Pod;
服务请求处理单元,用于基于目标服务部署单元Pod的IP地址,调用目标服务,并通过目标服务处理服务请求。The service request processing unit is configured to call the target service based on the IP address of the target service deployment unit Pod, and process the service request through the target service.
进一步地,集群内请求处理模块53之前还包括:Further, before the intra-cluster request processing module 53 also includes:
服务镜像存储模块,用于获取多种服务,并将多种服务进行编译打包,生成服务镜像,并将服务镜像置入到服务镜像仓库中;The service image storage module is used to obtain various services, compile and package the various services, generate a service image, and put the service image into the service image warehouse;
应用域配置模块,用于获取服务对应的应用域,并基于应用域,将服务配于对应的集群中;The application domain configuration module is used to obtain the application domain corresponding to the service, and allocate the service to the corresponding cluster based on the application domain;
根节点生成模块,用于在服务注册中心中,对集群中的应用域作为根节点并进行初始化处理,得到应用域对应的根节点。The root node generating module is configured to use the application domain in the cluster as the root node in the service registration center and perform initialization processing to obtain the root node corresponding to the application domain.
进一步地,根节点生成模块之后还包括:Further, after the root node generation module, it also includes:
服务变更通知生成模块,用于若监听到服务发送变更,则在服务注册中心生成服务变更通 知;The service change notification generation module is used to generate a service change notification in the service registration center if the service is monitored to send a change;
服务变更内容存储模块,用于将服务变更通知发送到客户端,以使得客户端获取服务变更内容以及将服务变更内容存储于客户端本地中。The service change content storage module is configured to send the service change notification to the client, so that the client obtains the service change content and stores the service change content locally in the client.
进一步地,服务请求接收模块51之后还包括:Further, after the service request receiving module 51, it also includes:
时间记录模块,用于记录客户端对服务请求的发起时间和响应时间,以及记录服务器对服务请求的接收时间和响应返回时间;The time recording module is used to record the client's initiation time and response time to the service request, and record the server's reception time and response return time to the service request;
日志信息生成模块,用于基于发起时间、响应时间、接收时间、响应返回时间以及头部信息,生成日志信息。The log information generation module is configured to generate log information based on initiation time, response time, reception time, response return time and header information.
进一步地,跨集群请求处理模块54包括:Further, the cross-cluster request processing module 54 includes:
目标头部信息生成单元,用于若判断结果为跨集群服务请求,则将请求端信息以及目标端信息注入头部信息中,得到目标头部信息;A target header information generation unit, configured to inject requester information and target information into the header information to obtain the target header information if the judgment result is a cross-cluster service request;
集群信息生成单元,用于采用服务网关,将目标头部信息注入到集群关系信息中,生成集群信息;The cluster information generation unit is used to inject the target header information into the cluster relationship information by using the 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.
为解决上述技术问题,本申请实施例还提供计算机设备。具体请参阅图9,图9为本实施例计算机设备基本结构框图。In order to solve the above technical problems, the embodiment of the present application further provides computer equipment. Please refer to FIG. 9 for details. FIG. 9 is a block diagram of the basic structure of the computer device in this embodiment.
计算机设备6包括通过系统总线相互通信连接存储器61、处理器62、网络接口63。需要指出的是,图中仅示出了具有三种组件存储器61、处理器62、网络接口63的计算机设备6,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。其中,本技术领域技术人员可以理解,这里的计算机设备是一种能够按照事先设定或存储的指令,自动进行数值计算和/或信息处理的设备,其硬件包括但不限于微处理器、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程门阵列(Field-Programmable Gate Array,FPGA)、数字处理器(Digital SignalProcessor,DSP)、嵌入式设备等。The computer device 6 includes a memory 61 , a processor 62 , and a network interface 63 connected to each other through a system bus. It should be noted that the figure only shows a computer device 6 with three components memory 61, processor 62, and network interface 63, but it should be understood that it is not required to implement all the components shown, and alternative implementation more or fewer components. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculation and/or information processing according to preset or stored instructions, and its hardware includes but is not limited to microprocessors, dedicated Integrated circuit (Application Specific Integrated Circuit, ASIC), programmable gate array (Field-Programmable Gate Array, FPGA), digital processor (Digital Signal Processor, DSP), embedded devices, etc.
计算机设备可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。计算机设备可以与用户通过键盘、鼠标、遥控器、触摸板或声控设备等方式进行人机交互。The computer equipment may be computing equipment such as desktop computers, notebooks, palmtop computers, and cloud servers. Computer equipment can interact with users through keyboards, mice, remote controls, touch pads, or voice-activated devices.
存储器61至少包括一种类型的可读存储介质,可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等。在一些实施例中,存储器61可以是计算机设备6的内部存储单元,例如该计算机设备6的硬盘或内存。在另一些实施例中,存储器61也可以是计算机设备6的外部存储设备,例如该计算机设备6上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全 数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。当然,存储器61还可以既包括计算机设备6的内部存储单元也包括其外部存储设备。本实施例中,存储器61通常用于存储安装于计算机设备6的操作系统和各类应用软件,例如基于大规模集群的服务请求处理方法的程序代码等。此外,存储器61还可以用于暂时地存储已经输出或者将要输出的各类数据。The memory 61 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory ( SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 61 may be an internal storage unit of the computer device 6 , such as a hard disk or internal 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 equipped on the computer device 6, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, flash memory card (Flash Card), etc. Of course, the memory 61 may also include both the internal storage unit of the computer device 6 and its external storage device. In this embodiment, the memory 61 is generally used to store the operating system and various application software installed in the computer device 6, such as program codes of a large-scale cluster-based service request processing method, and the like. In addition, the memory 61 can also be used to temporarily store various types of data that have been output or will be output.
处理器62在一些实施例中可以是中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器、或其他数据处理芯片。该处理器62通常用于控制计算机设备6的总体操作。本实施例中,处理器62用于运行存储器61中存储的程序代码或者处理数据,例如运行上述基于大规模集群的服务请求处理方法的程序代码,以实现基于大规模集群的服务请求处理方法的各种实施例。The processor 62 may be a central processing unit (Central Processing Unit, CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 62 is generally used to control the overall operation of the computer device 6 . In this embodiment, the processor 62 is used to run the program code or process data stored in the memory 61, for example, run the program code of the above-mentioned large-scale cluster-based service request processing method, so as to implement the large-scale cluster-based service request processing method various embodiments.
网络接口63可包括无线网络接口或有线网络接口,该网络接口63通常用于在计算机设备6与其他电子设备之间建立通信连接。The network interface 63 may include a wireless network interface or a wired network interface, and the network interface 63 is generally used to establish a communication connection between the computer device 6 and other electronic devices.
本申请还提供了另一种实施方式,即提供一种计算机可读存储介质,计算机可读存储介质存储有计算机程序,计算机程序可被至少一个处理器执行,以使至少一个处理器执行如上述的一种基于大规模集群的服务请求处理方法的步骤。The present application also provides another implementation manner, which is to provide a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and the computer program can be executed by at least one processor, so that at least one processor performs the above-mentioned The steps of a large-scale cluster-based service request processing method.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus a necessary general-purpose hardware platform, and of course also by hardware, but in many cases the former is better implementation. Based on such an understanding, the technical solution of the present application can be embodied in the form of a software product in essence or the part that contributes to the prior art, and the computer software product is stored in a storage medium (such as ROM/RAM, disk, CD) contains several instructions to make a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the method of each embodiment of the present application.
本发明所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。The block chain referred to in the present invention is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain (Blockchain), essentially a decentralized database, is a series of data blocks associated with each other using cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify its Validity of information (anti-counterfeiting) and generation of the next block. The blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
显然,以上所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例,附图中给出了本申请的较佳实施例,但并不限制本申请的专利范围。本申请可以以许多不同的形式来实现,相反地,提供这些实施例的目的是使对本申请的公开内容的理解更加透彻全面。尽管参照前述实施例对本申请进行了详细的说明,对于本领域的技术人员来而言,其依然可以对前述各具体实施方式所记载的技术方案进行修改,或者对其中部分技术特征进行等效替换。凡是利用本申请说明书及附图内容所做的等效结构,直接或间接运用在其他相关的技术领域,均同理在本申请专利保护范围之内。Apparently, the embodiments described above are only some of the embodiments of the present application, but not all of them. The drawings show preferred embodiments of the present application, but do not limit the patent scope of the present application. The present application can be implemented in many different forms, on the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure content 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 perform equivalent replacements for some of the technical features . All equivalent structures made using the contents of the description and drawings of this application, directly or indirectly used in other related technical fields, are also within the scope of protection of this application.

Claims (10)

  1. 一种基于大规模集群的服务请求处理方法,其特征在于,包括:A large-scale cluster-based service request processing method, characterized in that it includes:
    接收客户端的服务请求,并对所述服务请求进行解析,以获取服务请求标识、请求端信息以及目标端信息;Receive a service request from the client, and parse the service request to obtain the service request identifier, requester information, and target information;
    基于所述服务请求标识,判断所述服务请求对应的请求路径,得到判断结果,其中,所述请求路径包括集群内服务请求和跨集群服务请求;Based on the service request identifier, judge a request path corresponding to the service request, and 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 a service request in the cluster, inject the requester information and the target information into the header information, so as to obtain the target application domain and target service corresponding to the service request in the service registration center , and invoking the target service in the target application domain, and processing the service request through the target service;
    若所述判断结果为所述跨集群服务请求,则将所述请求端信息以及所述目标端信息注入所述头部信息中,并通过服务网关,将所述头部信息注入到集群关系信息中,以获取所述目标服务,并通过所述目标服务处理所述服务请求。If the judgment result is the cross-cluster service request, inject the requester information and the target information into the header information, and inject the header information into the cluster relationship information through the service gateway , to obtain the target service, and process the service request through the target service.
  2. 根据权利要求1所述的基于大规模集群的服务请求处理方法,其特征在于,所述若所述判断结果为所述集群内服务请求,则将所述请求端信息以及所述目标端信息注入头部信息中,以在服务注册中心获取所述服务请求对应的目标应用域和目标服务,以及在所述目标应用域中调用所述目标服务,并通过所述目标服务处理所述服务请求,包括:The large-scale cluster-based service request processing method according to claim 1, wherein if the judgment result is a service request within the cluster, injecting the requester information and the target information into In the header information, the target application domain and target service corresponding to the service request are obtained from the service registry, and the target service is invoked in the target application domain, and the service request is processed through the target service, include:
    若所述判断结果为所述集群内服务请求,则将所述请求端信息以及所述目标端信息注入头部信息中,生成链路追踪日志标识;If the judgment result is a service request in the cluster, inject the requester information and the target information into the header information to generate a link tracking log identifier;
    基于所述链路追踪日志标识,遍历所述服务注册中心,获取所述服务请求对应的目标应用域和目标服务;Based on the link tracking log identifier, traverse the service registration center to obtain the target application domain and target service corresponding to the service request;
    解析所述目标应用域对应的域名,以调用所述目标服务,并通过所述目标服务处理所述服务请求。Resolving the domain name corresponding to the target application domain to call the target service, and process the service request through the target service.
  3. 根据权利要求2所述的基于大规模集群的服务请求处理方法,其特征在于,所述解析所述目标应用域对应的域名,以调用所述目标服务,并通过所述目标服务处理所述服务请求,包括:The large-scale cluster-based service request processing method according to claim 2, wherein the domain name corresponding to the target application domain is resolved to call the target service, and the service is processed through the target service requests, including:
    通过CoreDNS解析方式,解析所述目标应用域对应的域名,得到目标服务部署单元Pod的IP地址;Analyzing the domain name corresponding to the target application domain through the CoreDNS resolution method to obtain the IP address of the target service deployment unit Pod;
    基于所述目标服务部署单元Pod的IP地址,调用所述目标服务,并通过所述目标服务处理所述服务请求。Based on the IP address of the target service deployment unit Pod, the target service is invoked, and the service request is processed through the target service.
  4. 根据权利要求1所述的基于大规模集群的服务请求处理方法,其特征在于,所述判断结果为所述集群内服务请求,则将所述请求端信息以及所述目标端信息注入头部信息中,以在服务注册中心获取所述服务请求对应的目标应用域和目标服务,以及在所述目标应用域中调用所 述目标服务,并通过所述目标服务处理所述服务请求之前,所述方法还包括:The large-scale cluster-based service request processing method according to claim 1, wherein the judgment result is a service request within the cluster, and injecting the requester information and the target information into the header information In order to acquire the target application domain and target service corresponding to the service request in the service registry, and invoke the target service in the target application domain, and process the service request through the target service, the Methods also include:
    获取多种服务,并将多种所述服务进行编译打包,生成服务镜像,并将所述服务镜像置入到服务镜像仓库中;Obtaining various services, compiling and packaging the various services, generating a service image, and placing the service image into a service image warehouse;
    获取所述服务对应的应用域,并基于所述应用域,将所述服务配于对应的集群中;Obtain the application domain corresponding to the service, and allocate the service to the corresponding cluster based on the application domain;
    在所述服务注册中心中,对集群中的所述应用域作为根节点并进行初始化处理,得到应用域对应的根节点。In the service registration center, the application domain in the cluster is used as the root node and initialized to obtain the root node corresponding to the application domain.
  5. 根据权利要求4所述的基于大规模集群的服务请求处理方法,其特征在于,所述在所述服务注册中心中,对集群中的所述应用域作为根节点并进行初始化处理,得到应用域对应的根节点之后,所述方法还包括:The large-scale cluster-based service request processing method according to claim 4, wherein, in the service registration center, the application domain in the cluster is used as the root node and initialized to obtain the application domain After the corresponding root node, the method also includes:
    若监听到所述服务发送变更,则在所述服务注册中心生成服务变更通知;If it is monitored 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, so that the client obtains the service change content and stores the service change content locally in the client.
  6. 根据权利要求1所述的基于大规模集群的服务请求处理方法,其特征在于,所述接收客户端的服务请求,并对所述服务请求进行解析,以获取服务请求标识、请求端信息以及目标端信息之后,所述方法还包括:The large-scale cluster-based service request processing method according to claim 1, wherein the service request from the client is received, and the service request is parsed to obtain the service request identifier, requester information, and target After the information, the method also includes:
    记录所述客户端对所述服务请求的发起时间和响应时间,以及记录服务器对所述服务请求的接收时间和响应返回时间;Recording the initiation time and response time of the client to the service request, and recording the receiving time and response return time of the server to the service request;
    基于所述发起时间、所述响应时间、接收时间、响应返回时间以及所述头部信息,生成日志信息。Log information is generated based on the initiation time, the response time, the reception time, the response return time and the header information.
  7. 根据权利要求1至6任一项所述的基于大规模集群的服务请求处理方法,其特征在于,所述若所述判断结果为所述跨集群服务请求,则将所述请求端信息以及所述目标端信息注入所述头部信息中,并通过服务网关,将所述头部信息注入到集群关系信息中,以获取所述目标服务,并通过所述目标服务处理所述服务请求,包括:The large-scale cluster-based service request processing method according to any one of claims 1 to 6, wherein if the judgment result is the cross-cluster service request, the requester information and the Inject the target information into the header information, and inject the header information into the cluster relationship information through the service gateway to obtain the target service, and process the service request through the target service, including :
    若所述判断结果为所述跨集群服务请求,则将所述请求端信息以及所述目标端信息注入所述头部信息中,得到目标头部信息;If the judgment result is the cross-cluster service request, injecting the requester information and the target information into the header information to obtain target header information;
    采用所述服务网关,将所述目标头部信息注入到集群关系信息中,生成集群信息;Using the service gateway, injecting the target header information into the cluster relationship information to generate cluster information;
    在所述集群关系信息中,通过对所述集群信息进行收集和转发处理,以获取所述目标服务,并通过所述目标服务处理所述服务请求。In the cluster relationship information, the cluster information is collected and forwarded to obtain the target service, and the service request is processed through the target service.
  8. 一种基于大规模集群的服务请求处理装置,其特征在于,包括:A large-scale cluster-based service request processing device, characterized in that it includes:
    服务请求接收模块,用于接收客户端的服务请求,并对所述服务请求进行解析,以获取服务请求标识、请求端信息以及目标端信息;A service request receiving module, configured to receive a service request from a client, and analyze the service request to obtain a service request identifier, requester information, and target information;
    请求路径判断模块,用于基于所述服务请求标识,判断所述服务请求对应的请求路径,得 到判断结果,其中,所述请求路径包括集群内服务请求和跨集群服务请求;A request path judging module, configured to judge a request path corresponding to the service request based on the service request identifier, and obtain a judgment result, wherein the request path includes an intra-cluster service request and a cross-cluster service request;
    集群内请求处理模块,用于若所述判断结果为所述集群内服务请求,则将所述请求端信息以及所述目标端信息注入头部信息中,以在服务注册中心获取所述服务请求对应的目标应用域和目标服务,以及在所述目标应用域中调用所述目标服务,并通过所述目标服务处理所述服务请求;An intra-cluster request processing module, configured to inject the requester information and the target information into the header information if the judgment result is the intra-cluster service request, so as to obtain the service request in the service registration center Corresponding target application domain and target service, and invoking the target service in the target application domain, and processing the service request through the target service;
    跨集群请求处理模块,用于若所述判断结果为所述跨集群服务请求,则将所述请求端信息以及所述目标端信息注入所述头部信息中,并通过服务网关,将所述头部信息注入到集群关系信息中,以获取所述目标服务,并通过所述目标服务处理所述服务请求。A cross-cluster request processing module, configured to inject the requester information and the target information into the header information if the judgment result is the cross-cluster service request, and send the The header information is injected into the cluster relationship information to obtain the target service, and process the service request through the target service.
  9. 一种计算机设备,其特征在于,包括存储器和处理器,所述存储器中存储有计算机程序,所述处理器执行所述计算机程序时实现如权利要求1至7中任一项所述的基于大规模集群的服务请求处理方法。A computer device, characterized by comprising a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the large-scale Service request processing method for scale clusters.
  10. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1至7中任一项所述的基于大规模集群的服务请求处理方法。A computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the large-scale Service request processing method for scale clusters.
PCT/CN2022/143185 2021-12-30 2022-12-29 Service request processing method and apparatus based on large-scale cluster, and device and medium WO2023125755A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111645206.6A CN114296880A (en) 2021-12-30 2021-12-30 Service request processing method, device, equipment and medium based on large-scale cluster
CN202111645206.6 2021-12-30

Publications (1)

Publication Number Publication Date
WO2023125755A1 true WO2023125755A1 (en) 2023-07-06

Family

ID=80971921

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/143185 WO2023125755A1 (en) 2021-12-30 2022-12-29 Service request processing method and apparatus based on large-scale cluster, and device and medium

Country Status (2)

Country Link
CN (1) CN114296880A (en)
WO (1) WO2023125755A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114296880A (en) * 2021-12-30 2022-04-08 天翼物联科技有限公司 Service request processing method, device, equipment and medium based on large-scale cluster

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110704158A (en) * 2019-09-23 2020-01-17 凡普数字技术有限公司 Method, apparatus and storage medium for forwarding access requests within a container cluster
CN111506367A (en) * 2020-04-20 2020-08-07 东云睿连(武汉)计算技术有限公司 Multi-cluster artificial intelligence online service method and system
CN112788112A (en) * 2020-12-30 2021-05-11 北京航天测控技术有限公司 Automatic publishing method, device and platform for equipment health management micro-service
US11086702B1 (en) * 2020-08-21 2021-08-10 International Business Machines Corporation API invoke request management
CN114296880A (en) * 2021-12-30 2022-04-08 天翼物联科技有限公司 Service request processing method, device, equipment and medium based on large-scale cluster

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110704158A (en) * 2019-09-23 2020-01-17 凡普数字技术有限公司 Method, apparatus and storage medium for forwarding access requests within a container cluster
CN111506367A (en) * 2020-04-20 2020-08-07 东云睿连(武汉)计算技术有限公司 Multi-cluster artificial intelligence online service method and system
US11086702B1 (en) * 2020-08-21 2021-08-10 International Business Machines Corporation API invoke request management
CN112788112A (en) * 2020-12-30 2021-05-11 北京航天测控技术有限公司 Automatic publishing method, device and platform for equipment health management micro-service
CN114296880A (en) * 2021-12-30 2022-04-08 天翼物联科技有限公司 Service request processing method, device, equipment and medium based on large-scale cluster

Also Published As

Publication number Publication date
CN114296880A (en) 2022-04-08

Similar Documents

Publication Publication Date Title
CN111290865A (en) Service calling method and device, electronic equipment and storage medium
WO2021013058A1 (en) Exception prompting method, apparatus, system and device for big data product, and medium
CN109635019B (en) Request processing method, device, equipment and storage medium
US9594619B2 (en) Robust hardware fault management system, method and framework for enterprise devices
CN104636678B (en) The method and system of management and control is carried out under a kind of cloud computing environment to terminal device
US20080288622A1 (en) Managing Server Farms
CN111385147B (en) Fault simulation method, device and computer readable storage medium
WO2023125755A1 (en) Service request processing method and apparatus based on large-scale cluster, and device and medium
CN112835782B (en) Interface access test method and system
CN111552568A (en) Cloud service calling method and device
US10873628B2 (en) System and method for non-intrusive context correlation across cloud services
CN116204239A (en) Service processing method, device and computer readable storage medium
CN112187509A (en) Multi-architecture cloud platform execution log management method, system, terminal and storage medium
CN111722994A (en) Task request response method and device
CN112448909A (en) Electronic lock management method, device, system and storage medium
CN114095272B (en) Intranet data linking method and device based on internal and external network security architecture
WO2023005500A1 (en) Cross-chain transaction processing method and apparatus, electronic device, and storage medium
KR20170122874A (en) Apparatus for managing log of application based on data distribution service
CN110032872A (en) A kind of service logic leak detection method and device
US11582345B2 (en) Context data management interface for contact center
CN108270832A (en) A kind of failure playback method and device
CN114675989A (en) Data verification method and device, electronic equipment and storage medium
CN114610343A (en) Application function implementation method and device, computer equipment and storage medium
CN117632858B (en) File format verification method, system, equipment and medium based on distributed network
CN117762430B (en) Processing method and device based on application program, computer equipment and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22915005

Country of ref document: EP

Kind code of ref document: A1