CN115604267A - Load balancing method, device, equipment and storage medium for message middleware - Google Patents

Load balancing method, device, equipment and storage medium for message middleware Download PDF

Info

Publication number
CN115604267A
CN115604267A CN202211172237.9A CN202211172237A CN115604267A CN 115604267 A CN115604267 A CN 115604267A CN 202211172237 A CN202211172237 A CN 202211172237A CN 115604267 A CN115604267 A CN 115604267A
Authority
CN
China
Prior art keywords
message middleware
load
node
message
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211172237.9A
Other languages
Chinese (zh)
Inventor
夏文
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Oribo Technology Co Ltd
Original Assignee
Shenzhen Oribo Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Oribo Technology Co Ltd filed Critical Shenzhen Oribo Technology Co Ltd
Priority to CN202211172237.9A priority Critical patent/CN115604267A/en
Publication of CN115604267A publication Critical patent/CN115604267A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/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

Landscapes

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

Abstract

The application relates to a load balancing method, device, equipment and storage medium for message middleware. The method comprises the following steps: reading at least two kinds of load state data of each message middleware node in the message middleware from a node load file corresponding to the message middleware; the node load file is generated by writing the load state data of each message middleware node acquired from the message middleware into a corresponding file through executing a script; according to the weight corresponding to each type of load state data, performing weighted calculation on the at least two types of load state data to obtain a load representation value of each message middleware node; determining a target message middleware node meeting an overload condition based on the load characterization value; and determining at least one target message queue from the message queues created in the target message middleware node and deleting the target message queue. By adopting the method, the adaptability of the message middleware can be improved.

Description

Load balancing method, device, equipment and storage medium for message middleware
Technical Field
The present application relates to the field of message transmission technologies, and in particular, to a method, an apparatus, a device, and a storage medium for load balancing of message middleware.
Background
With the development of message transmission technology, people propose the concept of message middleware, which can process network communication, when network connection is unavailable, messages are temporarily stored in a queue, and when the network is unblocked, the messages are forwarded to corresponding application programs or services, so that asynchronous communication can be realized in a distributed system.
In the conventional technology, the message middleware cannot realize self-adaptive load balancing, and if service data with large data volume is created in a certain message middleware node in a message middleware cluster, the message middleware node has high load, so that the problem of unbalanced load of the message middleware node is caused.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a method, an apparatus, a computer device, a computer-readable storage medium, and a computer program product for load balancing for message middleware, which can improve adaptability.
In a first aspect, the present application provides a load balancing method for message middleware. The method comprises the following steps:
reading at least two kinds of load state data of each message middleware node in the message middleware from a node load file corresponding to the message middleware; the node load file is generated by writing the load state data of each message middleware node acquired from the message middleware into a corresponding file through executing a script;
according to the weight corresponding to each kind of load state data, carrying out weighted calculation on the at least two kinds of load state data to obtain a load representation value of each message middleware node;
determining a target message middleware node meeting an overload condition based on the load characterization value;
and determining at least one target message queue from the message queues created in the target message middleware node and deleting the target message queue.
In one embodiment, the reading, from the node load file corresponding to the message middleware, at least two types of load status data of each message middleware node in the message middleware includes:
reading at least two kinds of load state data of each message middleware node in the message middleware from a node load file corresponding to the message middleware according to a preset reading time period through dynamic adjustment service;
wherein the dynamic adjustment service is a service application for dynamically deleting a message queue.
In one embodiment, the load status data includes resource occupancy data and pending task data of a processor of the message middleware node; the weighting calculation of the at least two types of load state data according to the weight corresponding to each type of load state data to obtain the load representation value of each message middleware node comprises:
determining a first weight corresponding to the resource occupation data and a second weight corresponding to the task data to be processed based on a task type corresponding to a message middleware node;
and performing weighted calculation on the resource occupation data and the task data to be processed according to the first weight and the second weight to obtain a load representation value of each message middleware node.
In one embodiment, before reading, in the node load file corresponding to the slave message middleware, at least two types of load status data of each message middleware node in the message middleware, the method further includes:
acquiring resource occupation data and task data to be processed of a processor of each message middleware node from the message middleware according to a preset writing time period by executing the script to obtain load state data of each message middleware node;
and writing the load state data of each message middleware node into a node load file by executing the script.
In one embodiment, the determining, based on the load characterizing value, a target message middleware node that meets an overload condition includes:
determining an overload threshold based on the load characterization value of each message middleware node;
and determining a target message middleware node of which the load characteristic value reaches an overload threshold value.
In one embodiment, the determining and deleting at least one target message queue from the message queues created in the target message middleware node includes:
selecting at least one target message queue from message queues created in the target message middleware node based on a pre-configured deletable queue set; the selected target message queue is matched with queue elements in the deletable queue set;
deleting the at least one target message queue.
In one embodiment, the target message queue is created by a target business service application; after determining and deleting at least one target message queue from the message queues created in the target message middleware node, the method further comprises:
and randomly rebuilding the target message queue to any message middleware node in the message middleware through the target business service application under the condition that the target message queue is deleted.
In a second aspect, the present application further provides a load balancing apparatus for message middleware. The device comprises:
the acquisition module is used for reading at least two kinds of load state data of each message middleware node in the message middleware from a node load file corresponding to the message middleware; the node load file is generated by writing the load state data of each message middleware node acquired from the message middleware into a corresponding file through executing a script;
the calculation module is used for performing weighted calculation on the at least two kinds of load state data according to the weight corresponding to each kind of load state data to obtain a load representation value of each message middleware node;
the determining module is used for determining a target message middleware node meeting an overload condition based on the load representation value; and determining at least one target message queue from the message queues created in the target message middleware node and deleting the target message queue.
In one embodiment, the obtaining module is configured to read, by a dynamic adjustment service, at least two types of load state data of each message middleware node in the message middleware from a node load file corresponding to the message middleware according to a preset reading time period; wherein the dynamic adjustment service is a service application for dynamically deleting a message queue.
In one embodiment, the load status data includes resource occupancy data and pending task data of a processor of the message middleware node; the computing module is further configured to determine a first weight corresponding to the resource occupation data and a second weight corresponding to the to-be-processed task data based on a task type corresponding to a message middleware node; and performing weighted calculation on the resource occupation data and the task data to be processed according to the first weight and the second weight to obtain a load representation value of each message middleware node.
In one embodiment, the obtaining module is further configured to obtain, by executing the script and according to a preset write-in time period, resource occupation data and task data to be processed of the processor of each message middleware node from the message middleware, to obtain load state data of each message middleware node; and writing the load state data of each message middleware node into the node load file by executing the script.
In one embodiment, the determining module is configured to determine an overload threshold based on the load characterizing value of each message middleware node; and determining the target message middleware node of which the load characteristic value reaches an overload threshold value.
In one embodiment, the determining module is configured to select at least one target message queue from message queues created in the target message middleware node based on a preconfigured deletable queue set; the selected target message queue is matched with queue elements in the deletable queue set; deleting the at least one target message queue.
In one embodiment, the target message queue is created by a target business service application; the determining module is configured to randomly reconstruct a target message queue to any message middleware node in a message middleware through the target service application when the target message queue is deleted.
In a third aspect, the application also provides a computer device. The computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor realizes the steps of the method embodiments when executing the computer program.
In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium has stored thereon a computer program which, when being executed by a processor, carries out the steps of the embodiments of the method described herein.
In a fifth aspect, the present application further provides a computer program product. The computer program product comprises a computer program which, when being executed by a processor, carries out the steps of the embodiments of the method described herein.
According to the load balancing method, the load balancing device, the computer equipment, the storage medium and the computer program product for the message middleware, at least two kinds of load state data of each message middleware node in the message middleware are read from the node load file corresponding to the message middleware; the node load file is generated by writing the load state data of each message middleware node acquired from the message middleware into a corresponding file through executing a script; according to the weight corresponding to each kind of load state data, carrying out weighted calculation on at least two kinds of load state data to obtain a load representation value of each message middleware node; determining a target message middleware node meeting an overload condition based on the load characterization value; at least one target message queue is determined and deleted from the message queues created in the target message middleware node. And calculating a load characteristic value of each middleware node according to the load state data and the corresponding weight, and deleting the target message queue to reduce the load after determining the target message middleware node meeting the overload condition, so that the load of the message middleware node can be adaptively adjusted, and the adaptability is improved.
Drawings
FIG. 1 is a diagram of an application environment for a method for load balancing of message middleware in one embodiment;
FIG. 2 is a flow diagram of a method for load balancing for message middleware in one embodiment;
FIG. 3 is an architecture diagram of a method for load balancing for message middleware in one embodiment;
FIG. 4 is a block diagram of a load balancing apparatus for message middleware in one embodiment;
FIG. 5 is a diagram illustrating an internal structure of a computer device according to an embodiment;
fig. 6 is an internal structural diagram of a computer device in another embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The load balancing method for the message middleware provided by the embodiment of the application can be applied to the application environment shown in fig. 1. Wherein message middleware 102 communicates with load adjustment server 104 over a network. The load adjustment server 104 may execute the script to obtain the load status data of each message middleware node from the message middleware and write the load status data into a corresponding file to generate a node load file corresponding to the message middleware 102. Load adjustment server 104 may read at least two load status data for each message middleware node in message middleware 102 from a node load file corresponding to message middleware 102. The load adjustment server 104 may perform weighted calculation on at least two types of load state data according to the weight corresponding to each type of load state data, so as to obtain a load representation value of each message middleware node. The load adjustment server 104 may determine a target message middleware node that meets the overload condition based on the load characterizing value. The load adjustment server 104 may determine and delete at least one target message queue from the message queues created in the target message middleware node. The message middleware 102 and the load adjustment server 104 may be implemented by independent servers or a server cluster composed of a plurality of servers.
In one embodiment, message middleware 102 may be implemented as a server cluster comprised of a plurality of servers. Each message middleware node included in the message middleware may involve one or more servers. The message middleware is based on a queue and message transmission technology and is used for supporting synchronous or asynchronous and reliable message transmission. Each message middleware node may support message transmission by the business service application after establishing a connection with the business service application, i.e., the message middleware node is used to establish a connection with the business service application, so that the business service application creates a message queue in the message middleware node. The business service application is a service program for supporting the business application deployed at the terminal. It can be understood that the service application in the terminal responds to the operation of the user to generate a corresponding message, and the message is sent to the connected message middleware node through the service application deployed in the application server.
In one embodiment, in the scene of smart home, a service application is deployed in the smart central control device, and the smart central control device may respond to a control operation for the home device and create a control instruction through the service application. The intelligent central control equipment can communicate with the application server through a network and send the control instruction to the application server. The application server may create control instructions into a message queue of the connected target middleware node through the business service application.
In one embodiment, the business service application can be deployed at a terminal, which can communicate with the messaging middleware over a network. The terminal can be but not limited to various personal computers, notebook computers, smart phones, tablet computers, internet of things equipment and portable wearable equipment, and the internet of things equipment can be intelligent sound boxes, intelligent televisions, intelligent air conditioners, intelligent vehicle-mounted equipment and the like. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, and the like.
In one embodiment, as shown in fig. 2, a load balancing method for message middleware is provided, which is described by taking the application of the method to the load adjustment server in fig. 1 as an example, and includes the following steps:
s202, reading at least two kinds of load state data of each message middleware node in the message middleware from the node load file corresponding to the message middleware.
The node load file is generated by writing the load state data of each message middleware node acquired from the message middleware into a corresponding file through executing a script. The load status data is used to indicate the load status of the message middleware node. It will be appreciated that a variety of load state data can embody the load state of a message middleware node from multiple dimensions. For example, one type of load state data represents the busy degree of a message middleware node, and the other type of load state data represents the load amount of the message middleware node.
Specifically, the load adjustment server may obtain load state data of each message middleware node from the message middleware by executing the script, and write the obtained load state data into the file to obtain a node load file corresponding to the message middleware. The load adjustment server can read various load state data of each message middleware node in the message middleware from the node load file corresponding to the message middleware.
In one embodiment, each message middleware node may run on a container capable of running an application program, or on a terminal or a server, or on a virtual host of a cloud service.
And S204, performing weighted calculation on at least two kinds of load state data according to the weight corresponding to each kind of load state data to obtain a load representation value of each message middleware node.
The load representation value is used for representing the whole load condition of the message middleware node. It can be understood that each load state data can only represent the load condition under a single dimension, and the load representation values obtained by combining at least two load state data can comprehensively and comprehensively represent the load condition of the message middleware node.
Specifically, the load adjustment server is preset with a weight corresponding to each load state data. The load adjustment server can use the weight corresponding to each load state data to perform weighted summation calculation to obtain a load representation value of each message middleware node. It can be understood that the load adjustment server may use the weight corresponding to each load status data to perform weighting, respectively, to obtain each load status data after weighting. The load adjustment server can perform summation calculation by calculating the weighted multiple load state data to obtain a load representation value of each middleware node.
S206, determining target message middleware nodes meeting overload conditions based on the load characterization values; at least one target message queue is determined and deleted from the message queues created in the target message middleware node.
In particular, the message middleware comprises a plurality of message middleware nodes. The load adjustment server may determine an average value of the load characterization values of the plurality of message middleware nodes, to obtain a load average value corresponding to the message middleware. The load adjustment server may determine that the overload condition is met based on the load average. The load adjustment server may determine a target message middleware node satisfying an overload condition from among the plurality of message middleware nodes, and then determine and delete at least one target message queue from the message queues created in the target message middleware node.
In one embodiment, the overload condition may be a fixed proportion of the load characterizing value exceeding the load average. It will be appreciated that in the event that the load characterizing value exceeds a fixed proportion of the load average value, the corresponding message middleware node may act as the target middleware node. For example, the fixed ratio may be 30%, and the load characteristic value exceeds 30% of the load average value, that is, in the case that the load characteristic value is greater than 1.3 times of the load average value, the corresponding message middleware node may be the target middleware node.
In the load balancing method for the message middleware, at least two kinds of load state data of each message middleware node in the message middleware are read from the node load file corresponding to the message middleware; the node load file is generated by writing the load state data of each message middleware node acquired from the message middleware into a corresponding file through executing a script; according to the weight corresponding to each kind of load state data, carrying out weighted calculation on at least two kinds of load state data to obtain a load representation value of each message middleware node; determining a target message middleware node meeting an overload condition based on the load representation value; at least one target message queue is determined and deleted from the message queues created in the target message middleware node. And calculating a load representation value of each middleware node according to the load state data and the corresponding weight, and deleting the target message queue to reduce the load after determining the target message middleware node meeting the overload condition, so that the load of the message middleware node can be adaptively adjusted, and the adaptability is improved.
In one embodiment, the step of reading at least two types of load status data of each message middleware node in the message middleware from a node load file corresponding to the message middleware comprises: reading at least two kinds of load state data of each message middleware node in the message middleware from a node load file corresponding to the message middleware through dynamic adjustment service according to a preset reading time period; the dynamic adjustment service is a service application for dynamically deleting the message queue.
The preset reading time period is a preset fixed time interval for reading the load status data, for example, the preset reading time period may be 2 seconds.
Specifically, a dynamic adjustment service is deployed in the load adjustment server. The load adjustment server may read, through the dynamic adjustment service, a plurality of load status data of each message middleware node in the message middleware from the node load file corresponding to the message middleware at preset reading time periods, that is, every other preset reading time period. The subsequent load adjustment server may write the read load status data into the node load file.
In one embodiment, the load adjustment server may write the read load status data into the node load file according to a preset write time period. The preset writing time period is a preset fixed time interval for writing the load state data into the file. The preset writing period and the preset reading period may be identical.
In one embodiment, the preset write time period may be less than or equal to the preset read time period to ensure that the load regulation server can read the new load status data.
In this embodiment, through the dynamic adjustment service, at least two types of load state data of each message middleware node in the message middleware are read from the node load file corresponding to the message middleware according to the preset reading time period, and subsequently, load balancing can be performed on the message middleware based on the read load state data, so that the adaptability is improved.
In one embodiment, the load status data comprises resource occupancy data and pending task data for a processor of the message middleware node; according to the weight corresponding to each kind of load state data, carrying out weighted calculation on at least two kinds of load state data to obtain a load representation value of each message middleware node comprises the following steps: determining a first weight corresponding to the resource occupation data and a second weight corresponding to the task data to be processed based on the task type corresponding to the message middleware node; and performing weighted calculation on the resource occupation data and the task data to be processed according to the first weight and the second weight to obtain a load representation value of each message middleware node.
The resource occupation data is used for indicating the busy degree of the message middleware node. The pending task data is used to indicate the load number of the message middleware node. It will be appreciated that too busy or too heavily loaded message middleware nodes may cause the message middleware nodes to crash and not continue to support message transmission.
Wherein the task type is a type of task processed by the message middleware node processor. For example, task types may include compute-intensive (CPU-bound) and access-intensive (IO-bound). The calculation intensive task is characterized in that a large amount of calculation is needed, and the calculation resources of the processor are consumed, so that the data occupied by the calculation intensive task resources is greatly influenced, and the data influence of the task to be processed is smaller. The access intensive task is characterized in that the consumption of computing resources is low, most of the time of the task is waiting for the completion of access operation (IO operation), so that the access intensive task is processed, the data occupied by the task resources has less influence, and the data of the task to be processed has greater influence.
Specifically, different weights are set in the load adjustment server in advance for different task types and different load state data. It is to be understood that the second weight corresponding to the compute-intensive pending task data is higher than that of the access-intensive setting, and the second weight corresponding to the access-intensive resource occupancy data is higher than that of the compute-intensive setting. The load adjustment server may determine a first weight corresponding to the resource occupancy data and a second weight corresponding to the to-be-processed task data that match the task type of the message middleware node. The load adjustment server can use the first weight and the second weight to perform weighted summation calculation on the resource occupation data and the task data to be processed, so as to obtain a load representation value of each message middleware node. It can be understood that the load adjustment server may use the first weight to weight the resource occupation data to obtain weighted resource occupation data, and use the second weight to weight the to-be-processed task data to obtain weighted to-be-processed task data. The load adjustment server can sum the weighted resource occupation data and the weighted task data to be processed to obtain a load representation value of the message middleware node.
In the embodiment, a first weight corresponding to resource occupation data and a second weight corresponding to task data to be processed are determined based on a task type corresponding to a message middleware node; and performing weighted calculation on the resource occupation data and the task data to be processed according to the first weight and the second weight to obtain a load representation value of each message middleware node, subsequently determining a target message middleware node based on the load representation value, and deleting a target message queue of the target message middleware node to realize load balance of the message middleware.
In one embodiment, before reading at least two types of load status data of each message middleware node in the message middleware from the node load file corresponding to the message middleware, the method further includes: acquiring resource occupation data and task data to be processed of a processor of each message middleware node from the message middleware according to a preset writing time period by executing the script to obtain load state data of each message middleware node; and writing the load state data of each message middleware node into the node load file by executing the script.
In particular, the resource occupancy data may comprise processor usage (CPUrate) of the message middleware node. The pending task data may include a processor load amount (CPUload) of the message middleware. The load adjustment server may obtain the processor utilization rate and the processor load amount of each message middleware node from the message middleware at every preset write-in time period by executing the script, to obtain the load state data of each message middleware node. The load adjustment server may write the load status data for each message middleware node to the node load file by executing the script. It will be appreciated that the load adjustment server may read two types of load status data for each message middleware node, which may be processor usage and processor load.
Wherein the processor usage rate represents an actual workload of the processor. Processor usage may indicate a busy condition of the message middleware node. The processor load amount represents the number of tasks waiting to use the processor. The processor load amount may indicate a load amount of the message middleware node.
In one embodiment, the load characterizing value = processor usage by a first weight + processor load by a second weight.
In the embodiment, by executing the script, according to a preset write-in time period, resource occupation data and task data to be processed of a processor of each message middleware node are obtained from the message middleware, and load state data of each message middleware node is obtained; by executing the script, the load state data of each message middleware node is written into the node load file, and then load balancing can be carried out on the message middleware based on the load state data in the node load file.
In one embodiment, the step of determining a target message middleware node meeting an overload condition based on the load characterizing value comprises: determining an overload threshold based on the load characterizing value of each message middleware node; and determining the target message middleware node of which the load characteristic value reaches the overload threshold value.
The overload threshold is a threshold for determining whether or not the load is excessive.
In particular, the overload threshold may be equal to a fixed multiple of the load average. The load adjustment server may determine a message middleware node having a largest load characterizing value from among the plurality of message middleware nodes. The load adjustment server can perform difference calculation on the maximum load characterization value and the load average value to obtain a load difference value. And under the condition that the ratio of the load difference value to the load average value is larger than a fixed ratio, determining that the maximum load characteristic value reaches an overload threshold value, and taking the corresponding message middleware node as a target message middleware node. Wherein the fixed ratio is matched with the fixed multiple, and the fixed ratio is equal to the fixed multiple minus 1. For example, the fixed ratio is 30%, and the overload condition may be (maximum load characteristic value-load average value)/load average value >30%.
In one embodiment, for a case that the load characterizing values of a plurality of message middleware nodes reach an overload threshold, the message middleware node with the maximum load characterizing value is adjusted each time until the load characterizing value of the message middleware node is no longer maximum, and another message middleware node (the message middleware node corresponding to the maximum load characterizing value) is selected for adjustment next time, so that the load of the message middleware node with the load characterizing value exceeding 30% of the load average value is adjusted.
In the embodiment, the overload threshold is determined based on the load characteristic value of each message middleware node; and determining the target message middleware node with the load characteristic value reaching the overload threshold value, and continuously adjusting the overloaded target message middleware node, so that the load balance of the message middleware is realized, and the adaptability is improved.
In one embodiment, the step of determining and deleting at least one target message queue from the message queues created in the target message middleware node comprises: selecting at least one target message queue from message queues created in target message middleware nodes based on a pre-configured deletable queue set; matching the selected target message queue with queue elements in the deletable queue set; at least one target message queue is deleted.
The deletable queue set comprises message queue related information which has a large influence on the message middleware node. It will be appreciated that the queue elements of the deletable queue set may correspond to attributes of the message queue. For example, a queue element may indicate a message queue with an ingress and egress speed greater than a preset maximum speed. It is understood that an ingress and egress speed of greater than 1000 times/second may have a greater impact on the load of the messaging middleware.
Specifically, the load adjustment server may determine a preconfigured deletable queue set, select a target message queue from the message queues created in the target message middleware node that matches a queue element in the deletable queue set, and delete the target message queue.
In one embodiment, in a case that there are a plurality of message queues respectively matched with a plurality of queue elements, the load adjustment server may arbitrarily select one of the message queues as the target message queue. It can be understood that the message queues indicated in the deletable queue set are all message queues having a large impact on the load, and one of the message queues may be randomly selected, which is better than the message queue with the largest message amount. If the message quantity of the deleted message is selected to be the largest directly, the node load of the message middleware can be reduced too fast, and imbalance can be caused.
In one embodiment, there are situations where deleting a message queue results in a message being lost, and therefore a message queue that would have lost a message cannot be recorded into the set of deletable queues, and a human may modify the set of deletable queues as the case may be.
In one embodiment, the load adjustment server may communicate with the application server, determine an original message queue created by the target business service application, and delete the target message queue if the target message queue matches the original message queue. It will be appreciated that the target message queue being in line with the original message queue indicates that there is no missing message in the target message queue.
In one embodiment, the load adjustment server may re-determine the target message queue in the event that the target message queue does not match the original message queue.
In this embodiment, based on a pre-configured deletable queue set, at least one target message queue is selected from message queues created in target message middleware nodes; matching the selected target message queue with queue elements in the deletable queue set; and deleting at least one target message queue, thereby realizing the load balance of the message middleware and improving the adaptability.
In one embodiment, the target message queue is created by a target business service application; after determining and deleting at least one target message queue from the message queues created in the target message middleware node, the method further comprises the following steps: and randomly rebuilding the target message queue to any message middleware node in the message middleware through the target business service application under the condition that the target message queue is deleted.
Specifically, under the condition that the target message queue is deleted, the application server where the target service application is located can learn about the event that the target message queue is deleted through monitoring the message middleware, and the application server can randomly rebuild the target message queue to any message middleware node in the message middleware through the target service application.
In one embodiment, a plurality of business service applications exist and are deployed in a cluster formed by a plurality of application servers. In case of starting the service application, the application server will use polling to establish connection with the message middleware, so the message middleware node to which the service application is connected is not fixed. After monitoring the time that the target message queue is deleted, the application server where the target business service application is located reestablishes the target message queue to any message middleware node through the connection with the message middleware.
In one embodiment, the target message queue is rebuilt to any message middleware node through an application server previously connected to the message middleware. It can be understood that the cluster formed by the plurality of application servers can monitor the time when the target message queue is deleted, and the plurality of application servers can rebuild the target message queue, so that the target message queue is rebuilt by the application server connected to the message middleware firstly.
In this embodiment, when the target message queue is deleted, the target service application randomly reconstructs the target message queue to any message middleware node in the message middleware, so that the transmission of messages is supported as much as possible while load balancing is achieved, and the adaptability is improved.
In one embodiment, an architecture diagram for a load balancing method for message middleware is provided as shown in FIG. 3. The load adjustment server may obtain a processor usage rate and a processor load amount of each message middleware node included in the message middleware every a preset write period by executing the script. The preset writing time period may be 2 seconds, and the script may be a sheet script. The load adjustment server can write the acquired processor utilization rate and processor load capacity into the node load file through the execution script. The node load file includes a processor usage rate and a processor load amount of each message middleware node in the message middleware.
The load adjusting server can read the processor utilization rate and the processor load capacity of each message middleware node from the node load file every other preset reading time period through the dynamic adjusting service, and performs weighted summation calculation on the processor utilization rate and the processor load capacity to obtain the load representation value of each message middleware node. The load adjustment server can determine a maximum load characteristic value and a load average value through the dynamic adjustment service, and determine the message middleware node corresponding to the maximum load characteristic value as a target middleware node under the condition that a load difference value between the maximum load characteristic value and the load average value exceeds a fixed proportion of the load average value.
The load adjustment server may determine any one of the message queues matching the queue elements in the deletable queue set by the dynamic adjustment service, obtain a target message queue, and delete the target message queue. The application server can rebuild the target message queue through the target business service application after monitoring the event that the target message queue is deleted.
It should be understood that, although the steps in the flowcharts related to the embodiments as described above are sequentially displayed as indicated by arrows, the steps are not necessarily performed sequentially as indicated by the arrows. The steps are not limited to being performed in the exact order illustrated and, unless explicitly stated herein, may be performed in other orders. Moreover, at least a part of the steps in the flowcharts related to the embodiments described above may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the execution order of the steps or stages is not necessarily sequential, but may be rotated or alternated with other steps or at least a part of the steps or stages in other steps.
Based on the same inventive concept, the embodiment of the present application further provides a load balancing device for message middleware, which is used for implementing the load balancing method for message middleware mentioned above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, so that the specific limitations in one or more embodiments of the load balancing device for message middleware provided below may refer to the limitations in the above description for the load balancing method for message middleware, and are not described herein again.
In one embodiment, as shown in fig. 4, there is provided a load balancing apparatus 400 for message middleware, comprising: an obtaining module 402, a calculating module 404, and a determining module 406, wherein:
an obtaining module 402, configured to read at least two types of load state data of each message middleware node in a message middleware from a node load file corresponding to the message middleware; the node load file is generated by writing the load state data of each message middleware node acquired from the message middleware into a corresponding file through executing a script.
A calculating module 404, configured to perform weighted calculation on the at least two types of load state data according to a weight corresponding to each type of load state data, so as to obtain a load characterization value of each message middleware node.
A determining module 406, configured to determine, based on the load characterizing value, a target message middleware node meeting an overload condition; and determining at least one target message queue from the message queues created in the target message middleware node and deleting the target message queue.
In an embodiment, the obtaining module 402 is configured to read, by using a dynamic adjustment service, at least two types of load status data of each message middleware node in a message middleware from a node load file corresponding to the message middleware according to a preset reading time period; the dynamic adjustment service is a service application for dynamically deleting the message queue.
In one embodiment, the load status data comprises resource occupancy data and pending task data for a processor of the message middleware node; the calculating module 404 is further configured to determine, based on the task type corresponding to the message middleware node, a first weight corresponding to the resource occupation data and a second weight corresponding to the to-be-processed task data; and performing weighted calculation on the resource occupation data and the task data to be processed according to the first weight and the second weight to obtain a load representation value of each message middleware node.
In an embodiment, the obtaining module 402 is further configured to obtain, by executing a script, resource occupation data and to-be-processed task data of a processor of each message middleware node from the message middleware according to a preset write-in time period, to obtain load state data of each message middleware node; and writing the load state data of each message middleware node into a node load file by executing the script.
In one embodiment, the determining module 406 is configured to determine an overload threshold based on the load characterizing value of each message middleware node; and determining the target message middleware node of which the load characteristic value reaches the overload threshold value.
In one embodiment, the determining module 406 is configured to select at least one target message queue from message queues created in the target message middleware node based on a preconfigured set of deletable queues; matching the selected target message queue with queue elements in the deletable queue set; at least one target message queue is deleted.
In one embodiment, the target message queue is created by a target business service application; a determining module 406, configured to randomly re-establish, by the target business service application, the target message queue to any message middleware node in the message middleware in the case that the target message queue is deleted.
The modules in the load balancing device for the message middleware can be wholly or partially implemented by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent of a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 5. The computer device includes a processor, a memory, an Input/Output interface (I/O for short), and a communication interface. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface is connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured 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, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used to store node load files. The input/output interface of the computer device is used for exchanging information between the processor and an external device. The communication interface of the computer device is used for connecting and communicating with an external terminal through a network. The computer program is executed by a processor to implement a method of load balancing for message middleware.
In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 6. The computer apparatus includes a processor, a memory, an input/output interface, a communication interface, a display unit, and an input device. The processor, the memory and the input/output interface are connected by a system bus, and the communication interface, the display unit and the input device are connected by the input/output interface to the system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile 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 operating system and the computer program to run on the non-volatile storage medium. The input/output interface of the computer device is used for exchanging information between the processor and an external device. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless communication can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a method of load balancing for message middleware. The display unit of the computer equipment is used for forming a visual picture, and can be a display screen, a projection device or a virtual reality imaging device, the display screen can be a liquid crystal display screen or an electronic ink display screen, the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on a shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the configurations shown in fig. 5 and 6 are merely block diagrams of some configurations relevant to the present disclosure, and do not constitute a limitation on the computing devices to which the present disclosure may be applied, and that a particular computing device may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the above-described method embodiments when executing the computer program.
In an embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which computer program, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.
In an embodiment, a computer program product is provided, comprising a computer program which, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.
It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) referred to in the present application are information and data authorized by the user or fully authorized by each party, and the collection, use and processing of the related data need to comply with the relevant laws and regulations and standards of the relevant countries and regions.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above may be implemented by hardware instructions of a computer program, which may be stored in a non-volatile computer-readable storage medium, and when executed, may include the processes of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high-density embedded nonvolatile Memory, resistive Random Access Memory (ReRAM), magnetic Random Access Memory (MRAM), ferroelectric Random Access Memory (FRAM), phase Change Memory (PCM), graphene Memory, and the like. Volatile Memory can include Random Access Memory (RAM), external cache Memory, and the like. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), for example. The databases referred to in various embodiments provided herein may include at least one of relational and non-relational databases. The non-relational database may include, but is not limited to, a block chain based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing based data processing logic devices, etc., without limitation.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, and these are all within the scope of protection of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.

Claims (10)

1. A method for load balancing of message middleware, the method comprising:
reading at least two kinds of load state data of each message middleware node in the message middleware from a node load file corresponding to the message middleware; the node load file is generated by writing the load state data of each message middleware node acquired from the message middleware into a corresponding file through executing a script;
according to the weight corresponding to each kind of load state data, carrying out weighted calculation on the at least two kinds of load state data to obtain a load representation value of each message middleware node;
determining a target message middleware node meeting an overload condition based on the load characterization value;
and determining at least one target message queue from the message queues created in the target message middleware node and deleting the target message queue.
2. The method according to claim 1, wherein the reading at least two types of load status data of each message middleware node in the message middleware from a node load file corresponding to the message middleware comprises:
reading at least two kinds of load state data of each message middleware node in the message middleware from a node load file corresponding to the message middleware according to a preset reading time period through dynamic adjustment service;
wherein the dynamic adjustment service is a service application for dynamically deleting a message queue.
3. The method of claim 1, wherein the load state data comprises resource occupancy data and pending task data for a processor of a message middleware node; the weighting calculation of the at least two types of load state data according to the weight corresponding to each type of load state data to obtain the load representation value of each message middleware node comprises:
determining a first weight corresponding to the resource occupation data and a second weight corresponding to the task data to be processed based on a task type corresponding to a message middleware node;
and performing weighted calculation on the resource occupation data and the task data to be processed according to the first weight and the second weight to obtain a load representation value of each message middleware node.
4. The method according to claim 3, further comprising, before reading at least two types of load status data of each message middleware node in the message middleware from the node load file corresponding to the slave message middleware:
acquiring resource occupation data and task data to be processed of a processor of each message middleware node from the message middleware according to a preset writing time period by executing the script to obtain load state data of each message middleware node;
and writing the load state data of each message middleware node into a node load file by executing the script.
5. The method of claim 1, wherein determining a target message middleware node that meets an overload condition based on the load characterizing value comprises:
determining an overload threshold based on the load characterization value of each message middleware node;
and determining a target message middleware node of which the load characteristic value reaches an overload threshold value.
6. The method of claim 1, wherein determining and deleting at least one target message queue from the message queues created in the target message middleware node comprises:
selecting at least one target message queue from message queues created in the target message middleware node based on a pre-configured deletable queue set; the selected target message queue is matched with queue elements in the deletable queue set;
deleting the at least one target message queue.
7. The method of any of claims 1 to 6, wherein the target message queue is created by a target business service application; after determining and deleting at least one target message queue from the message queues created in the target message middleware node, the method further includes:
and randomly rebuilding the target message queue to any message middleware node in the message middleware through the target business service application under the condition that the target message queue is deleted.
8. An apparatus for load balancing for message middleware, the apparatus comprising:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for reading at least two kinds of load state data of each message middleware node in the message middleware from a node load file corresponding to the message middleware; the node load file is generated by writing the load state data of each message middleware node acquired from the message middleware into a corresponding file through executing a script;
the calculation module is used for performing weighted calculation on the at least two types of load state data according to the weight corresponding to each type of load state data to obtain a load representation value of each message middleware node;
the determining module is used for determining a target message middleware node meeting an overload condition based on the load representation value; and determining at least one target message queue from the message queues created in the target message middleware node and deleting the target message queue.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202211172237.9A 2022-09-26 2022-09-26 Load balancing method, device, equipment and storage medium for message middleware Pending CN115604267A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211172237.9A CN115604267A (en) 2022-09-26 2022-09-26 Load balancing method, device, equipment and storage medium for message middleware

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211172237.9A CN115604267A (en) 2022-09-26 2022-09-26 Load balancing method, device, equipment and storage medium for message middleware

Publications (1)

Publication Number Publication Date
CN115604267A true CN115604267A (en) 2023-01-13

Family

ID=84845274

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211172237.9A Pending CN115604267A (en) 2022-09-26 2022-09-26 Load balancing method, device, equipment and storage medium for message middleware

Country Status (1)

Country Link
CN (1) CN115604267A (en)

Similar Documents

Publication Publication Date Title
US10803638B2 (en) Efficient display of data points in a user interface
CN115604267A (en) Load balancing method, device, equipment and storage medium for message middleware
US11783075B2 (en) Systems and methods of providing access to secure data
CN114253481A (en) Data storage method and device, computer equipment and storage medium
CN115604277A (en) Load balancing method, device, equipment and storage medium for message middleware
CN118018552B (en) Cluster service deployment method and device based on middleware and computer equipment
CN117453759B (en) Service data processing method, device, computer equipment and storage medium
CN116708245A (en) Interface control method, device and computer equipment
CN117435129A (en) Storage cluster expansion method and device, computer equipment and storage medium
CN116594770A (en) Data processing method, device, computer equipment and storage medium
CN116489089A (en) Flow control method and device and computer equipment
CN116700969A (en) Task processing method, device, computer equipment and storage medium
CN117919693A (en) Resource management method, device and computer equipment
CN117082143A (en) Resource scheduling method, device, computer equipment and storage medium
CN117149404A (en) Method, device, computer equipment and storage medium for allocating detection task resources
CN114254227A (en) Picture processing method and device, computer equipment and storage medium
CN117331625A (en) Page resource loading method and device, computer equipment and storage medium
CN116126490A (en) Resource scheduling method, device, computer equipment and storage medium
CN116089244A (en) Application resource use condition determining method, device, equipment and storage medium
CN116880961A (en) Service request processing method, device, computer equipment and storage medium
CN117312653A (en) Service policy determination method, device, computer equipment and storage medium
CN115686851A (en) Command execution method and device based on resource allocation and computer equipment
CN116416064A (en) Method, device and computer equipment for providing auxiliary information in resource conversion service
CN116541145A (en) Data calling method, device, computer equipment and computer storage medium
CN117873824A (en) Chip power consumption optimization method, device, computer equipment and storage medium

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