CN114884886B - Micro-service load balancing method, device, equipment, system and storage medium - Google Patents

Micro-service load balancing method, device, equipment, system and storage medium Download PDF

Info

Publication number
CN114884886B
CN114884886B CN202210582253.9A CN202210582253A CN114884886B CN 114884886 B CN114884886 B CN 114884886B CN 202210582253 A CN202210582253 A CN 202210582253A CN 114884886 B CN114884886 B CN 114884886B
Authority
CN
China
Prior art keywords
micro
information
service
task
task request
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
CN202210582253.9A
Other languages
Chinese (zh)
Other versions
CN114884886A (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.)
China United Network Communications Group Co Ltd
Unicom Digital Technology Co Ltd
China Unicom Internet of Things Corp Ltd
Original Assignee
China United Network Communications Group Co Ltd
Unicom Digital Technology Co Ltd
China Unicom Internet of Things Corp 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 China United Network Communications Group Co Ltd, Unicom Digital Technology Co Ltd, China Unicom Internet of Things Corp Ltd filed Critical China United Network Communications Group Co Ltd
Priority to CN202210582253.9A priority Critical patent/CN114884886B/en
Publication of CN114884886A publication Critical patent/CN114884886A/en
Application granted granted Critical
Publication of CN114884886B publication Critical patent/CN114884886B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/12Avoiding congestion; Recovering from congestion
    • H04L47/125Avoiding congestion; Recovering from congestion by balancing the load, e.g. traffic engineering
    • 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
    • H04L67/1008Server selection for load balancing based on parameters of servers, e.g. available memory or workload
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer And Data Communications (AREA)

Abstract

According to the micro-service load balancing method, device, equipment, system and storage medium, the characteristic information of the task request sent by the micro-service load balancing model processing terminal and the load state information corresponding to all original target servers capable of processing the task request in the micro-service cluster are used for obtaining the estimated time of each original target server for processing the task request, the target server information corresponding to the shortest estimated time is obtained according to the estimated time, so that the micro-service cluster is controlled to control the corresponding target server to process the task request according to the target server information, the response time of each server to the task request is estimated by utilizing the micro-service load balancing model under the condition that the characteristic information of the task request and the load state information of the server are considered simultaneously, the diversity of reference information is improved, the accuracy of the target servers for determining the task request is guaranteed, the running time of the micro-service cluster is reduced, and the running efficiency is improved.

Description

Micro-service load balancing method, device, equipment, system and storage medium
Technical Field
The present disclosure relates to the field of cloud computing micro services, and in particular, to a method, an apparatus, a device, a system, and a storage medium for balancing micro service load.
Background
In recent years, in a new technological revolution and industry change surge caused by a new generation of information technology represented by big data and cloud computing, a micro-service technology with independent deployment capability is applied and developed. Micro-service technology can decompose a single application program into a group of independent micro-services, and complex functions of the application program are jointly realized through mutual coordination among each micro-service. Each micro-service can be deployed on a single server or on a micro-service cluster composed of different servers.
In the running process of the micro-service cluster, as time is accumulated and the task amount is increased, load imbalance phenomenon occurs among servers in the cluster, so that when the cluster deploys a received task request on a server with a larger load, the task request cannot be processed in time, and the response time of the cluster to the task request is increased. In order to improve the efficiency of cluster processing tasks, a server with smaller load can be determined in a cluster through a load balancing algorithm when a case is deployed, and the task is distributed to the determined server, so that the relative balance of the loads of the servers in the cluster is maintained. The existing load balancing algorithm distributes tasks according to fixed proportion and sequence or according to performance indexes of servers in the cluster, and can not dynamically select the server with highest processing efficiency from the cluster according to specific task requests, and still can not effectively improve the processing efficiency of the cluster.
Disclosure of Invention
The application provides a method, a device, equipment, a system and a storage medium for balancing micro-service load, which are used for solving the technical problem of improving the processing efficiency of a micro-service cluster.
In a first aspect, the present application provides a method for balancing micro-service load, where the method is applied to an electronic device, and the method includes:
acquiring a task request sent by a terminal, wherein the task request comprises characteristic information;
according to the characteristic information, load state information corresponding to all original target servers capable of processing task requests in the micro-service cluster is obtained;
processing the characteristic information and the load state information by utilizing a micro-service load balancing model to obtain estimated time for processing task requests by each original target server;
comparing the estimated time, obtaining target server information corresponding to the shortest estimated time, generating a task execution instruction according to the target server information and the task request, and sending the task execution instruction to the micro-server cluster; the task execution instruction is used for controlling the micro-service cluster to control the corresponding target server to process the task request according to the target server information.
In the technical scheme, the electronic equipment considers the influence of the load state information of the server on the response time of the task request and also considers the influence of the characteristic information of the task request on the response time, so that after a micro-service load balancing model which represents the association relation among the characteristic information of the task request, the load state information of the server capable of processing the task request and the response time of the server on the task request is established, when the terminal sends the task request, the model can estimate the response time of each server according to the characteristic information and the load state information of each server so as to obtain the target server with the shortest response time, and the task request is prevented from being wrongly distributed to the server with better load state information but the task with the characteristic is processed at a low speed, thereby improving the overall processing efficiency of the micro-service cluster.
Optionally, according to the feature information, load state information corresponding to all original target servers capable of processing the task request in the micro service cluster is obtained, which specifically includes:
obtaining identifiers of all servers, load state information corresponding to each identifier and a first mapping relation;
according to the characteristic information, obtaining the identification of all original target servers capable of processing task requests in the micro-service cluster;
and obtaining the load state information corresponding to the identification of the original target server according to the identification of the original target server and the first mapping relation.
Optionally, according to the feature information, obtaining the identifiers of all original target servers capable of processing the task request in the micro service cluster specifically includes:
acquiring function information from the feature information, and generating an available micro-service instance query instruction according to the function information;
sending an available micro-service instance query instruction to service registration equipment; the available micro-service instance inquiry instruction is used for controlling the service registration equipment to inquire all original target server identifications corresponding to the function information in a local micro-service function mapping table;
and receiving the identification of all original target servers capable of processing the task request in the micro service cluster sent by the service registration equipment.
Optionally, obtaining identifiers of all servers, load state information corresponding to each identifier, and a first mapping relationship specifically includes:
acquiring identifiers of all servers sent by a micro-service cluster, performance data corresponding to the identifiers and a second mapping relation; the performance data includes occupied performance data and unoccupied performance data;
acquiring load state information corresponding to each identifier according to occupied performance data and unoccupied performance data corresponding to each identifier;
and establishing a first mapping relation between the identifier of the server and the load state information corresponding to the identifier according to the load state information corresponding to each identifier, the identifier of the server and the second mapping relation.
Optionally, the processing feature information and the load state information by using the micro-service load balancing model are utilized to obtain the estimated time of each original target server for processing the task request, which specifically comprises the following steps:
task type information is obtained from the characteristic information;
obtaining a processor utilization rate demand parameter according to the task type information and the task parameter mapping table; the task parameter mapping table represents the mapping relation between the task type information and the processor utilization rate demand parameters;
and processing the processor utilization rate demand parameter and the load state information by utilizing the micro-service load balancing model to obtain the estimated time of processing the task request by each original target server.
Optionally, the method includes using a micro-service load balancing model to process the processor utilization rate demand parameter and each load state information, and obtaining estimated time of each original target server for processing the task request, wherein the estimated time specifically includes:
obtaining model input parameters corresponding to each original target server according to the load state information and the processor utilization rate demand parameters; the model input parameters comprise processor utilization rate demand parameters and load state information corresponding to an original target server;
and processing model input parameters by using the micro-service load balancing model to obtain the estimated time of each original target server for processing the task request.
Optionally, the method further comprises:
obtaining original response information sent by a micro-service cluster; the original response information is information generated after the target server processes the task request;
converting the data type of the original response information by using a data type mapping table to obtain intermediate response information of the target type; the data type mapping table represents the mapping relation between the original response information and the intermediate response information;
and screening the effective information from the intermediate response information and sending the effective information to the terminal.
According to the technical scheme, the electronic equipment obtains the load state information of the server capable of processing the task request through the information stored in the service registration equipment and the information sent by the micro-service cluster, so that the estimation time of the micro-service load balancing model to the invalid server is saved, secondly, the electronic equipment carries out datamation on the task type information of the task request to obtain the processor utilization rate demand parameter, and the micro-service load balancing model is beneficial to processing the task type information, so that the model is ensured to utilize the processor utilization rate demand parameter and the load state information to estimate the response time, the acquisition of the target server under the consideration of various factors is realized, the selection accuracy of the server with the shortest response time in the micro-service cluster is improved, and the processing efficiency of the micro-service cluster is improved.
In a second aspect, the present application provides a micro-service load balancing apparatus, including:
the acquisition module is used for acquiring a task request sent by the terminal, wherein the task request comprises characteristic information;
the processing module is used for obtaining the load state information corresponding to all original target servers capable of processing the task requests in the micro-service cluster according to the characteristic information;
the processing module is also used for processing the characteristic information and the load state information by utilizing the micro-service load balancing model to obtain the estimated time of processing the task request by each original target server;
the processing module is also used for comparing the estimated time, obtaining target server information corresponding to the shortest estimated time, generating a task execution instruction according to the target server information and the task request, and sending the task execution instruction to the micro-server cluster; the task execution instruction is used for controlling the micro-service cluster to control the corresponding target server to process the task request according to the target server information.
In a third aspect, the present application provides an electronic device, comprising: a processor and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor, when executing the computer-executable instructions, is configured to implement the micro-service load balancing method according to the first aspect.
In a fourth aspect, the present application provides a micro-service processing system, including the electronic device, the client, and the micro-service cluster related to the third aspect, where the micro-service cluster includes a service registration device;
or alternatively
Including the electronic device, the client, the micro service cluster, and the service registration device according to the third aspect.
In a fifth aspect, the present application provides a computer readable storage medium having stored therein computer instructions which, when executed by a processor, are configured to implement the micro-service load balancing method according to the first aspect.
According to the micro-service load balancing method, device, equipment, system and storage medium, the task request sent by the terminal and the characteristic information in the task request are obtained, the load state information corresponding to all original target servers capable of processing the task request in the micro-service cluster is obtained according to the characteristic information, the characteristic information and the load state information are processed by utilizing the micro-service load balancing model, the estimated time of processing the task request by all original target servers is obtained, the estimated time is compared, the target server information corresponding to the shortest estimated time is obtained, the task execution instruction is generated according to the target server information and the task request, and the task execution instruction is sent to the micro-service cluster so as to control the micro-service cluster to control the corresponding target servers to process the task request according to the target server information, so that the response time of each server to the task request is estimated by utilizing the micro-service load balancing model under the condition that the characteristic information of the task request and the load state information of the servers are considered simultaneously, the diversity of the reference information is improved, the accuracy of the target servers for determining the task request is ensured, and the running time of the micro-service cluster is reduced.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
Fig. 1 is an application scenario schematic diagram of a micro-service load balancing method provided in the present application;
FIG. 2 is a flow chart of a method for balancing micro-service load according to an exemplary embodiment of the present application;
FIG. 3 is a flow chart of a method for balancing micro-service load according to another exemplary embodiment of the present application;
fig. 4 is a signaling interaction diagram of a micro-service load balancing method according to another exemplary embodiment of the present application;
fig. 5 is a schematic structural diagram of a micro-service load balancing device according to an exemplary embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a micro service processing system according to an embodiment of the present application.
Specific embodiments thereof have been shown by way of example in the drawings and will herein be described in more detail. These drawings and the written description are not intended to limit the scope of the inventive concepts in any way, but to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as detailed in the accompanying claims.
The embodiment of the application provides a method, a device and a storage medium for balancing micro-service load, aiming at solving the problem of improving the processing efficiency of a micro-service cluster. The technical conception of the application is as follows: in the method, the relation between the characteristic information, the load state information and the response time corresponding to the information of the task request is considered, a micro-service load balancing model is constructed, so that before the micro-service cluster obtains and processes the task request sent by the terminal, the electronic equipment utilizes the micro-service load balancing model to estimate the processing time of each server, and accordingly the target server in the micro-service cluster corresponding to the shortest estimated time is determined, so that the target server processes the task request.
Fig. 1 is an application scenario diagram of a micro service load balancing method provided in the present application, as shown in fig. 1, where the application scenario diagram includes a terminal 10, an electronic device 11, a micro service cluster 12, and a service registration device 13, where the micro service cluster 12 includes a micro service cluster control device 121 and at least one micro service server, and in the application scenario shown in fig. 1, the number of micro service servers is 2, and includes a first micro service server 122 and a second micro service server 123. The electronic device 11 is communicatively connected to the terminal 10, the micro service cluster 12, and the service registration device 13, respectively, and the micro service cluster 12 is communicatively connected to the service registration device 13.
The terminal 10 is installed with an application program, and a server system framework corresponding to the application program is installed on the micro service cluster 12 to provide corresponding technical support and services for the application program. When the terminal 10 sends a task request to the micro service cluster 12 during the process of running the application program, the terminal 10 sends the task request to the electronic device 11, and after the electronic device 11 analyzes the task request and the current running state of the micro service cluster 12, the target server capable of processing the task request fastest in the micro service cluster 12 and responding to the task request is determined. The electronic device 11 transmits the obtained task request to the target server, receives the response information after the target server processes the task request, and returns the effective information in the response information to the terminal 10.
In the process of analyzing the task request and the current running state of the micro service cluster 12, the electronic device 11 obtains feature information of the request from the task request, and sends the feature information to the service registration device 13, so that the service registration device 13 queries locally to obtain information of an original target server where a micro service instance capable of processing the task request is deployed. The electronic device 11 also obtains the load status information of each server in the micro service cluster 12 from the micro service cluster control device 121 in the cluster, and screens the load status information of the original target server from the load status information. The electronic device 11 processes the characteristic information of the task request and the load state information of each original target server by using a locally stored and trained micro-service load balancing model, and obtains the estimated time of processing the task request by each original target server by using the model. The electronic device 11 compares the estimated times, and determines the server with the shortest time as the target server, so that the target server processes the task request.
In the application scene, when the electronic equipment determines the target server running the task request, the influence of the load state information of each server in the micro-service cluster on the response information is considered, the influence of the characteristic information of the task request on the response information is also considered, the diversity of the input information of the micro-service load balancing model for estimating the response time is improved, the accuracy of selecting the optimal target server is improved accordingly, and the processing efficiency of the micro-service cluster is improved.
Fig. 2 is a flowchart of a micro-service load balancing method according to an exemplary embodiment of the present application. As shown in fig. 2, the micro-service load balancing method provided in the present application includes:
s201, the electronic equipment acquires a task request sent by the terminal.
The task request is a request sent by the terminal to a micro service cluster in the process of running the application program, and the micro service cluster is provided with a micro service system frame corresponding to the application program. The task request includes feature information.
S202, the electronic equipment obtains load state information corresponding to all original target servers capable of processing task requests in the micro-service cluster according to the characteristic information.
Wherein the characteristic information is obtained from step S201.
The micro service cluster comprises at least one micro service instance, and when the micro service instance can process the task request in the step S201, the server for deploying the micro service instance has an association relationship with the task request, and the server for deploying the micro service instance has an association relationship with the feature information. Further, in the running process of the server for deploying the micro service instance, the load state of the server changes in real time along with the task which is currently processed, so that the electronic equipment obtains information of all servers which are associated with the characteristic information and can process the task request according to the characteristic information and the association relation, the server for obtaining the information is determined to be an original target server, and the obtained information comprises load state information corresponding to each original target server.
S203, the electronic equipment processes the characteristic information and the load state information by utilizing the micro-service load balancing model to obtain estimated time for processing the task request by each original target server.
Wherein the characteristic information is obtained from step S201, and each load status information is obtained from step S202.
The micro service load balancing model is a model for estimating the time from the acquisition of a task request to the processing of the completion of the task request of each original target server. The model is a pre-trained, locally stored model.
S204, the electronic equipment compares the estimated time, obtains target server information corresponding to the shortest estimated time, generates a task execution instruction according to the target server information and the task request, and sends the task execution instruction to the micro-server cluster.
The estimated time is the estimated time corresponding to each original target server obtained in step S203.
The electronic equipment compares the estimated time to obtain the shortest estimated time, and obtains a server corresponding to the time according to the shortest estimated time. The electronic device determines the server as a target server.
The electronic device generates a task execution instruction according to the obtained target server and the task request obtained in step S201. The task execution instruction is used for controlling the micro-service cluster to control the corresponding target server to process the task request according to the target server information.
In the technical scheme, the electronic equipment considers the influence of the load state information of the server on the response time of the task request and also considers the influence of the characteristic information of the task request on the response time, so that after a micro-service load balancing model which represents the association relation among the characteristic information of the task request, the load state information of the server capable of processing the task request and the response time of the server on the task request is established, when the terminal sends the task request, the model can estimate the response time of each server according to the characteristic information and the load state information of each server so as to obtain the target server with the shortest response time, and the task request is prevented from being wrongly distributed to the server with better load state information but the task with the characteristic is processed at a low speed, thereby improving the overall processing efficiency of the micro-service cluster.
Fig. 3 is a flowchart of a micro-service load balancing method according to another exemplary embodiment of the present application, where an execution body of the method is an electronic device. As shown in fig. 3, the micro-service load balancing method provided in the present application includes:
s301, acquiring a task request sent by a terminal.
The task request is explained in detail in step S201, and will not be described herein.
S302, obtaining identifiers of all servers, load state information corresponding to the identifiers and a first mapping relation.
Wherein the identification of all servers is the identification of all servers contained in the micro-server cluster.
The load state information corresponding to each identifier represents the load state information of each server in the micro service cluster. The load state information represents information of a use state of the server, and includes a central processing unit (central processing unit, abbreviated as CPU) utilization, a memory utilization, and a disk utilization.
The first mapping relationship represents a mapping relationship between the identifier of each server and the load state information corresponding to each server.
More specifically, the process of the electronic device obtaining the identifiers of all the servers, the load status information corresponding to each identifier, and the first mapping relationship specifically includes steps S3021 to S3023:
s3021, obtaining identifiers of all servers sent by the micro service cluster, performance data corresponding to the identifiers and a second mapping relation.
The performance data corresponding to each identifier represents the operation state data of the necessary operation devices in the servers such as the CPU, the memory and the disk of each server. The performance data includes occupied performance data and unoccupied performance data. Wherein the occupied performance data represents data being used by the running device and the unoccupied performance data represents data not currently used by the running device. The running devices are different in type, and the corresponding occupied performance data and unoccupied performance data are different from each other.
The second mapping relation represents the mapping relation between each server identifier and the corresponding performance data of each server in the micro-service cluster.
S3022, obtaining load state information corresponding to each identifier according to occupied performance data and unoccupied performance data corresponding to each identifier.
Wherein the occupied performance data and the unoccupied performance data corresponding to each identifier are obtained from step S3021. More specifically, the occupied performance data corresponding to the CPU is CPU use time, and the unoccupied performance data corresponding to the CPU is CPU idle time; the occupied performance data corresponding to the memory is the memory usage amount, and the unoccupied performance data corresponding to the memory is the memory residual amount; the occupied performance data corresponding to the magnetic disk is the usage amount of the magnetic disk, and the unoccupied performance data corresponding to the magnetic disk is the residual amount of the magnetic disk.
The load state information corresponding to each identifier represents the running state data of all necessary running devices in each server, including CPU utilization rate, memory utilization rate and disk utilization rate.
The electronic equipment utilizes occupied performance data and unoccupied performance data corresponding to each identifier, and obtains load state information corresponding to each identifier by calculating the proportion of occupied performance data in the total performance data consisting of occupied performance data and unoccupied performance data. For example: the CPU utilization rate is the data obtained by dividing the CPU use time by the sum of the CPU use time and the CPU idle time.
More specifically, the load status data is greater than or equal to 0 and less than or equal to 1.
S3023, establishing a first mapping relation between the identifiers of the servers and the load state information corresponding to the identifiers according to the load state information corresponding to the identifiers, the identifiers of the servers and the second mapping relation.
Load status information corresponding to each identification is obtained from step S3022.
The identification of the server and the second mapping relationship are obtained from step S3021.
The electronic equipment obtains the mapping relation between the identifiers of all servers in the micro service cluster and the corresponding performance data of the servers according to the second mapping relation, determines the mapping relation between the identifiers and the load state information obtained by calculating the corresponding performance data according to the mapping relation, and determines the mapping relation as a first mapping relation.
S303, according to the characteristic information, the identification of all original target servers capable of processing the task request in the micro service cluster is obtained.
Wherein the feature information is the feature information of the task request obtained from step S301.
The electronic device may perform data analysis and feature extraction on the task request to obtain feature information of the task request, where the feature information includes function information and task type information. The function information is information indicating a target to be realized by the terminal through the task request. The task type information is information indicating the type of technology that processes the task request.
The identification of all original target servers in the micro service cluster that can process the task request is explained in detail in step S202, and will not be described here again.
More specifically, the process of the electronic device obtaining the identities of all the original target servers specifically includes steps S3031 to S3033:
s3031, obtaining function information from the feature information, and generating an available micro-service instance query instruction according to the function information.
The electronic device performs feature extraction on the task request obtained in step S301, and obtains functional information. The functional information is already explained in detail in step S303, and will not be described here again.
And the electronic equipment is used for inquiring all original target server identifications corresponding to the function information in a local micro-service function mapping table stored in the service registration equipment according to the micro-service embodiment inquiry instruction generated by the function information.
The micro service function mapping table contains the mapping relation between the function information and the micro service instance capable of realizing the function, wherein the micro service function mapping table also comprises the corresponding relation between the micro service instance and the identification of the server for deploying the instance, so that the electronic equipment can obtain the function information and the identification of the server capable of realizing the function from the micro service function mapping table, and the obtained server is determined as an original target server.
The service registration device obtains all micro service examples, a server for deploying each micro service example and related information of each example from the micro service cluster, and generates and stores a local mapping table according to all obtained information. More specifically, the service registration apparatus obtains the above information from the micro service cluster at preset time intervals and updates the micro service function mapping table with the information.
S3032, the available micro-service instance query instruction is sent to the service registration equipment.
The available micro service instance query instruction is obtained from step S3031, and the process of locally querying, by the service registration device, the identifiers of all the original target servers according to the instruction is explained in detail in step S3031, which is not described herein.
S3033, the identifications of all original target servers capable of processing the task requests in the micro service cluster sent by the service registration equipment are received.
Wherein the identities of all original target servers are obtained from step S3032.
S304, according to the identification of the original target server and the first mapping relation, load state information corresponding to the identification of the original target server is obtained.
Wherein the identification of the original target server is obtained from step S3033, and the first mapping relationship is obtained from step S3023.
And the electronic equipment obtains the load state information of all the servers capable of processing the task request according to the first mapping relation and the identification of the original target server capable of processing the task request.
S305, task type information is obtained from the feature information.
The feature information is obtained from step S303, and the feature information includes task type information, which is explained in detail in step S303, and is not described herein.
S306, obtaining the processor utilization rate demand parameters according to the task type information and the task parameter mapping table.
Wherein the task type information is obtained from step S305.
The task parameter mapping table represents a mapping relationship between task type information and processor utilization demand parameters.
The processor utilization rate demand parameter represents a parameter of the utilization rate of the CPU in the process of processing the task request by the server, and data corresponding to the parameter is data which is greater than or equal to 0 and less than or equal to 1. More specifically, when the task type of the task request is a CPU-intensive task, the server has a high CPU utilization in the process of processing the task request, and relatively, the processor utilization requirement parameter corresponding to the task request is data greater than a high utilization threshold and less than 1; when the task type of the task request is IO intensive task, the utilization rate of the CPU by the server in the process of processing the task request is low, and relatively, the processor utilization rate demand parameter corresponding to the task request is data which is larger than 0 and smaller than a low utilization rate threshold value.
S307, the utilization rate demand parameters of the processor and the information of each load state are processed by utilizing the micro-service load balancing model, and the estimated time of each original target server for processing the task request is obtained.
The micro-server load balancing model and the estimated time for each original target server to process the task request are explained in step S203, and are not described herein.
The processor utilization requirement parameter is obtained from step S306, and each load status information is obtained from step S304.
More specifically, the process of obtaining the estimated time by the electronic device using the micro-server load balancing model specifically includes steps S3071 to S3072:
s3071, obtaining model input parameters corresponding to each original target server according to the load state information and the processor utilization rate demand parameters.
Each load status information is obtained from step S304. The processor utilization requirement parameter is obtained from step S306.
The model input parameters are input parameters of the micro-service load balancing model, namely the micro-service load balancing model can estimate corresponding processing time according to the model input parameters, and the time is estimated time for each original target server to process task requests. The model input parameters comprise processor utilization demand parameters and load state information corresponding to the original target server. The number of groups of the model input parameters is the same as the number of the original target servers.
S3072, utilizing a micro-service load balancing model to process model input parameters, and obtaining estimated time of each original target server for processing task requests.
Wherein the model input parameters are obtained from step S3071. The micro-service balancing load model is the model involved in step S307.
The model is a trained model. In the process of establishing the model, the electronic equipment firstly establishes a data set for training the model according to response time when servers in different load states process different types of task requests, corresponding load state information and processor utilization rate demand parameters. The electronic device equally divides the data set into 10 parts, randomly takes out 9 parts from the data set, integrates the data set into a training set, and determines the rest 1 part as a test set.
Secondly, the electronic equipment establishes a corresponding model, namely R, according to the relation between response time, load state information and processor utilization rate demand parameters i =g(C i ,M i ,D i μ), wherein R is i Represents response time, C i Represents CPU utilization, M i Represents the utilization rate of the memory, D i The method is characterized in that the method comprises the steps of expressing the utilization rate of a disk, mu expressing the utilization rate demand parameter of a processor, and g (-) expressing the mapping relation between response time and the utilization rate of a memory, the utilization rate of the disk, the utilization rate of a CPU and the utilization rate demand parameter of the processor.
The electronic device trains the model using the Xgboost algorithm. More specifically, the electronic device trains the model by using a training set to obtain a first base learner, repeatedly trains by using each data in the training set on the basis of the first base learner, sequentially obtains a second base learner and a third base learner until the mth base learner, wherein the second base learner is a model for fitting residual data between the data in the training set and the data predicted by the first base learner, the third base learner is a model for fitting residual data between the data in the training set and the sum of the data predicted by the first base learner and the data predicted by the second base learner by the electronic device, and the rest base learners are similar. When the electronic equipment predicts the m-th basic learner, and does not meet the new basic learner training condition, determining a micro-service load balancing model as a strong learner consisting of the m-th basic learner, wherein the estimated time obtained by the model according to the input parameters is the sum of the estimated time of the m-th basic learner.
The electronic equipment takes the load state information in the test set and the processor utilization rate demand parameter as input parameters, controls the micro-service load balancing model to process the input parameters, obtains corresponding estimated time, and judges whether the model is successfully trained by comparing the real response time corresponding to the input parameters.
S308, comparing the estimated time, obtaining target server information corresponding to the shortest estimated time, generating a task execution instruction according to the target server information and the task request, and sending the task execution instruction to the micro-server cluster.
Wherein the estimated time is obtained from step S3072.
The electronic equipment compares the estimated time to obtain the shortest estimated time, and accordingly obtains a corresponding server, and the server is determined to be a target server.
The electronic device generates a task execution instruction according to the information of the target server and the task request obtained in the step S301, sends the instruction to the micro-service cluster, processes the task request with the target server in the micro-service cluster, and returns a processing result after the processing is completed.
The processing result is determined as the original response information in this step.
S309, obtaining original response information sent by the micro service cluster.
Wherein the original response information is obtained from step S308. The original response information is information generated after the target server processes the task request.
S310, converting the data type of the original response information by using the data type mapping table to obtain the intermediate response information of the target type.
Wherein, the data type mapping table represents the mapping relation between the original response information and the intermediate response information.
The intermediate response information is information which is converted from original response information into a data architecture applicable to an application program in the terminal. For example: the original response information generated by the target server is data of a character string class, when the electronic equipment returns the data to the terminal, the character string class data needs to be converted into Object class data, and then effective information is obtained from the data to be correspondingly sent, and the Object class data is intermediate response data.
S311, effective information is screened out from the intermediate response information, and the effective information is sent to the terminal.
Wherein, the intermediate response data is obtained from step S310, and the intermediate response information includes valid information, information indicating the data transmission state, and verification information, where the valid information is information available to an application program in the terminal.
In addition, aiming at task requests of the same task type, the electronic equipment respectively selects corresponding target servers by utilizing the micro-service load balancing method and the prior art provided by the application so as to obtain corresponding experimental results:
when the task sent by the client is a CPU intensive task, the target server selected using the micro-service load balancing method in the application processes the task request, the average response time is reduced by 39.8%, 14.2% and 18.6% compared to the polling algorithm, the queue waiting time predictive load algorithm and the shortest response time algorithm, respectively, and the throughput is improved by 34.7%, 8.6% and 25.3% respectively.
When the task sent by the client is an IO intensive task, the target server selected by the micro-service load balancing method is used for processing the task request, compared with a polling algorithm, a queue waiting time prediction load algorithm and a shortest response time algorithm, the average response time is reduced by 39.1%, 31.8% and 26.8%, and the throughput is improved by 7.7%, 23.3% and 33.9%, respectively.
According to the technical scheme, the electronic equipment obtains the load state information of the server capable of processing the task request through the information stored in the service registration equipment and the information sent by the micro-service cluster, so that the estimation time of the micro-service load balancing model to the invalid server is saved, secondly, the electronic equipment carries out datamation on the task type information of the task request to obtain the processor utilization rate demand parameter, and the micro-service load balancing model is beneficial to processing the task type information, so that the model is ensured to utilize the processor utilization rate demand parameter and the load state information to estimate the response time, the acquisition of the target server under the consideration of various factors is realized, the selection accuracy of the server with the shortest response time in the micro-service cluster is improved, and the processing efficiency of the micro-service cluster is improved.
Fig. 4 is a signaling interaction diagram of a micro service load balancing method according to another embodiment of the present application, where the method is information interaction among a terminal, an electronic device, a service registration device, and a micro service cluster. As shown in fig. 4, the method includes:
s401, the terminal sends a task request to the electronic equipment.
The task request is a request which is generated by the terminal according to the data received by the input unit and is sent to the micro-service cluster in the process of running the application program, and the task contained in the request is a request for carrying out data processing on the micro-service examples in the micro-service cluster.
When a terminal sends a task request to a micro-service cluster, the request is firstly received by a monitoring unit in the electronic equipment, wherein the monitoring unit is a module for monitoring signaling and data interaction in the electronic equipment.
S402, the electronic equipment analyzes the task request, acquires characteristic information from the task request, and generates an available micro-service example query instruction according to the functional information.
Wherein the task request is obtained from step S401.
After a monitoring unit in the electronic equipment obtains a task request, carrying out information filtering and safety verification on the task request by utilizing a service gateway, wherein the safety verification is that the electronic equipment checks risk information contained in the obtained task request, and the information filtering is that the electronic equipment filters validity of the task request so as to filter invalid and unidentifiable requests or misissued requests sent by a terminal.
After the task request passes the information filtering and the security verification of the service gateway, the gateway performs data extraction and feature extraction on the task request to obtain feature information of the task request, where the feature information includes function information and task type information, and the feature information is explained in detail in step S303 and is not described herein.
In order to obtain the information of the micro service instance of the server capable of processing the task request in the micro service cluster, the service gateway generates a micro service instance inquiry instruction according to the obtained characteristic information, wherein the instruction is used for inquiring whether the micro service instance of the task request capable of being processed exists in the micro service cluster in the information stored in the service registration equipment.
S403, the electronic equipment sends a micro-service instance query instruction to the service registration equipment.
Wherein, the micro service instance query instruction is obtained from step S402.
S404, the service registration device determines whether to deploy the corresponding micro service instance in the micro service cluster according to the micro service instance query instruction.
After obtaining the micro service instance query instruction sent in step S403, the service registration device obtains the feature information of the task request from the instruction, where the feature information includes the function information, and the function information is explained in step S303, which is not described herein again.
The service registration device inquires the function information in a local micro-service function mapping table, determines whether the function information exists in a micro-service instance associated with the function information, and obtains relevant information of a server for deploying the micro-service instance when the micro-service instance exists.
When the corresponding micro service instance is not deployed in the micro service cluster, the step S405 is entered, otherwise, the step S408 is entered.
S405, the service registration device returns a first query result to the electronic device.
The first query result is the result of a micro-service instance in the micro-service cluster that is not deployed to handle the task request.
S406, the electronic equipment generates reply information according to the first query result.
Wherein the first query result is obtained from step S405.
And the electronic equipment generates reply information according to the first query result, wherein the reply information indicates that the micro service cluster cannot process the task request in the step S401.
S407, the electronic equipment sends reply information to the terminal.
Wherein, the reply message is obtained from step S406.
S408, the service registration device returns a second query result to the electronic device.
The second query result comprises information of a micro service instance capable of processing the task request deployed in the micro service cluster and information of a server deploying the micro service instance.
S409, the electronic equipment obtains the number of all original target servers for deploying the micro-service instance and related information from the second query result.
Wherein the second query result is obtained from step S408.
And the electronic equipment obtains information of the server for deploying the micro-service instance from the second query result, wherein the information comprises identification information of the server.
And the electronic equipment determines the server obtained in the second query result as an original target server, and counts the number of the original target servers.
When the number of all original target servers deploying the micro service instance is equal to 1, step S410 is entered, and when the number is greater than 1, step S411 is entered.
S410, the electronic equipment determines the unique original target server as the target server, and generates a task execution instruction according to the information of the target server and the task request.
Wherein the unique original target server is obtained from step S409.
The target server designates a server for the electronic device that processes the task request in step S401.
The information of the target server is also obtained from step S409.
The task execution instruction is used for controlling the target server to process the task request.
After the completion of this step, the flow advances to step S421.
S411, the electronic equipment generates a load state information query instruction.
When the number of the original target servers of the micro-service examples deployed in the micro-service cluster for solving the task request is a plurality of, the electronic equipment screens out the optimal target server from the original target servers to process the task request according to the characteristic information of the task request and the load state information of each original target server.
Before the electronic device performs the screening operation, the electronic device needs to acquire the load state information of each original target server, so that the electronic device generates a load state information query instruction.
S412, the electronic equipment sends a load state information query instruction to the micro-service cluster.
Wherein the load status information query instruction is obtained from step S411.
S413, the micro service cluster acquires current performance data of all servers in the micro service cluster.
After the micro service cluster obtains the load status information query instruction sent in step S412, performance data of all servers stored in the local micro service cluster are obtained.
The performance data is explained in detail in step S3021, and will not be described here again.
And S414, the micro service cluster transmits the performance data to the electronic equipment.
The performance data is the performance data corresponding to all servers in the micro service cluster, which is obtained from step S413.
S415, the electronic equipment obtains the load state information corresponding to each original target server according to the performance data.
Wherein the performance data obtained by the electronic device is obtained from step S414.
And the electronic equipment screens out the performance data corresponding to each original target server from all the obtained performance data according to the identification information of the original target server obtained in the step S409.
The electronic device processes the performance data of the original target server to obtain corresponding load status information, where the process of processing is explained in detail in step S302, and will not be described herein.
S416, the electronic equipment obtains task type information from the task request.
Wherein the task type information is obtained from the feature information obtained in step 402.
S417, the electronic equipment obtains the processor utilization rate demand parameter according to the task type information and the task parameter mapping table.
The task type information is obtained from step S416, and the task parameter map represents a mapping relationship between the task type information and the processor utilization requirement parameter.
More specifically, the processor utilization requirement parameter is explained in detail in step S306, and will not be described here.
S418, the electronic equipment processes the processor utilization rate demand parameter and the load state information by utilizing the micro-service load balancing model, and the estimated time of processing the task request by each original target server is obtained.
The electronic device obtains the input parameters of the micro-service load balancing model by using the processor utilization requirement parameters obtained in step S417 and the load status information obtained in step S415, and the process of obtaining the parameters is explained in detail in step S3071, which is not described herein.
The electronic device processes the input parameters by using the micro-service load balancing model, and the detailed explanation in the process of obtaining the estimated time S3072 is not described herein.
S419, the electronic equipment compares the estimated time to obtain the target server information corresponding to the shortest estimated time.
The estimated time is the time for each original target server estimated from the model obtained in step S418 to process the task request.
The process of comparing the estimated time to obtain the information of the target server by the electronic device is explained in detail in step S308, which is not described herein.
S420, the electronic equipment generates a task execution instruction according to the target server information and the task request.
The target server information is obtained from step S419, and the task request is the task request obtained from step S402.
The task execution instruction is an instruction that controls a micro-service instance in the target server to process a task request.
S421, the electronic equipment sends a task execution instruction to the micro-service cluster.
Wherein the task execution instruction has been obtained in step S420.
S422, the micro service cluster judges the number of micro service instances deployed on the target server.
After obtaining the task execution instruction sent in step S421, the microservice cluster obtains the number of deployed microservice instances on the target server. When the number of micro service instances is 1, the process proceeds to step S424, and when the number is greater than 1, the process proceeds to step S423.
S423, the micro service cluster randomly selects one micro service instance.
S424, the micro service cluster controls the micro service instance to execute the task request, and generates original response information after execution is completed.
After the micro-service instance determines the micro-service instance for processing the task request, the task request is sent to a task queue of the micro-service instance, and the micro-service instance waits for processing.
When the micro service instance processing is completed, the original response information is generated, and the original response information is explained in detail in step S309, which is not described herein.
S425, the micro service cluster sends the original response information to the electronic device.
Wherein the original response information is obtained from step S424.
S426, the electronic equipment converts the data type of the original response information to obtain the intermediate response information of the target type.
The electronic device includes a service request receiving unit, which converts the original response information sent in step S425 into intermediate response information after receiving the original response information, where the intermediate response information is explained in detail in step S310, and is not described herein.
S427, the electronic equipment screens out effective information from the intermediate response information.
After the service request receiving unit in the electronic device obtains the intermediate response information, the information is sent to the monitoring unit, the monitoring unit extracts effective information from the intermediate response information, where the effective information is information available to an application program in the terminal, and a process of obtaining the effective information from the intermediate response information obtained in step S426 is explained in step S311, which is not described herein again.
And S428, the electronic equipment sends the effective information to the terminal.
More specifically, the listening unit in the electronic device sends the effective information obtained in step S427 to the terminal, and performs a corresponding operation after running in the application program of the terminal.
According to the technical scheme, the electronic equipment utilizes the micro-service load balancing model to estimate the response time of each server to the task request under the condition that the task request characteristic information and the load state information of the servers are simultaneously considered, so that the diversity of reference information is improved, the accuracy of a target server for processing the task request is ensured, the running time of a micro-service cluster is reduced, and the running efficiency is improved.
Fig. 5 is a schematic structural diagram of a micro-service load balancing apparatus according to an embodiment of the present application, where the micro-service load balancing apparatus 500 includes an obtaining module 501 and a processing module 502, where,
the obtaining module 501 is configured to obtain a task request sent by a terminal, where the task request includes feature information.
And the processing module 502 is configured to obtain, according to the feature information, load state information corresponding to all original target servers capable of processing the task request in the micro service cluster.
The processing module 502 is further configured to process the feature information and the load status information by using a micro-service load balancing model, so as to obtain estimated time for processing the task request by each original target server.
The processing module 502 is further configured to compare the estimated time, obtain target server information corresponding to the shortest estimated time, generate a task execution instruction according to the target server information and the task request, and send the task execution instruction to the micro-server cluster; the task execution instruction is used for controlling the micro-service cluster to control the corresponding target server to process the task request according to the target server information.
In one embodiment, the processing module 502 is specifically configured to:
obtaining identifiers of all servers, load state information corresponding to each identifier and a first mapping relation;
according to the characteristic information, obtaining the identification of all original target servers capable of processing task requests in the micro-service cluster;
and obtaining the load state information corresponding to the identification of the original target server according to the identification of the original target server and the first mapping relation.
In one embodiment, the processing module 502 is specifically configured to:
acquiring function information from the feature information, and generating an available micro-service instance query instruction according to the function information;
sending an available micro-service instance query instruction to service registration equipment; the available micro-service instance inquiry instruction is used for controlling the service registration equipment to inquire all original target server identifications corresponding to the function information in a local micro-service function mapping table;
and receiving the identification of all original target servers capable of processing the task request in the micro service cluster sent by the service registration equipment.
In one embodiment, the processing module 502 is specifically configured to:
acquiring identifiers of all servers sent by a micro-service cluster, performance data corresponding to the identifiers and a second mapping relation; the performance data includes occupied performance data and unoccupied performance data;
Acquiring load state information corresponding to each identifier according to occupied performance data and unoccupied performance data corresponding to each identifier;
and establishing a first mapping relation between the identifier of the server and the load state information corresponding to the identifier according to the load state information corresponding to each identifier, the identifier of the server and the second mapping relation.
In one embodiment, the processing module 502 is specifically configured to:
task type information is obtained from the characteristic information;
obtaining a processor utilization rate demand parameter according to the task type information and the task parameter mapping table; the task parameter mapping table represents the mapping relation between the task type information and the processor utilization rate demand parameters;
and processing the processor utilization rate demand parameter and the load state information by utilizing the micro-service load balancing model to obtain the estimated time of processing the task request by each original target server.
In one embodiment, the processing module 502 is specifically configured to:
obtaining model input parameters corresponding to each original target server according to the load state information and the processor utilization rate demand parameters; the model input parameters comprise processor utilization rate demand parameters and load state information corresponding to an original target server;
And processing model input parameters by using the micro-service load balancing model to obtain the estimated time of each original target server for processing the task request.
In one embodiment, the processing module 502 is specifically configured to:
obtaining original response information sent by a micro-service cluster; the original response information is information generated after the target server processes the task request;
converting the data type of the original response information by using a data type mapping table to obtain intermediate response information of the target type; the data type mapping table represents the mapping relation between the original response information and the intermediate response information;
and screening the effective information from the intermediate response information and sending the effective information to the terminal.
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application, where the electronic device 600 includes a memory 601 and a processor 602.
Wherein the memory 601 is used to store computer instructions executable by the processor.
The processor 602, when executing the computer instructions, implements the steps of the micro-service load balancing method with the electronic device as the execution body in the above embodiment. Reference may be made in particular to the relevant description of the embodiments of the method described above.
Alternatively, the memory 601 may be separate or integrated with the processor 602. When the memory 601 is provided separately, the server 600 further includes a bus for connecting the memory 601 and the processor 602.
Fig. 7 is a schematic structural diagram of a micro service processing system according to an embodiment of the present application. As shown in fig. 7, the micro service processing system includes a terminal 700, an electronic device 701, a service registration device 706, and a micro service cluster 707. The electronic device 701 includes a listening unit 702, a service request receiving unit 703, a service gateway 704, and a load balancing scheduling unit 705.
In the process of running an application program, the terminal 700 sends a task request needing micro-service cluster processing to the monitoring unit 702 in the electronic device 701, and after the monitoring unit 702 sends the task request to the service gateway 704, the service gateway 704 performs data processing and feature extraction on the request to obtain feature information of the task request. The service gateway 704 generates a micro service instance query instruction according to the feature information, and sends the instruction to the service registration device 706, and the service registration device 706 obtains the information of the micro service instance capable of processing the task request and the original target server for deploying the micro service instance according to the received instruction, and returns all the obtained information to the service gateway 704. The service gateway 704 sends this information to the load balancing scheduling unit 705. The load balancing scheduling unit 705 obtains performance data of all servers in the micro service cluster from the micro service cluster 707, and obtains load status information of each server according to the performance data. The load balancing scheduling unit 705 generates input parameters of a micro-service load balancing model according to the information of the original target servers and the load state information corresponding to the servers, and utilizes the input parameters to estimate the time of each original target server for processing and responding to the task request by utilizing the model. The load balancing scheduling unit 705 obtains server information corresponding to the shortest time according to the estimated time, determines that the server information is information of the target server, and generates a task execution instruction according to the information. The load balancing scheduling unit 705 sends the instruction to the micro service cluster 707 to control the corresponding target server to process the task request, and after the processing is finished, the micro service cluster 707 sends the generated original response information to the service request receiving unit 703, the service request receiving unit 703 converts the original response information into intermediate corresponding information, and then sends the intermediate response information to the monitoring unit 702, and the monitoring unit 702 extracts the effective information from the intermediate response information and then sends the effective information to the terminal 700. Wherein the service registration device 706 may synchronize information of each server in the micro service cluster 707 with information of each micro service instance at preset time intervals.
In addition, the service registration device 706 in the micro service processing system may be replaced by at least one server in the micro service cluster 707 to implement querying corresponding micro service instances and server information according to the feature information of the task request.
In the technical scheme, the method and the device for estimating the task request based on the micro-service load balancing have the advantages that the relation among the characteristic information, the load state information and the response time corresponding to the information of the task request is considered, the micro-service load balancing model is built, so that before the micro-service cluster obtains and processes the task request sent by the terminal, the electronic device estimates the processing time of each server by using the micro-service load balancing model, and accordingly, the target server in the micro-service cluster corresponding to the shortest estimated time is determined, so that the target server processes the task request, the accuracy of model estimation is improved, and the processing efficiency of the micro-service cluster is improved.
The embodiment of the application further provides a computer readable storage medium, wherein computer instructions are stored in the computer readable storage medium, and when a processor executes the computer instructions, the steps in the micro-service load balancing method in the embodiment are realized.
Embodiments of the present application also provide a computer program product comprising computer instructions which, when executed by a processor, implement the steps in the micro-service load balancing method of the above embodiments.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It is to be understood that the present application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (10)

1. A method of micro-service load balancing, the method being applied to an electronic device, the method comprising:
acquiring a task request sent by a terminal, wherein the task request comprises characteristic information;
according to the characteristic information, load state information corresponding to all original target servers capable of processing the task request in the micro service cluster is obtained;
Processing the characteristic information and the load state information by utilizing a micro-service load balancing model to obtain estimated time for processing the task request by each original target server;
comparing the estimated time to obtain target server information corresponding to the shortest estimated time, generating a task execution instruction according to the target server information and the task request, and sending the task execution instruction to the micro-server cluster; the task execution instruction is used for controlling the micro-server cluster to control a corresponding target server to process the task request according to the target server information;
processing the characteristic information and each piece of load state information by using a micro-service load balancing model to obtain estimated time for each original target server to process the task request, wherein the method specifically comprises the following steps:
task type information is obtained from the characteristic information;
obtaining a processor utilization rate demand parameter according to the task type information and the task parameter mapping table; the task parameter mapping table represents the mapping relation between the task type information and the processor utilization rate demand parameter;
and processing the processor utilization rate demand parameter and the load state information by utilizing a micro-service load balancing model to obtain estimated time for processing the task request by each original target server.
2. The method according to claim 1, wherein obtaining load state information corresponding to all original target servers capable of processing the task request in the micro service cluster according to the feature information specifically includes:
obtaining identifiers of all servers, load state information corresponding to each identifier and a first mapping relation;
according to the characteristic information, obtaining the identifiers of all original target servers capable of processing the task request in the micro service cluster;
and obtaining load state information corresponding to the identification of the original target server according to the identification of the original target server and the first mapping relation.
3. The method according to claim 2, wherein obtaining the identification of all original target servers capable of processing the task request in the micro service cluster according to the feature information specifically comprises:
acquiring function information from the feature information, and generating an available micro-service instance query instruction according to the function information;
sending the available micro-service instance query instruction to service registration equipment; the available micro-service embodiment inquiry instruction is used for controlling the service registration equipment to inquire all original target server identifications corresponding to the function information in a local micro-service function mapping table;
And receiving the identification of all original target servers which can process the task request in the micro service cluster sent by the service registration equipment.
4. The method of claim 2, wherein obtaining identifiers of all servers, load status information corresponding to each identifier, and a first mapping relationship specifically includes:
acquiring identifiers of all servers sent by the micro service cluster, performance data corresponding to the identifiers and a second mapping relation; the performance data includes occupied performance data and unoccupied performance data;
acquiring load state information corresponding to each identifier according to the occupied performance data and the unoccupied performance data corresponding to each identifier;
and establishing a first mapping relation between the identifier of the server and the load state information corresponding to the identifier according to the load state information corresponding to each identifier, the identifier of the server and the second mapping relation.
5. The method of claim 1, wherein processing the processor utilization requirement parameter and each of the load status information using a micro-service load balancing model to obtain an estimated time for each of the original target servers to process the task request, comprises:
Obtaining model input parameters corresponding to the original target servers according to the load state information and the processor utilization rate demand parameters; the model input parameters comprise the processor utilization rate demand parameters and load state information corresponding to the original target server;
and processing the model input parameters by using the micro-service load balancing model to obtain estimated time of processing the task request by each original target server.
6. The method according to claim 1, wherein the method further comprises:
obtaining original response information sent by the micro service cluster; the original response information is information generated after the target server processes the task request;
converting the data type of the original response information by using a data type mapping table to obtain intermediate response information of a target type; the data type mapping table represents the mapping relation between the original response information and the intermediate response information;
and screening effective information from the intermediate response information, and sending the effective information to a terminal.
7. A micro-service load balancing apparatus, comprising:
The acquisition module is used for acquiring a task request sent by the terminal, wherein the task request comprises characteristic information;
the processing module is used for obtaining the load state information corresponding to all original target servers capable of processing the task request in the micro service cluster according to the characteristic information;
the processing module is also used for processing the characteristic information and the load state information by utilizing a micro-service load balancing model to obtain estimated time for processing the task request by each original target server;
the processing module is further used for comparing the estimated time, obtaining target server information corresponding to the shortest estimated time, generating a task execution instruction according to the target server information and the task request, and sending the task execution instruction to the micro-server cluster; the task execution instruction is used for controlling the micro-server cluster to control a corresponding target server to process the task request according to the target server information;
the processing module is specifically used for obtaining task type information from the characteristic information; obtaining a processor utilization rate demand parameter according to the task type information and the task parameter mapping table; the task parameter mapping table represents the mapping relation between the task type information and the processor utilization rate demand parameter; and processing the processor utilization rate demand parameter and the load state information by utilizing a micro-service load balancing model to obtain estimated time for processing the task request by each original target server.
8. An electronic device, comprising: a processor and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor, when executing the computer-executable instructions, is configured to implement the micro-service load balancing method of any one of claims 1 to 6.
9. A micro service processing system comprising the electronic device, the client, and the micro service cluster of claim 8, wherein the micro service cluster comprises a service registration device; or alternatively
Comprising the electronic device, the client, the micro-service cluster, and the service registration device of claim 8.
10. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein computer instructions, which when executed by a processor are adapted to implement the micro-service load balancing method according to any of claims 1 to 6.
CN202210582253.9A 2022-05-26 2022-05-26 Micro-service load balancing method, device, equipment, system and storage medium Active CN114884886B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210582253.9A CN114884886B (en) 2022-05-26 2022-05-26 Micro-service load balancing method, device, equipment, system and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210582253.9A CN114884886B (en) 2022-05-26 2022-05-26 Micro-service load balancing method, device, equipment, system and storage medium

Publications (2)

Publication Number Publication Date
CN114884886A CN114884886A (en) 2022-08-09
CN114884886B true CN114884886B (en) 2023-07-21

Family

ID=82677577

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210582253.9A Active CN114884886B (en) 2022-05-26 2022-05-26 Micro-service load balancing method, device, equipment, system and storage medium

Country Status (1)

Country Link
CN (1) CN114884886B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106874112A (en) * 2017-01-17 2017-06-20 华南理工大学 A kind of workflow earth-filling method of combination load balancing
CN110740164A (en) * 2019-09-04 2020-01-31 无锡华云数据技术服务有限公司 Server determination method, regulation and control method, device, equipment and storage medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110149396B (en) * 2019-05-20 2022-03-29 华南理工大学 Internet of things platform construction method based on micro-service architecture
CN113810443A (en) * 2020-06-16 2021-12-17 中兴通讯股份有限公司 Resource management method, system, proxy server and storage medium
CN113934512A (en) * 2021-10-21 2022-01-14 平安国际智慧城市科技股份有限公司 Load balancing implementation method, device, equipment and storage medium
US20220116478A1 (en) * 2021-12-23 2022-04-14 Dan Biederman Microservice latency reduction

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106874112A (en) * 2017-01-17 2017-06-20 华南理工大学 A kind of workflow earth-filling method of combination load balancing
CN110740164A (en) * 2019-09-04 2020-01-31 无锡华云数据技术服务有限公司 Server determination method, regulation and control method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN114884886A (en) 2022-08-09

Similar Documents

Publication Publication Date Title
CN107968836B (en) Task distribution method and device
CN108632374B (en) Software gray level release method and device
CN106850830B (en) Service request processing method, device and system and related server
CN109150572B (en) Method, device and computer readable storage medium for realizing alarm association
CN111159046B (en) Test method, test device, electronic equipment, test system and storage medium
EP2985730A1 (en) Method and device for partially-upgrading
CN111860853B (en) Online prediction system, device, method and electronic device
EP3737039A1 (en) Method for transmitting request message and apparatus
CN109117244B (en) Method for implementing virtual machine resource application queuing mechanism
CN106101171A (en) Server method of attachment and device
CN114884886B (en) Micro-service load balancing method, device, equipment, system and storage medium
CN117149665B (en) Continuous integration method, control device, continuous integration system, and storage medium
CN105376226B (en) Forwarding method and system of streaming media server
CN113934512A (en) Load balancing implementation method, device, equipment and storage medium
CN110928687B (en) CPU resource allocation method and test equipment
CN113163029B (en) Network session account deployment method, device, terminal, server and storage medium
CN111309467B (en) Task distribution method and device, electronic equipment and storage medium
CN116126372A (en) Application program upgrading method and device, electronic equipment and storage medium
CN115065664A (en) Internet protocol address recovery method, electronic equipment and storage medium
CN114070855B (en) Resource allocation method, resource allocation device, resource allocation system, and storage medium
CN109450661A (en) Service release surveying method and device based on GIS map
CN111294250B (en) Pressure testing method, device and system
CN111106971B (en) Device registration management method, device and computer-readable storage medium
CN114221971A (en) Data synchronization method, device, server, storage medium and product
CN107317880B (en) Method and device for realizing load balance

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