CN105592134B - A kind of method and apparatus of load balancing - Google Patents
A kind of method and apparatus of load balancing Download PDFInfo
- Publication number
- CN105592134B CN105592134B CN201510531384.4A CN201510531384A CN105592134B CN 105592134 B CN105592134 B CN 105592134B CN 201510531384 A CN201510531384 A CN 201510531384A CN 105592134 B CN105592134 B CN 105592134B
- Authority
- CN
- China
- Prior art keywords
- virtual machine
- preset
- application
- service
- threshold
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 54
- 238000012545 processing Methods 0.000 claims abstract description 47
- 230000008569 process Effects 0.000 claims description 28
- 230000001965 increasing effect Effects 0.000 claims description 19
- 230000036541 health Effects 0.000 claims description 12
- 230000003247 decreasing effect Effects 0.000 claims description 8
- 238000012217 deletion Methods 0.000 claims description 6
- 230000037430 deletion Effects 0.000 claims description 6
- 230000004044 response Effects 0.000 description 6
- 238000010586 diagram Methods 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 3
- 230000007423 decrease Effects 0.000 description 2
- 241001522296 Erithacus rubecula Species 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000005265 energy consumption Methods 0.000 description 1
- 230000002708 enhancing effect Effects 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 230000002045 lasting effect Effects 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1001—Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Stored Programmes (AREA)
- Computer And Data Communications (AREA)
Abstract
The present invention provides a kind of method and apparatus of load balancing, this method comprises: obtaining the application message and performance information of each virtual machine in business virtual machine group;Using the application message and performance information, DRX processing is carried out to the virtual machine in the business virtual machine group;Using load-balancing algorithm, between each virtual machine in the business virtual machine group after DRX processing, load balancing is carried out to the user access request message for accessing the application.According to the technical solution of the present invention, the quantity that virtual machine is adjusted by dynamic, improves resource utilization, and can be with the resource of reasonable utilization virtual machine.
Description
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method and an apparatus for load sharing.
Background
With the increasing of data center services, user requirements are continuously improved, the scale and functions of the data center are increasingly complex, and the management difficulty is increasingly high, so that virtualization of data center resources becomes an important trend of data center integration at present. The virtualization technology abstracts physical resources and services provided by the physical resources, so that resource users and system managers do not care about the details of physical characteristics and service boundaries of objects, thereby reducing the complexity of resource use and management and improving the use efficiency. Therefore, the virtualization of the data center can improve the resource utilization rate of the data center and reduce the energy consumption of the system. Furthermore, a physical server can be virtualized into a plurality of virtual machines through special virtualization software, each virtual machine runs independently and is not influenced mutually, and the virtual machines have own operating system, application programs and hardware environments.
When a virtual machine provides an external service, if a large number of users need to access the application, the virtual machine providing the application may not be able to meet the access requirements of the large number of users, and thus, the number of virtual machines providing the application needs to be increased. Furthermore, if the number of users accessing the application is small, if a large number of virtual machines provide the application, resources of the virtual machines are wasted, and therefore, the number of virtual machines providing the application needs to be reduced. Based on this, it is necessary to know when to increase the number of virtual machines providing the application and when to decrease the number of virtual machines providing the application, thereby dynamically adjusting the number of virtual machines.
Disclosure of Invention
The invention provides a load sharing method, wherein a service virtual machine set comprises a plurality of virtual machines, and the virtual machines in the service virtual machine set are used for providing the same application, and the method comprises the following steps:
obtaining application information and performance information of each virtual machine in the service virtual machine group;
performing dynamic resource extension DRX processing on the virtual machines in the service virtual machine group by using the application information and the performance information of each virtual machine in the service virtual machine group;
and load sharing is carried out on the user access request message for accessing the application among all the virtual machines in the service virtual machine group after DRX processing by utilizing a load balancing algorithm.
The invention provides a load sharing device, a service virtual machine set comprises a plurality of virtual machines, and the virtual machines in the service virtual machine set are used for providing the same application, the device specifically comprises: the obtaining module is used for obtaining the application information and the performance information of each virtual machine in the service virtual machine group;
the processing module is used for performing dynamic resource extension DRX processing on the virtual machines in the service virtual machine group by utilizing the application information and the performance information of each virtual machine in the service virtual machine group;
and the load module is used for sharing the load of the user access request message for accessing the application among the virtual machines in the service virtual machine group after DRX processing by utilizing a load balancing algorithm.
Based on the above technical solution, in the embodiment of the present invention, a service virtual machine group including a plurality of virtual machines is configured, and the virtual machines in the service virtual machine group provide the same application, so that the application information and the performance information of each virtual machine in the service virtual machine group can be utilized to perform DRX (Dynamic resource extension) processing on the virtual machines in the service virtual machine group, and when a large number of users need to access the application, the number of virtual machines providing the application can be increased to meet the access requirements of a large number of users, thereby enhancing the processing capability; when the number of users needing to access the application is reduced, the number of virtual machines providing the application can be reduced to recycle resources of the virtual machines. According to the method, the number of the virtual machines is dynamically adjusted, so that the resource utilization rate is improved, and the resources of the virtual machines can be reasonably utilized.
Drawings
FIG. 1 is a flow chart of a method of load sharing in one embodiment of the present invention;
FIG. 2 is a hardware block diagram of a load sharing device in one embodiment of the invention;
fig. 3 is a configuration diagram of a load sharing apparatus according to an embodiment of the present invention.
Detailed Description
In view of the problems in the prior art, an embodiment of the present invention provides a load sharing method, which is applied to a system including multiple virtual machines. The virtual machine is a logical virtual machine virtualized on a physical server, and different virtual machines may be located on the same physical server or different physical servers. Through the DRX technology, a plurality of virtual machines can be added into one service virtual machine group. Based on this, a plurality of virtual machines are included in the service virtual machine group, and the virtual machines in the service virtual machine group can be used for providing the same application. For example, a plurality of virtual machines in the service virtual machine group are all used for providing webpage applications to the outside, or a plurality of virtual machines in the service virtual machine group are all used for providing mailbox applications to the outside, and the like.
In the application scenario, as shown in fig. 1, the load sharing method specifically includes the following steps:
step 101, obtaining application information and performance information of each virtual machine in a service virtual machine group.
And 102, performing DRX (dynamic resource extension) processing on the virtual machines in the service virtual machine group by using the application information and the performance information of each virtual machine in the service virtual machine group.
And 103, carrying out load sharing on the user access request message for accessing the application among all the virtual machines in the service virtual machine group after the DRX processing by using a load balancing algorithm.
In the embodiment of the present invention, a timing task may be started, where the timing task is used to periodically perform the method for load sharing, that is, the above steps 101 to 103 are performed at intervals, and a DRX process is performed on a virtual machine in a service virtual machine group, which is described below with reference to an execution process.
In the embodiment of the present invention, the performance information specifically includes, but is not limited to, a Central Processing Unit (CPU) utilization rate and/or a memory utilization rate. The application information specifically includes, but is not limited to, an application running state and an application index, and the application running state may specifically be an available state or an unavailable state.
Of course, the performance information is not limited to the CPU utilization and/or the memory utilization, and may also include other performance information such as throughput rate, bandwidth utilization, and the like.
In a DRX technique, a plurality of virtual machines are added to a service virtual machine group, and the CPU utilization and the memory utilization of each virtual machine in the service virtual machine group are detected at regular times. And if the CPU utilization rate and/or the memory utilization rate of all the virtual machines are less than the preset threshold value, reducing the number of the virtual machines in the service virtual machine set, and if the CPU utilization rate and/or the memory utilization rate of the virtual machines are greater than the preset threshold value, increasing the number of the virtual machines in the service virtual machine set. Based on this, when DRX processing is performed on the virtual machines in the service virtual machine group by using only the performance information (such as CPU utilization and/or memory utilization) of each virtual machine in the service virtual machine group, the following situations may occur: 1. although the CPU utilization and the memory utilization of all the virtual machines are less than the preset threshold, the virtual machine may not be able to process the user access request message for accessing the application, because there may be a large number of user access request messages to be processed on the virtual machine, in this case, if the number of virtual machines in the service virtual machine group is reduced, the number of user access request messages allocated to the virtual machine may be increased, that is, more user access request messages may not be processed in time. 2. Although the CPU utilization rate and/or the memory utilization rate of a virtual machine is greater than the preset threshold, there may be a case where only a few user access request messages are processed on the virtual machine, and the virtual machine has a large amount of resources to use.
In view of the above findings, in the embodiment of the present invention, when performing DRX processing on a virtual machine in a service virtual machine group, application information (such as an application running state and an application index) and performance information (such as a CPU utilization rate and/or a memory utilization rate) of each virtual machine in the service virtual machine group are comprehensively considered, and the DRX processing is performed on the virtual machine in the service virtual machine group. In order to implement this DRX processing procedure, the application information and the performance information of each virtual machine in the service virtual machine group need to be counted first.
In the process of using each virtual machine in the service virtual machine group, performance information (such as CPU utilization rate and/or memory utilization rate) of the virtual machine can be directly counted.
The method comprises the steps that for each virtual machine in a service virtual machine group, whether the corresponding application can be provided by the virtual machine externally or not is detected, and the application running state of the virtual machine is determined to be an available state or an unavailable state. When the virtual machine cannot provide corresponding application to the outside, determining that the application running state of the virtual machine is an unavailable state. When the virtual machine can provide corresponding application to the outside, determining that the application running state of the virtual machine is an available state. For example, for a Web application (Web application), in the process of processing a user access request message by a virtual machine, if the virtual machine can receive an HTTP response with a state code of 200 (the response of the state code 200 represents that the request has succeeded) when sending an HTTP (hypertext Transfer Protocol) request to a specified URL (Uniform resource locator) page, the virtual machine is considered to be able to provide the Web application to the outside, and the application running state of the virtual machine is determined to be an available state. If the virtual machine can receive an HTTP response with the state code of 404 (the response of the state code 404 represents that the page does not exist) when sending an HTTP request to the specified URL page, or does not receive any HTTP response within the maximum timeout time range, the virtual machine is considered to be incapable of providing a webpage application, and the application running state of the virtual machine is determined to be an unavailable state.
Further, when the application running state of the virtual machine is an available state, the application index of the virtual machine can be detected. The application index can be configured arbitrarily according to practical experience, and the application indexes are used for representing the health condition of the application. For example, for a web application, the application index may be configured to be the number of sessions currently connected, the connection response time, and the like. For Apache application, the application index may be configured as the number of bytes per request, the number of requests per second, the number of bytes per second, and the like.
In the embodiment of the present invention, the process of performing DRX processing on the virtual machines in the service virtual machine group by using the application information and the performance information of each virtual machine in the service virtual machine group may specifically include, but is not limited to, the following manners: and if the application running state of the virtual machine in the service virtual machine group is the unavailable state, restarting the virtual machine or closing the virtual machine. Or, if the application running states of a plurality of virtual machines (such as all virtual machines) in the service virtual machine group are available states, the application index of each virtual machine in the plurality of virtual machines is smaller than a preset first threshold, and the performance information is smaller than a preset second threshold, closing the virtual machines in the service virtual machine group. Or, if the application running states of a plurality of virtual machines (such as all virtual machines) in the service virtual machine group are available states, the application index of each virtual machine in the plurality of virtual machines is greater than a preset third threshold, and the performance information is greater than a preset fourth threshold, the virtual machines in the service virtual machine group are started. Or, if the application running states of a plurality of virtual machines (such as all virtual machines) in the service virtual machine group are available states, and the plurality of virtual machines include virtual machines of which the application indexes are smaller than a preset first threshold and the performance information is smaller than a preset second threshold, and include virtual machines of which the application indexes are larger than a preset third threshold and the performance information is larger than a preset fourth threshold, adjusting the access weights of the virtual machines in the service virtual machine group.
The preset first threshold, the preset second threshold, the preset third threshold and the preset fourth threshold can be set according to actual experience, the preset third threshold is larger than the preset first threshold, the preset fourth threshold is larger than the preset second threshold, moreover, the preset third threshold and the preset fourth threshold have no size relationship, and the preset first threshold and the preset second threshold also have no size relationship.
And setting a preset first threshold value and a preset second threshold value for the application index of the virtual machine. When the application index of the virtual machine is smaller than the preset first threshold, the health condition of the application on the virtual machine is indicated to be excellent, and at the moment, the virtual machine can process more user access request messages distributed to the virtual machine. When the application index of the virtual machine is greater than the preset second threshold, the health condition of the application on the virtual machine is poor, and at this time, the virtual machine cannot continue to process the user access request message distributed to the virtual machine. When the application index of the virtual machine is between the preset first threshold and the preset second threshold, the health condition of the application on the virtual machine is good, and at the moment, the number of the user access request messages distributed to the virtual machine is proper, and the number of the user access request messages distributed to the virtual machine is not required to be adjusted.
When the application index of the virtual machine is an application index, a preset first threshold value and a preset second threshold value are set for the application index. When the application indexes of the virtual machine are multiple application indexes, a preset first threshold value and a preset second threshold value are respectively set for each application index, the preset first threshold values set for different application indexes can be the same or different, and the preset second threshold values set for different application indexes can be the same or different. When the application indexes of the virtual machine are multiple application indexes, if the multiple application indexes are all smaller than the corresponding preset first threshold, the application indexes of the virtual machine are smaller than the preset first threshold, and the health condition of the application on the virtual machine is excellent. If any application index in the plurality of application indexes is larger than the corresponding preset second threshold, the application index of the virtual machine is larger than the preset second threshold, and the health condition of the application on the virtual machine is poor. For other cases, the application index representing the virtual machine is between the preset first threshold and the preset second threshold, and the health condition of the application on the virtual machine is good.
For example, for Apache application, assuming that the application index includes the number of bytes per request, the number of requests per second, and the number of bytes per second, a preset first threshold 1 and a preset second threshold 1 are set for the number of bytes per request, a preset first threshold 2 and a preset second threshold 2 are set for the number of requests per second, and a preset first threshold 3 and a preset second threshold 3 are set for the number of bytes per second. Counting the number of bytes requested each time, the number of requests per second and the number of bytes requested per second of the Apache application aiming at the virtual machine 1. When the number of bytes requested each time is smaller than a preset first threshold 1, the number of requests per second is smaller than a preset first threshold 2, and the number of bytes requested per second is smaller than a preset first threshold 3, it indicates that the application index of the virtual machine 1 is smaller than the preset first threshold, and the health condition of the application on the virtual machine 1 is optimal. When the number of bytes requested each time is greater than a preset second threshold value 1, and/or the number of requested bytes per second is greater than a preset second threshold value 2, and/or the number of requested bytes per second is greater than a preset second threshold value 3, it indicates that the application index of the virtual machine 1 is greater than the preset second threshold value, and the health condition of the application on the virtual machine 1 is poor. For other situations than the above two situations, the application index of the virtual machine 1 is between the preset first threshold and the preset second threshold, and the health condition of the application on the virtual machine 1 is good.
And setting a preset third threshold value and a preset fourth threshold value for the performance information of the virtual machine. When the performance information of the virtual machine is smaller than the preset third threshold, it indicates that the performance status on the virtual machine is superior, and at this time, the virtual machine can process more user access request messages distributed to the virtual machine. When the performance information of the virtual machine is greater than the preset fourth threshold, it indicates that the performance status on the virtual machine is poor, and at this time, the virtual machine cannot continue to process the user access request message distributed to the virtual machine. When the performance information of the virtual machine is between the preset third threshold and the preset fourth threshold, the performance condition on the virtual machine is indicated to be good, and the number of the user access request messages distributed to the virtual machine is just suitable at the moment, so that the number of the user access request messages distributed to the virtual machine is not required to be adjusted.
When the performance information (such as the CPU utilization rate or the memory utilization rate) of the virtual machine is one, a preset third threshold and a preset fourth threshold are set for the performance information. When the performance information (such as the CPU utilization rate and the memory utilization rate) of the virtual machine is multiple, a preset third threshold and a preset fourth threshold are respectively set for each piece of performance information, the preset third thresholds set for different pieces of performance information may be the same or different, and the preset fourth thresholds set for different pieces of performance information may be the same or different. When the performance information of the virtual machine is multiple, if the multiple performance information are all smaller than the corresponding preset third threshold, the performance information of the virtual machine is smaller than the preset third threshold, and the performance condition of the virtual machine is excellent. If any performance information in the plurality of performance information is larger than the corresponding preset fourth threshold, the performance information of the virtual machine is larger than the preset fourth threshold, and the performance condition of the virtual machine is poor. For other cases, the performance information of the virtual machine is between the preset third threshold and the preset fourth threshold, and the performance condition of the virtual machine is good.
For example, a preset third threshold 1 and a preset fourth threshold 1 are set for the CPU utilization, and a preset third threshold 2 and a preset fourth threshold 2 are set for the memory utilization. And counting the utilization rate of the CPU and the utilization rate of the memory aiming at the virtual machine 1. When the CPU utilization is less than the preset third threshold 1 and the memory utilization is less than the preset third threshold 2, it indicates that the performance information of the virtual machine 1 is less than the preset third threshold, and the performance status of the virtual machine 1 is excellent. When the CPU utilization is greater than the preset fourth threshold 1 and/or the memory utilization is greater than the preset fourth threshold 2, it indicates that the performance information of the virtual machine 1 is greater than the preset fourth threshold, and the performance status of the virtual machine 1 is poor. For other situations than the above two situations, the performance information of the virtual machine 1 is between the preset third threshold and the preset fourth threshold, and the performance status of the virtual machine 1 is good.
The following describes the above process of performing DRX processing on the virtual machines in the service virtual machine group.
In the first case, if the application running state of a virtual machine in a service virtual machine group is an unavailable state, the virtual machine is restarted or closed.
And when the application running state of the virtual machine is the unavailable state, restarting the virtual machine or closing the virtual machine based on the configuration information of the user. And if the configuration information of the user is the virtual machine which still shares the load of the user access request message to the unavailable state or restarts the unavailable state, restarting the virtual machine when the application running state of the virtual machine is the unavailable state. And if the configuration information of the user is the virtual machine which does not share the load of the user access request message to the unavailable state or the virtual machine which is closed to the unavailable state, closing the virtual machine when the application running state of the virtual machine is the unavailable state.
In the process of restarting the virtual machine, in order to avoid a situation that a fault still cannot be solved after continuous multiple times of restarting, that is, an application running state of the virtual machine is still an unavailable state, a maximum restart time may be specified. And when the maximum restart times are not reached, if the application running state of the virtual machine is still in an unavailable state after the virtual machine is restarted, continuously restarting the virtual machine. And when the maximum restart times is reached, if the application running state of the virtual machine is still in an unavailable state after the virtual machine is restarted, stopping restarting the virtual machine and closing the virtual machine.
In the process of restarting the virtual machine, since time is consumed for system startup, application startup and the like of the virtual machine, in order to avoid a problem caused by the fact that the virtual machine is not completely started and the virtual machine is restarted, a minimum time interval of two times of startup, that is, an interval time between two times of continuous restarting of the virtual machine, needs to be not less than the minimum time interval.
After the virtual machine is closed, the virtual machine is no longer used for providing corresponding applications to the outside, that is, the applications are stopped to the outside, so that the load of the user access request message is not shared to the virtual machine.
In practical applications, if NQA (Network Quality analysis) detection is configured for a virtual machine, the Network Quality between itself and the virtual machine may be periodically detected. When the application running state of the virtual machine is an unavailable state, the network quality between the virtual machine and the virtual machine is detected to be unavailable, at the moment, the virtual machine can be set to be unavailable, and the load of the user access request message cannot be shared to the virtual machine when the user access request message is sent subsequently.
And in the second situation, if the application running states of a plurality of virtual machines in the service virtual machine group are available, the application indexes of each virtual machine in the plurality of virtual machines are smaller than a preset first threshold value, and the performance information is smaller than a preset second threshold value, closing the virtual machines in the service virtual machine group.
When the application indexes of the multiple virtual machines in the service virtual machine group are all smaller than a preset first threshold value and the performance information is smaller than a preset second threshold value, it is indicated that the multiple virtual machines in the service virtual machine group can process more user access request messages distributed to the virtual machines. Therefore, in order to save resources of the virtual machines, the virtual machines in the service virtual machine group can be shut down. The number of the closed virtual machines can be selected according to actual needs. In a specific application, the number of virtual machines that need to be reserved in the service virtual machine group may be configured, and when the virtual machines are closed, only that the number of virtual machines that are not closed is greater than or equal to the number of virtual machines that are reserved. For example, if the number of virtual machines reserved in the service virtual machine group is 5 and the number of virtual machines currently existing in the service virtual machine group is 8, 1 virtual machine may be turned off, 2 virtual machines may be turned off, or 3 virtual machines may be turned off.
When the application indexes of the multiple virtual machines in the service virtual machine group are all smaller than a preset first threshold value and the performance information is all smaller than a preset second threshold value, the starting time of the situation can be recorded. In the process of closing the virtual machines in the service virtual machine group, according to a user-defined condition (for example, lasting for more than 2 hours) and the starting time of the condition, when it is determined that the duration of the condition (the application indexes of the virtual machines in the service virtual machine group are all smaller than a preset first threshold, and the performance information is all smaller than a preset second threshold) meets the user-defined condition, the virtual machines in the service virtual machine group can be closed. When the duration of the condition is determined not to meet the user-defined condition, the virtual machines in the service virtual machine group do not need to be closed.
In view of the above first and second cases, in the embodiment of the present invention, after the virtual machines in the service virtual machine group are closed, if a virtual machine in a closed state exists in the service virtual machine group, the virtual machine in the closed state may be deleted from the service virtual machine group when a preset virtual machine deletion condition is met. The preset virtual machine deletion condition may be arbitrarily set according to actual experience, and if the preset virtual machine deletion condition is set such that the number of virtual machines in the closed state exceeds 2, based on this, when the number of virtual machines in the closed state in the service virtual machine set exceeds 2, it is determined that the preset virtual machine deletion condition is met, and the virtual machines in the closed state are deleted from the service virtual machine set.
And thirdly, if the application running states of a plurality of virtual machines in the service virtual machine set are available, the application indexes of each virtual machine in the plurality of virtual machines are all larger than a preset third threshold value, and the performance information is all larger than a preset fourth threshold value, starting the virtual machines in the service virtual machine set.
When the application indexes of the multiple virtual machines in the service virtual machine group are greater than a preset third threshold value and the performance information is greater than a preset fourth threshold value, it is indicated that the multiple virtual machines in the service virtual machine group cannot continuously process the user access request messages distributed to the virtual machines. In order to ensure that the user access request message is processed in time, the virtual machine in the service virtual machine group can be started.
In the embodiment of the present invention, the process of starting the virtual machines in the service virtual machine group may specifically include, but is not limited to, the following ways: and judging whether a virtual machine in a closed state exists in the service virtual machine group. If yes, directly starting the virtual machine in the service virtual machine group in a closed state; and if the virtual machine does not exist, creating a virtual machine for providing the application corresponding to the service virtual machine group, adding the currently created virtual machine into the service virtual machine group, and starting the currently created virtual machine.
When creating a virtual machine for providing an application, an idle IP address may be allocated according to a DHCP (Dynamic host configuration Protocol) or a preset IP address range, a new virtual machine may be created according to a preset virtual machine template, and network information such as the idle IP address, a subnet mask, a default gateway, and the like may be configured on the currently created virtual machine.
The number of the started virtual machines can be selected according to actual needs. In a specific application, if a virtual machine in a closed state exists in a service virtual machine group, all virtual machines in the closed state in the service virtual machine group may be directly started, or some virtual machines in the closed state in the service virtual machine group may be started. If the virtual machine in the closed state does not exist in the service virtual machine group, a new virtual machine can be created or a plurality of new virtual machines can be created.
And fourthly, if the application running states of a plurality of virtual machines in the service virtual machine set are available states, the plurality of virtual machines comprise the virtual machines of which the application indexes are smaller than a preset first threshold value and the performance information is smaller than a preset second threshold value, and comprise the virtual machines of which the application indexes are larger than a preset third threshold value and the performance information is larger than a preset fourth threshold value, adjusting the access weight of the virtual machines in the service virtual machine set.
When the application index of the virtual machine in the service virtual machine group is smaller than a preset first threshold and the performance information is smaller than a preset second threshold, it indicates that the virtual machine can process more user access request messages distributed to the virtual machine. And when the application index of the virtual machine in the service virtual machine group is greater than a preset third threshold value and the performance information is greater than a preset fourth threshold value, indicating that the virtual machine cannot continuously process the user access request message distributed to the virtual machine. Based on this, in the embodiment of the present invention, the process of adjusting the access weight of the virtual machine in the service virtual machine group may specifically include, but is not limited to, the following manners: increasing the access weight of the virtual machine of which the application index is smaller than a preset first threshold and the performance information is smaller than a preset second threshold, and reducing the access weight of the virtual machine of which the application index is larger than a preset third threshold and the performance information is larger than a preset fourth threshold; when the load sharing is carried out on the user access request messages for accessing the application, the number of the user access request messages sent to the virtual machine with the increased access weight is increased, and the number of the user access request messages sent to the virtual machine with the decreased access weight is reduced.
And if the application information and the performance information of the plurality of virtual machines in the service virtual machine group are other than the four conditions, the DRX processing is not performed on the virtual machines in the service virtual machine group.
For example, when the service virtual machine group includes virtual machine 1, virtual machine 2, virtual machine 3, and virtual machine 4, a load balancing algorithm is used to share a load of a user access request message for accessing an application among virtual machine 1, virtual machine 2, virtual machine 3, and virtual machine 4. For the above first and second cases, assuming that the virtual machine 1 in the service virtual machine group is shut down, a load balancing algorithm is used to share the load of the user access request message for accessing the application among the virtual machines 2, 3 and 4 in the service virtual machine group after DRX processing. For the third situation, assuming that a new virtual machine 5 is added to the service virtual machine group and the virtual machine 5 in the service virtual machine group is started, load sharing is performed on the user access request message for accessing the application among the virtual machine 1, the virtual machine 2, the virtual machine 3, the virtual machine 4 and the virtual machine 5 in the service virtual machine group after DRX processing by using a load balancing algorithm. For the fourth situation, assuming that the access weight of the virtual machine 1 in the service virtual machine group is increased and the access weight of the virtual machine 2 in the service virtual machine group is decreased, the load balancing algorithm is used to share the load of the user access request message for accessing the application among the virtual machine 1, the virtual machine 2, the virtual machine 3 and the virtual machine 4 in the service virtual machine group after DRX processing.
For the case one, the case two, and the case three, the load balancing algorithm may use any load balancing algorithm, which is not limited in the embodiment of the present invention. For case four, the load balancing algorithm may use a round robin algorithm or a minimum chaining algorithm that may change the number of user access request messages sent to the virtual machine by adjusting the access weight of the virtual machine.
For the case four, it is assumed that, before the access weight is adjusted, for every 100 consecutive user access request messages, 25 user access request messages are sent to the virtual machine 1, 25 user access request messages are sent to the virtual machine 2, 25 user access request messages are sent to the virtual machine 3, and 25 user access request messages are sent to the virtual machine 4. Furthermore, after the access weight is adjusted, it is assumed that after the access weight of the virtual machine 1 is increased and the access weight of the virtual machine 2 is decreased, 45 user access request messages are sent to the virtual machine 1, 5 user access request messages are sent to the virtual machine 2, 25 user access request messages are sent to the virtual machine 3, and 25 user access request messages are sent to the virtual machine 4 for every 100 consecutive user access request messages. Through the above processing, the number of user access request messages sent to the idle virtual machine 1 can be increased, and the number of user access request messages sent to the busy virtual machine 2 can be decreased.
Based on the technical scheme, in the embodiment of the invention, a service virtual machine group comprising a plurality of virtual machines is configured, and the virtual machines in the service virtual machine group provide the same application, so that the application information and the performance information of each virtual machine in the service virtual machine group are utilized to perform DRX processing on the virtual machines in the service virtual machine group, and when a large number of users need to access the application, the number of the virtual machines providing the application is increased, so that the access requirements of a large number of users are met, and the processing capacity is enhanced; when the number of users accessing the application decreases, the number of virtual machines providing the application may be decreased to reclaim resources of the virtual machines. According to the method, the number of the virtual machines is dynamically adjusted, so that the resource utilization rate is improved, and the resources of the virtual machines can be reasonably utilized.
The load sharing method provided in the embodiment of the present invention may be applied to a load sharing device, and may also be applied to a network management device or other devices capable of managing the load sharing device. On the load sharing device, a real service group is created for an application (such as application a), and a plurality of real services are configured under the real service group. Wherein, a plurality of virtual machines with the same or similar applications can be abstracted into one real service group, and one real service group can comprise a plurality of real services. The real service is an entity for processing user service on the load sharing equipment, and has a mapping relation between an IP address and a port with the virtual machine. For the above process, the real service group is equivalent to the above service virtual machine group, and one real service corresponds to one virtual machine.
Based on the same inventive concept as the method, the embodiment of the invention also provides a load sharing device, and the load sharing device can be applied to load sharing equipment. The load sharing apparatus may be implemented by software, or may be implemented by hardware, or a combination of hardware and software. Taking a software implementation as an example, as a logical device, the device is formed by reading corresponding computer program instructions in the non-volatile memory into the memory for running through the processor of the load sharing device where the device is located. From a hardware level, as shown in fig. 2, a hardware structure diagram of a load sharing device where the load sharing apparatus provided by the present invention is located is shown, where in addition to the processor, the network interface, the memory and the nonvolatile memory shown in fig. 2, the load sharing device may further include other hardware, such as a forwarding chip responsible for processing a packet, and the like; in terms of hardware structure, the load sharing device may also be a distributed device, and may include multiple interface cards, so as to perform packet processing extension at the hardware level.
For the load sharing device provided in the embodiment of the present invention, the service virtual machine group includes a plurality of virtual machines, and the virtual machines in the service virtual machine group are used to provide the same application. As shown in fig. 3, a structure diagram of a load sharing apparatus according to an embodiment of the present invention is provided, where the load sharing apparatus specifically includes:
an obtaining module 11, configured to obtain application information and performance information of each virtual machine in the service virtual machine group; a processing module 12, configured to perform DRX processing on the virtual machines in the service virtual machine group by using application information and performance information of each virtual machine in the service virtual machine group; and the load module 13 is configured to perform load sharing on a user access request packet accessing the application among the virtual machines in the service virtual machine group after DRX processing by using a load balancing algorithm.
In the embodiment of the present invention, the application information includes an application running state and an application index, and the application running state is specifically an available state or an unavailable state;
the processing module 12 is specifically configured to, when an application running state of a virtual machine in the service virtual machine group is an unavailable state, restart the virtual machine, or close the virtual machine; or when the application running state of a plurality of virtual machines in the service virtual machine group is an available state, the application index of each virtual machine in the plurality of virtual machines is smaller than a preset first threshold value, and the performance information is smaller than a preset second threshold value, closing the virtual machines in the service virtual machine group; or when the application running states of a plurality of virtual machines in the service virtual machine set are available, the application index of each virtual machine in the plurality of virtual machines is greater than a preset third threshold value, and the performance information is greater than a preset fourth threshold value, starting the virtual machines in the service virtual machine set; or when the application running states of a plurality of virtual machines in the service virtual machine group are available states, and the plurality of virtual machines comprise virtual machines of which the application indexes are smaller than a preset first threshold value and the performance information is smaller than a preset second threshold value and virtual machines of which the application indexes are larger than a preset third threshold value and the performance information is larger than a preset fourth threshold value, adjusting the access weights of the virtual machines in the service virtual machine group;
the preset third threshold is greater than the preset first threshold, and the preset fourth threshold is greater than the preset second threshold.
The processing module 12 is further configured to, after the virtual machines in the service virtual machine group are closed, delete the virtual machines in the closed state from the service virtual machine group when a preset virtual machine deletion condition is met if the virtual machines in the closed state exist in the service virtual machine group.
The processing module 12 is specifically configured to determine whether a virtual machine in a closed state exists in the service virtual machine group in a process of starting a virtual machine in the service virtual machine group; if yes, starting the virtual machine in the closed state in the service virtual machine group; and if the virtual machine does not exist, creating the virtual machine for providing the application, adding the currently created virtual machine into the service virtual machine group, and starting the currently created virtual machine.
The processing module 12 is specifically configured to, in the process of adjusting the access weight of the virtual machine in the service virtual machine group, increase the access weight of the virtual machine whose application index is smaller than a preset first threshold and whose performance information is smaller than a preset second threshold, and reduce the access weight of the virtual machine whose application index is larger than a preset third threshold and whose performance information is larger than a preset fourth threshold; when the load sharing is carried out on the user access request messages for accessing the application, the number of the user access request messages sent to the virtual machine with the increased access weight is increased, and the number of the user access request messages sent to the virtual machine with the decreased access weight is reduced.
The modules of the device can be integrated into a whole or can be separately deployed. The modules can be combined into one module, and can also be further split into a plurality of sub-modules.
Through the above description of the embodiments, those skilled in the art will clearly understand that the present invention may be implemented by software plus a necessary general hardware platform, and certainly may also be implemented by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention. Those skilled in the art will appreciate that the drawings are merely schematic representations of one preferred embodiment and that the blocks or flow diagrams in the drawings are not necessarily required to practice the present invention.
Those skilled in the art will appreciate that the modules in the devices in the embodiments may be distributed in the devices in the embodiments according to the description of the embodiments, and may be correspondingly changed in one or more devices different from the embodiments. The modules of the above embodiments may be combined into one module, or further split into multiple sub-modules. The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
The above disclosure is only for a few specific embodiments of the present invention, but the present invention is not limited thereto, and any variations that can be made by those skilled in the art are intended to fall within the scope of the present invention.
Claims (10)
1. A method for load sharing is characterized in that a service virtual machine group comprises a plurality of virtual machines, and the virtual machines in the service virtual machine group are used for providing the same application, the method comprises the following steps:
obtaining application information and performance information of each virtual machine in the service virtual machine group; the application information comprises an application running state and an application index, wherein the application running state is specifically an available state or an unavailable state, and the application index is used for representing the health condition of the application;
performing dynamic resource extension DRX processing on the virtual machines in the service virtual machine group by using the application information and the performance information of each virtual machine in the service virtual machine group;
and load sharing is carried out on the user access request message for accessing the application among all the virtual machines in the service virtual machine group after DRX processing by utilizing a load balancing algorithm.
2. The method of claim 1,
the process of performing DRX processing on the virtual machines in the service virtual machine group by using the application information and the performance information of each virtual machine in the service virtual machine group specifically includes:
if the application running state of a virtual machine in the service virtual machine group is an unavailable state, restarting the virtual machine or closing the virtual machine; or,
if the application running states of a plurality of virtual machines in the service virtual machine set are available, the application index of each virtual machine in the plurality of virtual machines is smaller than a preset first threshold value, and the performance information is smaller than a preset second threshold value, closing the virtual machines in the service virtual machine set; or,
if the application running states of a plurality of virtual machines in the service virtual machine set are available, the application index of each virtual machine in the plurality of virtual machines is greater than a preset third threshold value, and the performance information is greater than a preset fourth threshold value, starting the virtual machines in the service virtual machine set; or,
if the application running states of a plurality of virtual machines in the service virtual machine set are available states, and the plurality of virtual machines comprise virtual machines of which the application indexes are smaller than a preset first threshold value and the performance information is smaller than a preset second threshold value and virtual machines of which the application indexes are larger than a preset third threshold value and the performance information is larger than a preset fourth threshold value, adjusting the access weights of the virtual machines in the service virtual machine set;
the preset third threshold is greater than the preset first threshold, and the preset fourth threshold is greater than the preset second threshold.
3. The method of claim 2, wherein after the shutdown processing of the virtual machines in the service virtual machine group, the method further comprises:
and if the virtual machines in the closed state exist in the service virtual machine group, deleting the virtual machines in the closed state from the service virtual machine group when the preset virtual machine deleting condition is met.
4. The method according to claim 2, wherein the process of starting the virtual machines in the service virtual machine group specifically includes:
judging whether a virtual machine in a closed state exists in the service virtual machine set;
if yes, starting the virtual machine in the closed state in the service virtual machine group;
and if the virtual machine does not exist, creating the virtual machine for providing the application, adding the currently created virtual machine into the service virtual machine group, and starting the currently created virtual machine.
5. The method according to claim 2, wherein the process of adjusting the access weight of the virtual machine in the service virtual machine group specifically includes:
increasing the access weight of the virtual machine of which the application index is smaller than a preset first threshold and the performance information is smaller than a preset second threshold, and reducing the access weight of the virtual machine of which the application index is larger than a preset third threshold and the performance information is larger than a preset fourth threshold; when the load sharing is carried out on the user access request messages for accessing the application, the number of the user access request messages sent to the virtual machine with the increased access weight is increased, and the number of the user access request messages sent to the virtual machine with the decreased access weight is reduced.
6. A load sharing apparatus, wherein a service virtual machine group includes a plurality of virtual machines, and the virtual machines in the service virtual machine group are configured to provide a same application, the apparatus specifically includes:
the obtaining module is used for obtaining the application information and the performance information of each virtual machine in the service virtual machine group; the application information comprises an application running state and an application index, wherein the application running state is specifically an available state or an unavailable state, and the application index is used for representing the health condition of the application;
the processing module is used for performing dynamic resource extension DRX processing on the virtual machines in the service virtual machine group by utilizing the application information and the performance information of each virtual machine in the service virtual machine group;
and the load module is used for sharing the load of the user access request message for accessing the application among the virtual machines in the service virtual machine group after DRX processing by utilizing a load balancing algorithm.
7. The apparatus of claim 6,
the processing module is specifically configured to, when an application running state of a virtual machine in the service virtual machine group is an unavailable state, restart the virtual machine or close the virtual machine; or when the application running state of a plurality of virtual machines in the service virtual machine group is an available state, the application index of each virtual machine in the plurality of virtual machines is smaller than a preset first threshold value, and the performance information is smaller than a preset second threshold value, closing the virtual machines in the service virtual machine group; or when the application running states of a plurality of virtual machines in the service virtual machine set are available, the application index of each virtual machine in the plurality of virtual machines is greater than a preset third threshold value, and the performance information is greater than a preset fourth threshold value, starting the virtual machines in the service virtual machine set; or when the application running states of a plurality of virtual machines in the service virtual machine group are available states, and the plurality of virtual machines comprise virtual machines of which the application indexes are smaller than a preset first threshold value and the performance information is smaller than a preset second threshold value and virtual machines of which the application indexes are larger than a preset third threshold value and the performance information is larger than a preset fourth threshold value, adjusting the access weights of the virtual machines in the service virtual machine group;
the preset third threshold is greater than the preset first threshold, and the preset fourth threshold is greater than the preset second threshold.
8. The apparatus of claim 7,
the processing module is further configured to, after the virtual machines in the service virtual machine group are closed, delete the virtual machines in the closed state from the service virtual machine group when a preset virtual machine deletion condition is met if the virtual machines in the closed state exist in the service virtual machine group.
9. The apparatus of claim 7,
the processing module is specifically configured to determine whether a virtual machine in a closed state exists in the service virtual machine set in a process of starting a virtual machine in the service virtual machine set; if yes, starting the virtual machine in the closed state in the service virtual machine group; and if the virtual machine does not exist, creating the virtual machine for providing the application, adding the currently created virtual machine into the service virtual machine group, and starting the currently created virtual machine.
10. The apparatus of claim 7,
the processing module is specifically configured to, in the process of adjusting the access weight of the virtual machine in the service virtual machine group, increase the access weight of the virtual machine of which the application index is smaller than a preset first threshold and the performance information is smaller than a preset second threshold, and reduce the access weight of the virtual machine of which the application index is larger than a preset third threshold and the performance information is larger than a preset fourth threshold; when the load sharing is carried out on the user access request messages for accessing the application, the number of the user access request messages sent to the virtual machine with the increased access weight is increased, and the number of the user access request messages sent to the virtual machine with the decreased access weight is reduced.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510531384.4A CN105592134B (en) | 2015-08-26 | 2015-08-26 | A kind of method and apparatus of load balancing |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510531384.4A CN105592134B (en) | 2015-08-26 | 2015-08-26 | A kind of method and apparatus of load balancing |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105592134A CN105592134A (en) | 2016-05-18 |
CN105592134B true CN105592134B (en) | 2019-04-05 |
Family
ID=55931340
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510531384.4A Active CN105592134B (en) | 2015-08-26 | 2015-08-26 | A kind of method and apparatus of load balancing |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105592134B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107645520B (en) * | 2016-07-21 | 2020-12-04 | 阿里巴巴集团控股有限公司 | Load balancing method, device and system |
CN107979539B (en) * | 2017-10-30 | 2021-12-03 | 新华三技术有限公司 | Message processing method and device |
CN111740857B (en) * | 2020-05-29 | 2023-12-26 | 新华三信息安全技术有限公司 | Method and device for issuing Network Quality Analysis (NQA) configuration |
CN112367267B (en) * | 2020-09-30 | 2022-03-29 | 新华三大数据技术有限公司 | Virtual machine management method and device |
CN112764879A (en) * | 2021-01-14 | 2021-05-07 | 深圳市科思科技股份有限公司 | Load balancing method, electronic device and computer readable storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102508718A (en) * | 2011-11-22 | 2012-06-20 | 杭州华三通信技术有限公司 | Method and device for balancing load of virtual machine |
CN103294552A (en) * | 2012-02-22 | 2013-09-11 | 鸿富锦精密工业(深圳)有限公司 | Method for increasing configuration quantity of virtual machines of server |
CN104426694A (en) * | 2013-08-28 | 2015-03-18 | 杭州华三通信技术有限公司 | Method and device for adjusting virtual-machine resources |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8185893B2 (en) * | 2006-10-27 | 2012-05-22 | Hewlett-Packard Development Company, L.P. | Starting up at least one virtual machine in a physical machine by a load balancer |
US9141420B2 (en) * | 2010-11-04 | 2015-09-22 | Alcatel Lucent | Overload control in a cloud computing environment |
-
2015
- 2015-08-26 CN CN201510531384.4A patent/CN105592134B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102508718A (en) * | 2011-11-22 | 2012-06-20 | 杭州华三通信技术有限公司 | Method and device for balancing load of virtual machine |
CN103294552A (en) * | 2012-02-22 | 2013-09-11 | 鸿富锦精密工业(深圳)有限公司 | Method for increasing configuration quantity of virtual machines of server |
CN104426694A (en) * | 2013-08-28 | 2015-03-18 | 杭州华三通信技术有限公司 | Method and device for adjusting virtual-machine resources |
Also Published As
Publication number | Publication date |
---|---|
CN105592134A (en) | 2016-05-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11886731B2 (en) | Hot data migration method, apparatus, and system | |
CN110138732B (en) | Access request response method, device, equipment and storage medium | |
US9804981B2 (en) | Method, controller, and system for service flow control in object-based storage system | |
CN105592134B (en) | A kind of method and apparatus of load balancing | |
US7587492B2 (en) | Dynamic performance management for virtual servers | |
US9342376B2 (en) | Method, system, and device for dynamic energy efficient job scheduling in a cloud computing environment | |
US20200042364A1 (en) | Movement of services across clusters | |
US9237460B2 (en) | Traffic control method and device | |
Nakai et al. | Load balancing for internet distributed services using limited redirection rates | |
US20150160983A1 (en) | Dynamic Virtual Machine Consolidation | |
CN104092650B (en) | A kind of method and apparatus for distributing service request | |
WO2018121334A1 (en) | Web application service providing method, apparatus, electronic device and system | |
US10397131B2 (en) | Method and system for determining bandwidth demand | |
CN105159775A (en) | Load balancer based management system and management method for cloud computing data center | |
US10346367B1 (en) | Load shedding techniques for distributed services with persistent client connections to ensure quality of service | |
US9819626B1 (en) | Placement-dependent communication channels in distributed systems | |
US10567492B1 (en) | Methods for load balancing in a federated identity environment and devices thereof | |
CN112650575B (en) | Resource scheduling method, device and cloud service system | |
CA3030504A1 (en) | Blockchain network and task scheduling method therefor | |
WO2014063487A1 (en) | Traffic control method and device | |
WO2017185615A1 (en) | Method for determining service status of service processing device and scheduling device | |
CN107645540A (en) | The load-balancing method of web application systems | |
AU2013318299A1 (en) | Adaptive service timeouts | |
CN111131841A (en) | Live indirect access method and device, electronic equipment and storage medium | |
CN112600761A (en) | Resource allocation method, device and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB02 | Change of applicant information | ||
CB02 | Change of applicant information |
Address after: 310052 Binjiang District Changhe Road, Zhejiang, China, No. 466, No. Applicant after: Xinhua three Technology Co., Ltd. Address before: 310052 Binjiang District Changhe Road, Zhejiang, China, No. 466, No. Applicant before: Huasan Communication Technology Co., Ltd. |
|
GR01 | Patent grant | ||
GR01 | Patent grant |