Container-based service discovery and load balancing processing method
By installing the target container platform, service registry and load balancer in a containerized environment, monitoring and responding to exceptions in real time, the problem of low service discovery and load balancing efficiency in containerized applications is solved, efficient and reliable service processing is achieved, and system performance and reliability are improved.
Patent Information
- Application Number
- CN202510726603.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-30
- Publication Date
- 2025-08-26
AI Technical Summary
In containerized applications, service discovery and load balancing performance degrade, making it difficult to handle service requests efficiently and reliably, resulting in reduced system performance and reliability.
By installing the target container platform and service registry in the system environment, configuring the target load balancer, monitoring the load balancing process in real time, identifying and responding to exceptions, ensuring the reliability of service discovery and load balancing.
Improve service discovery and load balancing efficiency in containerized applications, improve system performance and reliability, and ensure that service requests are processed efficiently.
Smart Images

Figure CN120540786A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of containerization technology, and in particular to a container-based service discovery and load balancing processing method. Background Art
[0002] With the rapid development of cloud computing and microservices architectures in recent years, service discovery and load balancing have become key components for building efficient, scalable, and reliable distributed systems. The increasing popularity of container technology has further fueled the development of these technologies. However, as the number of service instances and the volume of requests increase, load balancing performance degrades. Therefore, ensuring efficient and reliable discovery and load balancing of services in containerized applications has become a key area of research.
[0003] Therefore, the present invention provides a container-based service discovery and load balancing processing method. Summary of the Invention
[0004] The present invention provides a container-based service discovery and load balancing processing method, which is used to select a target container platform to install it in the current system environment, and select a target service registration center to realize service registration; configure a target load balancer to receive service requests sent by the client, and then query the target service registration center to select a target service instance to receive and process the service request; monitor the load balancing processing process in real time, identify anomalies and respond to them, which can effectively ensure that services in containerized applications can be discovered and load balanced efficiently and reliably, thereby improving the performance and reliability of the system.
[0005] The present invention provides a container-based service discovery and load balancing processing method, comprising: Step 1: Install the container platform in the current system environment and select the target service registry to register the service. Step 2: Configuring the target load balancer to receive the service request sent by the client, querying the target service registry, and selecting a target service instance to receive and process the service request; Step 3: Monitor the load balancing process in real time, identify anomalies, and respond to them to ensure that services in containerized applications can be discovered and load balanced efficiently and reliably.
[0006] Preferably, the container platform is installed in the current system environment, and the target service registration center is selected to implement service registration, including: Obtain and analyze current business needs and determine the target container platform; Install the target container platform into the current system environment and configure the network for the container; Obtain all first service registries compatible with the target container platform and establish a first service registries table; Performing a suitability evaluation on all first service registration centers in the first registration center table based on a set center evaluation index to obtain a first evaluation coefficient; The first service registration center with the largest first evaluation coefficient is used as the target service registration center and installed on the target server; When the container is started, the service information provided by the current container is registered with the target service registration center, completing the service registration.
[0007] Preferably, the setting center evaluation indicators include usability, consistency, cost-effectiveness and community support.
[0008] Preferably, configuring a target load balancer to receive a service request sent by a client, and querying the target service registration center to select a target service instance to receive and process the service request includes: Find a load balancer that seamlessly integrates with your target container platform and supports pre-defined container orchestration tools. If there is only one candidate load balancer, the current candidate load balancer is used as the target load balancer; If there are multiple load balancers to be selected, then the suitability of all the load balancers to be selected is evaluated based on the set balance evaluation index to obtain a second evaluation coefficient; The candidate load balancer with the second largest evaluation coefficient is selected as the target load balancer; Configuring the target load balancer using a preset container orchestration tool to receive a first service request sent by a client; The target balancer identifies the first service request and determines the request type; Based on the request type of the first service request, the target load balancer queries the target service registration center and filters to obtain the target service instance; The target load balancer forwards the first service request to the target service instance to process the first service request.
[0009] Preferably, based on the request type of the first service request, the target load balancer queries the target service registration center and filters to obtain the target service instance, including: Obtaining a matching first request distribution strategy according to the request type of the current first service request; According to the first request distribution strategy, the target load balancer queries the target service registration center to obtain a first list of candidate service instances; Marking all service instances in the first candidate service instance list as first service instances; Performing a health evaluation on the first service instance using a preset health evaluation mechanism to obtain a health status; Evaluate the request processing capability of the first service instance to obtain a first processing capability evaluation value; The calculation formula of the first processing capability evaluation value is as follows: Where, It is represented as the first processing capability evaluation value of the current first service instance; It is expressed as the influence weight of the i-th processing capacity evaluation index, where ; n represents the total number of processing capacity evaluation indicators; It is represented by the absolute difference between the i-th processing capability evaluation index data of the current first service instance and the corresponding set index threshold; Expressed as calculated loss factor; When the first processing capability evaluation value of the first service instance is greater than a set processing evaluation threshold, determining that the current request processing status of the first service instance is normal; Otherwise, the request processing status of the current first service instance is determined to be abnormal; If there is only a single first service instance in the first candidate service instance list, and the health status and request processing status of the first service instance are both normal, the current first service instance is regarded as the target service instance; If there are multiple first service instances in the first list of candidate service instances, screening the target service instance from the first list of candidate service instances based on a comprehensive analysis of the health status and request processing status of the first service instances; If there is only a single first service instance in the first candidate service instance list and the health status of the first service instance is abnormal, delete the current first service instance from the target service registration center and generate a deletion log record; By using a preset container orchestration tool, a service instance is added based on the load status data of the current system, and the target service registry automatically updates the information of the added service instance; The target load balancer re-queries the target service registration center and filters out the target service instance from the obtained first list of candidate service instances.
[0010] Preferably, if there are multiple first service instances in the first list of candidate service instances, screening the target service instance from the first list of candidate service instances based on a comprehensive analysis of the health status and request processing status of the first service instances includes: If there are multiple first service instances in the first candidate service instance list, and the health status of all first service instances is abnormal, the first service instance is deleted from the target service registration center and a ; By using a preset container orchestration tool, a service instance is added based on the load status data of the current system, and the target service registry automatically updates the information of the added service instance; The target load balancer re-queries the target service registration center and filters the target service instance from the obtained new list of candidate service instances; If there are multiple first service instances in the first candidate service instance list, and there is a first service instance with a normal health status, marking the first service instance with a normal health status as the second service instance; When there is only a single second service instance and the request processing status of the second service instance is normal, the current second service instance is regarded as the target service instance; When there is only a single second service instance and the request processing status of the second service instance is abnormal, by using a preset container orchestration tool, a service instance is added based on the load status data of the current system, and the target service registration center automatically updates the information of the added service instance; The target load balancer re-queries the target service registration center and filters out the target service instance from the obtained first list of candidate service instances; When there are multiple second service instances, extract the second service instance whose request processing status is normal to establish a second list of candidate service instances; For each second service instance in the second list of candidate service instances, calculating a distribution coefficient; The second service instance with the largest allocation coefficient is output as the target service instance.
[0011] Preferably, the calculation formula of the distribution coefficient is as follows: Where, is expressed as the allocation coefficient of the j-th second service instance, where ; m represents the total number of second service instances; It is represented as the first processing capability evaluation value of the j-th second service instance; represents the weight assigned to the performance impact of the j-th second service instance; Represents a learning factor for preference assignment; It represents the total processing time of the jth second service instance processing the request from the same client as the first service request; Indicates the total processing time of the request processed by the current j-th second service instance; It represents the usage time of the current j-th second service instance; Indicates the total number of requests from the same client as the first service request processed by the current j-th second service instance; Indicates the total number of requests processed for the current j-th second service instance; It represents the error ratio of the jth second service instance processing requests from the same client as the first service request.
[0012] Preferably, real-time monitoring of the load balancing process, identification of anomalies and response, including: Use preset monitoring tools to monitor the load balancing process in real time and obtain key monitoring indicator data; Compare and analyze the key monitoring indicator data with the set indicator alarm threshold range. If the key monitoring indicator data does not fall within the corresponding set indicator alarm threshold range, generate an abnormality identification report: Based on the anomaly identification report, relevant personnel respond with matching countermeasures.
[0013] Compared with the prior art, the present invention has the following advantages: By selecting the target container platform and installing it in the current system environment, and selecting the target service registry to implement service registration; configuring the target load balancer to receive service requests sent by the client, and then querying the target service registry to select the target service instance to receive and process the service request; real-time monitoring of the load balancing process, identifying anomalies and responding to them, it can effectively ensure that services in containerized applications can be efficiently and reliably discovered and load balanced, thereby improving the performance and reliability of the system.
[0014] Other features and advantages of the present invention will be described in the following description, and in part will become apparent from the description, or will be understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description and the accompanying drawings.
[0015] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings: Figure 1 This is a flowchart of a container-based service discovery and load balancing processing method in an embodiment of the present invention. DETAILED DESCRIPTION
[0017] The preferred embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0018] The embodiment of the present invention provides a container-based service discovery and load balancing processing method, such as Figure 1 Shown, including: Step 1: Install the container platform in the current system environment and select the target service registry to register the service. Step 2: Configuring the target load balancer to receive the service request sent by the client, querying the target service registry, and selecting a target service instance to receive and process the service request; Step 3: Monitor the load balancing process in real time, identify anomalies, and respond to them to ensure that services in containerized applications can be discovered and load balanced efficiently and reliably.
[0019] In this embodiment, the container platform includes Kubernetes, Docker, Rancher, etc.; the target service registry center refers to the first service registry center with the largest first evaluation coefficient, wherein the first service registry center refers to a service registry center compatible with the target container platform; the service registry center is used to store information of service instances, including Consul, Zookeeper, Eureka, etc.; the first evaluation coefficient is used to express the degree of applicability of the first service registry center to the current target container platform.
[0020] In this embodiment, a load balancer refers to a network device or software program whose main function is to effectively distribute network traffic or workload to multiple back-end servers or service instances; a target load balancer refers to a candidate load balancer with the largest second evaluation coefficient, wherein the second evaluation coefficient is used to evaluate the degree of adaptability of the candidate load balancer to the current system environment and container platform; a service request refers to a request initiated by a client to a back-end service or application instance, which aims to obtain data, perform operations or trigger certain service logic, such as HTTP requests, database queries, etc.; a service instance refers to a specific instance of a service running in a containerized environment.
[0021] The beneficial effects of the above technical solution are: by selecting the target container platform to install it in the current system environment, and selecting the target service registration center to realize service registration; configuring the target load balancer to receive the service request sent by the client, and then querying the target service registration center to select the target service instance to receive and process the service request; real-time monitoring of the load balancing processing process, identifying anomalies and responding to them, it can effectively ensure that the services in the containerized application can be efficiently and reliably discovered and load balanced, thereby improving the performance and reliability of the system.
[0022] An embodiment of the present invention provides a container-based service discovery and load balancing processing method, which installs a container platform in the current system environment and selects a target service registration center to implement service registration, including: Obtain and analyze current business needs and determine the target container platform; Install the target container platform into the current system environment and configure the network for the container; Obtain all first service registries compatible with the target container platform and establish a first service registries table; Performing a suitability evaluation on all first service registration centers in the first registration center table based on a set center evaluation index to obtain a first evaluation coefficient; The first service registration center with the largest first evaluation coefficient is used as the target service registration center and installed on the target server; When the container is started, the service information provided by the current container is registered with the target service registration center, completing the service registration.
[0023] In this embodiment, business requirements include microservice architecture support requirements, rapid deployment and iteration requirements, availability requirements, fault tolerance requirements, elastic scaling requirements, security and isolation requirements, integration and automation requirements, and cost requirements, etc.; container platforms include Kubernetes, Docker, Rancher, etc.
[0024] In this embodiment, the first service registration center refers to a service registration center compatible with the target container platform, wherein the service registration center is used to store information of service instances, including Consul, Zookeeper, Eureka, etc.; the first registration center table is composed of a set of all first service registration centers; the center evaluation indicators are set to include availability, consistency, cost-effectiveness and community support, wherein availability refers to the number of successful service registration, query and other requests initiated to the service registration center within a unit time, divided by the total number of requests, consistency refers to the proportion of the number of times the same registration, query and other operations are performed multiple times with consistent statistical results, cost-effectiveness refers to the calculation of the costs incurred in the subsequent maintenance of the service registration center, including the sum of labor costs (operation and maintenance personnel salaries, etc.), energy consumption, network bandwidth costs, etc. within a certain period (such as one year), and community support refers to the average response time and problem resolution rate after users raise questions in the community problem feedback section.
[0025] In this embodiment, the first evaluation coefficient is used to express the degree of applicability between the first service registry and the current target container platform; the target service registry refers to the first service registry with the largest first evaluation coefficient; the target server refers to the hardware or virtual machine running the target service registry instance, which needs to have certain computing power and network connection capabilities to ensure that the service registry can run stably and communicate effectively with other containerized services; service information includes IP address, port number, service name, etc.
[0026] The beneficial effects of the above technical solution are: by installing the container platform in the current system environment and selecting the target service registration center to realize service registration, it can effectively improve resource utilization, accelerate application development and deployment, and realize dynamic registration and discovery of services, making calls between services more flexible and efficient.
[0027] An embodiment of the present invention provides a container-based service discovery and load balancing processing method, which configures a target load balancer to receive service requests sent by a client, queries the target service registry, selects a target service instance to receive and process the service request, and includes: Find a load balancer that seamlessly integrates with your target container platform and supports pre-defined container orchestration tools. If there is only one candidate load balancer, the current candidate load balancer is used as the target load balancer; If there are multiple load balancers to be selected, then the suitability of all the load balancers to be selected is evaluated based on the set balance evaluation index to obtain a second evaluation coefficient; The candidate load balancer with the second largest evaluation coefficient is selected as the target load balancer; Configuring the target load balancer using a preset container orchestration tool to receive a first service request sent by a client; The target balancer identifies the first service request and determines the request type; Based on the request type of the first service request, the target load balancer queries the target service registration center and filters to obtain the target service instance; The target load balancer forwards the first service request to the target service instance to process the first service request.
[0028] In this embodiment, the preset container orchestration tool is pre-set; the load balancer refers to a network device or software program whose main function is to effectively distribute network traffic or workload to multiple back-end servers or service instances; the selected load balancer refers to a load balancer that is seamlessly integrated with the target container platform and supports the preset container orchestration tool.
[0029] In this embodiment, the balancing evaluation indicators set include performance and scalability, load balancing algorithm, automatic scaling and security, etc.; the second evaluation coefficient is used to evaluate the adaptability of the candidate load balancer to the current system environment and container platform; the target load balancer refers to the candidate load balancer with the largest second evaluation coefficient; a service request refers to a request initiated by a client to a backend service or application instance, aiming to obtain data, perform operations or trigger certain service logic, such as HTTP requests, database queries, etc.; request types are classified based on business needs, including static resource requests, dynamic data processing requests, API interface calls, etc., where the request type is identified through information such as HTTP header, URL path, and request method.
[0030] The beneficial effect of the above technical solution is: by configuring the target load balancer to receive service requests sent by the client and query the target service registration center, it is conducive to ensuring the reliability and stability of service discovery and load balancing, thereby improving the performance and flexibility of the system.
[0031] An embodiment of the present invention provides a container-based service discovery and load balancing processing method. Based on the request type of a first service request, the target load balancer queries a target service registration center and screens to obtain a target service instance, including: Obtaining a matching first request distribution strategy according to the request type of the current first service request; According to the first request distribution strategy, the target load balancer queries the target service registration center to obtain a first list of candidate service instances; Marking all service instances in the first candidate service instance list as first service instances; Performing a health evaluation on the first service instance using a preset health evaluation mechanism to obtain a health status; Evaluate the request processing capability of the first service instance to obtain a first processing capability evaluation value; The calculation formula of the first processing capability evaluation value is as follows: Where, It is represented as the first processing capability evaluation value of the current first service instance; It is expressed as the influence weight of the i-th processing capacity evaluation index, where ; n represents the total number of processing capacity evaluation indicators; It is represented by the absolute difference between the i-th processing capability evaluation index data of the current first service instance and the corresponding set index threshold; Expressed as calculated loss factor; When the first processing capability evaluation value of the first service instance is greater than a set processing evaluation threshold, determining that the current request processing status of the first service instance is normal; Otherwise, the request processing status of the current first service instance is determined to be abnormal; If there is only a single first service instance in the first candidate service instance list, and the health status and request processing status of the first service instance are both normal, the current first service instance is regarded as the target service instance; If there are multiple first service instances in the first list of candidate service instances, screening the target service instance from the first list of candidate service instances based on a comprehensive analysis of the health status and request processing status of the first service instances; If there is only a single first service instance in the first candidate service instance list and the health status of the first service instance is abnormal, delete the current first service instance from the target service registration center and generate a deletion log record; By using a preset container orchestration tool, a service instance is added based on the load status data of the current system, and the target service registry automatically updates the information of the added service instance; The target load balancer re-queries the target service registration center and filters out the target service instance from the obtained first list of candidate service instances.
[0032] In this embodiment, the first request distribution strategy refers to a distribution strategy that matches the request type, for example, the distribution strategy for static resource requests refers to distributing static resources to a server or CDN node that specializes in processing static resources, where static resources include images, CSS, JS files, etc.
[0033] In this embodiment, the first service request refers to the service request transmitted by the client to the target load balancer, wherein the service request refers to the request initiated by the client to the backend service or application instance, which aims to obtain data, perform operations or trigger certain service logic, such as HTTP requests, database queries, etc.; the request type is classified based on business needs, including static resource requests, dynamic data processing requests, API interface calls, etc., wherein the request type is identified through information such as HTTP header, URL path, and request method.
[0034] In this embodiment, the first candidate service instance list refers to a list of service instances obtained by the target load balancer querying the target service registration center; the first service instance refers to a service instance in the first candidate service instance list; the preset health assessment mechanism is used to evaluate the readiness and activity of the service instance, wherein readiness refers to whether the service instance is ready to receive traffic; activity refers to determining whether the service instance is still running.
[0035] In this embodiment, the health status includes normal and abnormal; the request processing status includes normal and abnormal; the load status data includes CPU usage, memory usage, network bandwidth, disk I / O, etc.; the first processing capacity evaluation value is used to evaluate the ability of the service instance to process and respond to client requests in a unit of time; the preset container orchestration tool is pre-set; It consists of the information of unhealthy instances and the time of deletion.
[0036] The beneficial effect of the above technical solution is: based on the request type of the service request, the target load balancer queries the target service registration center and filters out the target service instance to ensure that the request is efficiently distributed to the service instance with stronger processing capability or lower current load, thereby improving the overall performance and response speed of the system.
[0037] An embodiment of the present invention provides a container-based service discovery and load balancing method. If there are multiple first service instances in the first candidate service instance list, based on a comprehensive analysis of the health status and request processing status of the first service instances, a target service instance is screened from the first candidate service instance list, including: If there are multiple first service instances in the first candidate service instance list, and the health status of all first service instances is abnormal, the first service instance is deleted from the target service registration center and a ; By using a preset container orchestration tool, a service instance is added based on the load status data of the current system, and the target service registry automatically updates the information of the added service instance; The target load balancer re-queries the target service registration center and filters the target service instance from the obtained new list of candidate service instances; If there are multiple first service instances in the first candidate service instance list, and there is a first service instance with a normal health status, marking the first service instance with a normal health status as the second service instance; When there is only a single second service instance and the request processing status of the second service instance is normal, the current second service instance is regarded as the target service instance; When there is only a single second service instance and the request processing status of the second service instance is abnormal, by using a preset container orchestration tool, a service instance is added based on the load status data of the current system, and the target service registration center automatically updates the information of the added service instance; The target load balancer re-queries the target service registration center and filters out the target service instance from the obtained first list of candidate service instances; When there are multiple second service instances, extract the second service instance whose request processing status is normal to establish a second list of candidate service instances; For each second service instance in the second list of candidate service instances, calculating a distribution coefficient; The second service instance with the largest allocation coefficient is output as the target service instance.
[0038] In this embodiment, the health status includes normal and abnormal; the request processing status includes normal and abnormal; and the deletion log record consists of the information of the unhealthy instance and the deletion time.
[0039] In this embodiment, the preset container orchestration tool is set in advance; the load status data includes CPU usage, memory usage, network bandwidth, disk I / O, etc.; the second service instance refers to a first service instance with a normal health status in a list of first candidate service instances with multiple first service instances; the service instance information includes IP address, port number, service name, etc.; the allocation coefficient is used to characterize the adaptability of the second service instance for processing the current service request.
[0040] The beneficial effect of the above technical solution is that the target service instances can be screened out based on a comprehensive analysis of the health status and request processing capabilities of the service instances to ensure that requests are efficiently distributed to service instances with stronger processing capabilities or lower current loads, thereby improving the overall performance and response speed of the system.
[0041] An embodiment of the present invention provides a container-based service discovery and load balancing method. The calculation formula of the distribution coefficient is as follows: Where, is expressed as the allocation coefficient of the j-th second service instance, where ; m represents the total number of second service instances; It is represented as the first processing capability evaluation value of the j-th second service instance; represents the weight assigned to the performance impact of the j-th second service instance; Represents a learning factor for preference assignment; It represents the total processing time of the jth second service instance processing the request from the same client as the first service request; Indicates the total processing time of the request processed by the current j-th second service instance; It represents the usage time of the current j-th second service instance; Indicates the total number of requests from the same client as the first service request processed by the current j-th second service instance; Indicates the total number of requests processed for the current j-th second service instance; It represents the error ratio of the jth second service instance processing requests from the same client as the first service request.
[0042] In this embodiment, The value is greater than or equal to 0, The value of is between 0 and 1. The value of is 0.1, The value is a non-negative real number, The value is between 0 and 1. is a non-negative integer, is a non-negative integer, and .
[0043] In this embodiment, the error ratio Taking this into account in the calculation can guide the system to tend to select service instances with low error rates to ensure service quality; at the same time, combined with the processing time and number of requests, it can effectively balance the load of different service instances to avoid some instances being overly busy and some being idle.
[0044] In this embodiment, the whole This comprehensively reflects the proportion of time that the second service instance of the jth service spends processing the same client request as the first service request, compared with the proportion of time spent processing ordinary requests. This ratio can reflect the time consumption characteristics of the service instance when processing a specific client request, and combines with other parameters to jointly influence the allocation coefficient. The calculation is used to measure the efficiency or resource consumption of the service instance in processing specific types of requests, thereby playing a role in service discovery and load balancing.
[0045] The beneficial effect of the above technical solution is: by calculating the allocation coefficient, effective data support is provided for screening out target service instances, which is conducive to ensuring that requests are efficiently distributed to service instances with stronger processing capabilities or lower current loads.
[0046] The embodiment of the present invention provides a container-based service discovery and load balancing method, which monitors the load balancing process in real time, identifies anomalies, and responds to them, including: Use preset monitoring tools to monitor the load balancing process in real time and obtain key monitoring indicator data; Compare and analyze the key monitoring indicator data with the set indicator alarm threshold range. If the key monitoring indicator data does not fall within the corresponding set indicator alarm threshold range, generate an abnormality identification report: Based on the anomaly identification report, relevant personnel respond with matching countermeasures.
[0047] In this embodiment, the preset monitoring tools are pre-set, which are Prometheus tools and Datadog tools; key monitoring indicators include throughput, response time, number of concurrent connections, error rate, bandwidth utilization and latency, etc.; the set indicator alarm threshold range is set in advance; the anomaly identification report is composed of key monitoring indicator data with abnormalities and the difference results with the corresponding set indicator alarm threshold range, among which the key monitoring indicator data with abnormalities refers to the key monitoring indicator data that does not fall within the set indicator alarm threshold range.
[0048] The beneficial effects of the above technical solution are: by monitoring the load balancing process in real time, obtaining the operating status of the load balancer, and then identifying and responding to anomalies, it is possible to promptly discover and solve problems, thereby avoiding system crashes or service interruptions and improving system reliability. Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if such changes and modifications fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.
Claims
1. A container-based service discovery and load balancing method, characterized in that: include: Step 1: Install the container platform in the current system environment and select the target service registry to register the service. Step 2: Configuring the target load balancer to receive the service request sent by the client, querying the target service registry, and selecting a target service instance to receive and process the service request; Step 3: Monitor the load balancing process in real time, identify anomalies, and respond to them to ensure that services in containerized applications can be discovered and load balanced efficiently and reliably.
2. A container-based service discovery and load balancing processing method according to claim 1, characterized in that: Install the container platform in the current system environment and select the target service registry to implement service registration, including: Obtain and analyze current business needs and determine the target container platform; Install the target container platform into the current system environment and configure the network for the container; Obtain all first service registries compatible with the target container platform and establish a first service registries table; Performing a suitability evaluation on all first service registration centers in the first registration center table based on a set center evaluation index to obtain a first evaluation coefficient; The first service registration center with the largest first evaluation coefficient is used as the target service registration center and installed on the target server; When the container is started, the service information provided by the current container is registered with the target service registration center, completing the service registration.
3. A container-based service discovery and load balancing processing method according to claim 2, characterized in that: The setting center evaluation criteria include usability, consistency, cost-effectiveness and community support.
4. A container-based service discovery and load balancing processing method according to claim 1, characterized in that: Configuring the target load balancer to receive the service request sent by the client, querying the target service registry, and selecting the target service instance to receive and process the service request, including: Find a load balancer that seamlessly integrates with your target container platform and supports pre-defined container orchestration tools. If there is only one candidate load balancer, the current candidate load balancer is used as the target load balancer; If there are multiple load balancers to be selected, then the suitability of all the load balancers to be selected is evaluated based on the set balance evaluation index to obtain a second evaluation coefficient; The candidate load balancer with the second largest evaluation coefficient is selected as the target load balancer; Configuring the target load balancer using a preset container orchestration tool to receive a first service request sent by a client; The target balancer identifies the first service request and determines the request type; Based on the request type of the first service request, the target load balancer queries the target service registration center and filters to obtain the target service instance; The target load balancer forwards the first service request to the target service instance to process the first service request.
5. A container-based service discovery and load balancing method according to claim 4, characterized in that: Based on the request type of the first service request, the target load balancer queries the target service registry and filters to obtain the target service instance, including: Obtaining a matching first request distribution strategy according to the request type of the current first service request; According to the first request distribution strategy, the target load balancer queries the target service registration center to obtain a first list of candidate service instances; Marking all service instances in the first candidate service instance list as first service instances; Performing a health evaluation on the first service instance using a preset health evaluation mechanism to obtain a health status; Evaluate the request processing capability of the first service instance to obtain a first processing capability evaluation value; The calculation formula of the first processing capability evaluation value is as follows: Where, It is represented as the first processing capability evaluation value of the current first service instance; It is expressed as the influence weight of the i-th processing capacity evaluation index, where ; n represents the total number of processing capacity evaluation indicators; It is represented by the absolute difference between the i-th processing capability evaluation index data of the current first service instance and the corresponding set index threshold; Expressed as calculated loss factor; When the first processing capability evaluation value of the first service instance is greater than a set processing evaluation threshold, determining that the current request processing status of the first service instance is normal; Otherwise, the request processing status of the current first service instance is determined to be abnormal; If there is only a single first service instance in the first candidate service instance list, and the health status and request processing status of the first service instance are both normal, the current first service instance is regarded as the target service instance; If there are multiple first service instances in the first list of candidate service instances, screening the target service instance from the first list of candidate service instances based on a comprehensive analysis of the health status and request processing status of the first service instances; If there is only a single first service instance in the first candidate service instance list and the health status of the first service instance is abnormal, delete the current first service instance from the target service registration center and generate a deletion log record; By using a preset container orchestration tool, a service instance is added based on the load status data of the current system, and the target service registry automatically updates the information of the added service instance; The target load balancer re-queries the target service registration center and filters out the target service instance from the obtained first list of candidate service instances.
6. A container-based service discovery and load balancing processing method according to claim 5, characterized in that: If there are multiple first service instances in the first list of candidate service instances, screening a target service instance from the first list of candidate service instances based on a comprehensive analysis of the health status and request processing status of the first service instances includes: If there are multiple first service instances in the first candidate service instance list, and the health status of all first service instances is abnormal, the first service instance is deleted from the target service registration center and a ; By using a preset container orchestration tool, a service instance is added based on the load status data of the current system, and the target service registry automatically updates the information of the added service instance; The target load balancer re-queries the target service registration center and filters the target service instance from the obtained new list of candidate service instances; If there are multiple first service instances in the first candidate service instance list, and there is a first service instance with a normal health status, marking the first service instance with a normal health status as the second service instance; When there is only a single second service instance and the request processing status of the second service instance is normal, the current second service instance is regarded as the target service instance; When there is only a single second service instance and the request processing status of the second service instance is abnormal, by using a preset container orchestration tool, a service instance is added based on the load status data of the current system, and the target service registration center automatically updates the information of the added service instance; The target load balancer re-queries the target service registration center and filters out the target service instance from the obtained first list of candidate service instances; When there are multiple second service instances, extract the second service instance whose request processing status is normal to establish a second list of candidate service instances; For each second service instance in the second list of candidate service instances, calculating a distribution coefficient; The second service instance with the largest allocation coefficient is output as the target service instance.
7. A container-based service discovery and load balancing method according to claim 6, characterized in that: The distribution coefficient is calculated as follows: Where, is expressed as the allocation coefficient of the j-th second service instance, where ; m represents the total number of second service instances; It is represented as the first processing capability evaluation value of the j-th second service instance; represents the weight assigned to the performance impact of the j-th second service instance; Represents a learning factor for preference assignment; It represents the total processing time of the jth second service instance processing the request from the same client as the first service request; Indicates the total processing time of the request processed by the current j-th second service instance; It represents the usage time of the current j-th second service instance; Indicates the total number of requests from the same client as the first service request processed by the current j-th second service instance; Indicates the total number of requests processed for the current j-th second service instance; It represents the error ratio of the jth second service instance processing requests from the same client as the first service request.
8. The container-based service discovery and load balancing processing method according to claim 1, characterized in that: Monitor the load balancing process in real time, identify anomalies, and respond accordingly, including: Use preset monitoring tools to monitor the load balancing process in real time and obtain key monitoring indicator data; Compare and analyze the key monitoring indicator data with the set indicator alarm threshold range. If the key monitoring indicator data does not fall within the corresponding set indicator alarm threshold range, generate an abnormality identification report: Based on the anomaly identification report, relevant personnel respond with matching countermeasures.