A seven-layer load balancing system and method based on resource reuse Nginx container

By deploying Nginx services in containers and using port number mapping technology, multiple load balancing services are mapped to the same container, which solves the problems of resource waste and inconvenient expansion and contraction in public cloud scenarios, and achieves high-performance seven-layer load balancing. and improvement in resource utilization.

CN115190133BActive Publication Date: 2024-10-25CHINA ELECTRONICS CLOUD DIGITAL INTELLIGENCE TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210796708.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-08
Publication Date
2024-10-25
Estimated Expiration
2042-07-08

AI Technical Summary

Technical Problem

Existing load balancing technology has problems of resource waste and inconvenient expansion and contraction in public cloud scenarios, especially when deployed on physical machines or virtual machines, resulting in low resource utilization.

Method used

By deploying Nginx services in containers and using port number mapping to map multiple load balancing service IP+ports to the same Nginx container, Nginx containers can be reused and resource utilization improved.

Benefits of technology

It can quickly and conveniently provide users with high-performance seven-layer load balancing services, reduce resource waste, and improve resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115190133B_ABST
    Figure CN115190133B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of load balancing, and provides a seven-layer load balancing system and method based on resource reuse Nginx container. The method of the present invention comprises: an LVS cluster module, comprising a plurality of LVS cluster units, for receiving user requests, providing four-layer load balancing services, and sending user requests that have passed the four-layer load balancing service to the Nginx container; an Nginx container, comprising an Nginx module, for providing seven-layer load balancing services for different user requests that have passed the four-layer load balancing service through port mapping; a back-end server module, comprising a plurality of RS servers, for receiving user requests that have passed the seven-layer load balancing service and responding to the Nginx container. The seven-layer load balancing system and method based on resource reuse Nginx container according to the exemplary embodiment of the present invention can realize the reuse of nginx container, improve resource utilization, and quickly and conveniently provide users with high-performance seven-layer load balancing services.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of load balancing, and in particular to a seven-layer load balancing system and method based on resource reuse Nginx container. Background Art

[0002] As a powerful web server software, Nginx has the characteristics of high performance, high stability, high concurrency, rich functions, simple configuration and low memory usage. In addition, it can also provide powerful reverse proxy functions. As a reverse proxy, it can provide powerful load balancing services, and has the advantages of high concurrent connections, low memory consumption, very simple configuration files, low cost, support for Rewrite rules, built-in health check function and bandwidth saving.

[0003] In actual applications, load balancing is generally deployed in two levels, with the LVS cluster providing four-layer load balancing capabilities in the front and the nginx cluster providing seven-layer load balancing capabilities in the back. The conventional solution is to deploy nginx in a physical machine or a virtual machine. For public cloud scenarios, each user may have one or more load balancing instances of their own. The cloud vendor as a service provider will start an nginx service for each instance, and the user-configured listener and backend configuration are configured on their respective nginx services. There are the following shortcomings: 1) Deployment on a physical machine is not convenient for resource expansion and contraction, and the elasticity is insufficient; 2) Deployment in a virtual machine, the startup of the service is subject to the performance of the virtual machine, which is not convenient enough; 3) For a certain user, the listener or port number used is generally very limited, and starting an nginx service for each user causes a huge waste of resources.

[0004] Therefore, how to provide a resource-saving load balancing method has become a technical problem that needs to be solved urgently. Summary of the invention

[0005] In view of this, in order to overcome the shortcomings of the prior art, the present invention provides a method for deploying nginx service in a container, which can quickly and conveniently provide users with high-performance seven-layer load balancing services. At the same time, through port number mapping, multiple load balancing service IP+ports are mapped to the same nginx container, thereby realizing the reuse of nginx containers and improving resource utilization.

[0006] On the one hand, the present invention provides a seven-layer load balancing system based on resource reuse Nginx container, comprising:

[0007] The LVS cluster module includes multiple LVS cluster units, which are used to receive user requests, provide layer-4 load balancing services, and send user requests that have passed the layer-4 load balancing services to the Nginx container;

[0008] Nginx container, including Nginx module, is used to provide seven-layer load balancing service for different user requests through four-layer load balancing service through port mapping;

[0009] The backend server module includes multiple RS servers, which are used to receive user requests through the seven-layer load balancing service and respond to the Nginx container.

[0010] Furthermore, the present invention is based on a seven-layer load balancing system of a resource-reusing Nginx container, and the LVS cluster unit in the LVS cluster module is used to receive user request traffic, select traffic that needs to be load balanced based on the information of the fourth layer, and perform four-layer load balancing service processing.

[0011] Furthermore, the present invention is based on a seven-layer load balancing system of a resource-reusing Nginx container. The LVS cluster unit in the LVS cluster module selects the traffic that needs to be load balanced by publishing a three-layer IP address VIP and adding a four-layer port number port, wherein the four-layer port number port adopts 80.

[0012] Furthermore, the present invention is based on a seven-layer load balancing system of a resource-reusing Nginx container, in which the Nginx module in the Nginx container is used to receive user requests through a four-layer load balancing service according to different Nginx port numbers, and to provide a seven-layer load balancing service for different user requests.

[0013] Furthermore, the present invention is based on a seven-layer load balancing system of a resource-reusing Nginx container, and the Nginx port number of the Nginx module is arranged by port number mapping.

[0014] Furthermore, the present invention is based on a seven-layer load balancing system of a resource-reusing Nginx container, and the Nginx port number of the Nginx module is obtained by mapping the three-layer IP address VIP and the four-layer port number port of the LVS cluster unit to the Nginx module of the Nginx container.

[0015] On the other hand, the present invention provides a seven-layer load balancing method based on resource reuse Nginx container, comprising:

[0016] Step S1: The LVS cluster unit of the LVS cluster module receives the user request, provides a four-layer load balancing service for the received user request, and sends the user request that has passed the four-layer load balancing service to the Nginx container;

[0017] Step S2: Using the Nginx module of the Nginx container to provide a seven-layer load balancing service for different user requests that pass through the four-layer load balancing service through port mapping;

[0018] Step S3: The RS server of the backend server module receives the user request through the seven-layer load balancing service and responds to the Nginx container.

[0019] Furthermore, the present invention provides a seven-layer load balancing method based on resource reuse Nginx container, step S1, comprising:

[0020] Step S11: using the LVS cluster unit to receive user request traffic;

[0021] Step S12: The LVS cluster unit selects the traffic that needs to be load balanced by publishing the layer 3 IP address VIP and adding the layer 4 port number port, selects the traffic that needs to be load balanced according to the layer 4 information, and performs layer 4 load balancing service processing on the selected traffic;

[0022] Step S13: The LVS cluster unit sends the user request served by the four-layer load balancing service to the Nginx container.

[0023] Furthermore, the present invention provides a seven-layer load balancing method based on resource reuse Nginx container, step S2, including

[0024] Step S21: Map the layer 3 IP address VIP and layer 4 port number port of the LVS cluster unit to the Nginx module of the Nginx container;

[0025] Step S22: Arrange the Nginx port number of the Nginx module;

[0026] Step S23: using the Nginx module to receive different user requests through the four-layer load balancing service according to different Nginx port numbers, and providing seven-layer load balancing services for different user requests.

[0027] Finally, the present invention also provides a terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the steps of the method are implemented when the processor executes the program.

[0028] The present invention is based on a seven-layer load balancing system and method for resource-reusing Nginx containers, which maps multiple load balancing service IP+ports to the same nginx container, and realizes the reuse of nginx containers through port number mapping, thereby improving resource utilization and quickly and conveniently providing users with high-performance seven-layer load balancing services. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0030] Figure 1 This is an architecture diagram of a seven-layer load balancing system based on resource reuse Nginx container according to the first exemplary embodiment of the present invention.

[0031] Figure 2 This is a flowchart of a seven-layer load balancing method based on resource reuse Nginx container according to the fourth exemplary embodiment of the present invention.

[0032] Figure 3 This is a flowchart of a seven-layer load balancing method based on resource reuse Nginx container according to the fifth exemplary embodiment of the present invention.

[0033] Figure 4 This is a flowchart of a seven-layer load balancing method based on resource reuse Nginx container according to the sixth exemplary embodiment of the present invention. DETAILED DESCRIPTION

[0034] The embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0035] It should be noted that the following embodiments and features in the embodiments may be combined with each other in the absence of conflict; and, based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without making any creative work are within the scope of protection of the present disclosure.

[0036] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein may be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present disclosure, it should be understood by those skilled in the art that an aspect described herein may be implemented independently of any other aspect, and two or more of these aspects may be combined in various ways. For example, any number of aspects described herein may be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein may be used to implement this device and / or practice this method.

[0037] Figure 1 FIG. 1 is an architecture diagram of a seven-layer load balancing system based on resource reuse Nginx container according to an exemplary first embodiment of the present invention. Figure 1 As shown, the system described in this embodiment includes:

[0038] The LVS cluster module includes multiple LVS cluster units, which are used to receive user requests, provide layer-4 load balancing services, and send user requests that have passed the layer-4 load balancing services to the Nginx container;

[0039] Nginx container, including Nginx module, is used to provide seven-layer load balancing service for different user requests through four-layer load balancing service through port mapping;

[0040] The backend server module includes multiple RS servers, which are used to receive user requests through the seven-layer load balancing service and respond to the Nginx container.

[0041] In the system of this embodiment, the Nginx container may further include multiple Nginx modules.

[0042] The second exemplary embodiment of the present invention provides a seven-layer load balancing system based on resource reuse Nginx container. Figure 1 The preferred embodiment of the system shown in the figure, in this embodiment, the LVS cluster unit in the LVS cluster module is used to receive user request traffic, select traffic that needs to be load balanced according to the information of the fourth layer, and perform the fourth layer load balancing service processing. Specifically, in actual application, the LVS cluster unit in the LVS cluster module selects the traffic that needs to be load balanced by publishing the third layer IP address VIP and adding the fourth layer port number port, wherein the fourth layer port number port adopts 80.

[0043] The third exemplary embodiment of the present invention provides a seven-layer load balancing system based on resource reuse Nginx container. Figure 1 In the preferred embodiment of the system shown, in this embodiment, the Nginx module in the Nginx container is used to receive user requests through the four-layer load balancing service according to different Nginx port numbers, and provide seven-layer load balancing services for different user requests. Specifically, the Nginx port number of the Nginx module is arranged by port number mapping, and the Nginx port number of the Nginx module is obtained by mapping the three-layer IP address VIP and the four-layer port number port of the LVS cluster unit to the Nginx module of the Nginx container.

[0044] Figure 2 FIG. 4 is a flow chart of a seven-layer load balancing method based on resource reuse Nginx container according to an exemplary fourth embodiment of the present invention. Figure 1 As shown, the method described in this embodiment includes:

[0045] Step S1: The LVS cluster unit of the LVS cluster module receives the user request, provides a four-layer load balancing service for the received user request, and sends the user request that has passed the four-layer load balancing service to the Nginx container;

[0046] Step S2: Using the Nginx module of the Nginx container to provide a seven-layer load balancing service for different user requests that pass through the four-layer load balancing service through port mapping;

[0047] Step S3: The RS server of the backend server module receives the user request through the seven-layer load balancing service and responds to the Nginx container.

[0048] Figure 3 is a flowchart of a seven-layer load balancing method based on resource reuse Nginx container according to an exemplary fifth embodiment of the present invention. Figure 2 The preferred embodiment of the method shown is as follows Figure 3 As shown, step S1 of the method of this embodiment includes:

[0049] Step S11: using the LVS cluster unit to receive user request traffic;

[0050] Step S12: The LVS cluster unit selects the traffic that needs to be load balanced by publishing the layer 3 IP address VIP and adding the layer 4 port number port, selects the traffic that needs to be load balanced according to the layer 4 information, and performs layer 4 load balancing service processing on the selected traffic;

[0051] Step S13: The LVS cluster unit sends the user request served by the four-layer load balancing service to the Nginx container.

[0052] Figure 4 Flow chart of a seven-layer load balancing method based on resource reuse Nginx container according to an exemplary sixth embodiment of the present invention. Figure 2 The preferred embodiment of the method shown is as follows Figure 4 As shown, step S2 of the method of this embodiment includes:

[0053] Step S21: Map the layer 3 IP address VIP and layer 4 port number port of the LVS cluster unit to the Nginx module of the Nginx container;

[0054] Step S22: Arrange the Nginx port number of the Nginx module;

[0055] Step S23: using the Nginx module to receive different user requests through the four-layer load balancing service according to different Nginx port numbers, and providing seven-layer load balancing services for different user requests.

[0056] Finally, the present invention also provides a terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the steps of the method are implemented when the processor executes the program.

[0057] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims

1. A seven-layer load balancing system based on resource reuse Nginx container, characterized in that: The system comprises: The LVS cluster module includes multiple LVS cluster units, which are used to receive user requests, provide layer-4 load balancing services, and send user requests that have passed the layer-4 load balancing services to the Nginx container; Nginx container, including Nginx module, is used to provide seven-layer load balancing service for different user requests through four-layer load balancing service through port mapping; The backend server module includes multiple RS servers, which are used to receive user requests through the seven-layer load balancing service and respond to the Nginx container; The LVS cluster unit in the LVS cluster module is used to receive user request traffic, select the traffic that needs to be load balanced based on the information of the fourth layer, and perform the fourth layer load balancing service processing; The LVS cluster unit in the LVS cluster module selects the traffic that needs to be load balanced by publishing the Layer 3 IP address VIP and adding the Layer 4 port number port. The Layer 4 port number port uses 80. The Nginx module in the Nginx container is used to receive user requests through the four-layer load balancing service according to different Nginx port numbers, and provide seven-layer load balancing services for different user requests; The Nginx port number of the Nginx module is arranged by port number mapping; The Nginx port number of the Nginx module is obtained by mapping the LVS cluster unit's layer-3 IP address VIP and layer-4 port number port to the Nginx module of the Nginx container.

2. A seven-layer load balancing method based on resource reuse Nginx container according to the seven-layer load balancing system based on resource reuse Nginx container according to claim 1, characterized in that: The method comprises: Step S1: The LVS cluster unit of the LVS cluster module receives the user request, provides a four-layer load balancing service for the received user request, and sends the user request that has passed the four-layer load balancing service to the Nginx container; Step S2: Using the Nginx module of the Nginx container to provide a seven-layer load balancing service for different user requests that pass through the four-layer load balancing service through port mapping; Step S3: The RS server of the backend server module receives the user request through the seven-layer load balancing service and responds to the Nginx container; Step S1 includes: Step S11: using the LVS cluster unit to receive user request traffic; Step S12: The LVS cluster unit selects the traffic that needs to be load balanced by publishing the layer 3 IP address VIP and adding the layer 4 port number port, selects the traffic that needs to be load balanced according to the layer 4 information, and performs layer 4 load balancing service processing on the selected traffic; Step S13: The LVS cluster unit sends the user request that has passed the Layer 4 load balancing service to the Nginx container; Step S2 includes: Step S21: Map the layer 3 IP address VIP and layer 4 port number port of the LVS cluster unit to the Nginx module of the Nginx container; Step S22: Arrange the Nginx port number of the Nginx module; Step S23: using the Nginx module to receive different user requests through the four-layer load balancing service according to different Nginx port numbers, and providing seven-layer load balancing services for different user requests.

3. A terminal device, characterized in that: The terminal device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the method according to claim 2 when executing the program.