Method, device, equipment and storage medium for reducing capacity of multi-active load balancing application
By accepting shrinking instructions in multi-active load balancing applications and automatically shrinking unnecessary container instances, the problem of cost waste when user visits decrease is solved, and the continuity and cost reduction of load balancing services are achieved.
Patent Information
- Application Number
- CN201910528005.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-06-18
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2039-06-18
AI Technical Summary
In multi-active load balancing applications, when the number of user visits drops sharply, too many containers lead to waste of costs, and it is difficult for existing technology to effectively reduce the capacity to reduce costs.
Provides a shrinking method for multi-active load balancing applications. By receiving shrinking instructions, obtaining identification information, calling the shrinking setting interface to set the target container instance, deactivating and destroying unnecessary container instances, and recycling resources to ensure load balancing. Reduce the number of containers while serving.
It achieves automatic scaling while ensuring load balancing services, reduces costs, improves scaling efficiency, and saves time and labor costs.
Smart Images

Figure CN110413405B
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing technology, and in particular to a method, device, computer equipment and storage medium for scaling down multi-active load balancing applications. Background Art
[0002] When using LVS load balancing application and Nginx load balancing application to implement multi-active load balancing application, since there are multiple LVS containers (also called LVS container instances) in LVS load balancing application, there are multiple Nginx containers (also called LVS container instances) in Nginx load balancing application, and there are multiple containers of the backend application of multi-active load balancing application, it can meet the concurrency requirements of user requests to a certain extent. Since there are multiple containers involved in multi-active load balancing application, each container will incur costs as long as it is put into use. If the user access volume drops sharply, and the current multi-active load balancing application no longer needs more containers to provide better load balancing services, then too many containers will cause cost waste. Summary of the invention
[0003] The embodiments of the present application provide a method, apparatus, computer equipment and storage medium for scaling down a multi-active load balancing application, which can scale down containers in a multi-active load balancing application and reduce cost waste.
[0004] In a first aspect, an embodiment of the present application provides a method for scaling down a multi-active load balancing application, including:
[0005] If a scaling-down instruction of a multi-active load balancing application is received, the identification information of the multi-active load balancing application in the scaling-down instruction is obtained, and the scaling-down setting interface is called to receive the identification information of the target container instance of the multi-active load balancing application to be scaled down that is set through the scaling-down setting interface; if a setting completion instruction is received, the target container instance is scaled down according to the identification information of the multi-active load balancing application and the information of the target container instance of the multi-active load balancing application to be scaled down.
[0006] In a second aspect, an embodiment of the present invention provides a device for scaling down a multi-active load balancing application, wherein the device for scaling down a multi-active load balancing application includes a unit for executing a method corresponding to the method described in the first aspect.
[0007] In a third aspect, an embodiment of the present invention provides a computer device, the computer device comprising a memory and a processor connected to the memory;
[0008] The memory is used to store a computer program, and the processor is used to run the computer program stored in the memory to execute the method described in the first aspect above.
[0009] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in the first aspect is implemented.
[0010] The embodiment of the present application can achieve the reduction of container instances of multi-active load balancing applications, thereby reducing costs while ensuring that load balancing provides services, and the specific reduction process is performed automatically, which improves the efficiency of reduction and saves time and labor costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.
[0012] Figure 1 It is a flowchart of a method for reducing capacity of a multi-active load balancing application provided in an embodiment of the present application;
[0013] Figure 2 It is a sub-flow diagram of a method for reducing capacity of a multi-active load balancing application provided in an embodiment of the present application;
[0014] Figure 3 It is a sub-flow diagram of a method for reducing capacity of a multi-active load balancing application provided by another embodiment of the present application;
[0015] Figure 4 It is a schematic block diagram of a capacity reduction device for a multi-active load balancing application provided in an embodiment of the present application;
[0016] Figure 5 is a schematic block diagram of a capacity reduction unit provided in an embodiment of the present application;
[0017] Figure 6 is a schematic block diagram of a capacity reduction device for a multi-active load balancing application provided in another embodiment of the present application;
[0018] Figure 7 It is a schematic block diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0019] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0020] Figure 1 1 is a flow chart of a method for reducing capacity of a multi-active load balancing application provided in an embodiment of the present application. Figure 1 As shown, the method includes S101-S102.
[0021] S101, if a scaling-down instruction of a multi-active load balancing application is received, obtain the identification information of the multi-active load balancing application in the scaling-down instruction, and call the scaling-down setting interface to receive the information of the target container instance of the multi-active load balancing application to be scaled down set through the scaling-down setting interface.
[0022] Among them, the scaling down instruction of the multi-active load balancing application can be triggered by a variety of methods, such as being triggered by the user touching or clicking a related button or image, such as clicking a scaling down button corresponding to a multi-active load balancing application in the list of multi-active load balancing applications to trigger the scaling down instruction of the multi-active load balancing application; it can also be triggered by receiving the user's voice scaling down information, etc. In this embodiment, the method of triggering the scaling down instruction of the multi-active load balancing application is not limited. The scaling down instruction includes information about the multi-active load balancing application, such as identification information of the multi-active load balancing application. The identification information of the multi-active load balancing application can be the name of the multi-active load balancing application or the number of the multi-active load balancing application, etc., which can determine which specific multi-active load balancing application the information is.
[0023] The scaling down setting interface is developed by developers and can exist in the form of a setting interface. The information of the target container instance that needs to be scaled down for the multi-active load balancing application can be set through the scaling down setting interface. For example, in one embodiment, the information of all container instances of the multi-active load balancing application is displayed on the setting interface corresponding to the scaling down setting interface, so that the user can input / select the target container instance that needs to be scaled down from all the displayed container instances, and use the input / selected target container instance that needs to be scaled down as the target container instance of the multi-active load balancing application that needs to be scaled down; or the target container instance that needs to be scaled down is displayed by default on the setting interface corresponding to the scaling down setting interface, and the target container instance that needs to be scaled down displayed by default is used as the target container instance of the multi-active load balancing application that needs to be scaled down.
[0024] In this embodiment, the multi-active load balancing application includes an LVS load balancing application and an Nginx load balancing application. The Nginx load balancing application can be regarded as a backend application of the LVS load balancing application to assist the LVS load balancing application. It should be noted that the expression "can be regarded as" is only for the convenience of understanding the relationship between the LVS load balancing application and the Nginx load balancing application in the multi-active load balancing application. In the multi-active load balancing application, the LVS load balancing application has multiple LVS containers (also referred to as LVS container instances), and the Nginx load balancing application also has multiple Nginx containers (also referred to as LVS container instances). The multi-active load balancing application can be applied to a specific network architecture, and the routing protocol in the network architecture needs to use the OSPF protocol so that the user request is distributed to different LVS containers through the distribution strategy of the router corresponding to the OSPF protocol. After the LVS container receives the user request, it sends the user request to the Nginx container instance according to the LVS load balancing algorithm. After the Nginx container instance receives the user request, it sends the user request to the backend application of the multi-active load balancing application according to the Nginx load balancing algorithm, and the backend application responds to the user request. It should be noted that the backend application of the multi-active load balancing application can be understood as the service corresponding to the multi-active load balancing application, that is, the application that actually provides services to users. The multi-active load balancing application provides load balancing services for the backend application.
[0025] In this way, the target container instance that needs to be shrunk of the multi-active load balancing application set through the shrinkage setting interface includes the following situations: the target container instance that needs to be shrunk of the multi-active load balancing application is the target LVS container instance in the LVS load balancing application in the multi-active load balancing application, which can be understood as, only the LVS load balancing application needs to be shrunk; or the target container instance that needs to be shrunk of the multi-active load balancing application is the target Nginx container instance in the Nginx load balancing application in the multi-active load balancing application, which can be understood as, only the Nginx load balancing application needs to be shrunk; or the target container instance that needs to be shrunk of the multi-active load balancing application includes the target LVS container instance in the LVS load balancing application in the multi-active load balancing application and the target Nginx container instance in the Nginx load balancing application in the multi-active load balancing application, which can be understood as, both the LVS load balancing application and the Nginx load balancing application in the multi-active load balancing application need to be shrunk.
[0026] In one embodiment, the number of target container instances that need to be reduced can be determined according to the reduction in the current user access volume and the preset user access volume that can normally access each container instance.
[0027] S102: If a setting completion instruction is received, the target container instance is scaled down according to the identification information of the multi-active load balancing application and the information of the target container instance of the multi-active load balancing application that needs to be scaled down.
[0028] The setting completion instruction can be triggered in a variety of ways, such as by the user touching or clicking a button or image to confirm, or by receiving the user's voice to confirm the reduction. The multi-active load balancing application can be determined based on the identification information of the multi-active load balancing application, and the target container instance can be accurately determined based on the information of the target container instance. The information of the target container instance includes the IP of the container instance and other information that can determine a container instance.
[0029] In one embodiment, if Figure 2 As shown, step S102 includes the following steps S201-S204.
[0030] S201, acquiring the IP address of the target container instance according to the identification information of the multi-active load balancing application and the information of the target container instance of the multi-active load balancing application to be scaled down, and deactivating the IP address of the target container instance.
[0031] According to the identification information of the multi-active load balancing application and the information of the target container instance of the multi-active load balancing application that needs to be scaled down, the information of the target container instance can be queried in the database to obtain the IP of the target container instance, and the usage status identifier of the IP of the target container instance can be set to a disabled state to disable the IP of the target container instance.
[0032] S202: Determine the host machine where the target container instance is located according to the identification information of the multi-active load balancing application and the information of the target container instance of the multi-active load balancing application that needs to be scaled down.
[0033] The information of the target container instance can be queried in the database according to the identification information of the multi-active load balancing application and the information of the target container instance of the multi-active load balancing application that needs to be scaled down to obtain the host machine where the target container instance is located, or the IP of the target container instance can be obtained according to the identification information of the multi-active load balancing application and the information of the target container instance of the multi-active load balancing application that needs to be scaled down, and the host machine where the target container instance is located can be determined according to the IP of the target container instance.
[0034] S203: Destroy the target container instance on the host machine.
[0035] For example, a destruction instruction is sent to the host machine corresponding to the target container instance through a container orchestration tool, such as a docker stop instruction, to destroy the corresponding target container instance on the corresponding host machine. The destruction instruction is generated by the container orchestration tool based on the information of the target container instance. After the destruction instruction is generated, the generated destruction instruction is sent to the host machine corresponding to the target container instance. Destroying the target container instance will destroy the environment information corresponding to the target container instance, close the file input and output streams, close the connection with the database, delete the recorded data information, etc., to release all resources on the host machine occupied by the target container instance, such as monitoring resources, CPU resources, memory resources, IO resources, etc. The container orchestration tool can be a marathon orchestration tool or other container orchestration tools.
[0036] It should be noted that the IP address of the target container instance should be deactivated first and then destroyed, rather than first destroying the target container instance and then deactivating the IP address of the target container instance. This is to prevent the IP address of the target container instance from being valid while the target container instance is invalid. The active-active load balancing application will distribute the received user access request to the target container instance, but in fact the target container instance is invalid, which will cause the user access request to fail.
[0037] S204: Reclaim all resources occupied by the target container instance and the IP address of the target container instance.
[0038] All resources on the host occupied by the target container instance, including monitoring resources, CPU resources, memory resources, IO resources, etc. All resources occupied by the target container instance are recycled, and the subsequent creation of container instances can directly use the recycled resources of the target container instance.
[0039] Among them, reclaiming the IP of the target container instance includes: determining whether the IP of the target container instance is a pre-allocated IP, wherein the pre-allocated IP is an IP pre-allocated for the container instance to be added to the multi-active load balancing application, and the pre-allocated IP has corresponding pre-allocated identification information, and whether the IP is a pre-allocated IP is determined by the identification information of the IP; if it is a pre-allocated IP, the IP of the target container instance is recycled to the pre-allocated IP address pool; if it is not a pre-allocated IP, the IP of the target container instance is recycled to the ordinary IP address pool. The ordinary IP address pool is an IP address pool pre-allocated in the application environment and region corresponding to the multi-active load balancing application, and is an IP address pool that can be used by all other container applications in the application environment and region corresponding to the multi-active load balancing application.
[0040] If the target container instance that needs to be scaled down for the multi-active load balancing application is the target LVS container instance in the LVS load balancing application in the multi-active load balancing application, that is, only the LVS load balancing application in the multi-active load balancing application needs to be scaled down, the above steps S201-204 can achieve the scaling down of the target LVS container instance.
[0041] In one embodiment, the target container instance that needs to be scaled down in the multi-active load balancing application is the target Nginx container instance in the Nginx load balancing application in the multi-active load balancing application, that is, only the Nginx load balancing application in the multi-active load balancing application needs to be scaled down, and the method also includes 204a.
[0042] 204a, modify the configuration file of the LVS load balancing application according to the information of the shrunk target Nginx container instance to delete the information of the shrunk target Nginx container instance in the configuration file.
[0043] It can be understood that in a multi-active load balancing application, the Nginx load balancing application is equivalent to the backend application of the LVS load balancing application (note that the term "equivalent" here is only to help understand the relationship between the Nginx load balancing application and the LVS load balancing application in a multi-active load balancing application). Therefore, the information of the Nginx container instance is recorded in the configuration file of the LVS load balancing application (the configuration file referred to here corresponds to keeplived.conf). After the target Nginx container instance is scaled down, the target Nginx container instance is no longer functional. The scaled-down Nginx container instance information recorded in the configuration file of the LVS load balancing application needs to be deleted to ensure that the LVS load balancing application does not allocate user requests to the scaled-down target Nginx container instance when allocating user requests.
[0044] Specifically, step S204a includes: locating the location of the IP of the target Nginx container instance in the configuration file of the LVS load balancing application according to the IP of the target container instance in the information of the shrunk target Nginx container instance; determining the configuration information of the target Nginx container instance in the configuration file of the LVS load balancing application according to the location of the IP of the target Nginx container instance, and deleting all the configuration information of the target Nginx container instance. If the location of the IP of the target Nginx container instance is the line where real_server is located, the configuration information between the first pair of brackets after real_server and the configuration information of the line where real_server is located are used as the configuration information of the target Nginx container instance. The configuration information of the target Nginx container instance includes information such as the IP of the target Nginx container instance, the weight parameter of the target Nginx container instance, and the TCP health check parameter of the target Nginx container instance.
[0045] In one embodiment, the target container instance that needs to be scaled down in the multi-active load balancing application includes the target LVS container instance in the LVS load balancing application in the multi-active load balancing application and the target Nginx container instance in the Nginx load balancing application in the multi-active load balancing application, that is, both the LVS load balancing application and the Nginx load balancing application in the multi-active load balancing application need to be scaled down, and the method also includes 204a.
[0046] 204a, modify the configuration file of the LVS load balancing application according to the information of the shrunk target Nginx container instance to delete the information of the shrunk target Nginx container instance in the configuration file.
[0047] Specifically, please refer to the above description of step S204a, which will not be repeated here.
[0048] The above method embodiment involves scaling down the container instance in a multi-active load balancing application. In one embodiment, the method also includes scaling down the backend application of the multi-active load balancing application. Among them, the backend application also belongs to the container application. It can be understood that the backend application is the application that actually provides services to users, and the multi-active load balancing application provides load balancing services for the backend application. Specifically, Figure 3 As shown, the method also includes steps S301-S303.
[0049] S301, if a scaling-down request is received for a backend application of a multi-active load balancing application, the identification information of the backend application in the scaling-down request is obtained, and a preset setting interface is called according to the scaling-down request to receive information of a target container instance of the backend application to be scaled down which is set through the preset setting interface.
[0050] Among them, the shrinking request of the backend application can be triggered by multiple methods, and the triggering method can refer to the triggering method of the shrinking instruction of the multi-active load balancing application mentioned above. The shrinking request of the backend application includes information of the backend application, such as the identification information of the backend application. The identification information of the backend application can be the name of the backend application or other information that can determine which backend application it is. The preset setting interface is also an interface developed by developers, and can also exist in the form of a setting interface. The information of the target container instance that the backend application needs to shrink can be set through the preset setting interface. For example, in one embodiment, the information of all container instances of the backend application is displayed on the setting interface corresponding to the preset setting interface, so that the user can input / select the target container instance that needs to be shrunk from all the displayed container instances, and the input / selected target container instance that needs to be shrunk is used as the target container instance that the backend application needs to be shrunk; or the target container instance that needs to be shrunk is displayed by default on the setting interface corresponding to the preset setting interface, and the target container instance that needs to be shrunk displayed by default is used as the target container instance that the backend application needs to be shrunk.
[0051] S302: If a setting completion instruction is received, the target container instance is shrunk according to the identification information of the backend application and the information of the target container instance that needs to be shrunk by the backend application.
[0052] The method for shrinking the target container instance according to the identification information of the backend application and the information of the target container instance that needs to be shrunk for the backend application is similar to the method for shrinking the target container instance according to the identification information of the multi-active load balancing application and the information of the target container instance of the multi-active load balancing application that needs to be shrunk. For the specific implementation process, please refer to the corresponding description above, which will not be repeated here.
[0053] S303: modify the configuration file of the Nginx load balancing application according to the information of the shrunk target container instance to delete the information of the shrunk target container instance in the configuration file.
[0054] It can be understood that the backend application is the application server corresponding to the multi-active load balancing application. Therefore, the information of the container instance of the backend application is recorded in the configuration file of the Nginx load balancing application (the configuration file mentioned here corresponds to Nginx.conf). After the target container instance is scaled down, the target container instance no longer exists. Among them, the target container instance refers to one or more container instances in the container instance of the backend application. In this way, it is necessary to delete the information of the target container instance of the scaled backend application recorded in the configuration file of the Nginx load balancing application to ensure that the multi-active load balancing application will not allocate user requests to the target container instance of the scaled backend application when allocating user requests.
[0055] For example, step S303 includes: locating the upstream node in the configuration file of the Nginx load balancing application; according to the IP address of the target container instance in the target container instance information of the backend application, deleting the code line where the IP address of the target container instance is located in the upstream node to delete the information of the reduced target container instance in the configuration file. Among them, the upstream node in the configuration file of the Nginx load balancing application records all the container instance information that can provide services, and each container instance information that can provide services (including the IP address of the container instance and the port provided by the container instance) is a separate line of code, such as: server 192.168.12.23:8080.
[0056] In one embodiment, if all container instance information that can provide a server is written in one line of code, such as server 192.168.12.23:8080, 192.168.12.24:8080, 192.168.12.25:8080, then step S303 includes: locating the upstream node in the configuration file of the Nginx load balancing application; deleting the IP address of the target container instance and the port information of the service provided by the target container instance in the upstream node, such as deleting 192.168.12.24:8080.
[0057] In one embodiment, the shrinking mode of the target container instance can also be set through the shrinking setting interface, and the shrinking mode includes a serial mode and a parallel mode. If the shrinking mode is a serial mode, the target container instances are shrunk one by one; if the shrinking mode is a parallel mode, the target container instances are shrunk in parallel.
[0058] The step S101 includes: if a scaling-down instruction of a multi-active load balancing application is received, obtaining identification information of the multi-active load balancing application in the scaling-down instruction, and calling a scaling-down setting interface to receive information and a scaling-down method of a target container instance of the multi-active load balancing application to be scaled down set through the scaling-down setting interface.
[0059] The step S102 includes: if a setting completion instruction is received, scaling down the target container instance according to the identification information of the multi-active load balancing application, the information of the target container instance of the multi-active load balancing application to be scaled down, and the scaling down method.
[0060] Thus, if the shrinking mode is a serial mode, steps S201-S204 are executed in a loop until all target container instances are completely shrunk; if the shrinking mode is a parallel mode, steps S201-S204 are executed in parallel, that is, multiple target container instances are shrunk in parallel.
[0061] In one embodiment, the method further includes S103.
[0062] S103: Update the information of the reduced target container instance to the database.
[0063] Updating the database includes deleting information such as the IP address of the reduced container instance of the multi-active load balancing application, updating the number of container instances in the multi-active load balancing application, and the like.
[0064] It can be understood that in all the above method embodiments, after the target container instance is shrunk, the information of the shrunk target container instance needs to be updated to the database.
[0065] The above method embodiment can realize the scaling down of container instances of multi-active load balancing applications, thereby reducing costs while ensuring that load balancing provides services. In addition to the corresponding settings, the specific scaling down process is performed automatically, which improves the efficiency of scaling down and saves time and labor costs. On the other hand, a setting interface is provided for users to select / input target container instances, thereby improving user experience.
[0066] Figure 4 1 is a schematic block diagram of a device for reducing capacity of a multi-active load balancing application provided in an embodiment of the present application. The device includes a unit corresponding to the method for reducing capacity of the multi-active load balancing application. Figure 4 As shown, the capacity reduction device 100 for the multi-active load balancing application includes a setting unit 101 and a capacity reduction unit 102.
[0067] The setting unit 101 is used to obtain the identification information of the multi-active load balancing application in the scaling-down instruction if a scaling-down instruction of the multi-active load balancing application is received, and call the scaling-down setting interface to receive the information of the target container instance of the multi-active load balancing application to be scaled down set through the scaling-down setting interface.
[0068] The shrinking unit 102 is configured to shrink the target container instance according to the identification information of the multi-active load balancing application and the information of the target container instance of the multi-active load balancing application to be shrunk if a setting completion instruction is received.
[0069] In one embodiment, the apparatus 100 further includes an information updating unit 103, and the information updating unit 103 is configured to update the information of the shrunk target container instance to a database.
[0070] In one embodiment, if Figure 5As shown, the scaling-down unit 102 includes a deactivation unit 201, a host determination unit 202, a destruction unit 203, and a recycling unit 204. Among them, the deactivation unit 201 is used to obtain the IP of the target container instance according to the identification information of the multi-active load balancing application and the information of the target container instance of the multi-active load balancing application that needs to be scaled down, and deactivate the IP of the target container instance. The host determination unit 202 is used to determine the host where the target container instance is located according to the identification information of the multi-active load balancing application and the information of the target container instance of the multi-active load balancing application that needs to be scaled down. The destruction unit 203 is used to destroy the target container instance on the host. The recycling unit 204 is used to recycle all resources occupied by the target container instance and the IP of the target container instance.
[0071] In one embodiment, the target container instance of the multi-active load balancing application to be scaled down is a target Nginx container instance. The scaling down unit 102 further includes a load configuration changing unit 204a. The load configuration changing unit 204a is used to change the configuration file of the LVS load balancing application according to the information of the scaled down target Nginx container instance to delete the information of the scaled down target Nginx container instance in the configuration file.
[0072] In one embodiment, the target container instance of the multi-active load balancing application to be scaled down includes a target LVS container instance and a target Nginx container instance. The scaling down unit 102 also includes a load configuration changing unit 204a. The load configuration changing unit 204a is used to change the configuration file of the LVS load balancing application according to the information of the scaled down target Nginx container instance to delete the information of the scaled down target Nginx container instance in the configuration file.
[0073] In one embodiment, the shrinking method of the target container instance can also be set through the shrinking setting interface, and the shrinking method includes a serial method and a parallel method. The setting unit 101 is also used to, if a shrinking instruction of a multi-active load balancing application is received, obtain the identification information of the multi-active load balancing application in the shrinking instruction, and call the shrinking setting interface to receive the information and shrinking method of the target container instance of the multi-active load balancing application to be shrunk set through the shrinking setting interface. The shrinking unit 101 is also used to shrink the target container instance according to the identification information of the multi-active load balancing application, the information of the target container instance of the multi-active load balancing application to be shrunk, and the shrinking method.
[0074] Figure 6 FIG. 1 is a schematic block diagram of a capacity reduction device for a multi-active load balancing application provided by another embodiment of the present application. Figure 6As shown, the capacity reduction device 100' of the multi-active load balancing application includes a setting unit 101', a capacity reduction unit 102', an information updating unit 103', and a configuration updating unit 104. Figure 4 The description of the setting unit 101, the shrinking unit 102, and the information updating unit 103 in the embodiment. In addition, this embodiment is different from Figure 4 The illustrated embodiments also differ in that:
[0075] The setting unit 101' is also used to obtain the identification information of the backend application in the scaling-down request if a scaling-down request is received for the backend application of the multi-active load balancing application, and call the preset setting interface according to the scaling-down request to receive the information of the target container instance that needs to be scaled down for the backend application set through the preset setting interface.
[0076] The shrinking unit 102' is further configured to shrink the target container instance according to the identification information of the backend application and the information of the target container instance to be shrunk by the backend application if a setting completion instruction is received.
[0077] The configuration updating unit 104 is used to modify the configuration file of the Ngxin load balancing application according to the information of the shrunk target container instance, so as to delete the information of the shrunk target container instance in the configuration file.
[0078] It should be noted that those skilled in the art can clearly understand that the specific implementation process of the above-mentioned device and each unit can refer to the corresponding description in the aforementioned method embodiment, and for the convenience and brevity of description, it will not be repeated here.
[0079] The above device can be implemented in the form of a computer program. The computer program can be Figure 7 Runs on the computer device shown.
[0080] Figure 7 A schematic block diagram of a computer device provided in an embodiment of the present application. The device is a terminal or other device, such as a server in a PaaS platform. The device 100 includes a processor 102, a memory, and a network interface 103 connected via a system bus 101, wherein the memory may include a non-volatile storage medium 104 and an internal memory 105.
[0081] The non-volatile storage medium 104 can store an operating system 1041 and a computer program 1042. When the computer program 1042 stored in the non-volatile storage medium is executed by the processor 102, the method for reducing the capacity of the multi-active load balancing application described in the above-mentioned server can be implemented. The processor 102 is used to provide computing and control capabilities to support the operation of the entire device 100. The internal memory 105 provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor 102, the processor 102 can execute the method for reducing the capacity of the multi-active load balancing application described in the above-mentioned server. The network interface 103 is used for network communication. It can be understood by those skilled in the art that the structure shown in the figure is only a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the device to which the scheme of the present application is applied. The specific device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0082] The processor 102 is used to run a computer program stored in a memory to implement any embodiment of the above-mentioned method for scaling down a multi-active load balancing application.
[0083] It should be understood that in the embodiment of the present application, the processor 102 may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0084] It can be understood by those skilled in the art that all or part of the processes in the method for implementing the above embodiment can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a storage medium, which can be a computer-readable storage medium. The computer program is executed by at least one processor in the computer system to implement the process steps of the embodiment of the above method.
[0085] Therefore, the present application also provides a storage medium. The storage medium may be a computer-readable storage medium, and the computer-readable storage medium includes a non-volatile computer-readable storage medium. The storage medium stores a computer program, and when the computer program is executed by a processor, any embodiment of the above-mentioned method for reducing capacity of a multi-active load balancing application is implemented.
[0086] The storage medium may be a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk, etc., which are computer-readable storage media that can store program codes.
[0087] In the several embodiments provided in the present application, it should be understood that the disclosed devices, equipment and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, and the division of the units is only a logical function division, and there may be other division methods in actual implementation. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the devices, equipment and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. The above is only a specific implementation method of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A method for reducing capacity of a multi-active load balancing application, characterized in that: The method comprises: If a scaling-down instruction of a multi-active load balancing application is received, identification information of the multi-active load balancing application in the scaling-down instruction is obtained, and a scaling-down setting interface is called to receive information of a target container instance of the multi-active load balancing application to be scaled down set through the scaling-down setting interface, wherein the multi-active load balancing application includes an LVS (Linux Virtual Server) load balancing application and an Nginx load balancing application; If a setting completion instruction is received, the target container instance is shrunk according to the identification information of the multi-active load balancing application and the information of the target container instance of the multi-active load balancing application that needs to be shrunk, wherein the target container instance of the multi-active load balancing application that needs to be shrunk includes a target LVS container instance and a target Nginx container instance; Modify the configuration file of the LVS load balancing application according to the information of the shrunk target Nginx container instance to delete the information of the shrunk target Nginx container instance in the configuration file; The step of reducing the capacity of the target container instance according to the identification information of the multi-active load balancing application and the information of the target container instance of the multi-active load balancing application to be reduced includes: According to the identification information of the multi-active load balancing application and the information of the target container instance of the multi-active load balancing application that needs to be scaled down, the IP address of the target container instance is obtained, and the IP address of the target container instance is deactivated; Determine the host machine where the target container instance is located according to the identification information of the multi-active load balancing application and the information of the target container instance of the multi-active load balancing application that needs to be scaled down; Destroying the target container instance on the host machine; Reclaim all resources occupied by the target container instance and the IP address of the target container instance, wherein the resources include monitoring resources, CPU resources, memory resources, and IO resources.
2. The method according to claim 1, characterized in that The method further comprises: If a scaling-down request is received from a backend application of a multi-active load balancing application, identification information of the backend application in the scaling-down request is obtained, and a preset setting interface is called according to the scaling-down request to receive information of a target container instance of the backend application to be scaled down, which is set through the preset setting interface; If a setting completion instruction is received, scaling down the target container instance according to the identification information of the backend application and the information of the target container instance to be scaled down of the backend application; The configuration file of the Nginx load balancing application is modified according to the information of the shrunk target container instance to delete the information of the shrunk target container instance in the configuration file.
3. The method according to claim 1, characterized in that The shrinking setting interface can also be used to set the shrinking mode of the target container instance, and the shrinking mode includes a serial mode and a parallel mode; The step of shrinking the target container instance according to the identification information of the multi-active load balancing application and the information of the target container instance of the multi-active load balancing application to be shrunk includes: The target container instance is shrunk according to the identification information of the multi-active load balancing application, the information of the target container instance of the multi-active load balancing application to be shrunk, and the scaling method.
4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Update the database with information about the reduced target container instance.
5. A capacity reduction device for multi-active load balancing applications, characterized in that: The capacity reduction device of the multi-active load balancing application includes: A setting unit, configured to, if a scaling-down instruction of a multi-active load balancing application is received, obtain identification information of the multi-active load balancing application in the scaling-down instruction, and call a scaling-down setting interface to receive identification information of a target container instance of the multi-active load balancing application to be scaled down set through the scaling-down setting interface, wherein the multi-active load balancing application includes an LVS (Linux Virtual Server) load balancing application and an Nginx load balancing application; A shrinking unit, configured to shrink the target container instance according to the identification information of the multi-active load balancing application and the information of the target container instance of the multi-active load balancing application to be shrunk if a setting completion instruction is received, wherein the target container instance of the multi-active load balancing application to be shrunk includes a target LVS container instance and a target Nginx container instance; A load configuration changing unit, configured to change a configuration file of the LVS load balancing application according to the information of the shrunk target Nginx container instance, so as to delete the information of the shrunk target Nginx container instance in the configuration file; Wherein, the shrinking unit comprises: A deactivation unit, configured to obtain the IP of the target container instance according to the identification information of the multi-active load balancing application and the information of the target container instance of the multi-active load balancing application to be scaled down, and deactivate the IP of the target container instance; A host determination unit, configured to determine a host where the target container instance is located according to identification information of the multi-active load balancing application and information of a target container instance of the multi-active load balancing application that needs to be scaled down; A destroying unit, configured to destroy the target container instance on the host machine; A recycling unit is used to recycle all resources occupied by the target container instance and the IP address of the target container instance, wherein the resources include monitoring resources, CPU resources, memory resources, and IO resources.
6. A computer device, characterized in that: The computer device includes a memory and a processor connected to the memory; The memory is used to store a computer program; the processor is used to run the computer program stored in the memory to execute the method according to any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
