CN113934512A - Load balancing implementation method, device, equipment and storage medium - Google Patents

Load balancing implementation method, device, equipment and storage medium Download PDF

Info

Publication number
CN113934512A
CN113934512A CN202111225160.2A CN202111225160A CN113934512A CN 113934512 A CN113934512 A CN 113934512A CN 202111225160 A CN202111225160 A CN 202111225160A CN 113934512 A CN113934512 A CN 113934512A
Authority
CN
China
Prior art keywords
service instance
cluster
service
load
target
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.)
Pending
Application number
CN202111225160.2A
Other languages
Chinese (zh)
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.)
Ping An International Smart City Technology Co Ltd
Original Assignee
Ping An International Smart City 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 Ping An International Smart City Technology Co Ltd filed Critical Ping An International Smart City Technology Co Ltd
Priority to CN202111225160.2A priority Critical patent/CN113934512A/en
Publication of CN113934512A publication Critical patent/CN113934512A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • 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/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/4557Distribution of virtual machine instances; Migration and load balancing

Abstract

The invention relates to the field of artificial intelligence and discloses a method, a device, equipment and a storage medium for realizing load balancing. The method comprises the following steps: receiving a service instance calling request sent by a terminal, wherein the service instance calling request carries cluster identification information; determining a plurality of candidate clusters corresponding to the service instance calling request according to the cluster identification information; performing cluster state analysis on the plurality of candidate clusters to obtain a cluster state corresponding to each candidate cluster, and determining a target cluster corresponding to the service instance calling request according to the cluster state corresponding to each candidate cluster; acquiring a service instance list corresponding to the target cluster from a preset registry database, and determining a target service instance from the service instance list through a preset load balancing algorithm; and sending the target service instance to the terminal. The invention also relates to a block chain technology, and the cluster identification information can be stored in the block chain.

Description

Load balancing implementation method, device, equipment and storage medium
Technical Field
The invention relates to the field of artificial intelligence, in particular to a method, a device, equipment and a storage medium for realizing load balancing.
Background
With the continuous progress of the internet technology, more and more internet functions need developers to research and develop in a development environment, the development environment is the basis of rapid and efficient development of each developer, the development environment is the local environment of the developers in general, and the development environment is very convenient and fast.
However, as the subsequent services increase more and more, the underlying basic services increase more and more, which may affect daily development, and meanwhile, multiple users may be frequently deployed in the test environment, and at this time, the tester is also testing, which may cause unstable test environment, and in addition, the current load mode may cause a call request to be called across the machine room for multiple times, which may cause high resource consumption of the network dedicated line, and thus the service instance load scheduling efficiency is low.
Disclosure of Invention
The invention mainly aims to solve the technical problem of low efficiency in service instance load scheduling.
The first aspect of the present invention provides a method for implementing load balancing, including: receiving a service instance calling request sent by a terminal, wherein the service instance calling request carries cluster identification information; determining a plurality of candidate clusters corresponding to the service instance calling request according to the cluster identification information; performing cluster state analysis on the plurality of candidate clusters to obtain a cluster state corresponding to each candidate cluster, and determining a target cluster corresponding to the service instance calling request according to the cluster state corresponding to each candidate cluster; acquiring a service instance list corresponding to the target cluster from a preset registry database, and determining a target service instance from the service instance list through a preset load balancing algorithm; and sending the target service instance to the terminal.
Optionally, in a first implementation manner of the first aspect of the present invention, before the receiving a service instance invocation request sent by a terminal, where the service instance invocation request carries cluster identification information, the method further includes: receiving a plurality of service instance registration requests sent by a plurality of terminals, wherein the service instance registration requests carry cluster registration identification information, and each terminal corresponds to one service instance registration request; scanning the service instance registration requests to acquire a plurality of corresponding cluster registration identification information; determining a registration cluster corresponding to each service instance registration request according to the plurality of cluster registration identification information; analyzing each service instance registration request, determining a service instance to be registered corresponding to each service instance registration request, and registering the service instance to be registered corresponding to each service instance registration request in a registration cluster corresponding to each service instance registration request.
Optionally, in a second implementation manner of the first aspect of the present invention, the obtaining a service instance list corresponding to the target cluster from a preset registry database, and determining a target service instance from the service instance list through a preset load balancing algorithm includes: performing service instance traversal query on the preset registration center database to acquire a plurality of service instances in the preset registration center database; the service instances are subjected to priority sequencing, and a corresponding service instance list is determined; scanning a preset load balancing algorithm to determine a corresponding load balancing strategy; and screening the plurality of service instances in the service instance list according to the priority order based on the load balancing strategy to obtain a target service instance meeting preset conditions.
Optionally, in a third implementation manner of the first aspect of the present invention, the screening, according to a priority order, the multiple service instances in the service instance list based on the load balancing policy to obtain a target service instance meeting a preset condition includes: counting the service load quantity of the plurality of service instances to obtain the service load quantity corresponding to each service instance; based on the service load quantity corresponding to each service instance, carrying out load grade calculation on each service instance through a preset load grade algorithm to obtain the load grade corresponding to each service instance; and analyzing the load grade corresponding to each service instance, and screening the plurality of service instances according to the priority order through the load balancing strategy to obtain a target service instance meeting preset conditions.
Optionally, in a fourth implementation manner of the first aspect of the present invention, the performing service load quantity statistics on the plurality of service instances to obtain the service load quantity corresponding to each service instance includes: scanning the plurality of service instances, and determining service instance connection port information corresponding to each service instance; and analyzing the connection number information of the plurality of service instances through the service instance connection port information corresponding to each service instance to obtain the service load number corresponding to each service instance.
Optionally, in a fifth implementation manner of the first aspect of the present invention, the performing, by using a preset load level algorithm, load level calculation on each service instance based on the service load quantity corresponding to each service instance to obtain a load level corresponding to each service instance includes: obtaining the maximum connection number supported by the service instance corresponding to each service instance; analyzing the service load rate according to the maximum connection number information supported by the service instance corresponding to each service instance and the service load quantity to obtain the service load rate corresponding to each service instance; and performing load equivalent division on each service instance according to a preset load grade division algorithm, and determining the load grade corresponding to each service instance.
Optionally, in a sixth implementation manner of the first aspect of the present invention, the sending the target service instance to the terminal includes: scanning the target service instance to determine a corresponding target service instance address; and downloading the target service instance from a preset database through the target service instance address, and transmitting the target service instance to the terminal.
A second aspect of the present invention provides a load balancing implementation apparatus, including: the system comprises a receiving module, a sending module and a receiving module, wherein the receiving module is used for receiving a service instance calling request sent by a terminal, and the service instance calling request carries cluster identification information; a determining module, configured to determine, according to the cluster identification information, a plurality of candidate clusters corresponding to the service instance invocation request; the analysis module is used for carrying out cluster state analysis on the candidate clusters to obtain a cluster state corresponding to each candidate cluster, and determining a target cluster corresponding to the service instance calling request according to the cluster state corresponding to each candidate cluster; the acquisition module is used for acquiring a service instance list corresponding to the target cluster from a preset registry database and determining a target service instance from the service instance list through a preset load balancing algorithm; and the sending module is used for sending the target service instance to the terminal.
Optionally, in a first implementation manner of the second aspect of the present invention, the load balancing implementation apparatus further includes: the second receiving module is used for receiving a plurality of service instance registration requests sent by a plurality of terminals, wherein the service instance registration requests carry cluster registration identification information, and each terminal corresponds to one service instance registration request; the request scanning module is used for scanning the plurality of service instance registration requests to acquire a plurality of corresponding cluster registration identification information; a second determining module, configured to determine, according to the multiple pieces of cluster registration identification information, a registration cluster corresponding to each service instance registration request; and the request analysis module is used for analyzing each service instance registration request, determining a service instance to be registered corresponding to each service instance registration request, and registering the service instance to be registered corresponding to each service instance registration request into a registration cluster corresponding to each service instance registration request.
Optionally, in a second implementation manner of the second aspect of the present invention, the list obtaining module further includes: the query unit is used for performing service instance traversal query on the preset registry database to acquire a plurality of service instances in the preset registry database; the sequencing unit is used for carrying out priority sequencing on the plurality of service instances and determining a corresponding service instance list; the scanning unit is used for scanning a preset load balancing algorithm and determining a corresponding load balancing strategy; and the screening unit is used for screening the plurality of service instances in the service instance list according to the priority order based on the load balancing strategy to obtain the target service instance meeting the preset condition.
Optionally, in a third implementation manner of the second aspect of the present invention, the screening unit further includes: the counting subunit is configured to perform service load quantity counting on the plurality of service instances to obtain a service load quantity corresponding to each service instance; the calculating subunit is configured to perform load level calculation on each service instance through a preset load level algorithm based on the service load quantity corresponding to each service instance, so as to obtain a load level corresponding to each service instance; and the analysis subunit is used for analyzing the load grade corresponding to each service instance, and screening the plurality of service instances according to the priority order through the load balancing strategy to obtain the target service instance meeting the preset condition.
Optionally, in a fourth implementation manner of the second aspect of the present invention, the statistics subunit is specifically configured to: scanning the plurality of service instances, and determining service instance connection port information corresponding to each service instance; and analyzing the connection number information of the plurality of service instances through the service instance connection port information corresponding to each service instance to obtain the service load number corresponding to each service instance.
Optionally, in a fifth implementation manner of the second aspect of the present invention, the calculating subunit is specifically configured to: obtaining the maximum connection number supported by the service instance corresponding to each service instance; analyzing the service load rate according to the maximum connection number information supported by the service instance corresponding to each service instance and the service load quantity to obtain the service load rate corresponding to each service instance; and performing load equivalent division on each service instance according to a preset load grade division algorithm, and determining the load grade corresponding to each service instance.
Optionally, in a sixth implementation manner of the second aspect of the present invention, the instance sending module is specifically configured to: scanning the target service instance to determine a corresponding target service instance address; and downloading the target service instance from a preset database through the target service instance address, and transmitting the target service instance to the terminal.
A third aspect of the present invention provides a load balancing implementation device, including: a memory and at least one processor, the memory having instructions stored therein; the at least one processor calls the instructions in the memory to enable the load balancing implementation equipment to execute the load balancing implementation method.
A fourth aspect of the present invention provides a computer-readable storage medium, which stores instructions that, when executed on a computer, cause the computer to execute the load balancing implementation method described above.
In the technical scheme provided by the invention, a service instance calling request sent by a terminal is received, wherein the service instance calling request carries cluster identification information; determining a plurality of candidate clusters corresponding to the service instance calling request according to the cluster identification information; performing cluster state analysis on the plurality of candidate clusters to obtain a cluster state corresponding to each candidate cluster, and determining a target cluster corresponding to the service instance calling request according to the cluster state corresponding to each candidate cluster; acquiring a service instance list corresponding to the target cluster from a preset registry database, and determining a target service instance from the service instance list through a preset load balancing algorithm; and sending the target service instance to the terminal. In the embodiment of the invention, the target cluster is an established cluster, and the cluster identification information is added in the service instance calling request, so that when the service instance is called, the server can only obtain the target service instance from the calling target cluster corresponding to the cluster identification information, namely, the server can only call the service instance of the target cluster, and the calling target cluster is the cluster established by the completed cluster, thereby solving the problems of data loss or data abnormity caused by the direct calling of the service instance of the new cluster or the cross-cluster calling of the service instance of the new cluster in the existing service instance calling mode, simultaneously realizing the local priority principle of service instance calling, and obtaining the target service instance from the service instance list after obtaining the service instance list of the calling target cluster, wherein the calling target cluster can have a plurality of service frames, therefore, the server calls all the service instances of the target cluster to obtain a service instance list, a plurality of service instance lists are obtained, and then the obtained service instance lists are aggregated to obtain the target service instance corresponding to the service instance calling request. Wherein. When aggregating multiple service instance lists, attention is paid to combining the hash code values of the multiple instance lists so as to avoid that the aggregation efficiency is too low because the hash code values are all pulled from the multiple service instance lists each time.
Drawings
Fig. 1 is a schematic diagram of an embodiment of a load balancing implementation method in an embodiment of the present invention;
fig. 2 is a schematic diagram of another embodiment of a load balancing implementation method in an embodiment of the present invention;
fig. 3 is a schematic diagram of an embodiment of a load balancing implementation apparatus according to an embodiment of the present invention;
fig. 4 is a schematic diagram of another embodiment of a load balancing implementation apparatus according to an embodiment of the present invention;
fig. 5 is a schematic diagram of an embodiment of a load balancing implementation device in the embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a method, a device, equipment and a storage medium for realizing load balancing. The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises," "comprising," or "having," and any variations thereof, are intended to cover non-exclusive inclusions, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The embodiment of the application can acquire and process related data based on an artificial intelligence technology. Among them, Artificial Intelligence (AI) is a theory, method, technique and application system that simulates, extends and expands human Intelligence using a digital computer or a machine controlled by a digital computer, senses the environment, acquires knowledge and uses the knowledge to obtain the best result. The artificial intelligence infrastructure generally includes technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a robot technology, a biological recognition technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and the like.
For convenience of understanding, a specific flow of the embodiment of the present invention is described below, and referring to fig. 1, an embodiment of a load balancing implementation method in the embodiment of the present invention includes:
101. receiving a service instance calling request sent by a terminal, wherein the service instance calling request carries cluster identification information;
it is to be understood that the execution subject of the present invention may be a load balancing implementation apparatus, and may also be a server, which is not limited herein. The embodiment of the present invention is described by taking a server as an execution subject.
The cluster identification information can be automatically generated by the terminal, the terminal can automatically generate corresponding cluster identification information according to the network system where the terminal is located, additionally, the cluster identification information can also be set by the user independently, and the user sets the cluster identification information on the terminal independently according to the self requirement. And when the service instance calling requirement occurs, adding the cluster identification information to the service instance calling request. In the application, the server can receive the service instance calling request from the terminal in a wired connection mode or a wireless connection mode. It should be noted that the wireless connection means may include, but is not limited to, a 3G/4G connection, a WiFi connection, a bluetooth connection, and other wireless connection means. Specifically, when a user has a need to invoke a service instance, a service instance invocation request of a terminal is received, and cluster identification information is obtained from the service instance invocation request, it needs to be emphasized that, in order to further ensure the privacy and the security of the cluster identification information, the cluster identification information may also be stored in a node of a block chain.
102. Determining a plurality of candidate clusters corresponding to the service instance calling request according to the cluster identification information;
specifically, the server adds the cluster identification information to the service instance calling request, so that when the service instance is called, the server obtains the service instance from the calling candidate cluster corresponding to the cluster identification information.
103. Performing cluster state analysis on the plurality of candidate clusters to obtain a cluster state corresponding to each candidate cluster, and determining a target cluster corresponding to the service instance calling request according to the cluster state corresponding to each candidate cluster;
it should be noted that, the target cluster is a cluster that has already been built, by adding the cluster identification information in the service instance invocation request, when the service instance is invoked, the server obtains the target service instance from the invocation target cluster corresponding to the cluster identification information, that is, at this time, the server can only invoke the service instance of the target cluster, and the invocation target cluster is a cluster that has already been built by the cluster, so that the problem of data loss or data abnormality caused by directly invoking the service instance of the new cluster or invoking the service instance of the new cluster across clusters, which may occur in the existing service instance invocation mode, is solved, and the local priority principle of service instance invocation is also realized. In the embodiment of the present application, a cluster has two states: the built cluster is also called a new cluster, and the built cluster is also called a cluster, the building of the cluster is completed, the service instance in the cluster can be directly called by a user, and the new cluster is in a built state and does not have the capability of providing service, so the service instance in the new cluster can not be directly called. Specifically, the server performs cluster state analysis on the plurality of candidate clusters to obtain a cluster state corresponding to each candidate cluster, and determines a target cluster corresponding to the service instance invocation request according to the cluster state corresponding to each candidate cluster.
104. Acquiring a service instance list corresponding to a target cluster from a preset registry database, and determining a target service instance from the service instance list through a preset load balancing algorithm;
it should be noted that the preset registry database provides a Java-based user terminal component, and can very conveniently register and uniformly manage services to realize registration and discovery of services. All the service instances registered on the preset registry database are recorded in the service instance list of each preset registry database, and comprise the names, types, developer information, registration time, called times and the like of the service instances. Specifically, a service instance list of a calling target cluster is obtained, and a target service instance is obtained from the service instance list, wherein the calling target cluster may have a plurality of service frames, so that the server calls all the service instances of the target cluster to obtain the service instance list, obtain a plurality of service instance lists, and then aggregate the obtained service instance lists to obtain the target service instance corresponding to the service instance calling request. Wherein. When aggregating multiple service instance lists, attention is paid to combining the hash code values of the multiple instance lists so as to avoid that the aggregation efficiency is too low because the hash code values are all pulled from the multiple service instance lists each time.
105. And sending the target service instance to the terminal.
Specifically, the server acquires a service instance list of a service registration center cluster calling a target cluster, and after acquiring a target service instance from the service instance list, sends the acquired target service instance to the terminal.
In the embodiment of the invention, the target cluster is a built cluster, the cluster identification information is added in the service instance calling request, when the service instance is called, the server analyzes the cluster state of the candidate clusters to obtain the cluster state corresponding to each candidate cluster, and determines the target cluster corresponding to the service instance calling request according to the cluster state corresponding to each candidate cluster, and the calling target cluster is the cluster built by the cluster, so that the problem of data loss or data abnormity caused by directly calling the service instance of the new cluster or calling the service instance of the new cluster across clusters in the existing service instance calling mode is solved, the local priority principle of calling the service instance is realized, and the target service instance is obtained from the service instance list after the service instance list of the calling target cluster is obtained, the calling target cluster may have a plurality of service frames, so that the server simultaneously obtains a service instance list from all service instances of the calling target cluster to obtain a plurality of service instance lists, and then aggregates the obtained service instance lists to obtain a target service instance corresponding to the service instance calling request. Wherein. When aggregating multiple service instance lists, attention is paid to combining the hash code values of the multiple instance lists so as to avoid that the aggregation efficiency is too low because the hash code values are all pulled from the multiple service instance lists each time.
Referring to fig. 2, another embodiment of the load balancing implementation method in the embodiment of the present invention includes:
201. receiving a service instance calling request sent by a terminal, wherein the service instance calling request carries cluster identification information;
specifically, in this embodiment, the specific implementation of step 201 is similar to that of step 101, and is not described herein again.
Optionally, before step 201, the method may further include: receiving a plurality of service instance registration requests sent by a plurality of terminals, wherein the service instance registration requests carry cluster registration identification information, and each terminal corresponds to one service instance registration request; scanning the plurality of service instance registration requests to acquire a plurality of corresponding cluster registration identification information; determining a registration cluster corresponding to each service instance registration request according to the plurality of cluster registration identification information; and analyzing each service instance registration request, determining a service instance to be registered corresponding to each service instance registration request, and registering the service instance to be registered corresponding to each service instance registration request into a registration cluster corresponding to each service instance registration request.
Specifically, the user autonomously sets cluster registration identification information on the terminal according to the self requirement, and the server adds the cluster registration identification information to the service instance registration request when receiving the service instance registration request. Specifically, the registration target cluster may be a built cluster or a new cluster being built, and when a user has a need to register a service instance, the user receives a service instance registration request from a terminal and acquires cluster registration identification information from the service instance call request. The server adds the cluster registration identification information in the service instance registration request, so that the terminal can only register the service instance in the registration target cluster corresponding to the cluster registration identification information when the service instance is registered, and the local priority principle of service instance registration is realized. Specifically, cluster registration identification information is obtained in the service instance registration request, and a registration target cluster corresponding to the service instance registration request is determined according to the cluster registration identification information. And after determining a registration target cluster corresponding to the service instance registration request, registering the service instance in the registration target cluster.
202. Determining a plurality of candidate clusters corresponding to the service instance calling request according to the cluster identification information;
specifically, in this embodiment, the specific implementation of step 202 is similar to that of step 102, and is not described here again.
203. Performing cluster state analysis on the plurality of candidate clusters to obtain a cluster state corresponding to each candidate cluster, and determining a target cluster corresponding to the service instance calling request according to the cluster state corresponding to each candidate cluster;
specifically, in this embodiment, the specific implementation of step 203 is similar to that of step 103, and is not described herein again.
204. Service instance traversal query is carried out on a preset registration center database, and a plurality of service instances in the preset registration center database are obtained;
specifically, all the service instances in the service instance list are screened by adopting a load balancing strategy, so that the target service instance required to be called by the terminal can be accurately obtained. The load balancing policy is a scheme for providing a load balancing function for the server, and is usually implemented by using a load balancer, wherein a preset interface is provided inside the load balancer, and the preset interface is used for performing load balancer operation. Specifically, the server performs service instance traversal query on the preset registry database to obtain a plurality of service instances in the preset registry database.
205. Carrying out priority sequencing on a plurality of service instances, and determining a corresponding service instance list;
specifically, when the service instances are prioritized, the server acquires a ranking description file in the service instance call request, and then performs the prioritization on the service instances based on the ranking description file, it should be noted that the ranking description file is mainly used for indicating the service instance types that are preferentially loaded in different environments, and performing priority ranking according to the plurality of service instance types, thereby determining the corresponding service instance list.
206. Scanning a preset load balancing algorithm to determine a corresponding load balancing strategy;
it should be noted that the load balancing policy is a scheme for providing a load balancing function for the server, and is usually implemented by using a load balancer, where a preset interface is provided inside the load balancer, and the preset interface is used for performing load balancer operation, and specifically, the server scans a preset load balancing algorithm to obtain a corresponding load balancing policy, so as to facilitate implementation of subsequent load balancing.
207. Screening a plurality of service instances in the service instance list according to a priority order based on a load balancing strategy to obtain a target service instance meeting a preset condition;
specifically, the server performs service load quantity statistics on a plurality of service instances to obtain service load quantity corresponding to each service instance; the server calculates the load grade of each service instance through a preset load grade algorithm based on the service load quantity corresponding to each service instance to obtain the load grade corresponding to each service instance; and the server analyzes the load grade corresponding to each service instance, and screens the service instances according to the priority order through a load balancing strategy to obtain a target service instance meeting preset conditions.
The server monitors the state and counts the number of service connections, and reports the number to the registration center at regular time. The server receives monitoring data sent by the user terminal and the server at regular time, judges the connection condition of the current user terminal and the server according to the monitoring state, and pushes newly-added, changed, abnormal and disconnected information of a service instance to the online user terminal in real time; the registration center is used as a load balancing framework service publishing and service subscribing center and provides automatic service registration and subscribing functions for the service end and the user terminal respectively. Meanwhile, a service instance load grade classifier is arranged in the registration center, the current connection number information of the service instance pushed by the monitoring center is received, and the real-time service instance load rate is calculated. The registration center pushes an available service instance list to the user terminal, obtains the number of service loads in real time, calculates the load grades of the service instances, then the server analyzes the load grade corresponding to each service instance, and screens the service instances according to the priority order through a load balancing strategy to obtain a target service instance meeting preset conditions.
Optionally, performing service load quantity statistics on a plurality of service instances, and obtaining the service load quantity corresponding to each service instance may include: the server scans a plurality of service instances and determines service instance connection port information corresponding to each service instance; and the server analyzes the connection number information of the plurality of service instances through the service instance connection port information corresponding to each service instance to obtain the service load number corresponding to each service instance.
After the user terminal is started, a service subscription request is sent, the registration center receives the request, a service instance list is obtained, the service instance list is pushed to the user terminal, and the user terminal receives the service instance list information. The server counts the connection number information of the user terminal corresponding to the current service instance in real time, and pushes an instance connection number updating list to the registration center, the user terminal updates after receiving the service instance updating information, and then the server analyzes the connection number information of a plurality of service instances through the service instance connection port information corresponding to each service instance to obtain the service load number corresponding to each service instance.
Optionally, based on the service load quantity corresponding to each service instance, performing load level calculation on each service instance through a preset load level algorithm, and obtaining the load level corresponding to each service instance may include: the server acquires the maximum connection number information supported by the service instance corresponding to each service instance; the server carries out service load rate analysis through the maximum connection number information and the service load number supported by the service instance corresponding to each service instance to obtain the service load rate corresponding to each service instance; and the server performs load equivalent division on each service instance according to a preset load grade division algorithm to determine the load grade corresponding to each service instance.
The server acquires the information of the maximum connection number supported by the service instance corresponding to each service instance; analyzing the service load rate through the maximum connection number information supported by the service instance corresponding to each service instance and the service load number to obtain the service load rate corresponding to each service instance, converting the load rate into a corresponding load grade by the server, and expressing the current service load state in a quantifiable manner, wherein the current load rate of the service instance is calculated in the following manner: the load grade dividing module provides configurable load grade dividing standard according to the ratio of the number of the user terminals currently connected with the service instance to the maximum connection number configured by the service instance, and supports the user-defined dividing mode: the load grade dividing module provides a configurable file of the dividing standard, generates a user-defined load grade dividing standard, and then the server performs load equivalent division on each service instance according to a preset load grade dividing algorithm to determine the load grade corresponding to each service instance. It should be noted that, the higher the load rate and the higher the load level, the larger the current load of the service instance. The default load levels include level 1, level 2, level 3, level 4, and level 5 from high to low. The default load-rating criteria are: the load rate is within 20 percent, and the corresponding load grade is 5; the load rate is more than 20% and within 40%, and the corresponding load grade is 4; the load rate is more than 40% and within 60%, and the corresponding load grade is 3; the load rate is more than 60% and within 80%, and the corresponding load grade is 2; the load rate is more than 80%, and the corresponding load grade is 1. And calculating the current load rate of the service instance. And converting the load rate into a corresponding load grade to represent the current service load state in a quantifiable manner. And when no service instance with the lowest load exists in the service instance set, dividing the request of the user terminal equally according to the rule that the load of the service instance is high, the selected probability is lower, the load of the service instance is high, and the selected probability is lower, so that the service instance with the higher load grade is selected with lower probability, and the service instance with the lower load grade is selected with higher probability.
208. And sending the target service instance to the terminal.
Specifically, the server scans a target service instance and determines a corresponding target service instance address; and the server downloads the target service instance from the preset database through the target service instance address and transmits the target service instance to the terminal.
The server scans a target service instance and determines a corresponding target service instance address, it should be noted that the target service instance address is stored in a preset database, and the target service instance address is used for instructing the server to download the target service instance from the preset database, and further the server downloads the target service instance from the preset database through the target service instance address and transmits the target service instance to the terminal.
In the embodiment of the invention, the server is internally provided with the service instance load grade divider in the registration center, receives the current connection number information of the service instance pushed by the monitoring center and calculates the real-time service instance load rate. The registration center pushes an available service instance list to the user terminal, obtains the number of service loads in real time, calculates the load grades of the service instances, then the server analyzes the load grades corresponding to each service instance, screens the service instances according to the priority sequence through a load balancing strategy to obtain target service instances meeting preset conditions, can finish scheduling and using of the load service instances in a short time, and improves the efficiency of load scheduling.
Referring to fig. 3, an embodiment of a load balancing implementation apparatus according to an embodiment of the present invention includes:
a first receiving module 301, configured to receive a service instance invocation request sent by a terminal, where the service instance invocation request carries cluster identification information;
a first determining module 302, configured to determine, according to the cluster identification information, a plurality of candidate clusters corresponding to the service instance invocation request;
a cluster analysis module 303, configured to perform cluster state analysis on the multiple candidate clusters to obtain a cluster state corresponding to each candidate cluster, and determine, according to the cluster state corresponding to each candidate cluster, a target cluster corresponding to the service instance invocation request;
a list obtaining module 304, configured to obtain a service instance list corresponding to the target cluster from a preset registry database, and determine a target service instance from the service instance list through a preset load balancing algorithm;
an instance sending module 305, configured to send the target service instance to the terminal.
Referring to fig. 4, another embodiment of the load balancing implementation apparatus in the embodiment of the present invention includes:
a first receiving module 301, configured to receive a service instance invocation request sent by a terminal, where the service instance invocation request carries cluster identification information;
a first determining module 302, configured to determine, according to the cluster identification information, a plurality of candidate clusters corresponding to the service instance invocation request;
a cluster analysis module 303, configured to perform cluster state analysis on the multiple candidate clusters to obtain a cluster state corresponding to each candidate cluster, and determine, according to the cluster state corresponding to each candidate cluster, a target cluster corresponding to the service instance invocation request;
a list obtaining module 304, configured to obtain a service instance list corresponding to the target cluster from a preset registry database, and determine a target service instance from the service instance list through a preset load balancing algorithm;
an instance sending module 305, configured to send the target service instance to the terminal.
Optionally, the load balancing implementation apparatus further includes:
a second receiving module 306, configured to receive multiple service instance registration requests sent by multiple terminals, where the service instance registration requests carry cluster registration identifier information, and each terminal corresponds to one service instance registration request;
a request scanning module 307, configured to scan the multiple service instance registration requests to obtain multiple corresponding cluster registration identifier information;
a second determining module 308, configured to determine, according to the multiple cluster registration identification information, a registration cluster corresponding to each service instance registration request;
the request analysis module 309 is configured to analyze each service instance registration request, determine a service instance to be registered corresponding to each service instance registration request, and register the service instance to be registered corresponding to each service instance registration request in the registration cluster corresponding to each service instance registration request.
Optionally, the list obtaining module 304 includes:
the query unit 3041 is configured to perform service instance traversal query on the preset registry database, and acquire a plurality of service instances in the preset registry database;
a sorting unit 3042, configured to perform priority sorting on the multiple service instances, and determine a corresponding service instance list;
a scanning unit 3043, configured to scan a preset load balancing algorithm and determine a corresponding load balancing policy;
the screening unit 3044 is configured to screen, based on the load balancing policy, the multiple service instances in the service instance list according to the priority order, so as to obtain a target service instance meeting a preset condition.
Optionally, the screening unit 3034 includes:
a statistics subunit 30441, configured to perform service load quantity statistics on the multiple service instances to obtain a service load quantity corresponding to each service instance;
a computing subunit 30442, configured to perform load level calculation on each service instance through a preset load level algorithm based on the service load quantity corresponding to each service instance, to obtain a load level corresponding to each service instance;
the analyzing subunit 30443 analyzes the load level corresponding to each service instance, and screens the plurality of service instances according to the priority order by using the load balancing policy to obtain a target service instance meeting preset conditions.
Optionally, the statistics subunit 30441 is specifically configured to:
scanning the plurality of service instances, and determining service instance connection port information corresponding to each service instance; and analyzing the connection number information of the plurality of service instances through the service instance connection port information corresponding to each service instance to obtain the service load number corresponding to each service instance.
Optionally, the computing subunit 30442 is specifically configured to:
obtaining the maximum connection number supported by the service instance corresponding to each service instance; analyzing the service load rate according to the maximum connection number information supported by the service instance corresponding to each service instance and the service load quantity to obtain the service load rate corresponding to each service instance; and performing load equivalent division on each service instance according to a preset load grade division algorithm, and determining the load grade corresponding to each service instance.
Optionally, the instance sending module 305 is specifically configured to:
scanning the target service instance to determine a corresponding target service instance address; and downloading the target service instance from a preset database through the target service instance address, and transmitting the target service instance to the terminal.
Fig. 5 is a schematic structural diagram of a load balancing implementation apparatus according to an embodiment of the present invention, where the load balancing implementation apparatus 500 may generate relatively large differences due to different configurations or performances, and may include one or more processors (CPUs) 510 (e.g., one or more processors) and a memory 520, and one or more storage media 530 (e.g., one or more mass storage devices) storing applications 533 or data 532. Memory 520 and storage media 530 may be, among other things, transient or persistent storage. The program stored in the storage medium 530 may include one or more modules (not shown), and each module may include a series of instruction operations for the load balancing implementation apparatus 500. Still further, the processor 510 may be configured to communicate with the storage medium 530, and execute a series of instruction operations in the storage medium 530 on the load balancing implementation apparatus 500.
The load balancing implementation 500 may also include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input-output interfaces 560, and/or one or more operating systems 531, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, and so forth. Those skilled in the art will appreciate that the load balancing implementation architecture illustrated in fig. 5 does not constitute a limitation of the load balancing implementation, and may include more or fewer components than those illustrated, or some components in combination, or a different arrangement of components.
The invention further provides a load balancing implementation device, which includes a memory and a processor, where the memory stores computer readable instructions, and the computer readable instructions, when executed by the processor, cause the processor to execute the steps of the load balancing implementation method in the foregoing embodiments.
The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium, and may also be a volatile computer-readable storage medium, having stored therein instructions, which, when executed on a computer, cause the computer to perform the steps of the load balancing implementation method.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. The Blockchain (Blockchain), which is essentially a decentralized database, is a string of data blocks associated by using a cryptographic method, each data block contains information of a batch of network transactions for verifying the validity (anti-counterfeiting) of the information and generating a next block, and the Blockchain may include a Blockchain underlying platform, a platform product service layer, an application service layer, and the like.

Claims (10)

1. A method for implementing load balancing is characterized in that the method comprises the following steps:
receiving a service instance calling request sent by a terminal, wherein the service instance calling request carries cluster identification information;
determining a plurality of candidate clusters corresponding to the service instance calling request according to the cluster identification information;
performing cluster state analysis on the plurality of candidate clusters to obtain a cluster state corresponding to each candidate cluster, and determining a target cluster corresponding to the service instance calling request according to the cluster state corresponding to each candidate cluster;
acquiring a service instance list corresponding to the target cluster from a preset registry database, and determining a target service instance from the service instance list through a preset load balancing algorithm;
and sending the target service instance to the terminal.
2. The method according to claim 1, wherein before the service instance invocation request sent by the receiving terminal, where the service instance invocation request carries cluster identification information, the method further comprises:
receiving a plurality of service instance registration requests sent by a plurality of terminals, wherein the service instance registration requests carry cluster registration identification information, and each terminal corresponds to one service instance registration request;
scanning the service instance registration requests to acquire a plurality of corresponding cluster registration identification information;
determining a registration cluster corresponding to each service instance registration request according to the plurality of cluster registration identification information;
analyzing each service instance registration request, determining a service instance to be registered corresponding to each service instance registration request, and registering the service instance to be registered corresponding to each service instance registration request in a registration cluster corresponding to each service instance registration request.
3. The method of claim 1, wherein the obtaining a service instance list corresponding to the target cluster from a preset registry database, and determining a target service instance from the service instance list through a preset load balancing algorithm comprises:
performing service instance traversal query on the preset registration center database to acquire a plurality of service instances in the preset registration center database;
the service instances are subjected to priority sequencing, and a corresponding service instance list is determined;
scanning a preset load balancing algorithm to determine a corresponding load balancing strategy;
and screening the plurality of service instances in the service instance list according to the priority order based on the load balancing strategy to obtain a target service instance meeting preset conditions.
4. The method according to claim 3, wherein the screening the plurality of service instances in the service instance list according to the priority order based on the load balancing policy to obtain the target service instance meeting the preset condition comprises:
counting the service load quantity of the plurality of service instances to obtain the service load quantity corresponding to each service instance;
based on the service load quantity corresponding to each service instance, carrying out load grade calculation on each service instance through a preset load grade algorithm to obtain the load grade corresponding to each service instance;
and analyzing the load grade corresponding to each service instance, and screening the plurality of service instances according to the priority order through the load balancing strategy to obtain a target service instance meeting preset conditions.
5. The method of claim 4, wherein the performing statistics on the service load quantity of the plurality of service instances to obtain the service load quantity corresponding to each service instance comprises:
scanning the plurality of service instances, and determining service instance connection port information corresponding to each service instance;
and analyzing the connection number information of the plurality of service instances through the service instance connection port information corresponding to each service instance to obtain the service load number corresponding to each service instance.
6. The method according to claim 4, wherein the obtaining the load level corresponding to each service instance by performing load level calculation on each service instance through a preset load level algorithm based on the service load quantity corresponding to each service instance comprises:
obtaining the maximum connection number supported by the service instance corresponding to each service instance;
analyzing the service load rate according to the maximum connection number information supported by the service instance corresponding to each service instance and the service load quantity to obtain the service load rate corresponding to each service instance;
and performing load equivalent division on each service instance according to a preset load grade division algorithm, and determining the load grade corresponding to each service instance.
7. The method for implementing load balancing according to claims 1-6, wherein the sending the target service instance to the terminal includes:
scanning the target service instance to determine a corresponding target service instance address;
and downloading the target service instance from a preset database through the target service instance address, and transmitting the target service instance to the terminal.
8. A load balancing implementation apparatus, comprising:
the first receiving module is used for receiving a service instance calling request sent by a terminal, wherein the service instance calling request carries cluster identification information;
a first determining module, configured to determine, according to the cluster identification information, a plurality of candidate clusters corresponding to the service instance invocation request;
the cluster analysis module is used for carrying out cluster state analysis on the candidate clusters to obtain a cluster state corresponding to each candidate cluster, and determining a target cluster corresponding to the service instance calling request according to the cluster state corresponding to each candidate cluster;
the list acquisition module is used for acquiring a service instance list corresponding to the target cluster from a preset registry database and determining a target service instance from the service instance list through a preset load balancing algorithm;
and the instance sending module is used for sending the target service instance to the terminal.
9. A load balancing implementation device, wherein the load balancing implementation device comprises: a memory and at least one processor, the memory having instructions stored therein;
the at least one processor calls the instructions in the memory to cause the load balancing implementation device to perform the load balancing implementation method according to any one of claims 1-7.
10. A computer-readable storage medium having instructions stored thereon, wherein the instructions, when executed by a processor, implement a method for load balancing according to any one of claims 1-7.
CN202111225160.2A 2021-10-21 2021-10-21 Load balancing implementation method, device, equipment and storage medium Pending CN113934512A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111225160.2A CN113934512A (en) 2021-10-21 2021-10-21 Load balancing implementation method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111225160.2A CN113934512A (en) 2021-10-21 2021-10-21 Load balancing implementation method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113934512A true CN113934512A (en) 2022-01-14

Family

ID=79280675

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111225160.2A Pending CN113934512A (en) 2021-10-21 2021-10-21 Load balancing implementation method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113934512A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114884886A (en) * 2022-05-26 2022-08-09 中国联合网络通信集团有限公司 Micro-service load balancing method, device, equipment, system and storage medium
CN114979157A (en) * 2022-05-17 2022-08-30 南昌智能新能源汽车研究院 Load balancing method, system, storage medium and computer based on SOME/IP protocol

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114979157A (en) * 2022-05-17 2022-08-30 南昌智能新能源汽车研究院 Load balancing method, system, storage medium and computer based on SOME/IP protocol
CN114979157B (en) * 2022-05-17 2024-03-22 南昌智能新能源汽车研究院 Load balancing method, system, storage medium and computer based on SOME/IP protocol
CN114884886A (en) * 2022-05-26 2022-08-09 中国联合网络通信集团有限公司 Micro-service load balancing method, device, equipment, system and storage medium

Similar Documents

Publication Publication Date Title
CN108776934B (en) Distributed data calculation method and device, computer equipment and readable storage medium
KR101614052B1 (en) System and method for configuring cloud computing systems
US20160253220A1 (en) Data center operation
Flores et al. Evidence-aware mobile computational offloading
CN113934512A (en) Load balancing implementation method, device, equipment and storage medium
US20140047084A1 (en) System and method for modifying a hardware configuration of a cloud computing system
CN108255707B (en) Development role creating method, device, equipment and storage medium of test case
CN112162865A (en) Server scheduling method and device and server
JP4343983B2 (en) Network management apparatus and network management method
US20140047227A1 (en) System and method for configuring boot-time parameters of nodes of a cloud computing system
US11106439B2 (en) Offload server and offload program
CN111444019A (en) Cloud-end-collaborative deep learning model distributed training method and system
CN113867600A (en) Development method and device for processing streaming data and computer equipment
CN113419818B (en) Basic component deployment method, device, server and storage medium
CN112527642A (en) Performance test index data display method, device, equipment and storage medium
CN113704077A (en) Test case generation method and device
CN116700920A (en) Cloud primary hybrid deployment cluster resource scheduling method and device
CN115185611A (en) Method, device, system and equipment for dynamic loading of service grid proxy configuration
US20220182290A1 (en) Status sharing in a resilience framework
CN115952098A (en) Performance test tuning scheme recommendation method and system
CN111294250B (en) Pressure testing method, device and system
CN111381831B (en) Application deployment method and server
CN110247802B (en) Resource configuration method and device for cloud service single-machine environment
CN113791961A (en) Data acquisition method, device and equipment based on microservice and storage medium
Pandey et al. Here, there, anywhere: Profiling-driven services to tame the heterogeneity of edge applications

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