Service grid full-limited current limiting method and device, computer equipment, medium and product
Through the global flow restriction controller component, the problem of complex configuration of global flow restriction service in the service grid is solved, and configuration efficiency and reliability are improved.
Patent Information
- Application Number
- CN202411748850.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2044-12-02
AI Technical Summary
In the prior art, when creating or updating global stream limiting services in the service grid, users need to manually configure the sidecar proxy filter, resulting in complex configuration and inefficient efficiency.
The global flow restriction controller component monitors changes in global flow restriction custom resources, and automatically generates and sends side car agent filters, simplifies the configuration process of global flow restriction service. Users only need to configure global flow restriction custom resources to achieve automated configuration .
It greatly reduces configuration complexity, improves the configuration efficiency of global stream limiting services, reduces the test process, improves configuration accuracy and reliability, and avoids the complexity of manually configuring sidecar proxy filters.
Smart Images

Figure CN119276796A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing technology, and in particular to a service grid global current limiting method, device, computer equipment, medium and product. Background Art
[0002] Service grid global throttling refers to the implementation of a unified flow control strategy for service requests within the entire service grid in a distributed system or microservice architecture to ensure system stability and reasonable allocation of resources. This mechanism is crucial for handling high-concurrency scenarios and avoiding service overload.
[0003] In related technologies, service meshes can use some sidecar proxies to manage and control network traffic. For example, Envoy is a high-performance, open source network proxy software that is often used as a sidecar proxy in service meshes and is used in cloud native and microservice architecture design. In order to provide global current limiting services for service meshes, it is usually necessary to configure sidecar proxy filters for sidecar proxies according to the global current limiting strategy, such as Envoy filters (EnvoyFilter), so that sidecar proxies can use sidecar proxy filters to provide global current limiting services.
[0004] However, when creating or updating a global current limiting service in a service grid, related technologies require users to manually configure the sidecar proxy filter according to the global current limiting policy. The configuration process is complicated, resulting in low configuration efficiency. Summary of the invention
[0005] The embodiments of the present application provide a service grid global current limiting method, apparatus, computer equipment, medium and product, which can automatically generate sidecar proxy filters and improve the efficiency of global current limiting configuration.
[0006] In a first aspect, the present application provides a service grid global current limiting method, which is applied to a container cluster, wherein the container cluster is deployed with a global current limiting custom resource component and a global current limiting controller component, and the method includes:
[0007] Through the global current limiting controller component, the global current limiting custom resource of the global current limiting custom resource component is monitored;
[0008] When a change in the global current limiting custom resource is monitored, a sidecar proxy filter of the service grid is generated according to the global current limiting custom resource through the global current limiting controller component;
[0009] The sidecar proxy filter is sent to a sidecar proxy, so that the sidecar proxy filter is used by the sidecar proxy to provide a global current limiting service for the container cluster.
[0010] In one embodiment, the method further comprises:
[0011] When a change in the global current limiting custom resource is monitored, the current limiting configuration corresponding to the sidecar proxy filter is generated according to the global current limiting custom resource through the global current limiting control component;
[0012] The current limiting configuration is sent to the external current limiting service corresponding to the sidecar proxy filter through the global current limiting control component, so that the business request is globally current limited according to the current limiting configuration through the external current limiting service.
[0013] In one embodiment, the method further comprises:
[0014] When changes to the global current limiting custom resource are monitored, the global current limiting control component generates a universal request descriptor corresponding to the sidecar proxy filter according to the global current limiting custom resource, and the universal request descriptor is used to customize the global current limiting service.
[0015] In one of the embodiments, when a change of the global current limiting custom resource is monitored, generating a sidecar proxy filter of the service grid according to the global current limiting custom resource through the global current limiting controller component includes:
[0016] When a change in the global current limiting custom resource is monitored, a preset field association library is obtained through the global current limiting controller component;
[0017] The sidecar proxy filter is generated through the global current limiting controller component according to the field association library and the global current limiting custom resource; wherein the field association relationship in the field association library is used to represent the association relationship between at least some fields in the global current limiting custom resource and at least some fields in the sidecar proxy filter.
[0018] In one embodiment, the method further comprises:
[0019] Obtaining configuration information of the global current limiting custom resource by the user end through the global current limiting custom resource component;
[0020] The global current limiting custom resource is updated according to the configuration information through the global current limiting custom resource component.
[0021] In one embodiment, the method further comprises:
[0022] By means of the sidecar proxy, in response to a service request from a user terminal to the container cluster, a request descriptor parameter of the service request is obtained;
[0023] Calling, through the sidecar proxy, an external current limiting service corresponding to the sidecar proxy filter, so as to determine, through the external current limiting service, a global current limiting control result of the service request according to the request descriptor parameters and the current limiting configuration corresponding to the sidecar proxy filter;
[0024] Through the sidecar proxy, a request response corresponding to the service request is sent to the user terminal according to the global current limiting control result.
[0025] In a second aspect, the present application provides a service grid global current limiting device, which is applied to a container cluster, wherein the container cluster is deployed with a global current limiting custom resource component and a global current limiting controller component, and the device includes:
[0026] A monitoring module, used to monitor the global current limiting custom resource of the global current limiting custom resource component through the global current limiting controller component;
[0027] A generation module, configured to generate a sidecar proxy filter of a service grid according to the global current limiting custom resource through the global current limiting controller component when a change of the global current limiting custom resource is monitored;
[0028] A sending module is used to send the sidecar proxy filter to the sidecar proxy, so as to provide a global current limiting service for the container cluster through the sidecar proxy using the sidecar proxy filter.
[0029] In a third aspect, the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0030] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.
[0031] In a fifth aspect, the present application provides a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.
[0032] The above-mentioned service grid global current limiting method, device, computer equipment, medium and product monitor the global current limiting custom resources of the global current limiting custom resource component through the global current limiting controller component. When the changes of the global current limiting custom resources are monitored, the global current limiting controller component generates a sidecar proxy filter of the service grid according to the global current limiting custom resources, and sends the sidecar proxy filter to the sidecar proxy to provide global current limiting services for the container cluster through the sidecar proxy using the sidecar proxy filter. This method deploys the global current limiting controller component and the global current limiting custom resource component in the container cluster. Therefore, the user can The current limiting requirement requires customized configuration of global current limiting custom resources, and the global current limiting controller component not only has the function of listening to global current limiting custom resources, but also has the function of automatically generating sidecar proxy filters, which simplifies and abstracts the global current limiting service configuration process. The configuration process does not need to consider the version of the sidecar proxy. Users do not need to fully learn and master the sidecar proxy filter configuration rules. They only need to configure a small amount of global current limiting custom resources to realize the automatic configuration of the global current limiting service. Compared with the manual configuration of the sidecar proxy filter, it greatly reduces the configuration complexity, improves the global current limiting service configuration efficiency, reduces the test process after configuration, and improves the configuration accuracy and reliability. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] FIG1 is a schematic diagram of the structure of a container cluster in one embodiment;
[0034] FIG2 is a flow chart of a global current limiting method for a service grid according to an embodiment of the present invention;
[0035] FIG3 is a second flow diagram of a service grid global current limiting method in one embodiment;
[0036] FIG4 is a third flow diagram of a service grid global current limiting method in one embodiment;
[0037] FIG5 is a fourth flow diagram of a service grid global current limiting method in one embodiment;
[0038] FIG6 is a fifth flow diagram of a service grid global current limiting method in one embodiment;
[0039] FIG7 is a sixth flow chart of a service grid global current limiting method in one embodiment;
[0040] FIG8 is a seventh flow diagram of a service grid global current limiting method in one embodiment;
[0041] FIG9 is a structural block diagram of a service grid global current limiting device in one embodiment;
[0042] FIG. 10 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0044] The service grid global current limiting method provided in the embodiment of the present application can be applied to the container cluster as shown in Figure 1. Among them, the container cluster can be a cluster created based on Kubernetes. Among them, Kubernetes is an open source container orchestration engine, referred to as K8s. The container cluster may include multiple server nodes, and a server node may be a virtual machine or a physical host. A server node may include one or more container groups (Pods) 10. Pod is the basic unit for Kubernetes to deploy, manage, and orchestrate containerized applications. Pod may include one or more containers.
[0045] In the cloud native architecture, the Pod sidecar container and the application container 12 are deployed in one, as shown in Figure 1. The sidecar container is used to provide a sidecar proxy 11, such as Envoy, which can manage and control network traffic. Specifically, the sidecar proxy 11 is used to process each business request received by this Pod, including current limiting operations and distributing the corresponding business requests to the corresponding Pod. The application container 12 is used to implement the business functions of microservices. It can be understood that any business request must first pass through the sidecar proxy 11, and the sidecar proxy 11 distributes the business request.
[0046] It can be understood that in the container cluster shown in Figure 1, the container cluster can be managed based on various microservices in the service grid. The service grid takes over the traffic of all microservice containers through a series of distributed and interconnected sidecar proxies 11 to achieve flexible and sophisticated microservice traffic control. In the service grid, all inbound and outbound traffic of the microservice container must be forwarded by the sidecar proxy 11.
[0047] In one embodiment, as shown in FIG2 , a service grid global current limiting method is provided, which is described by taking the method applied to the container cluster in FIG1 as an example, and includes the following steps S202 to S206 .
[0048] S202: Monitor the global current limiting custom resource of the global current limiting custom resource component through the global current limiting controller component.
[0049] The container cluster is deployed with a global rate limiting custom resource component (GlobalRateLimit Custom ResourceDefinition, GlobalRateLimit CRD) and a global rate limiting controller (Controller) component. Among them, the global rate limiting custom resource component is used to provide users with global rate limiting custom resources for declarative configuration of global rate limiting services. Users can customize global permission services by configuring global rate limiting custom resources. CRD is a powerful Kubernetes API (application programming interface) extension mechanism that allows users to create and manage custom resources, so that Kubernetes is not limited to built-in resources (such as Pod, Service, etc.), but can also support user-defined resource types.
[0050] The global current limiting controller component is a core component in Kubernetes, which is responsible for managing and maintaining the actual state of cluster resources and the user's expected state, and taking action to correct the deviation when a deviation is detected, thereby realizing the automated management function. In the embodiment of the present application, the global current limiting controller component is used to monitor the global current limiting custom resource state.
[0051] The global current limiting custom resource meets the preset CRD specification. In the application, the user can submit the configuration information of the global current limiting custom resource (for example, the global current limiting configuration) according to the CRD specification to configure the global current limiting service. Exemplarily, the global current limiting custom resource includes at least one of an external current limiting service, a current limited service, and a global current limiting configuration.
[0052] Exemplarily, the external current limiting service is used to specify the external current limiting service address and timeout information, for example, the external current limiting service includes at least one of the external current limiting service address and the external current limiting service connection timeout period. Exemplarily, the limited service is used to specify the limited service information, supporting inlet or outlet current limiting, for example, the limited service includes the limited service service name and at least one of the inlet or outlet current limiting of the traffic. Exemplarily, multiple global current limiting configurations can be configured, and each global current limiting configuration is used to configure the total current limiting amount per unit time for a specified path, for example, the global current limiting configuration includes at least one of the threshold configuration and the matching condition, the threshold configuration is used to specify the total current limiting amount per unit time, for example, supporting the unit time of hours / minutes / seconds / days, and the total amount is the number of times; the matching condition supports at least one matching content of the request header, the request IP (Internet Protocol) and the request parameter, and supports at least one matching mode of regular, prefix, suffix, inclusion and exact. The key fields in the global current limiting custom resource are shown in Table 1.
[0053] Table 1
[0054]
[0055] It can be understood that the global current limiting controller component depends on the creation of the global current limiting custom resource component. In the application, you can first deploy the global current limiting custom resource component in the container cluster, and then deploy the global current limiting controller component.
[0056] S204: When changes in the global current limiting custom resources are monitored, a sidecar proxy filter of the service grid is generated according to the global current limiting custom resources through the global current limiting controller component.
[0057] Exemplarily, the global current limiting controller component periodically detects whether the global current limiting custom resources have changed. If changes are detected in the global current limiting custom resources, the corresponding sidecar proxy filter is automatically generated according to the global current limiting custom resources; otherwise, the global current limiting custom resources continue to be monitored.
[0058] Exemplary sidecar proxy filters include EnvoyFilter based on Envoy. Envoy filter is a powerful resource type in the control core component of the service mesh (such as Istio), which allows users to customize and extend the Envoy configuration generated by Istio. EnvoyFilter resources provide operators and developers with a mechanism to fine-grainedly adjust and enhance Envoy's behavior without modifying the service code.
[0059] S206: Send the sidecar proxy filter to the sidecar proxy to provide a global current limiting service for the container cluster by using the sidecar proxy filter through the sidecar proxy.
[0060] Exemplarily, the container cluster is also deployed with a control core component, such as Istio, a control core component based on Envoy. Exemplarily, the control component sends a sidecar proxy filter to the sidecar proxy, so that the sidecar proxy uses the sidecar proxy filter to provide a global current limiting service for the container cluster. For example, after the control core component Istio monitors the change of EnvoyFilter, it sends EnvoyFilter to the service mesh sidecar proxy Envoy through a preset communication protocol (for example, xds protocol), so that Envoy uses EnvoyFilter to provide a global current limiting service for the microservices in the corresponding Pod.
[0061] The above-mentioned service grid global current limiting method monitors the global current limiting custom resources of the global current limiting custom resource component through the global current limiting controller component. When the changes of the global current limiting custom resources are monitored, the global current limiting controller component generates the sidecar proxy filter of the service grid according to the global current limiting custom resources, and sends the sidecar proxy filter to the sidecar proxy to provide global current limiting services for the container cluster through the sidecar proxy using the sidecar proxy filter. This method deploys the global current limiting controller component and the global current limiting custom resource component in the container cluster. Therefore, the user can control the global current limiting custom resource component according to the global current limiting requirements. The current limiting custom resources are customized and configured, and the global current limiting controller component not only has the function of listening to the global current limiting custom resources, but also has the function of automatically generating sidecar proxy filters, which simplifies and abstracts the global current limiting service configuration process. The configuration process does not need to consider the version of the sidecar proxy. Users do not need to fully learn and master the sidecar proxy filter configuration rules. They only need to configure a small amount of global current limiting custom resources to realize the automatic configuration of the global current limiting service. Compared with the manual configuration of the sidecar proxy filter, it greatly reduces the configuration complexity, improves the global current limiting service configuration efficiency, reduces the test process after configuration, and improves the configuration accuracy and reliability.
[0062] In one embodiment, as shown in FIG3 , the service grid global current limiting method further includes the following steps S302 and S304 .
[0063] S302: When a change in the global current limiting custom resource is monitored, the global current limiting control component generates a current limiting configuration corresponding to the sidecar proxy filter according to the global current limiting custom resource.
[0064] The sidecar proxy filter includes a current limiting configuration. The current limiting configuration is used to describe the current limiting rules of the global current limiting service. Exemplarily, the current limiting configuration includes a current limiting domain and a general request descriptor, wherein the current limiting domain is used to define the application scope of the global current limiting service, and the current limiting domain can also be used to organize and isolate different global current limiting services.
[0065] S304: Send the current limiting configuration to the external current limiting service corresponding to the sidecar proxy filter through the global current limiting control component, so as to perform global current limiting control on the business request according to the current limiting configuration through the external current limiting service.
[0066] Exemplarily, the container cluster is deployed with an external current limiting server, which is used to provide external current limiting services. In the application, the current limiting configuration can be sent to the external current limiting server through the global current limiting control component, so that the external current limiting service provided by the external current limiting server can be used to perform global current limiting control on the business request according to the current limiting configuration, wherein the external current limiting server is used to provide the external current limiting service corresponding to the sidecar proxy filter.
[0067] The above-mentioned service grid global current limiting method, when monitoring the changes of the global current limiting custom resources, generates the current limiting configuration corresponding to the sidecar proxy filter according to the global current limiting custom resources through the global current limiting control component, and sends the current limiting configuration to the external current limiting service corresponding to the sidecar proxy filter through the global current limiting control component, so that the business request can be globally current limited according to the current limiting configuration through the external current limiting service. It realizes the automatic generation of the current limiting configuration corresponding to the sidecar proxy filter, thereby providing technical support and guarantee for providing global current limiting services based on the sidecar proxy filter and current limiting configuration. Compared with manually writing the current limiting configuration, it reduces the complexity of the global current limiting service configuration and improves the configuration efficiency.
[0068] In one embodiment, the service grid global current limiting method also includes: when monitoring the changes of the global current limiting custom resource, generating a general request descriptor corresponding to the sidecar proxy filter according to the global current limiting custom resource through the global current limiting control component, wherein the general request descriptor is used to customize the global current limiting service. Among them, the sidecar proxy filter and the current limiting configuration respectively include a general request descriptor. It should be noted that the general request descriptor is associated with the sidecar proxy filter. The general request descriptor is different from the default request descriptor based on the service grid sidecar proxy, wherein the sidecar proxy filter also includes a default request descriptor. The general request descriptor is used to customize the global current limiting service based on the general request descriptor. In the embodiment of the present application, not only can a default request descriptor be generated, but also a general request descriptor can be generated, which can be used to customize the global current limiting service, with stronger scalability and higher flexibility.
[0069] In one embodiment, as shown in FIG. 4 , step S204, when a change in a global current limiting custom resource is monitored, a sidecar proxy filter of a service grid is generated according to the global current limiting custom resource through a global current limiting controller component, including the following steps S402 and S404.
[0070] S402: When a change in the global current limiting custom resource is detected, a preset field association library is obtained through a global current limiting controller component.
[0071] S404: Generate a sidecar proxy filter according to the field association library and the global current limiting custom resource through the global current limiting controller component; wherein the field association relationship in the field association library is used to represent the association relationship between at least some fields in the global current limiting custom resource and at least some fields in the sidecar proxy filter.
[0072] The field association library can be understood as the basis for the global current limiting controller component to automatically generate the sidecar proxy filter. The field association library includes multiple field association relationships. Each field association relationship is used to represent the association relationship between at least some fields in the global current limiting custom resource and at least some fields in the sidecar proxy filter; wherein, at least some fields in the global current limiting custom resource can be understood as key fields for generating the sidecar proxy filter, and exemplary, the key fields include at least one of the external current limiting service field, the current limited business field, the threshold configuration field in the global current limiting configuration, the matching mode field, and the matching path field. For example, the current limited business field is set to gateway, workloadSelector, that is, the current limited business is the gateway business. For another example, the threshold configuration field is set to limit the request once per minute. For another example, the matching content field is set to use an exact matching mode for the path parameter in the request header. At least some fields in the sidecar proxy filter can be understood as associated fields that are associated with the key fields, or, in other words, mapped to the associated fields of the sidecar proxy filter according to preset rules, such as the current limiting configuration field and the general request descriptor field, etc.
[0073] In the application, the global current limiting controller component can be used to parse the global current limiting custom resource to determine multiple key fields, and the associated fields corresponding to each key field can be determined according to the field association library, and then the sidecar proxy filter corresponding to the global current limiting custom resource can be generated according to each associated field.
[0074] The above-mentioned service grid global current limiting method, when monitoring the changes of the global current limiting custom resources, obtains the preset field association library through the global current limiting controller component, and generates a sidecar proxy filter according to the field association library and the global current limiting custom resources through the global current limiting controller component. The global current limiting controller component has the function of automatically generating sidecar proxy filters, thereby realizing the automatic generation of sidecar proxy filters from global current limiting custom resources, which helps to improve the efficiency of global current limiting service configuration.
[0075] In one embodiment, as shown in FIG5 , the service grid global current limiting method further includes the following steps S502 and S504 .
[0076] S502: Obtain configuration information of the global current limiting custom resource on the user side through the global current limiting custom resource component.
[0077] S504: Update the global current limiting custom resource according to the configuration information through the global current limiting custom resource component.
[0078] Configuration information is used to describe the user-side custom configuration of global current limiting custom resources. In the application, users can configure global current limiting custom resources through the user side according to the global current limiting service policy to be configured and the global current limiting custom resource specification.
[0079] It can be understood that after the global current limiting custom resource component obtains the configuration information of the global current limiting custom resource, it can update the global current limiting custom resource according to the configuration information, and trigger the global current limiting controller component to generate a corresponding sidecar proxy filter according to the changes in the global current limiting custom resource and the updated global current limiting custom resource.
[0080] The above-mentioned service grid global current limiting method obtains the user-side configuration information of the global current limiting custom resource through the global current limiting custom resource component, and updates the global current limiting custom resource according to the configuration information through the global current limiting custom resource component. Based on this, the user can implement customized configuration of the global current limiting custom resource through the global current limiting custom resource component, thereby providing support for the automatic generation of global current limiting services.
[0081] In one embodiment, as shown in FIG6 , the service grid global current limiting method further includes the following steps S602 to S606 .
[0082] S602: Responding to a service request from a user terminal to a container cluster through a sidecar proxy, obtaining a request descriptor parameter of the service request.
[0083] In the application, the user end can send a business request to the container group. After receiving the business request, the sidecar proxy in the container group parses the business request and obtains the request descriptor parameter in the business request. The request descriptor parameter is used to indicate the business or service that the business request needs to call.
[0084] S604: Call the external current limiting service corresponding to the sidecar proxy filter through the sidecar proxy to determine the global current limiting control result of the business request according to the request descriptor parameters and the current limiting configuration corresponding to the sidecar proxy filter through the external current limiting service.
[0085] S606: Send a request response corresponding to the service request to the user end through the sidecar proxy according to the global current limiting control result.
[0086] The global current limiting control result is used to indicate whether global current limiting is performed on the service request. The global current limiting control result includes current limiting or no current limiting. Exemplarily, if the global current limiting control result is no current limiting, that is, the global current limiting control is not performed on the service request, in this case, the current limiting service is called normally and a normal request response is sent to the user end to indicate that the service is called normally; if the global current limiting control result is current limiting, that is, the global current limiting control is performed on the service request, in this case, an error request response is sent to the user end, for example, a current limiting error code, to indicate that the service is not called normally.
[0087] The above-mentioned service grid global current limiting method, through the sidecar proxy, responds to the user's business request to the container cluster, obtains the request descriptor parameters of the business request, and calls the external current limiting service corresponding to the sidecar proxy filter to determine the global current limiting control result of the business request according to the request descriptor parameters and the current limiting configuration corresponding to the sidecar proxy filter through the external current limiting service, and sends the request response corresponding to the business request to the user according to the global current limiting control result, thereby realizing global current limiting control of business requests, being able to effectively control and manage traffic, and realizing the provision of reliable global current limiting services for container clusters.
[0088] In one embodiment, as shown in Figures 7 and 8, a service grid global current limiting method is provided. Taking the method applied to the container cluster shown in Figure 1 as an example, and taking the configuration of global current limiting rules for the gateway inlet and limiting the current limiting to only take effect on requests accessing the / ratelimit path as an example, the method includes the following steps S702 to S712.
[0089] S702: Deploy a global current limiting custom resource component and a global current limiting custom controller component in the container cluster.
[0090] S704: Obtain configuration information of the global current limiting custom resource submitted by the user terminal according to the global current limiting custom resource specification through the global current limiting custom resource component.
[0091] Among them, the limited service field in the configuration information is the gateway, the threshold configuration field in the global limiting configuration is to limit requests once per minute, the matching mode field is to use an exact matching mode for the path parameter in the request header, the matching path field is / ratelimit, and if the external limiting service field is not specified, the default address parameter will be used.
[0092] S706: Monitor changes in global current limiting custom resources through the global current limiting custom controller component, and generate corresponding sidecar proxy filters, current limiting configurations, and general request descriptors based on the global current limiting custom resources.
[0093] Among them, the global current limiting custom controller component monitors the changes of the global current limiting custom resources, and generates corresponding Envoy filters, current limiting configurations and general request descriptors based on the global current limiting custom resources.
[0094] S708: After the service mesh control core component deployed in the container cluster monitors the Envoy filter changes, it sends the sidecar proxy filter to the sidecar proxy of the service mesh through the preset protocol.
[0095] Among them, after the service mesh control core component Istiod monitors the changes in the Envoy filter, it sends it to the sidecar proxy Envoy of the service mesh through the xds protocol.
[0096] S710: The sidecar proxy calls the external current limiting service corresponding to the sidecar proxy filter according to the request descriptor parameters of the received service request.
[0097] S712: The external current limiting service determines whether to limit the current of this request according to the request descriptor parameters and the current limiting configuration. If current limiting is required, a current limiting error code is returned. Otherwise, the current limiting service is called normally and then returned.
[0098] When a request is called to the limited service, it will first pass through the Envoy proxy. Envoy will call the external limited service with the request descriptor parameters. The external limited service determines whether to limit the current request based on the request descriptor parameters and the limited configuration. For example, if the first call does not trigger global limited flow, the limited service will be called normally and then returned; if the second call triggers global limited flow, the total limit of once per minute is reached, and a limited error code will be returned.
[0099] The above-mentioned service grid global current limiting method, compared with the manual configuration of EnvoyFilter in the related technology, introduces the global current limiting custom resource component (GlobalRateLimit CRD) and the global current limiting custom controller component (GlobalRateLimit Controller), so that the global current limiting rules are simpler and more friendly, and only a few lines of configuration are needed to implement the EnvoyFilter function, and it is completely independent of the EnvoyFilter version, and the configuration efficiency is higher; in addition, compared with the need for handwritten current limiting configuration in the related technology, the embodiment of the present application introduces a global current limiting custom controller component to monitor the changes of the global current limiting custom resource (CRD), automatically convert and create complex EnvoyFilter rules, and automatically generate a current limiting configuration according to the global current limiting custom resource definition; in addition, compared with the current limiting configuration in the related technology that only adapts to the default current limiting service, the embodiment of the present application can not only generate the default current limiting configuration, but also generate a general request descriptor description, which can be used for custom current limiting services, with stronger scalability and flexibility.
[0100] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0101] Based on the same inventive concept, the embodiment of the present application also provides a service grid global current limiting device for implementing the service grid global current limiting method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the one or more service grid global current limiting device embodiments provided below can refer to the limitations of the service grid global current limiting method above, and will not be repeated here.
[0102] In one embodiment, as shown in FIG9 , a service grid global current limiting device is provided, which is applied to a container cluster, and the container cluster is deployed with a global current limiting custom resource component and a global current limiting controller component. The service grid global current limiting device includes a monitoring module, a generating module and a sending module. Among them, the monitoring module is used to monitor the global current limiting custom resources of the global current limiting custom resource component through the global current limiting controller component. The generating module is used to generate a sidecar proxy filter of the service grid according to the global current limiting custom resources through the global current limiting controller component when changes in the global current limiting custom resources are monitored. The sending module is used to send the sidecar proxy filter to the sidecar proxy, so as to provide a global current limiting service for the container cluster through the sidecar proxy using the sidecar proxy filter.
[0103] In the above-mentioned service grid global current limiting device, the monitoring module monitors the global current limiting custom resources of the global current limiting custom resource component through the global current limiting controller component. When the generation module monitors the changes of the global current limiting custom resources, it generates the sidecar proxy filter of the service grid according to the global current limiting custom resources through the global current limiting controller component, and sends the sidecar proxy filter to the sidecar proxy through the sending module, so as to provide global current limiting services for the container cluster through the sidecar proxy filter. The device deploys the global current limiting controller component and the global current limiting custom resource component in the container cluster. Therefore, the user can The global current limiting custom resources are customized to meet the local current limiting needs, and the global current limiting controller component not only has the function of listening to the global current limiting custom resources, but also has the function of automatically generating the sidecar proxy filter, which simplifies and abstracts the global current limiting service configuration process. The configuration process does not need to consider the version of the sidecar proxy. Users do not need to fully learn and master the sidecar proxy filter configuration rules. They only need to configure a small amount of global current limiting custom resources to realize the automatic configuration of the global current limiting service. Compared with the manual configuration of the sidecar proxy filter, it greatly reduces the configuration complexity, improves the global current limiting service configuration efficiency, reduces the test process after configuration, and improves the configuration accuracy and reliability.
[0104] In one embodiment, the generation module is further used to generate a current limiting configuration corresponding to the sidecar proxy filter according to the global current limiting custom resource through the global current limiting control component when a change in the global current limiting custom resource is monitored. The sending module is also used to send the current limiting configuration to the external current limiting service corresponding to the sidecar proxy filter through the global current limiting control component, so as to perform global current limiting control on the service request according to the current limiting configuration through the external current limiting service.
[0105] In one embodiment, the generation module is also used to generate a universal request descriptor corresponding to the sidecar proxy filter according to the global current limiting custom resource through the global current limiting control component when changes to the global current limiting custom resource are monitored. The universal request descriptor is used to customize the global current limiting service.
[0106] In one embodiment, the generation module is also used to obtain a preset field association library through a global current limiting controller component when changes in the global current limiting custom resources are monitored; generate a sidecar proxy filter based on the field association library and the global current limiting custom resources through the global current limiting controller component; wherein the field association relationship in the field association library is used to represent the association relationship between at least some fields in the global current limiting custom resources and at least some fields in the sidecar proxy filter.
[0107] In one embodiment, the service grid global current limiting device further includes an acquisition module and an update module. The acquisition module is used to obtain the configuration information of the global current limiting custom resource of the user end through the global current limiting custom resource component. The update module is used to update the global current limiting custom resource according to the configuration information through the global current limiting custom resource component.
[0108] In one embodiment, the service grid global current limiting device also includes an acquisition module and a calling module. Among them, the acquisition module is used to obtain the request descriptor parameters of the business request through the sidecar proxy in response to the business request of the user end to the container cluster. The calling module is used to call the external current limiting service corresponding to the sidecar proxy filter through the sidecar proxy, so as to determine the global current limiting control result of the business request through the external current limiting service according to the request descriptor parameters and the current limiting configuration corresponding to the sidecar proxy filter. The sending module is also used to send a request response corresponding to the business request to the user end through the sidecar proxy according to the global current limiting control result.
[0109] Each module in the above-mentioned service grid global current limiting device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0110] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG10. The computer device includes a processor, a memory, and a network interface connected via a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a service grid global current limiting method is implemented.
[0111] Those skilled in the art will understand that the structure shown in FIG. 10 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0112] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps of the above method when executing the computer program.
[0113] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the aforementioned method are implemented.
[0114] In one embodiment, a computer program product is provided, comprising a computer program, which implements the steps of the aforementioned method when executed by a processor.
[0115] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0116] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0117] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0118] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A service grid global current limiting method, characterized in that: Applied to a container cluster, the container cluster is deployed with a global current limiting custom resource component and a global current limiting controller component, the method includes: Through the global current limiting controller component, the global current limiting custom resource of the global current limiting custom resource component is monitored; When a change in the global current limiting custom resource is monitored, a sidecar proxy filter of the service grid is generated according to the global current limiting custom resource through the global current limiting controller component; The sidecar proxy filter is sent to a sidecar proxy, so that the sidecar proxy filter is used by the sidecar proxy to provide a global current limiting service for the container cluster.
2. The method according to claim 1, characterized in that The method further comprises: When a change in the global current limiting custom resource is monitored, the current limiting configuration corresponding to the sidecar proxy filter is generated according to the global current limiting custom resource through the global current limiting control component; The current limiting configuration is sent to the external current limiting service corresponding to the sidecar proxy filter through the global current limiting control component, so that the business request is globally current limited according to the current limiting configuration through the external current limiting service.
3. The method according to claim 1, characterized in that: The method further comprises: When changes to the global current limiting custom resource are monitored, the global current limiting control component generates a universal request descriptor corresponding to the sidecar proxy filter according to the global current limiting custom resource, and the universal request descriptor is used to customize the global current limiting service.
4. The method according to any one of claims 1 to 3, characterized in that: When a change of the global current limiting custom resource is monitored, a sidecar proxy filter of a service grid is generated according to the global current limiting custom resource through the global current limiting controller component, including: When a change in the global current limiting custom resource is monitored, a preset field association library is obtained through the global current limiting controller component; The sidecar proxy filter is generated through the global current limiting controller component according to the field association library and the global current limiting custom resource; wherein the field association relationship in the field association library is used to represent the association relationship between at least some fields in the global current limiting custom resource and at least some fields in the sidecar proxy filter.
5. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Obtaining configuration information of the global current limiting custom resource by the user end through the global current limiting custom resource component; The global current limiting custom resource is updated according to the configuration information through the global current limiting custom resource component.
6. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: By means of the sidecar proxy, in response to a service request from a user terminal to the container cluster, a request descriptor parameter of the service request is obtained; Calling, through the sidecar proxy, an external current limiting service corresponding to the sidecar proxy filter, so as to determine, through the external current limiting service, a global current limiting control result of the service request according to the request descriptor parameters and the current limiting configuration corresponding to the sidecar proxy filter; Through the sidecar proxy, a request response corresponding to the service request is sent to the user terminal according to the global current limiting control result.
7. A service grid global current limiting device, characterized in that: Applied to a container cluster, the container cluster is deployed with a global current limiting custom resource component and a global current limiting controller component, and the device includes: A monitoring module, used to monitor the global current limiting custom resource of the global current limiting custom resource component through the global current limiting controller component; A generation module, configured to generate a sidecar proxy filter of a service grid according to the global current limiting custom resource through the global current limiting controller component when a change of the global current limiting custom resource is monitored; A sending module is used to send the sidecar proxy filter to the sidecar proxy, so as to provide a global current limiting service for the container cluster through the sidecar proxy using the sidecar proxy filter.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Route updating method and device
CN111314141A
Gateway interface resource management method and device, storage medium and electronic equipment
CN117112260A
Traffic isolation method, apparatus, and system, and computer-readable storage medium
WO2024078025A1
Service grid flow limiting method, and related apparatus
WO2024125201A1