CN112532743B - Intelligent load balancing method and device and storage medium - Google Patents

Intelligent load balancing method and device and storage medium Download PDF

Info

Publication number
CN112532743B
CN112532743B CN202011507408.XA CN202011507408A CN112532743B CN 112532743 B CN112532743 B CN 112532743B CN 202011507408 A CN202011507408 A CN 202011507408A CN 112532743 B CN112532743 B CN 112532743B
Authority
CN
China
Prior art keywords
service
load balancing
called
intelligent load
real
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011507408.XA
Other languages
Chinese (zh)
Other versions
CN112532743A (en
Inventor
陈亚平
张玮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Anchnet Network Technology Co ltd
Original Assignee
Shanghai Anchnet Network Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Anchnet Network Technology Co ltd filed Critical Shanghai Anchnet Network Technology Co ltd
Priority to CN202011507408.XA priority Critical patent/CN112532743B/en
Publication of CN112532743A publication Critical patent/CN112532743A/en
Application granted granted Critical
Publication of CN112532743B publication Critical patent/CN112532743B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • H04L67/025Protocols based on web technology, e.g. hypertext transfer protocol [HTTP] for remote control or remote monitoring of applications
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/163In-band adaptation of TCP data exchange; In-band control procedures

Abstract

The application provides an intelligent load balancing method, an intelligent load balancing device and a storage medium, and aims to automatically select a load balancing strategy suitable for an actual access scene to perform balanced distribution on loads according to the actual access scene, so that the effect of the balanced distribution of the loads is more excellent. The method comprises the following steps: the calling service initiates a service calling request; configuring data acquisition services for each called service in the called services deployed in the cluster; the data acquisition service acquires index data of the called service corresponding to the data acquisition service in real time and sends the index data to the intelligent load balancing service; the intelligent load balancing service analyzes the received index data in real time to obtain a real-time analysis result; and automatically selecting a preset load balancing strategy corresponding to the real-time analysis result from a plurality of preset load balancing strategies according to the real-time analysis result, and dynamically adjusting and distributing the service call requests to each called service through the intelligent load balancing service.

Description

Intelligent load balancing method and device and storage medium
Technical Field
The present invention relates to the field of load balancing technologies, and in particular, to an intelligent load balancing method, an intelligent load balancing device, and a storage medium.
Background
With the continuous development of internet technology, the data access amount of the current network is increasing day by day, in the current micro-service architecture scene, services are deployed in a distributed manner, each service is deployed in multiple instances, and if the access balance cannot be realized and the services are distributed to the multiple instances, the access accumulation of the servers can be caused to cause downtime in a high-concurrency scene.
However, in the prior art, a load balancing method for implementing access balancing and distributing to multiple instances specifies a load balancing policy in advance for a developer, access of a client is uncertain and diverse in a current internet and a large scene of micro services, if the load balancing policy specified by the developer is used only, the client may be suitable in a part of time, but when access conditions change, a large number of accesses may be accumulated on a certain server or loads of various services are unbalanced, and a service interruption may be caused seriously. Therefore, the load balancing method in the prior art cannot adaptively and dynamically adjust and select other more suitable load balancing strategies to distribute the service call request according to the actual access scene, thereby causing poor load balancing effect.
Disclosure of Invention
The embodiment of the application provides an intelligent load balancing method and a storage medium, aiming at dynamically selecting a load balancing strategy suitable for an actual access scene to carry out balanced distribution on loads according to the actual access scene, so as to achieve a better load balancing effect.
A first aspect of an embodiment of the present application provides an intelligent load balancing method, where the method includes:
the calling service initiates a service calling request;
the called service is deployed in a cluster, and each called service in the called service cluster is respectively configured with a data acquisition service;
each data acquisition service acquires index data of the corresponding called service in real time and sends the index data to the intelligent load balancing service;
the intelligent load balancing service analyzes the received index data in real time to obtain a real-time analysis result;
and according to the real-time analysis result, automatically selecting a preset load balancing strategy corresponding to the real-time analysis result from a plurality of preset load balancing strategies, and dynamically adjusting and distributing service call requests of each called service in the called service cluster through the intelligent load balancing service.
Optionally, the index data includes: configuration information of the called service, TCP connection number information of the called service and average response time length information of the called service.
Optionally, when the preset load balancing policy is a priority intelligent load balancing policy, the dynamically adjusting, by the intelligent load balancing service, the service invocation requests allocated to each invoked service in the invoked service cluster includes:
obtaining configuration weights of all called services according to configuration information of all called services in the index data, wherein the configuration weights are first priority data, and the higher the configuration of the called services is, the higher the processing capacity of the called services is, the more service calling requests distributed to the called services are;
and dynamically adjusting the service call requests distributed to the called services through the intelligent load balancing service according to the first priority data.
Optionally, after dynamically adjusting, by the intelligent load balancing service, the service invocation request allocated to each invoked service according to the first priority data, the method further includes:
obtaining a connection number weight of each called service according to TCP connection number information of each called service in the index data, wherein the connection number weight is second priority data, and when the configuration weights of a plurality of called service instances are the same, the more TCP connections of the called service are, the higher the connection number weight of the called service is, and the service calling request distributed to the called service is reduced;
and dynamically adjusting the service call requests distributed to the called services through the intelligent load balancing service according to the second priority data acquired in real time.
Optionally, after dynamically adjusting, by the intelligent load balancing service, the service invocation request allocated to each invoked service according to the second priority data collected in real time, the method further includes:
obtaining an access weight of each called service according to the average response duration information of each called service in the index data, wherein the access weight is third-priority data, and the longer the average response duration of each called service is, the lower the access weight is, the lower the processing capacity of each called service is, and the service call request distributed to each called service is reduced;
and dynamically adjusting and distributing the service call requests to the called services through the intelligent load balancing service according to the third priority data acquired in real time.
Optionally, when the preset load balancing policy is a load balancing policy specified by a user, after the service invocation request distributed to each invoked service is dynamically adjusted by the intelligent load balancing service according to the load balancing policy specified by the user, the method further includes:
the intelligent load balancing service analyzes the received index data in real time to obtain an analysis result;
and when the service calling request distributed to the called service in the analysis result is abnormal, outputting alarm information in real time to prompt a user to switch the specified load balancing strategy into the priority intelligent load balancing strategy.
Optionally, the method further comprises:
according to index data collected historically, analyzing the index data collected historically through the intelligent load balancing service to obtain prediction data;
and predicting the concurrency of the service call requests in the future period according to the prediction data, automatically selecting a corresponding preset load balancing strategy from a plurality of preset load balancing strategies in advance, and dynamically adjusting and distributing the service call requests to each called service through the intelligent load balancing service.
Optionally, the acquiring, by each data acquisition service, index data of a corresponding called service in real time includes:
when the called service is started, the data acquisition service acquires the configuration information of the called service through an interface;
according to a mode of acquiring the TCP connection number once at set time intervals, the data acquisition service acquires the TCP connection number of the called service through an interface;
under a micro-service architecture, the data acquisition service acquires the average response time of the called service through a calling link port in a butt joint micro-service architecture;
under a non-microservice architecture, in a preset time period, the data acquisition service acquires the quantity of called service response service calling requests through an interface, and obtains the average response time of the called service through analysis.
A second aspect of the embodiments of the present application provides an intelligent load balancing apparatus, where the apparatus includes:
the main dispatching service module is used for initiating a service calling request;
the called service module is used for processing a service calling request initiated by the master service module and is deployed in a cluster;
the data acquisition service module is configured to the corresponding called service module, is used for acquiring the index data of the called service module corresponding to the data acquisition service module in real time and sending the index data to the intelligent load balancing service module;
the intelligent load balancing service module is used for analyzing the received index data in real time, obtaining a real-time analysis result, automatically selecting a preset load balancing strategy corresponding to the real-time analysis result from a plurality of preset load balancing strategies according to the real-time analysis result, and distributing service calling requests to each called service in the called service cluster.
A third aspect of embodiments of the present application provides a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the steps in the method according to the first aspect of the present application.
The embodiment of the application provides an intelligent load balancing method, which comprises the following steps: the calling service initiates a service calling request; configuring data acquisition services for each called service in the called services deployed in the cluster; the data acquisition service acquires index data of the called service corresponding to the data acquisition service in real time and sends the index data to the intelligent load balancing service; the intelligent load balancing service analyzes the received index data in real time to obtain a real-time analysis result; and automatically selecting a preset load balancing strategy corresponding to the real-time analysis result from a plurality of preset load balancing strategies according to the real-time analysis result, and dynamically adjusting and distributing the service call requests to each called service through the intelligent load balancing service.
According to the first aspect of the application, the load balancing strategy corresponding to the analysis result is automatically selected from a plurality of preset load balancing strategies for balancing and distributing the service calling request through analyzing the index data acquired in real time without selecting the designated load balancing strategy by a user;
according to the second aspect of the application, the access concurrency in the future period is predicted according to the analysis of a large amount of historical index data, and a proper load balancing strategy is automatically selected from a plurality of preset load balancing strategies in advance for balanced distribution of service call requests;
according to the third aspect of the application, according to the requirements of an access scene, a user can designate a load balancing strategy from a plurality of preset load balancing strategies for balanced distribution of loads, and when the real-time analysis result of index data shows that a service calling request jam exists in a called service, the user is warned to switch the designated load balancing strategy into priority intelligent load balancing, so that the distribution of the loads is more balanced, the effect of load balancing is more excellent, the data processing capacity of network equipment is effectively improved, and the data throughput of the network equipment is effectively improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments of the present application will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without inventive exercise.
Fig. 1 is a flowchart illustrating an intelligent load balancing method according to an embodiment of the present application;
FIG. 2 is a schematic diagram illustrating multiple levels of service invocation according to one embodiment of the present application;
FIG. 3 is a schematic diagram illustrating a single-level service invocation according to an embodiment of the present application;
fig. 4 is a schematic diagram of an intelligent load balancing apparatus according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Before describing the intelligent load balancing method provided by the present application, first, a simple description is given below of a load balancing manner in the related art.
At present, the data access amount of a network is rapidly increased, services are deployed in a distributed mode in a micro-service architecture scene, each service is deployed in multiple instances, and if access balance cannot be distributed to each instance, the access accumulation of servers can be caused to cause downtime in a high-concurrency scene. In order to solve the problem, in the prior art, a load balancing mode adopted for realizing access balancing distribution to a plurality of instances designates a load balancing strategy in advance for developers, so that access balancing distribution to each service instance is realized, and therefore each service instance achieves the best processing effect, the throughput is increased, and the data processing capacity is enhanced. However, in the load balancing manner in the prior art, other more suitable load balancing policies cannot be adaptively and dynamically adjusted and selected according to actual access scenarios to distribute service call requests, access of a client under a large current internet and micro-service scenarios is uncertain and diverse, if only the load balancing policy specified by a developer is used, the load balancing policy may be suitable in a part of time, but when the access situation changes, a large amount of access may be accumulated on a certain server or load of each service is unbalanced, and service interruption may be caused seriously.
Therefore, the application provides an intelligent load balancing method for overcoming the technical problem that access cannot be allocated according to actual access scenes by means of adaptive dynamic adjustment and selection of other more suitable load balancing strategies in the related art. According to the first aspect of the method, the corresponding load balancing strategy can be automatically selected to be evenly distributed and accessed to each instance according to the index data collected in real time; according to the second aspect of the method, the access concurrency in the future period can be predicted according to the analysis of a large amount of historical index data, and a proper load balancing strategy is automatically selected for balanced distribution of access; according to the third aspect of the method, according to the requirements of an access scene, a user can designate a load balancing strategy for balanced distribution of the load, and when the real-time analysis result of the index data shows access congestion of the called service, the user is warned to switch the designated load balancing strategy into priority intelligent load balancing. The method and the device are applied to the field of the Internet, so that the load balancing strategy can automatically select the corresponding load balancing strategy to be used for distributing the access balance to each service instance according to the actual access scene, the distribution of the load is more balanced, the load balancing effect is more excellent, the data processing capacity of the existing network equipment is effectively improved, and the throughput of the existing network equipment is effectively improved.
Referring to fig. 1, fig. 1 is a flowchart illustrating an intelligent load balancing method according to an embodiment of the present application. As shown in fig. 1, the intelligent load balancing method provided by the present application includes the following steps:
s101: the calling service initiates a service invocation request.
In the embodiment of the application, the micro service architecture refers to that a program is divided into a plurality of small services, each service is constructed around a specific service, each service operates independently, and the services are mutually coordinated and matched to realize the function of the whole program; the main call service refers to a service at one end which sends out a service call request; the invoked service refers to the end service that receives the service invocation request.
Referring to fig. 2, fig. 2 is a schematic diagram illustrating a multi-level service invocation according to an embodiment of the present application. As shown in fig. 2, in the micro-service architecture, a service invocation request has a multi-level service invocation, that is, the service invocation request is sent and received among a plurality of services, and then a result corresponding to the service invocation request is returned, the same service instance may be used as a calling service or a called service, when the server initiates the service invocation request, the same server belongs to the calling service, and when receiving the service invocation request, the same server belongs to the called service.
Illustratively, the calling service a sends a service invocation request T0, the intelligent load balancing service allocates T0 to the service a1, the service a1 receives T0, at this time, a is the calling service, and a1 is the invoked service; after the service invocation request T0 is processed by a1, the service invocation request T0 is sent out, the intelligent load balancing service allocates T0 to the service a11, the service a11 receives T0, at this time, a1 is the calling service, a11 is the called service, and finally, after the service invocation request T0 is processed by a11, a result corresponding to the service invocation request T0 is returned according to the service invocation request T0, wherein in the whole service invocation process, the service a1 is the called service when receiving the service invocation request T0, and the service a1 is the calling service when sending the service invocation request T0.
In the embodiment of the present application, referring to fig. 3, fig. 3 is a schematic diagram illustrating a service call at a single layer level according to an embodiment of the present application. As shown in fig. 3, a single-layer service instance refers to a calling service initiating a service invocation request, and after a called service is passed, a result corresponding to the service invocation request is returned, so that there is no situation that the same service is both the calling service and the called service. For ease of understanding, the following examples each take a single-level service invocation as an example.
S102: the called service is deployed in a cluster, and each called service in the called service cluster is respectively configured with a data acquisition service; and each data acquisition service acquires the index data of the corresponding called service in real time and sends the index data to the intelligent load balancing service.
In the embodiment of the present application, the called service is deployed in a cluster, and the called service is configured to process the service invocation request sent by the calling service in step S101, and return a result corresponding to the service invocation request according to the service invocation request. Each called service is configured with a corresponding data acquisition service for acquiring index data of the called service, wherein the index data includes: configuration information of the called service, TCP connection number information of the called service and average response time length information of the called service. The configuration information comprises a CPU, an internal memory and the like, and the higher the configuration is, the stronger the data processing capacity of the called service is; the TCP connection number information refers to the number of effective service calling requests which need to be processed and are currently connected with the called service, and the more TCP connections, the more service calling requests which are not processed by the called service; the average response duration information refers to the time for the calling service to initiate a service calling request, the called service to receive the service calling request and return a result corresponding to the service calling request to the calling service, and the shorter the average response duration is, the stronger the processing capacity of the called service is. And each data acquisition service acquires the index data of the corresponding called service in real time and sends the acquired index data to the intelligent load balancing service, so that the intelligent load balancing service selects a suitable load balancing strategy to distribute the service calling request to each called service in the called service cluster in a balanced manner according to the acquired index data.
In this embodiment of the present application, the acquiring, by each data acquisition service, index data of a called service corresponding to each data acquisition service in real time includes: when the called service is started, the data acquisition service acquires the configuration information of the called service through an interface; according to a mode of acquiring the TCP connection number once at set time intervals, the data acquisition service acquires the TCP connection number of the called service through an interface; under a micro-service architecture, the data acquisition service acquires the average response time of the called service through a calling link port in a butt joint micro-service architecture; under a non-microservice architecture, in a preset time period, the data acquisition service acquires the quantity of called service response service calling requests through an interface, and obtains the average response time of the called service through analysis.
Illustratively, the configuration information of the called service is relatively fixed and does not change for a long time after being determined, and the data acquisition service acquires the configuration information of the corresponding called service through an interface and sends the configuration information to the intelligent load balancing service when the called service is started each time; the TCP connection number is continuously processed along with the called service, and the effective TCP connection number of the called service is continuously changed along with the time of the service calling request continuously sent by the main calling service, and each data acquisition service acquires the effective TCP connection number information of the called service corresponding to each data acquisition service through the interface once after each time interval; in the micro service architecture, the average response duration of the called service, which is directly collected by the data collection service through the interface of the call chain under the micro service architecture, is not the average response duration of the called service under the micro service architecture, and the number of service call requests to be responded by the called service within a certain time period, which is collected through the interface, is obtained through analysis, for example: the preset time period is t0, the service invocation request responded in the time period t0 is n, and the average response time length is t 0/n.
S103: and the intelligent load balancing service analyzes the received index data in real time to obtain a real-time analysis result.
In this embodiment of the application, the intelligent load balancing service receives the index data sent by each data collection service in step S102, and according to the real-time analysis of all the received index data, the configuration information, the TCP connection number information, and the average response time information of each called service in the called service cluster can be obtained, so that the current processing state and the configuration condition of each called service can be obtained.
S104: and according to the real-time analysis result, automatically selecting a preset load balancing strategy corresponding to the real-time analysis result from a plurality of preset load balancing strategies, and dynamically adjusting and distributing service call requests of each called service in the called service cluster through the intelligent load balancing service.
In this embodiment of the application, according to the current processing state and the configuration condition of each called service obtained from the real-time analysis result of the index data in step S103, the current processing state and the configuration condition of each called service are automatically selected from a plurality of preset load balancing policies, and the load balancing policy of the configuration condition is used to distribute the service invocation request to each called service in a balanced manner through the intelligent load balancing service.
Illustratively, a plurality of calling services initiate service invocation requests, and each called service receives service invocation requests of different quantities, processes the received service invocation requests, and returns a result corresponding to the received service invocation request. And each data collection service collects the current index data of the corresponding called service in real time and sends the current index data to the intelligent load balancing service, and the intelligent load balancing service analyzes the received index data in real time to obtain the current processing state of each called service and the analysis result of the configuration condition.
When the analysis result shows that the state of each called service for processing the service call request is good, and the condition that the distributed service call request is jammed does not exist, a load balancing strategy with better performance does not need to be selected, the access requirement of the actual service call request can be met only by the conventional common load balancing algorithm, and the intelligent load balancing service automatically selects the conventional common load balancing algorithm to carry out balanced distribution on the service call request initiated by the active service to each called service. Common load balancing algorithms include: a polling load balancing algorithm, a random load balancing algorithm and the like, wherein the polling load balancing algorithm means that all service calling requests are circularly distributed to all called services in turn; the random load balancing algorithm is that all service call requests are randomly distributed to all called services for the service call requests initiated by the master service, and when the total amount of the service call requests is large enough, the number of the service call requests distributed to each called service is basically consistent.
When the real-time analysis result shows that a large number of service calling requests are initiated by the main dispatching service, the concurrency of the service calling requests is greatly increased, each called service starts to receive a large number of service calling requests, the service calling requests distributed in a large number start to be congested when the called service starts to be congested, the processing speed is reduced, the conventional polling load balancing algorithm or the random load balancing algorithm is continuously used, the congestion condition of the called service is aggravated, even the called service is down, and at the moment, the intelligent load balancing service automatically selects a priority intelligent load balancing strategy to carry out balanced distribution on the service calling requests initiated by the active service to each called service.
In this embodiment of the present application, in a case that the preset load balancing policy is a priority intelligent load balancing policy, the dynamically adjusting, by the intelligent load balancing service, the service invocation requests allocated to each invoked service in the invoked service cluster includes: obtaining configuration weights of all called services according to configuration information of all called services in the index data, wherein the configuration weights are first priority data, and the higher the configuration of the called services is, the higher the processing capacity of the called services is, the more service calling requests distributed to the called services are; and dynamically adjusting the service call requests distributed to the called services through the intelligent load balancing service according to the first priority data.
Illustratively, when the priority intelligent load balancing strategy is selected to balance and distribute service call requests to the called service clusters, the intelligent load balancing service analyzes the collected index data to obtain configuration weights corresponding to the called services, the higher the configuration weights are, the higher the configuration of the called services is, the higher the processing data capacity is, more service call requests are distributed to the called services with higher configuration weights, and the service call requests are distributed to the called services through the intelligent load balancing service according to the configuration weights of the called services in the analysis result. For example: the currently called services are A1 to A5, the corresponding configuration weights are 10%, 30%, 10%, 30% and 20%, 1000 service call requests are initiated by the calling service, and the 1000 service call requests initiated by the calling service are distributed to the called services A1 to A5, 100, 300 and 200 respectively, through the intelligent load balancing service according to the first priority data in the selected priority intelligent load balancing strategy.
In this embodiment of the present application, after dynamically adjusting, by the intelligent load balancing service, the service invocation request allocated to each invoked service according to the first priority data, the method further includes: obtaining a connection number weight of each called service according to TCP connection number information of each called service in the index data, wherein the connection number weight is second priority data, and when the configuration weights of a plurality of called service instances are the same, the more TCP connections of the called service are, the higher the connection number weight of the called service is, and the service calling request distributed to the called service is reduced; and dynamically adjusting the service call requests distributed to the called services through the intelligent load balancing service according to the second priority data acquired in real time.
Following the above example, after 1000 service invocation requests are distributed to the invoked services a1 through a5 by the intelligent load balancing service according to the first priority data in the priority intelligent load balancing policy, the effective TCP connection number of each invoked service is collected in real time, and the connection number weight of each invoked service is obtained. When the configuration weights of the plurality of called services are the same, the plurality of called services may be configured the same due to other network bandwidths and other factors, but the data processing capabilities are different, so that the configuration weights of the plurality of called services are the same, and the effective TCP connection numbers of the plurality of called service instances are different. And judging the connection number weight of a plurality of called services with the same configuration weight, wherein the larger the connection number weight is, the more unprocessed service calling requests of the called services are, the less service calling requests are distributed to the called service with the larger connection number weight in the plurality of called services with the same configuration weight, and the more service calling requests are distributed to the called service with the smaller connection number weight in the plurality of called services with the same configuration weight. For example: after 1000 service invocation requests are distributed to invoked services A1-A5 through the intelligent load balancing service according to first priority data in the priority intelligent load balancing strategy, the corresponding effective TCP connection numbers of the invoked services are collected in real time and are respectively 75, 150, 50, 200 and 25, and the corresponding connection number weights are 15%, 30%, 10%, 40% and 5%. At this time, 1000 service invocation requests are newly initiated by the master service, the configuration weights of A1 and A3 are the same, the current connection number of A1 is large, the data processing capacity of A1 is lower than that of A3, and the newly initiated service invocation requests are less distributed to A1; the a2 and a4 configuration weights are the same, while a4 has a larger number of current connections, a4 has lower data processing capacity than a2, and newly initiated service invocation requests will be less assigned to a 4.
The total service invocation request number of the called service cluster is the sum of the total effective TCP connection number of the currently collected called service cluster and the newly-initiated service invocation request number, the service invocation request number needing to be allocated to each called service is the product of the total service invocation request number of the called service cluster and the configuration weight of each called service, the number of the newly-initiated service invocation request allocated to each called service is the difference value between the service invocation request number needing to be allocated to each called service and the current effective TCP connection number of each called service, and therefore 1000 service invocation requests newly-initiated by the master service are allocated to the service invocation requests from A1 to A5, which are respectively 75, 300, 100, 250 and 275.
In this embodiment of the present application, after dynamically adjusting, by the intelligent load balancing service, the service invocation requests allocated to the respective invoked services according to the second priority data collected in real time, the method further includes: obtaining access weight of each called service according to average response duration information of each called service in the index data, wherein the access weight is third-priority data, and the longer the average response duration of each called service is, the lower the access weight is, the lower the processing capacity of each called service is, and the service call request distributed to each called service is reduced; and dynamically adjusting and distributing the service call requests to the called services through the intelligent load balancing service according to the third priority data acquired in real time.
Following the above example, the 1000 newly initiated service invocation requests are distributed to the invoked services a 1-a 5 by the intelligent load balancing service according to the first priority data in the priority intelligent load balancing policy and the second priority data in the priority intelligent load balancing policy, and the average response time lengths of the invoked services are respectively 20%, 25%, 15%, and 20% collected in real time. The average response time directly reflects the processing capacity of the called service for processing the service call request, and the longer the average response time, the slower the speed of the called service for processing the service call request, and the lower the corresponding access weight, the less the service call request distributed to the called service. At this time, the calling service newly initiates 2000 service invocation requests, the average response time directly reflects the processing capacity of the called service for processing the service invocation requests, and the 2000 service invocation requests are distributed to the called services A1 to A5 through the intelligent load balancing service according to the access weight of each called service, which are respectively 400, 500, 300 and 400.
It should be understood that the common load balancing algorithm in the above example is only one example of the possible implementation manners of the present application, and other existing common load balancing algorithms may also be used as the load balancing policy automatically selected by the intelligent load balancing service of the present application, and the above example should not be construed as a limitation to the present application.
In this embodiment of the present application, when the preset load balancing policy is a load balancing policy specified by a user, after dynamically adjusting and allocating a service invocation request to each invoked service through the intelligent load balancing service according to the load balancing policy specified by the user, the method further includes: the intelligent load balancing service analyzes the received index data in real time to obtain an analysis result; and when the service calling request distributed to the called service in the analysis result is abnormal, outputting alarm information in real time to prompt a user to switch the specified load balancing strategy into the priority intelligent load balancing strategy.
Illustratively, in order to meet an access scenario that a specific load balancing strategy is adopted to perform load balancing distribution on a called service cluster, a user can specify the load balancing strategy, a service calling request is distributed to each called service in a balanced manner through the intelligent load balancing service, the service calling request is not switched to other load balancing strategies in the whole load balancing process, index data of each called service can be collected in real time, an analysis result is obtained through analysis of the index data, when the analysis result shows that the called service has a service calling request congestion situation, the user is alarmed to be switched to the priority intelligent load balancing strategy in real time, and the user manually selects whether to be switched to the priority intelligent load balancing strategy or not.
In the embodiment of the application, according to index data collected historically, the index data collected historically is analyzed through the intelligent load balancing service to obtain prediction data; and predicting the concurrency of the service call requests in the future period according to the prediction data, automatically selecting a corresponding preset load balancing strategy from a plurality of preset load balancing strategies in advance, and dynamically adjusting and distributing the service call requests to each called service through the intelligent load balancing service.
Illustratively, the predictive data is obtained from analysis of a large amount of index data collected historically. When the predicted data shows that high-concurrency service calling requests appear in the specified time periods in a plurality of time periods, automatically switching to a preset load balancing strategy suitable for the access scene in the specified time periods in each time period in advance according to the predicted data; when the predicted data shows that a lower number of service call requests should originally be initiated in a plurality of time periods, the service call requests different from the normally initiated service call requests suddenly appear, and the service call requests with high concurrency appear in the next period, so that the preset load balancing strategy suitable for the access scene can be automatically switched to when the service call requests different from the normally initiated service call requests appear in each time period in advance according to the predicted data.
The embodiment of the application provides an intelligent load balancing method, which comprises the following steps: the calling service initiates a service calling request; configuring data acquisition services for each called service in the called services deployed in the cluster; the data acquisition service acquires index data of the called service corresponding to the data acquisition service in real time and sends the index data to the intelligent load balancing service; the intelligent load balancing service analyzes the received index data in real time to obtain a real-time analysis result; and automatically selecting a preset load balancing strategy corresponding to the real-time analysis result from a plurality of preset load balancing strategies according to the real-time analysis result, and dynamically adjusting and distributing the service call requests to each called service through the intelligent load balancing service. According to the method and the device, the load balancing strategy is not required to be appointed by a user to realize the balanced distribution of the load, but the load balancing strategy corresponding to the analysis result is automatically selected from a plurality of preset load balancing strategies to be used for the balanced distribution of the service calling request according to the analysis result by analyzing the index data acquired in real time; meanwhile, the access concurrency in the future period can be predicted according to the analysis of a large amount of historical index data, and a proper load balancing strategy is automatically selected from a plurality of preset load balancing strategies in advance for balanced distribution of the service call request; and when the real-time analysis result of the index data shows that the called service has service calling request congestion, the user is warned to switch the load balancing strategy into the priority intelligent load balancing strategy, so that the load distribution is more balanced, and the load balancing effect is more excellent. By adopting the intelligent load balancing method, the load balancing strategy suitable for the access scene can be automatically selected according to the actual access scene to uniformly distribute the service calling request to the called service cluster, so that the load is more uniformly distributed to each called service in the called service cluster, the load balancing effect is more excellent, the data processing capacity of the network equipment is effectively improved, and the data throughput of the network equipment is effectively improved.
Based on the same inventive concept, an embodiment of the present application provides an intelligent load balancing apparatus. Referring to fig. 4, fig. 4 is a schematic diagram of an intelligent load balancing apparatus according to an embodiment of the present application. As shown in fig. 4, the apparatus includes:
a master service module 41, configured to initiate a service invocation request;
a called service module 42, configured to process a service calling request initiated by the master service module, where the called service module is deployed in a cluster;
the data acquisition service module 43 is configured to the corresponding called service module, and is configured to acquire the index data of the called service module corresponding to the data acquisition service module in real time and send the index data to the intelligent load balancing service module;
the intelligent load balancing service module 44 is configured to analyze the received index data in real time to obtain a real-time analysis result, and automatically select a preset load balancing policy corresponding to the real-time analysis result from a plurality of preset load balancing policies according to the real-time analysis result, and allocate a service invocation request to each invoked service in the invoked service cluster.
Based on the same inventive concept, another embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of the method according to any of the above-mentioned embodiments of the present application.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
While preferred embodiments of the present invention have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.
The foregoing describes in detail an intelligent load balancing method, apparatus, and storage medium provided by the present invention, and the present invention has been described in detail by applying specific examples to explain the principles and embodiments of the present invention, and the descriptions of the above examples are only used to help understand the method and core ideas of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (9)

1. An intelligent load balancing method, the method comprising:
the calling service initiates a service calling request;
the called service is deployed in a cluster, and each called service in the called service cluster is respectively configured with a data acquisition service;
each data acquisition service acquires index data of the corresponding called service in real time and sends the index data to the intelligent load balancing service;
the intelligent load balancing service analyzes the received index data in real time to obtain a real-time analysis result, wherein the real-time analysis result represents the current processing state and the configuration condition of each called service;
according to the real-time analysis result, automatically selecting a preset load balancing strategy corresponding to the real-time analysis result from a plurality of preset load balancing strategies, and dynamically adjusting and distributing service call requests of each called service in the called service cluster through the intelligent load balancing service;
according to the real-time analysis result, automatically selecting a preset load balancing strategy corresponding to the real-time analysis result from a plurality of preset load balancing strategies, wherein the method comprises the following steps:
when the analysis result represents that the distributed service call request is not congested, automatically selecting a first load balancing strategy, wherein the first load balancing strategy is as follows: a polling load balancing algorithm or a random load balancing algorithm;
when the analysis result represents that the distributed service call request is congested, automatically selecting a priority intelligent load balancing strategy, wherein the priority intelligent load balancing strategy is a strategy for distributing the service call request according to index data of a plurality of different priority levels, and the index data of the plurality of different priority levels are as follows: configuration information of the called service, TCP connection number information of the called service and average response time length information of the called service.
2. The method according to claim 1, wherein in a case that the preset load balancing policy is a priority intelligent load balancing policy, the dynamically adjusting, by the intelligent load balancing service, the service invocation requests allocated to each invoked service in the invoked service cluster includes:
obtaining configuration weights of all called services according to configuration information of all called services in the index data, wherein the configuration weights are first priority data, and the higher the configuration of the called services is, the higher the processing capacity of the called services is, the more service calling requests distributed to the called services are;
and dynamically adjusting the service call requests distributed to the called services through the intelligent load balancing service according to the first priority data.
3. The method of claim 2, wherein after dynamically adjusting, by the intelligent load balancing service, the service invocation requests assigned to the respective invoked service in accordance with the first priority data, the method further comprises:
obtaining a connection number weight of each called service according to TCP connection number information of each called service in the index data, wherein the connection number weight is second priority data, and when the configuration weights of a plurality of called service instances are the same, the more TCP connections of the called service are, the higher the connection number weight of the called service is, and the service calling request distributed to the called service is reduced;
and dynamically adjusting the service call requests distributed to the called services through the intelligent load balancing service according to the second priority data acquired in real time.
4. The method of claim 3, wherein after dynamically adjusting, by the intelligent load balancing service, the service invocation requests assigned to the respective invoked services according to the second priority data collected in real-time, the method further comprises:
obtaining an access weight of each called service according to the average response duration information of each called service in the index data, wherein the access weight is third-priority data, and the longer the average response duration of each called service is, the lower the access weight is, the lower the processing capacity of each called service is, and the service call request distributed to each called service is reduced;
and dynamically adjusting and distributing the service call requests to the called services through the intelligent load balancing service according to the third priority data acquired in real time.
5. The method according to any one of claims 2 to 4, wherein, in a case where the preset load balancing policy is a user-specified load balancing policy, after the service invocation request allocated to each invoked service is dynamically adjusted by the intelligent load balancing service according to the user-specified load balancing policy, the method further comprises:
the intelligent load balancing service analyzes the received index data in real time to obtain an analysis result;
and when the service calling request distributed to the called service in the analysis result is abnormal, outputting alarm information in real time to prompt a user to switch the specified load balancing strategy into the priority intelligent load balancing strategy.
6. The method of claim 1, further comprising:
according to index data collected historically, analyzing the index data collected historically through the intelligent load balancing service to obtain prediction data;
and predicting the concurrency of the service call requests in the future period according to the prediction data, automatically selecting a corresponding preset load balancing strategy from a plurality of preset load balancing strategies in advance, and dynamically adjusting and distributing the service call requests to each called service through the intelligent load balancing service.
7. The method of claim 1, wherein the step of acquiring the index data of the called service corresponding to each data acquisition service in real time comprises:
when the called service is started, the data acquisition service acquires the configuration information of the called service through an interface;
according to a mode of acquiring the TCP connection number once at set time intervals, the data acquisition service acquires the TCP connection number of the called service through an interface;
under a micro-service architecture, the data acquisition service acquires the average response time of the called service through a calling link port in a butt joint micro-service architecture;
under a non-microservice architecture, in a preset time period, the data acquisition service acquires the quantity of called service response service calling requests through an interface, and obtains the average response time of the called service through analysis.
8. An intelligent load balancing apparatus, the apparatus comprising:
the main dispatching service module is used for initiating a service calling request;
the called service module is used for processing a service calling request initiated by the master service module and is deployed in a cluster;
the data acquisition service module is configured to the corresponding called service module, is used for acquiring the index data of the called service module corresponding to the data acquisition service module in real time and sending the index data to the intelligent load balancing service module;
the intelligent load balancing service module is used for analyzing the received index data in real time, obtaining a real-time analysis result, automatically selecting a preset load balancing strategy corresponding to the real-time analysis result from a plurality of preset load balancing strategies according to the real-time analysis result, and distributing a service calling request to each called service in the called service cluster, wherein the real-time analysis result represents the current processing state and configuration condition of each called service;
wherein, the intelligent load balancing service module comprises:
the first load balancing strategy determination model is used for automatically selecting a first load balancing strategy when an analysis result represents that the distributed service calling request is not congested, and the first load balancing strategy is as follows: a polling load balancing algorithm or a random load balancing algorithm;
the first load balancing strategy determination model is used for automatically selecting a priority intelligent load balancing strategy when an analysis result represents that the distributed service calling request is congested, wherein the priority intelligent load balancing strategy is a strategy for distributing the service calling request according to a plurality of index data with different priority levels, and the index data with the different priority levels are as follows: configuration information of the called service, TCP connection number information of the called service and average response time length information of the called service.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the intelligent load balancing method according to any one of claims 1 to 8.
CN202011507408.XA 2020-12-18 2020-12-18 Intelligent load balancing method and device and storage medium Active CN112532743B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011507408.XA CN112532743B (en) 2020-12-18 2020-12-18 Intelligent load balancing method and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011507408.XA CN112532743B (en) 2020-12-18 2020-12-18 Intelligent load balancing method and device and storage medium

Publications (2)

Publication Number Publication Date
CN112532743A CN112532743A (en) 2021-03-19
CN112532743B true CN112532743B (en) 2021-11-30

Family

ID=75001654

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011507408.XA Active CN112532743B (en) 2020-12-18 2020-12-18 Intelligent load balancing method and device and storage medium

Country Status (1)

Country Link
CN (1) CN112532743B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113746933A (en) * 2021-09-14 2021-12-03 京东科技信息技术有限公司 Method and device for displaying information
CN114466019B (en) * 2022-04-11 2022-09-16 阿里巴巴(中国)有限公司 Distributed computing system, load balancing method, device and storage medium
CN114866480A (en) * 2022-05-31 2022-08-05 北京天融信网络安全技术有限公司 NAT load balancing implementation method, system, electronic equipment and storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1495634A (en) * 2002-06-27 2004-05-12 上海汉唐科技有限公司 Server clustering load balancing method and system
CN102404224A (en) * 2011-11-28 2012-04-04 曙光信息产业(北京)有限公司 Self-adaptive balanced load shunting equipment and method
CN104202254A (en) * 2014-08-14 2014-12-10 江苏省邮电规划设计院有限责任公司 An intelligent load balancing method based on a cloud calculation platform server
CN106453125A (en) * 2016-11-04 2017-02-22 中国电子科技集团公司第二十八研究所 Load balancing system for remote service calling based on real-time load rate
CN108712464A (en) * 2018-04-13 2018-10-26 中国科学院信息工程研究所 A kind of implementation method towards cluster micro services High Availabitity
CN109104500A (en) * 2018-09-29 2018-12-28 广东省信息工程有限公司 A kind of server load balancing method and device of dynamic adjustment
CN109257440A (en) * 2018-10-29 2019-01-22 南京南瑞信息通信科技有限公司 A kind of service discovery and client load equalization methods based on service register center
CN109933431A (en) * 2019-03-11 2019-06-25 浪潮通用软件有限公司 A kind of intelligent client load equalization methods and system
CN110389841A (en) * 2019-07-25 2019-10-29 中南民族大学 A kind of server load balancing method, apparatus and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160277488A1 (en) * 2013-10-23 2016-09-22 Telefonaktiebolaget Lm Ericsson (Publ) Load Balancing in a Distributed Network Management Architecture
US9602380B2 (en) * 2014-03-28 2017-03-21 Futurewei Technologies, Inc. Context-aware dynamic policy selection for load balancing behavior

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1495634A (en) * 2002-06-27 2004-05-12 上海汉唐科技有限公司 Server clustering load balancing method and system
CN102404224A (en) * 2011-11-28 2012-04-04 曙光信息产业(北京)有限公司 Self-adaptive balanced load shunting equipment and method
CN104202254A (en) * 2014-08-14 2014-12-10 江苏省邮电规划设计院有限责任公司 An intelligent load balancing method based on a cloud calculation platform server
CN106453125A (en) * 2016-11-04 2017-02-22 中国电子科技集团公司第二十八研究所 Load balancing system for remote service calling based on real-time load rate
CN108712464A (en) * 2018-04-13 2018-10-26 中国科学院信息工程研究所 A kind of implementation method towards cluster micro services High Availabitity
CN109104500A (en) * 2018-09-29 2018-12-28 广东省信息工程有限公司 A kind of server load balancing method and device of dynamic adjustment
CN109257440A (en) * 2018-10-29 2019-01-22 南京南瑞信息通信科技有限公司 A kind of service discovery and client load equalization methods based on service register center
CN109933431A (en) * 2019-03-11 2019-06-25 浪潮通用软件有限公司 A kind of intelligent client load equalization methods and system
CN110389841A (en) * 2019-07-25 2019-10-29 中南民族大学 A kind of server load balancing method, apparatus and storage medium

Also Published As

Publication number Publication date
CN112532743A (en) 2021-03-19

Similar Documents

Publication Publication Date Title
CN112532743B (en) Intelligent load balancing method and device and storage medium
CA2471594C (en) Method and apparatus for web farm traffic control
EP3547625B1 (en) Method and system for sending request for acquiring data resource
US8291424B2 (en) Method and system of managing resources for on-demand computing
CN109933431B (en) Intelligent client load balancing method and system
CN105335231B (en) server thread dynamic allocation method and device
CN112689007B (en) Resource allocation method, device, computer equipment and storage medium
CN111654561B (en) Method and device for determining IP address number, electronic equipment and storage medium
CN115334082A (en) Load balancing method, device, computer equipment, storage medium and product
CN115604278A (en) Dynamic load balancing method and system
CN117155942A (en) Micro-service dynamic self-adaptive client load balancing method and system
US20220124172A1 (en) Service Deployment Method and Scheduling Apparatus
CN111355664A (en) Flow control method and device
US20220318065A1 (en) Managing computer workloads across distributed computing clusters
CN116382892B (en) Load balancing method and device based on multi-cloud fusion and cloud service
CN116527600A (en) Method for determining bandwidth quota and resource quota and method for distributing node bandwidth
CN116546028A (en) Service request processing method and device, storage medium and electronic equipment
CN114205361B (en) Load balancing method and server
CN112732425B (en) Application management method and device, electronic equipment and storage medium
CN114936089A (en) Resource scheduling method, system, device and storage medium
CN114726860B (en) Load balancing system and load balancing method for streaming media transmission
CN116866357B (en) Multi-cloud container cluster resource optimization management method and system
CN111586139B (en) Information transmission method and device based on echo state network
CN112261076B (en) Download service separation method, device, electronic equipment and readable storage medium
CN109257292B (en) RCS load balancing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant