Microservice load balancing method, device, equipment and medium

By calculating the similarity between the current task request and the historical task request and using the server characteristics of similar data, combined with the server cross characteristics, the target server identification is determined, which solves the problem that the existing technology cannot achieve accurate and stable load balancing in the microservice architecture, and improves the efficiency Load balancing accuracy.

CN118612229BActive Publication Date: 2025-01-21CHINA TELECOM YIJIN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410701638.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-31
Publication Date
2025-01-21
Estimated Expiration
2044-05-31

AI Technical Summary

Technical Problem

The existing technology cannot make real-time intelligent adjustments based on the current load conditions of the server, resulting in the inability to provide accurate and stable load balancing strategies for servers in the microservice architecture.

Method used

By obtaining the data of the current task request and the historical task request, calculate the similarity between the two, determine the most similar historical task request data, and use the server characteristics of the data as reference characteristics, combined with the server cross characteristics, determine the similarity with the current task Request the best matching target server ID.

Benefits of technology

It provides accurate and stable load balancing strategies for servers in microservice architecture, improving the accuracy of the load balancing process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118612229B_ABST
    Figure CN118612229B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of data processing technology, and discloses a microservice load balancing method, device, equipment and medium, comprising: obtaining current task request data and historical task request data, and obtaining a server-related data set; determining first similarity data between the current task request and the historical task request according to the current task request data and the historical task request data; determining target historical task request data that is most similar to the current task request from the historical task request data according to the first similarity data; using server features corresponding to the target historical task request data as reference server features; determining a server cross-feature set according to the server-related data set; determining a target server identifier that matches the current task request according to the current task request data, the server-related data set, the reference server features and the server cross-feature set, so as to effectively improve the accuracy of the microservice load balancing strategy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a microservice load balancing method, device, equipment and medium. Background Art

[0002] In today's digital age, cloud computing and microservice architecture have become the core of building flexible and efficient application systems. With the rapid growth of the number of users and the amount of data, load balancing has become crucial. At present, traditional load balancing methods mainly use polling algorithms, weighted polling algorithms, etc. to balance the load on each server, but these algorithms cannot be adjusted intelligently in real time according to the current load of the server, and thus cannot provide accurate and stable load balancing strategies for servers in the microservice architecture. Therefore, how to provide accurate and stable load balancing strategies for servers in the microservice architecture has become a problem that needs to be solved urgently. Summary of the invention

[0003] The present invention provides a microservice load balancing method, device, equipment and medium to solve the technical problem of providing an accurate and stable load balancing strategy for servers in a microservice architecture.

[0004] In a first aspect, a microservice load balancing method is provided, including:

[0005] Obtain the current task request data corresponding to the current task request and the historical task request data corresponding to the historical task request, and obtain the relevant data of each server in the microservice architecture to obtain a server-related data set;

[0006] Determine first similarity data between the current task request and the historical task request according to the current task request data and the historical task request data;

[0007] Determine, from the historical task request data, target historical task request data that is most similar to the current task request according to the first similarity data;

[0008] The server characteristics corresponding to the target historical task request data are used as reference server characteristics;

[0009] Determine a server cross-feature set based on a server-related data set;

[0010] A target server identifier matching the current task request is determined based on the current task request data, a server-related data set, reference server features, and a server cross-feature set.

[0011] In a second aspect, a microservice load balancing device is provided, comprising:

[0012] The first acquisition module is used to acquire current task request data corresponding to the current task request and historical task request data corresponding to the historical task request, and acquire relevant data of each server in the microservice architecture to obtain a server-related data set;

[0013] A first determination module, configured to determine first similarity data between a current task request and a historical task request based on the current task request data and the historical task request data;

[0014] A second determination module is used to determine, from the historical task request data, target historical task request data that is most similar to the current task request based on the first similarity data;

[0015] A first processing module is used to use the server characteristics corresponding to the target historical task request data as reference server characteristics;

[0016] A third determination module, used to determine a server cross-feature set according to a server-related data set;

[0017] The fourth determination module is used to determine the target server identifier that matches the current task request based on the current task request data, the server-related data set, the reference server characteristics and the server cross-characteristic set.

[0018] In a third aspect, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned microservice load balancing method when executing the computer program.

[0019] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned microservice load balancing method are implemented.

[0020] In the scheme implemented by the above-mentioned microservice load balancing method, device, equipment and medium, by obtaining the current task request data corresponding to the current task request and the historical task request data corresponding to the historical task request, and obtaining the relevant data of each server in the microservice architecture, a server-related data set is obtained. The first similarity data between the current task request and the historical task request can be determined based on the current task request data and the historical task request data, so as to further determine the target historical task request data most similar to the current task request from the historical task request data based on the first similarity data, and use the server characteristics corresponding to the target historical task request data as the reference server characteristics, so as to determine the server cross-feature set based on the server-related data set, and then determine the target server identifier that matches the current task request based on the current task request data, the server-related data set, the reference server characteristics and the server cross-feature set, which is conducive to providing an accurate and stable load balancing strategy for servers in the microservice architecture. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0022] Figure 1 This is a schematic diagram of an application environment of a microservice load balancing method in one embodiment of the present invention;

[0023] Figure 2 It is a flow chart of a microservice load balancing method in one embodiment of the present invention;

[0024] Figure 3 It is a structural diagram of a microservice load balancing device in one embodiment of the present invention;

[0025] Figure 4 is a schematic diagram of a structure of a computer device in one embodiment of the present invention;

[0026] Figure 5 It is another structural schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION

[0027] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0028] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.

[0029] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments.

[0030] At present, in the existing rule-based load balancing methods, although specific allocation rules can be customized according to various indicators, it requires a lot of manpower and is not replicable. In the existing machine learning-based load balancing methods, intelligent decisions can be made based on real-time performance indicators and historical data to adapt to the dynamic changes of the system. Although more flexible than traditional algorithms, machine learning-based load balancing methods usually only consider the load situation on the server side, and do not further refine the load based on the specific requests of the request side. It is impossible to more comprehensively measure the adaptability of the server to the request task, which may cause the final load balancing strategy to be inaccurate.

[0031] The microservice load balancing method provided in the embodiment of the present invention can be applied in Figure 1In an application environment, the client communicates with the server through a network. Exemplarily, taking the scenario of selecting a target server from a microservice architecture for current task request data as an example, the target user can upload the current task request data corresponding to the current task request, the historical task request data corresponding to the historical task request, and the server-related data set in the microservice architecture through the client. Among them, the target user can be a manager or R&D personnel who makes load balancing strategy judgments for the microservice architecture, and this application does not limit this. Correspondingly, the server can obtain the current task request data, historical task request data, and server-related data set uploaded by the target user through the client, so as to determine the first similarity data between the current task request and the historical task request according to the current task request data and the historical task request data, and determine the target historical task request data most similar to the current task request from the historical task request data according to the first similarity data, so as to use the server feature corresponding to the target historical task request data as the reference server feature, and further determine the server cross feature set according to the server-related data set, so as to determine the target server identifier that matches the current task request according to the current task request data, the server-related data set, the reference server feature, and the server cross feature set, and feed the target server identifier back to the client. Correspondingly, the client can receive the target server identifier from the server, and can display the target server identifier on the client for the target user to query or browse. By adopting the microservice load balancing method provided by the present application, the accuracy of the microservice load balancing process can be improved.

[0032] The client may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices. The server may be implemented by an independent server or a server cluster consisting of multiple servers. The present invention is described in detail below through specific embodiments.

[0033] See also Figure 2 As shown, Figure 2 A flow chart of a microservice load balancing method provided in an embodiment of the present invention includes the following steps:

[0034] S10: Obtain current task request data corresponding to the current task request and historical task request data corresponding to the historical task request, and obtain relevant data of each server in the microservice architecture to obtain a server-related data set.

[0035] Among them, the current task request can be used to indicate the task request corresponding to the current moment. The current task request data can be used to indicate data related to the task request corresponding to the current moment. The current task request data may include but is not limited to the central processing unit (CPU) utilization demand rate corresponding to the current task request, the response type of the current task request, the current task request number and the label corresponding to the current task request, etc., and this application does not limit this.

[0036] The historical task request can be used to indicate the task request corresponding to the historical moment. It is understandable that the historical task request may include one or more task requests corresponding to the historical moment, and the present application does not limit this. The historical task request data can be used to indicate data related to the task request corresponding to the historical moment. The historical task request data may include but is not limited to the CPU utilization demand rate corresponding to the historical task request, the response type of the historical task request, the number of historical task requests, and the label corresponding to the historical task request, etc., and the present application does not limit this.

[0037] The historical task request feature matrix can be used to indicate a feature matrix constructed by the relevant task request features corresponding to one or more task request data. In other words, the historical task request feature matrix can include one or more historical task request features, which is not limited in this application.

[0038] The microservice architecture can be used to indicate the architecture of multiple independent microservices obtained by decomposing a large application, and this application does not limit this. It is understandable that the microservice architecture may include one or more servers. This application uses the example of multiple servers in the microservice architecture for illustration, and does not constitute a limitation on this application. The server-related data set may include one or more server-related data, and the server-related data can be used to indicate data related to the server. The server-related features may include but are not limited to CPU utilization, memory utilization, disk utilization, average task response time, number of intensive tasks, number of input / output (IO) intensive tasks and current server temperature, etc., and this application does not limit this.

[0039] The server-related feature set may include one or more server-related features, and the server-related features may be used to indicate features corresponding to server-related data.

[0040] S20: Determine first similarity data between the current task request and the historical task request according to the current task request data and the historical task request data.

[0041] Among them, the first similarity data can be used to indicate the similarity between the current task request and the historical task request. It is understandable that the first similarity data may include one or more similarities, such as similarity 1 between the current task request and historical task request 1, similarity 2 between the current task request and historical task request 2, etc., and this application does not limit this.

[0042] It should be understood that determining the first similarity data between the current task request and the historical task request based on the current task request data and the historical task request data refers to the process of determining the similarity between the current task request and the historical task request. Wherein, in step S20, that is, determining the first similarity data between the current task request and the historical task request based on the current task request data and the historical task request data, includes the following steps:

[0043] S21: Acquire numerical task request data and first category task request data from the current task request data;

[0044] S22: normalizing the numerical task request data to obtain a first current task request feature;

[0045] S23: performing feature encoding on the first category task request data to obtain a second current task request feature;

[0046] S24: fusing the first current task request feature and the second current task request feature to obtain a current task request feature;

[0047] S25: performing data preprocessing on the historical task request data to obtain a historical task request feature matrix;

[0048] S26: Calculate the similarity between the current task request feature and the historical task request feature matrix to obtain first similarity data between the current task request and the historical task request.

[0049] Wherein, the numerical task request data can be used to indicate the numerical data in the current task request data. Optionally, the numerical task request data can also be understood as the continuous data in the task request data, which is not limited in this application. Exemplarily, the numerical task request data can include the CPU utilization demand rate corresponding to the current task request and the current task request number, etc., which is not limited in this application.

[0050] The categorical task request data can be used to indicate the categorical data in the current task request feature. Optionally, the categorical task request data can also be understood as discrete data in the task request data, which is not limited in this application. Exemplarily, the categorical task request data can include the response type of the current task request and the label corresponding to the current task request, etc., which is not limited in this application.

[0051] The first current task request feature can be used to indicate the current task request reference feature obtained after the server normalizes the numerical task request data. The second current task request feature can be used to indicate the current task request reference feature obtained after the server performs feature encoding on the category-type task request data. In other words, the server can select different processing methods according to different types of task request data in the current task request data to obtain the current task request feature corresponding thereto, and the present application does not impose any restrictions on this. Optionally, the server can use One-Hot Encoding to perform feature encoding on the category-type task request data to obtain the second current task request feature, and the present application does not impose any restrictions on this.

[0052] It should be understood that normalizing the numerical task request data to obtain the first current task request feature refers to the process of preprocessing the numerical task request data. In step S22, normalizing the numerical task request data to obtain the first current task request feature includes the following steps:

[0053] S221: performing maximum normalization processing on the numerical task request data to obtain maximum normalized features;

[0054] S222: performing minimum normalization processing on the numerical task request data to obtain minimum normalized features;

[0055] S223: performing a difference operation on the numerical task request data, the maximum normalized feature, and the minimum normalized feature to obtain a difference normalized feature;

[0056] S224: performing a normalization operation on the difference normalization feature to obtain numerical task request data.

[0057] Among them, the maximum normalized feature can be used to indicate the normalized feature obtained after the server performs maximum normalization processing on the numerical task request data. Optionally, the server can perform maximum normalization processing on the numerical task request data based on the maximum normalization function to scale the numerical task request data to a specified range (such as 0-1), and this application does not impose any restrictions on this. By performing maximum normalization processing on the numerical task request data, the distribution information of the original data can be retained, so that more accurate results can be obtained in subsequent processes based on the maximum normalization feature.

[0058] The minimum normalization feature can be used to indicate the normalized feature obtained after the server performs minimum normalization processing on the numerical task request data. Optionally, the server can perform minimum normalization processing on the numerical task request data based on the minimum normalization function to map the numerical task request data to a specified interval range (such as 0-1), and the present application does not impose any restrictions on this. By performing minimum normalization processing on the numerical task request data, the relative size relationship of the original data can be retained, so that a more accurate result can be obtained in the subsequent process based on the minimum normalization feature, and the present application does not impose any restrictions on this.

[0059] The difference normalization feature can be used to indicate the normalized feature obtained after the server performs a difference operation on the numerical task request data, the maximum normalization feature, and the minimum normalization feature. It is understandable that the server can perform maximum and minimum normalization processing on the numerical task request data based on the maximum and minimum normalization function to obtain the difference normalization feature, and this application does not limit this.

[0060] Optionally, the server performs a difference operation on the numerical task request data, the maximum normalized feature, and the minimum normalized feature to obtain a difference normalized feature, which can be seen in the following formula:

[0061]

[0062] Among them, X min-max Can be used to indicate difference normalization features; X can be used to indicate numerical task request data; X min Can be used to indicate the minimum normalized feature; X max Can be used to indicate the maximum normalized feature.

[0063] Optionally, the server performs normalization operation on the difference normalization feature to obtain the numerical task request data, which can be seen in the following formula:

[0064] X norm =X min-max +(1-X min-max )*(X min-max-0.5)*2

[0065] Among them, X norm Can be used to indicate numerical task request data; X min-max Can be used to indicate difference normalization features.

[0066] For steps S221-S224, the server performs maximum normalization processing on the numerical task request data to obtain the maximum normalized feature, and performs minimum normalization processing on the numerical task request data to obtain the minimum normalized feature, so that the numerical task request data, the maximum normalized feature and the minimum normalized feature can be differenced to obtain the difference normalized feature, and the difference normalized feature can be further normalized to obtain the numerical task request data, and then in subsequent steps, a more accurate target server identifier can be determined based on the numerical task request data to effectively improve the accuracy of microservice load balancing measurement.

[0067] After obtaining the first current task request feature after normalization processing and the second current task request feature after feature encoding processing, the server can fuse the first current task request feature and the second current task request feature, such as splicing them by feature splicing, or strategically fusing them by using a fusion function, etc., to further obtain the current task request feature. This application does not impose any restrictions on this.

[0068] The server can perform data processing on each historical task request data in the historical task request data to obtain the historical task request features corresponding to each historical task request data, thereby constructing a historical task request feature matrix according to each historical task request feature. Optionally, the server performs data preprocessing on each historical task request data to obtain the corresponding historical task request features. For details, please refer to the detailed description of the server performing data preprocessing on the current task request data to obtain the current task request features, which will not be repeated in this application.

[0069] It should be understood that the process of calculating the similarity between the current task request feature and the historical task request feature matrix to obtain the first similarity data between the current task request and the historical task request refers to how to calculate the similarity between the current task request and the historical task request. Among them, step S26, that is, calculating the similarity between the current task request feature and the historical task request feature matrix to obtain the first similarity data between the current task request and the historical task request, includes the following steps:

[0070] S261: embedding the current task request feature to obtain a current embedded feature vector;

[0071] S262: performing a matrix multiplication operation on the current embedded feature vector and the historical task request feature matrix to obtain reference similarity data;

[0072] S263: Activate the reference similarity data to obtain first similarity data between the current task request and the historical task request.

[0073] The current embedded feature vector can be used to indicate the embedded feature vector obtained after embedding the current task request feature. Optionally, the server can use an embedding network, such as neural network embedding, to encode the current task request feature to obtain the current embedded feature vector, which is not limited in this application.

[0074] The reference similarity data can be used to indicate the similarity data obtained after performing a matrix multiplication operation on the current embedded feature vector and the historical task request feature matrix. It is understandable that after obtaining the reference similarity data, the server can further activate the reference similarity data through an activation function, such as a softmax activation function, to further obtain the first similarity data, and this application does not limit this.

[0075] For steps S261-S263, the server embeds the current task request feature to obtain a current embedded feature vector, and performs matrix multiplication on the current embedded feature vector and the historical task request feature matrix to obtain reference similarity data, so that the reference similarity data can be activated to obtain the first similarity data between the current task request and the historical task request, and then in subsequent steps, a more accurate target server identifier can be determined based on the first similarity data to effectively improve the accuracy of microservice load balancing measurement.

[0076] For steps S21-S26, the server obtains numerical task request data and first category task request data from the current task request data, and normalizes the numerical task request data to obtain a first current task request feature, so as to further feature encode the first category task request data to obtain a second current task request feature, thereby fusing the first current task request feature and the second current task request feature to obtain a current task request feature, so as to further preprocess the historical task request data to obtain a historical task request feature matrix, and then perform similarity calculation on the current task request feature and the historical task request feature matrix to obtain a first similarity data between the current task request and the historical task request, which is beneficial to determine a more accurate target server identifier based on the first similarity data in subsequent steps, so as to effectively improve the accuracy of microservice load balancing measurement.

[0077] S30: Determine, according to the first similarity data, target historical task request data that is most similar to the current task request from the historical task request data.

[0078] The target historical task request data may be used to indicate the historical task request data that is most similar to the current task request in the historical task request data. It should be noted that the target historical task request data may include one or more historical task request data, and this application does not limit this.

[0079] Optionally, the server may arrange each first similarity in the first similarity data in order, so that the server can select one or more first similarities that meet the requirements from the first similarity data arranged in order according to preset requirements, and thus determine one or more historical task request data corresponding to the one or more first similarities, and then obtain the above-mentioned target historical task request data. This application does not impose any restrictions on this.

[0080] S40: Using the server characteristics corresponding to the target historical task request data as reference server characteristics.

[0081] Among them, the reference server characteristics can be used to indicate the characteristics of the server corresponding to the target historical task request data. That is to say, after obtaining the target historical task request data, the server can determine the server corresponding to the target historical task request data, so as to use the characteristics of the server as a reference server characteristic for subsequent steps, thereby helping to improve the accuracy of the microservice load balancing strategy.

[0082] S50: Determine a server cross-feature set according to the server-related data set.

[0083] Among them, the server cross-feature set may include one or more server cross-features, and the server cross-features can be used to indicate the cross-features obtained after the server performs feature cross-processing on server-related data. This application does not impose any restrictions on this.

[0084] It should be understood that determining the server cross-feature set based on the server-related data set refers to a process of performing feature analysis on each server-related data in the server-related data set. In step S50, determining the server cross-feature set based on the server-related data set includes the following steps:

[0085] S51: acquiring the number of first intensive tasks corresponding to each server from the server-related data set to obtain a first intensive task number subset, and acquiring the number of second intensive tasks corresponding to each server to obtain a second intensive task number subset;

[0086] S52: constructing a task number ratio cross feature set according to the first intensive task number subset and the second intensive task number subset;

[0087] S53: acquiring the processor utilization corresponding to each server from the server-related data set to obtain a processor utilization subset, acquiring the memory utilization corresponding to each server to obtain a memory utilization subset, and acquiring the disk utilization corresponding to each server to obtain a disk utilization subset;

[0088] S54: performing load calculation on each processing utilization in the processor utilization subset, each memory utilization in the memory utilization subset, and each disk utilization in the disk utilization subset to determine a server load cross-feature set;

[0089] S55: Determine a server cross-feature set according to the task number proportion cross-feature set and the server load cross-feature set.

[0090] Among them, the first intensive task number can be the number of tasks that require a large number of computing resources. The first intensive task number may consume more computing resources such as the CPU of the server, and this application does not limit this. The second intensive task number can be the number of tasks involving a large number of input / output operations, such as the number of IO intensive tasks. The second intensive task number often requires frequent data interaction with external devices (such as disks, networks, etc.), and has high requirements for input / output performance. This application does not limit this.

[0091] The task number proportion cross-feature set may include one or more task number proportion cross-features, and the task number proportion cross-features may be used to indicate the cross-features corresponding to the task number proportion data constructed according to the first intensive task number subset and the second intensive task number subset. Optionally, the server may construct the task number proportion data according to the first intensive task number subset and the second intensive task number subset to further normalize the task number proportion data to obtain the task number proportion cross-feature, and this application does not impose any restrictions on this.

[0092] The processor utilization subset may include one or more processor utilizations, which can be used to indicate the utilization of the server's processor; the memory utilization subset may include one or more memory utilizations, which can be used to indicate the utilization of the server's memory; the disk utilization subset may include one or more disk utilizations, which can be used to indicate the utilization of the server's disk, and the present application does not impose any restrictions on this.

[0093] The load cross-feature set may include one or more load cross-features, which may be used to indicate cross-features related to server load. Optionally, the server performs load calculation on the control parameters in the server-related data set, each processing utilization in the processor utilization subset, each memory utilization in the memory utilization subset, and each disk utilization in the disk utilization subset to determine the server load cross-feature set. The process can be seen in the following formula:

[0094] Load i =(1-λ i )(C ri +λ i M ri +λ i 2 H ri )

[0095] Among them, Load i can be used to represent the server load cross-feature of the i-th server in the server load cross-feature set; i can be used to represent the index of the server; λ i Can be used to represent the control parameters of the i-th server; C ri can be used to represent the processor utilization of the i-th server in the processor utilization subset; M ri It can be used to represent the memory utilization of the i-th server in the memory utilization subset; C ri It can be used to represent the disk utilization of the i-th server in the disk utilization subset.

[0096] After obtaining the task number proportion cross-feature set and the server load cross-feature set, the server can fuse each task number proportion cross-feature in the task number proportion cross-feature set with each server load cross-feature in the server load cross-feature set, such as by splicing using feature splicing, or by strategically fusing using a fusion function, etc., to further obtain the server cross-feature set. This application does not impose any restrictions on this.

[0097] For steps S51-S55, the server obtains the first intensive task number corresponding to each server from the server-related data set to obtain a first intensive task number subset, and obtains the second intensive task number corresponding to each server to obtain a second intensive task number subset, so as to construct a task number proportion cross-feature set based on the first intensive task number subset and the second intensive task number subset, and obtains the processor utilization corresponding to each server from the server-related data set to obtain a processor utilization subset, obtains the memory utilization corresponding to each server to obtain a memory utilization subset, and obtains the disk utilization corresponding to each server to obtain a disk utilization subset, so that each processing utilization in the processor utilization subset, each memory utilization in the memory utilization subset, and each disk utilization in the disk utilization subset can be load calculated to determine the server load cross-feature set, and then the server cross-feature set can be determined based on the task number proportion cross-feature set and the server load cross-feature set, which is beneficial to determine a more accurate target server identifier based on the server cross-set in subsequent steps, so as to effectively improve the accuracy of the microservice load balancing strategy.

[0098] S60: Determine a target server identifier that matches the current task request according to the current task request data feature, the server-related feature set, the reference server feature and the server cross-feature set.

[0099] The target server identifier may be used to indicate the identifier corresponding to the target server that matches the current task request. The target server may be understood as the optimal server matched by the server for the current task request, and this application does not limit this.

[0100] It should be understood that determining the target server identifier that matches the current task request based on the current task request data, the server-related data set, the reference server features, and the server cross-feature set refers to the process of how to determine the matching target server. Among them, step S60, that is, determining the target server identifier that matches the current task request based on the current task request data, the server-related data set, the reference server features, and the server cross-feature set, includes the following steps:

[0101] S61: Input the current task request data and the reference server feature, as well as each server-related data in the server-related data set and each server cross-feature in the server cross-feature set, into the microservice load balancing model for data processing, determine the reference matching probability between each server and the current task request, and obtain a reference matching probability set;

[0102] S61: acquiring the server response time corresponding to each server from the server-related data set to obtain a server response time subset;

[0103] S62: Obtain the inverse of each server response time in the server response time subset to obtain the server response time inverse subset;

[0104] S63: Determine a time probability matching value set according to the server response time reciprocal subset and the reference matching probability set;

[0105] S64: Determine a target server identifier that matches the current task request according to each time probability matching value in the time probability matching value set.

[0106] Among them, the reference matching probability set may include one or more reference matching probabilities, which can be used to indicate the matching probability of the degree of matching between the current task request and the historical task request determined after inputting the microservice load balancing model for data processing based on the current task request data and the reference server characteristics, as well as each server-related data in the server-related data set and each server cross-feature in the server cross-feature set.

[0107] Optionally, the server can train the initial model based on sample data (such as historical task request data corresponding to historical moments, and historical server decisions corresponding to historical moments) so that the trained model can determine the reference matching probability between each server and a certain task request for a certain task request, thereby obtaining an accurate microservice load balancing model. This application does not impose any restrictions on this.

[0108] The server response time subset may include one or more server response times, which may be used to indicate the response time of the server to a request (such as a detection request, etc.). The server response time countdown subset may include one or more server response time countdowns, which may be used to indicate the countdown of the server response time, and the present application does not impose any restrictions on this. The time probability matching value set may include one or more time probability matching values, which may be used to indicate the matching value between the server and the current request task determined based on the server response time and the reference matching probability.

[0109] Optionally, the server determines a time probability matching value set according to the server response time inverse subset and the reference matching probability set; and determines a target server identifier that matches the current task request according to each time probability matching value in the time probability matching value set, as shown in the following formula:

[0110]

[0111] Among them, D s It can be used to indicate the target server ID; argmax can be used to indicate that the server ID corresponding to the maximum value is selected as the output; p i It can be used to represent the reference matching probability of the i-th server in the reference matching probability set; s i It can be used to represent the inverse server response time of the i-th server in the inverse server response time subset.

[0112] For steps S61-S64, the server obtains the server response time corresponding to each server from the server-related data set to obtain a server response time subset, and obtains the inverse of each server response time in the server response time subset to obtain a server response time inverse subset. The server can further determine a time probability matching value set based on the server response time inverse subset and the reference matching probability set, and thus determine a target server identifier that matches the current task request based on each time probability matching value in the time probability matching value set, thereby helping to improve the accuracy of the microservice load balancing strategy.

[0113] It can be seen that in the above scheme, the server obtains the current task request data corresponding to the current task request and the historical task request data corresponding to the historical task request, and obtains the relevant data of each server in the microservice architecture to obtain a server-related data set. The server can determine the first similarity data between the current task request and the historical task request based on the current task request data and the historical task request data, and further determine the target historical task request data that is most similar to the current task request from the historical task request data based on the first similarity data, and use the server characteristics corresponding to the target historical task request data as reference server characteristics, so that the server cross-feature set can be determined based on the server-related data set, and then the target server identifier that matches the current task request can be determined based on the current task request data, the server-related data set, the reference server characteristics and the server cross-feature set, which is beneficial to provide an accurate and stable load balancing strategy for servers in the microservice architecture.

[0114] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.

[0115] In one embodiment, a microservice load balancing device is provided, which corresponds one-to-one to the microservice load balancing method in the above embodiment. Figure 3 As shown, the microservice load balancing device includes a first acquisition module 101, a first determination module 102, a second determination module 103, a first processing module 104, a third determination module 105 and a fourth determination module 106. Each functional module is described in detail as follows:

[0116] The first acquisition module 101 is used to acquire current task request data corresponding to the current task request and historical task request data corresponding to the historical task request, and acquire relevant data of each server in the microservice architecture to obtain a server-related data set;

[0117] A first determination module 102, configured to determine first similarity data between a current task request and a historical task request based on the current task request data and the historical task request data;

[0118] A second determination module 103 is used to determine, from the historical task request data, target historical task request data that is most similar to the current task request according to the first similarity data;

[0119] The first processing module 104 is used to use the server characteristics corresponding to the target historical task request data as reference server characteristics;

[0120] The third determination module 105 is used to determine a server cross-feature set according to the server-related data set;

[0121] The fourth determination module 106 is used to determine the target server identifier that matches the current task request according to the current task request data, the server-related data set, the reference server characteristics and the server cross-characteristic set.

[0122] In one embodiment, the first determination module 102 is specifically used to obtain numerical task request data and category task request data from the current task request data; normalize the numerical task request data to obtain a first current task request feature; feature encode the category task request data to obtain a second current task request feature; fuse the first current task request feature and the second current task request feature to obtain a current task request feature; preprocess the historical task request data to obtain a historical task request feature matrix; perform similarity calculation on the current task request feature and the historical task request feature matrix to obtain first similarity data between the current task request and the historical task request.

[0123] In one embodiment, the first determination module 102 is specifically used to perform maximum normalization processing on the numerical task request data to obtain a maximum normalized feature; perform minimum normalization processing on the numerical task request data to obtain a minimum normalized feature; perform difference operation on the numerical task request data, the maximum normalized feature and the minimum normalized feature to obtain a difference normalized feature; perform normalization operation on the difference normalized feature to obtain the numerical task request data.

[0124] In one embodiment, the first determination module 102 is specifically used to embed the current task request feature to obtain a current embedded feature vector; perform matrix multiplication operation on the current embedded feature vector and the historical task request feature matrix to obtain reference similarity data; activate the reference similarity data to obtain the first similarity data between the current task request and the historical task request.

[0125] In one embodiment, the third determination module 105 is specifically used to obtain the first intensive task number corresponding to each server from the server-related data set to obtain a first intensive task number subset, and obtain the second intensive task number corresponding to each server to obtain a second intensive task number subset; construct a task number ratio cross-feature set based on the first intensive task number subset and the second intensive task number subset; obtain the processor utilization corresponding to each server from the server-related data set to obtain a processor utilization subset, obtain the memory utilization corresponding to each server to obtain a memory utilization subset, and obtain the disk utilization corresponding to each server to obtain a disk utilization subset; perform load calculations on the control parameters in the server-related data set, each processing utilization in the processor utilization subset, each memory utilization in the memory utilization subset, and each disk utilization in the disk utilization subset to determine the server load cross-feature set; determine the server cross-feature set based on the task number ratio cross-feature set and the server load cross-feature set.

[0126] In one embodiment, the fourth determination module 106 is specifically used to input the current task request data and the reference server characteristics, as well as each server-related data in the server-related data set and each server cross-feature in the server cross-feature set, into the microservice load balancing model for data processing, determine the reference matching probability between each server and the current task request, and obtain a reference matching probability set; obtain the server response time corresponding to each server from the server-related data set to obtain a server response time subset; obtain the inverse of each server response time in the server response time subset to obtain a server response time inverse subset; determine a time probability matching value set based on the server response time inverse subset and the reference matching probability set; and determine a target server identifier that matches the current task request based on each time probability matching value in the time probability matching value set.

[0127] The present invention provides a microservice load balancing device, which obtains current task request data corresponding to a current task request and historical task request data corresponding to historical task requests, and obtains relevant data of each server in a microservice architecture to obtain a server-related data set. The device can determine first similarity data between the current task request and the historical task request based on the current task request data and the historical task request data, and further determine target historical task request data that is most similar to the current task request from the historical task request data based on the first similarity data, and use server features corresponding to the target historical task request data as reference server features, so that a server cross-feature set can be determined based on the server-related data set, and then a target server identifier that matches the current task request can be determined based on the current task request data, the server-related data set, the reference server features and the server cross-feature set, which is beneficial to providing an accurate and stable load balancing strategy for servers in a microservice architecture.

[0128] For the specific definition of the microservice load balancing device, please refer to the definition of the microservice load balancing method above, which will not be repeated here. Each module in the above-mentioned microservice load balancing device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0129] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 4 As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client through a network connection. When the computer program is executed by the processor, it implements the functions or steps on the server side of a microservice load balancing method.

[0130] In one embodiment, a computer device is provided. The computer device may be a client, and its internal structure diagram may be as follows: Figure 5As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external server through a network connection. When the computer program is executed by the processor, it realizes the functions or steps of the client side of a microservice load balancing method.

[0131] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:

[0132] Obtain the current task request data corresponding to the current task request and the historical task request data corresponding to the historical task request, and obtain the relevant data of each server in the microservice architecture to obtain a server-related data set;

[0133] Determine first similarity data between the current task request and the historical task request according to the current task request data and the historical task request data;

[0134] Determine, from the historical task request data, target historical task request data that is most similar to the current task request according to the first similarity data;

[0135] The server characteristics corresponding to the target historical task request data are used as reference server characteristics;

[0136] Determine a server cross-feature set based on a server-related data set;

[0137] A target server identifier matching the current task request is determined based on the current task request data, a server-related data set, reference server features, and a server cross-feature set.

[0138] The present invention provides a computer device, which obtains current task request data corresponding to a current task request and historical task request data corresponding to historical task requests, and obtains relevant data of each server in a microservice architecture to obtain a server-related data set. The first similarity data between the current task request and the historical task request can be determined based on the current task request data and the historical task request data, so as to further determine the target historical task request data most similar to the current task request from the historical task request data based on the first similarity data, and use the server characteristics corresponding to the target historical task request data as reference server characteristics, so as to determine the server cross-feature set based on the server-related data set, and then determine the target server identifier that matches the current task request based on the current task request data, the server-related data set, the reference server characteristics and the server cross-feature set, which is beneficial to provide an accurate and stable load balancing strategy for the servers in the microservice architecture.

[0139] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0140] Obtain the current task request data corresponding to the current task request and the historical task request data corresponding to the historical task request, and obtain the relevant data of each server in the microservice architecture to obtain a server-related data set;

[0141] Determine first similarity data between the current task request and the historical task request according to the current task request data and the historical task request data;

[0142] Determine, from the historical task request data, target historical task request data that is most similar to the current task request according to the first similarity data;

[0143] The server characteristics corresponding to the target historical task request data are used as reference server characteristics;

[0144] Determine a server cross-feature set based on a server-related data set;

[0145] A target server identifier matching the current task request is determined based on the current task request data, a server-related data set, reference server features, and a server cross-feature set.

[0146] The present invention provides a computer-readable storage medium, which obtains current task request data corresponding to a current task request and historical task request data corresponding to historical task requests, and obtains relevant data of each server in a microservice architecture to obtain a server-related data set. The first similarity data between the current task request and the historical task request can be determined based on the current task request data and the historical task request data, so as to further determine the target historical task request data most similar to the current task request from the historical task request data based on the first similarity data, and use the server characteristics corresponding to the target historical task request data as reference server characteristics, so as to determine the server cross-feature set based on the server-related data set, and then determine the target server identifier that matches the current task request based on the current task request data, the server-related data set, the reference server characteristics and the server cross-feature set, which is beneficial to provide an accurate and stable load balancing strategy for the servers in the microservice architecture.

[0147] It should be noted that the above functions or steps that can be implemented by the computer-readable storage medium or computer device can refer to the relevant descriptions on the server side and the client side in the aforementioned method embodiment. To avoid repetition, they will not be described one by one here.

[0148] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0149] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0150] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.

Claims

1. A microservice load balancing method, characterized in that: The microservice load balancing method includes: Obtain the current task request data corresponding to the current task request and the historical task request data corresponding to the historical task request, and obtain the relevant data of each server in the microservice architecture to obtain a server-related data set; Determining first similarity data between the current task request and the historical task request according to the current task request data and the historical task request data; Determining, from the historical task request data, target historical task request data that is most similar to the current task request according to the first similarity data; Using the server characteristics corresponding to the target historical task request data as reference server characteristics; Determining a server cross-feature set according to the server-related data set; A target server identifier matching the current task request is determined according to the current task request data, the server-related data set, the reference server characteristics and the server cross-characteristic set.

2. The microservice load balancing method according to claim 1, characterized in that: The determining, according to the current task request data and the historical task request data, first similarity data between the current task request and the historical task request includes: Acquire numerical task request data and category task request data from the current task request data; Normalizing the numerical task request data to obtain a first current task request feature; Performing feature encoding on the category-type task request data to obtain a second current task request feature; The first current task request feature and the second current task request feature are merged to obtain a current task request feature; Performing data preprocessing on the historical task request data to obtain a historical task request feature matrix; The similarity between the current task request feature and the historical task request feature matrix is ​​calculated to obtain first similarity data between the current task request and the historical task request.

3. The microservice load balancing method according to claim 2, characterized in that: The normalizing the numerical task request data to obtain the first current task request characteristic numerical task request data numerical task request data includes: Performing maximum normalization processing on the numerical task request data to obtain maximum normalized features; Performing minimum normalization processing on the numerical task request data to obtain minimum normalized features; Performing a difference operation on the numerical task request data, the maximum normalized feature, and the minimum normalized feature to obtain a difference normalized feature; The difference normalization feature is normalized to obtain numerical task request data.

4. The microservice load balancing method according to claim 3, characterized in that: The calculating the similarity between the current task request feature and the historical task request feature matrix to obtain first similarity data between the current task request and the historical task request includes: Embedding the current task request feature to obtain a current embedded feature vector; Performing a matrix multiplication operation on the current embedded feature vector and the historical task request feature matrix to obtain reference similarity data; The reference similarity data is activated to obtain first similarity data between the current task request and the historical task request.

5. The microservice load balancing method according to claim 4, characterized in that: The determining of the server cross-feature set according to the server-related data set includes: Acquire the number of first intensive tasks corresponding to each server from the server-related data set to obtain a subset of the number of first intensive tasks, and acquire the number of second intensive tasks corresponding to each server to obtain a subset of the number of second intensive tasks; Constructing a task number ratio cross feature set according to the first intensive task number subset and the second intensive task number subset; Acquire the processor utilization corresponding to each server from the server-related data set to obtain a processor utilization subset, acquire the memory utilization corresponding to each server to obtain a memory utilization subset, and acquire the disk utilization corresponding to each server to obtain a disk utilization subset; Perform load calculation on the control parameters in the server related data set, each processing utilization in the processor utilization subset, each memory utilization in the memory utilization subset, and each disk utilization in the disk utilization subset to determine a server load cross feature set; A server cross-feature set is determined according to the task number proportion cross-feature set and the server load cross-feature set.

6. The microservice load balancing method according to claim 5, characterized in that: The step of determining a target server identifier that matches the current task request according to the current task request data, the server-related data set, the reference server feature, and the server cross-feature set includes: Input the current task request data and the reference server feature, as well as each server-related data in the server-related data set and each server cross-feature in the server cross-feature set, into the microservice load balancing model for data processing, determine the reference matching probability between each server and the current task request, and obtain a reference matching probability set; Acquire the server response time corresponding to each server from the server-related data set to obtain a server response time subset; Obtain the inverse of each server response time in the server response time subset to obtain the inverse subset of server response time; Determine a time probability matching value set according to the server response time reciprocal subset and the reference matching probability set; According to each time probability matching value in the time probability matching value set, a target server identifier matching the current task request is determined.

7. A microservice load balancing device, characterized in that: The microservice load balancing device comprises: The first acquisition module is used to acquire current task request data corresponding to the current task request and historical task request data corresponding to the historical task request, and acquire relevant data of each server in the microservice architecture to obtain a server-related data set; A first determination module, configured to determine first similarity data between the current task request and the historical task request according to the current task request data and the historical task request data; A second determination module, configured to determine, from the historical task request data, target historical task request data that is most similar to the current task request according to the first similarity data; A first processing module, configured to use the server characteristics corresponding to the target historical task request data as reference server characteristics; A third determination module, configured to determine a server cross-feature set based on the server-related data set; The fourth determination module is used to determine the target server identifier that matches the current task request according to the current task request data, the server-related data set, the reference server characteristics and the server cross-characteristic set.

8. The microservice load balancing device according to claim 7, characterized in that: The first determination module is used to determine first similarity data between the current task request and the historical task request according to the current task request data and the historical task request data, and is specifically used to: Acquire numerical task request characteristics and data and category-type task request characteristic data from the current task request characteristic data; Normalizing the numerical task request feature data to obtain a first current task request feature; Characteristically encoding the category-type task request characteristic data to obtain a second current task request characteristic; The first current task request feature and the second current task request feature are fused to obtain a target current task request feature; Processing the historical task request data to obtain a historical task request feature matrix; The similarity between the current task request feature and the historical task request feature matrix is ​​calculated to obtain first similarity data between the current task request and the historical task request.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the microservice load balancing method according to any one of claims 1 to 6 is implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the microservice load balancing method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

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

    CN114884886A

  • Load balancing implementation method and device, computer equipment and storage medium

    CN116185627A