Load balancing method, load balancing device, electronic device and storage medium
By using security group rules in cloud computing services to control traffic and directly determine the target server device, the problem of reduced load balancing efficiency is solved and the applicability of high-concurrency scenarios is improved.
Patent Information
- Application Number
- CN202210139507.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-15
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2042-02-15
AI Technical Summary
In cloud computing services, the implementation of load balancing requires the storage of connection information. When access traffic is large, the stored connection information takes up a large amount of memory, resulting in reduced load balancing efficiency.
By using security group rules to control outbound and inbound traffic, there is no need to store connection information. Target security group rules are determined directly from multiple security group rules, and the target server device is determined based on address information and application layer content.
It effectively reduces the memory consumption of the load balancing server, improves its applicability to high-concurrency and low-latency scenarios, and avoids performance problems caused by storing connection information.
Smart Images

Figure CN114513465B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of cloud computing, and more specifically, to a load balancing method, a load balancing device, an electronic device, a readable storage medium, and a computer program product. Background Art
[0002] In cloud computing services, load balancing is a key component of high-availability network infrastructure and is typically used to distribute workloads to multiple servers to improve the performance and reliability of websites, applications, databases, or other services.
[0003] In the process of implementing the concept of the present disclosure, the inventors found that there are at least the following problems in the related art: the implementation of load balancing in the related art requires the storage of connection information. When the access traffic is large, the stored connection information will occupy a large amount of memory, resulting in reduced load balancing efficiency. Summary of the invention
[0004] In view of this, the present disclosure provides a load balancing method, a load balancing device, an electronic device, a readable storage medium and a computer program product.
[0005] One aspect of the present disclosure provides a load balancing method, including: obtaining a connection request from a target client device, wherein the connection request carries address information; based on the address information, determining a first target security group rule from a plurality of security group rules; when the security policy configured in the first target security group rule is accept, determining a target server device from a server device cluster; and sending the connection request to the target server device.
[0006] According to an embodiment of the present disclosure, the above-mentioned security group rules are also configured with a transmission direction and an adaptation address range, and the above-mentioned transmission direction includes an outbound direction and an inbound direction; wherein, based on the above-mentioned address information, determining the first target security group rule from multiple security group rules includes: selecting a security group rule with a configured transmission direction as an inbound direction from the multiple security group rules, and obtaining at least one inbound security group rule; for each of the above-mentioned inbound security group rules, matching the address information of the above-mentioned target client device with the adaptation address range of the above-mentioned inbound security group rule; and in the case where the matching result indicates that the address information of the above-mentioned target client device is within the adaptation address range of the above-mentioned inbound security group rule, determining the above-mentioned inbound security group rule as the above-mentioned first target security group rule.
[0007] According to an embodiment of the present disclosure, the above-mentioned connection request also carries application layer content; wherein, the above-mentioned determination of the target server device from the server device cluster includes: determining the target application scenario according to the application layer content carried in the above-mentioned connection request; obtaining at least one server device under the above-mentioned target application scenario from the above-mentioned server device cluster; and determining the above-mentioned target server device from at least one of the above-mentioned server devices based on a preset load balancing algorithm.
[0008] According to an embodiment of the present disclosure, the above-mentioned preset load balancing algorithm includes any one of the following algorithms: random algorithm, polling, weighted polling, hash algorithm, IP address hash and URL hash.
[0009] According to an embodiment of the present disclosure, the method further includes: before sending the connection request to the target server device, modifying the address information carried in the connection request to the address information of the target server device.
[0010] According to an embodiment of the present disclosure, the method further includes: when the security policy configured in the first target security group rule is rejection, sending feedback information of rejecting the connection to the target client device.
[0011] According to an embodiment of the present disclosure, the above-mentioned method also includes: obtaining a response request from the above-mentioned target server device, wherein the above-mentioned response request includes the response request generated by the above-mentioned target server device in response to the above-mentioned connection request; based on the address information of the above-mentioned target server device, determining a second target security group rule from the multiple security group rules; and when the security policy configured in the above-mentioned second target security group rule is accepted, sending the above-mentioned response request to the above-mentioned target client device.
[0012] Another aspect of the present disclosure provides a load balancing device, including: a first acquisition module, used to obtain a connection request from a target client device, wherein the connection request carries address information; a first determination module, used to determine a first target security group rule from multiple security group rules based on the address information; a second determination module, used to determine a target server device from a server device cluster when the security policy configured in the first target security group rule is accept; and a first sending module, used to send the connection request to the target server device.
[0013] Another aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more instructions, wherein when the one or more instructions are executed by the one or more processors, the one or more processors implement the method as described above.
[0014] Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, which are used to implement the above method when executed.
[0015] Another aspect of the present disclosure provides a computer program product, which includes computer executable instructions, and when the instructions are executed, are used to implement the method as described above.
[0016] According to an embodiment of the present disclosure, for a connection request from a target client device, a matching first target security group rule can be determined from multiple security group rules, and then, when the security policy configured in the first target security group rule is accepted, a target server device is selected and the connection request is sent to the target server device. Through the above technical means, the load balancing request process is implemented using security group rules, and there is no need to store the connection information, so it at least partially overcomes the technical problem in the related art that the stored connection information will occupy a large amount of memory when the access traffic is large, resulting in a decrease in load balancing efficiency, thereby effectively reducing the memory consumption of the load balancing server and improving the applicability to high concurrency and low latency scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The above and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0018] Figure 1 An exemplary system architecture to which a load balancing method according to an embodiment of the present disclosure can be applied is schematically shown.
[0019] Figure 2 The flowchart schematically shows a request process in the load balancing method according to an embodiment of the present disclosure.
[0020] Figure 3 A flowchart of a method for determining a first target security group rule according to an embodiment of the present disclosure is schematically shown.
[0021] Figure 4 The flowchart schematically shows a response process in the load balancing method according to an embodiment of the present disclosure.
[0022] Figure 5 A schematic diagram of a load balancing system according to an embodiment of the present disclosure is schematically shown.
[0023] Figure 6 A block diagram of a load balancing device according to an embodiment of the present disclosure is schematically shown.
[0024] Figure 7A block diagram of an electronic device suitable for implementing a load balancing method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0025] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0026] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0027] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification, and should not be interpreted in an idealized or overly rigid manner.
[0028] In the case of using expressions such as "at least one of A, B, and C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.). In the case of using expressions such as "at least one of A, B, or C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, or C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0029] In cloud computing services, load balancing is a key component of high-availability network infrastructure, and is usually used to distribute workloads to multiple servers to improve the performance and reliability of websites, applications, databases, or other services. Load balancing is bound to a virtual IP, and the client accesses the load balancing through the virtual IP, and the load balancing then forwards the traffic to the backend service.
[0030] In the related art, the control of the outbound and inbound traffic of the load balancer is implemented through the Conntrack component of OVS. When the access traffic is large or the qps is very high, OVS needs to store a large amount of stateful connection information, which consumes a lot of memory and limits the performance of the load balancer.
[0031] In view of this, the embodiments of the present disclosure are based on the characteristics of load balancing as a server, which only accepts client requests and does not actively initiate requests. It uses security group rules to control outbound and inbound traffic, so that connection information is not stored, solving performance problems caused by OVS storing too much connection information.
[0032] Specifically, an embodiment of the present disclosure provides a load balancing method, a load balancing device, an electronic device, a readable storage medium, and a computer program product. The method includes a request process and a response process, wherein the request process includes: obtaining a connection request from a target client device, wherein the connection request carries address information; based on the address information, determining a first target security group rule from multiple security group rules; when the security policy configured in the first target security group rule is accepted, determining a target server device from a server device cluster; and sending the connection request to the target server device.
[0033] Figure 1 The exemplary system architecture to which the load balancing method can be applied according to the embodiment of the present disclosure is schematically shown. It should be noted that: Figure 1 What is shown is merely an example of a system architecture to which the embodiments of the present disclosure can be applied, in order to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.
[0034] like Figure 1 As shown, the system architecture 100 according to this embodiment may include terminal devices 101 , 102 , 103 , a load balancing server 104 and a server cluster 105 .
[0035] The terminal devices 101, 102, 103 may be any type of electronic device, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers. Various client applications may be installed on the terminal devices 101, 102, 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, and / or social platform software.
[0036] The load balancing server 104 may be any type of load balancing server, including but not limited to DNS domain name resolution load balancing, data link layer load balancing, IP load balancing, HTTP redirection load balancing, reverse proxy load balancing, etc. The load balancing server 104 is used to implement information interaction between the terminal devices 101, 102, 103 and the server cluster 105 by forwarding or proxying.
[0037] The server cluster 105 can provide various services for users, including but not limited to cloud computing services, etc. Users can use the services provided by the server cluster 105 through client applications installed on the terminal devices 101 , 102 , 103 .
[0038] It should be noted that the load balancing method provided in the embodiment of the present disclosure can generally be executed by the load balancing server 104. Accordingly, the load balancing device provided in the embodiment of the present disclosure can generally be set in the load balancing server 104. The load balancing method provided in the embodiment of the present disclosure can also be executed by a load balancing server or a load balancing server cluster that is different from the load balancing server 104 and can communicate with the terminal devices 101, 102, 103 and / or the server cluster 105. Accordingly, the load balancing device provided in the embodiment of the present disclosure can also be set in a load balancing server or a load balancing server cluster that is different from the load balancing server 104 and can communicate with the terminal devices 101, 102, 103 and / or the server cluster 105.
[0039] It should be understood that Figure 1 The number of terminal devices, load balancing servers and server clusters in the embodiment is only for illustration. Any number of terminal devices, load balancing servers and server clusters may be provided according to implementation requirements.
[0040] Figure 2 The flowchart schematically shows a request process in the load balancing method according to an embodiment of the present disclosure.
[0041] like Figure 2 As shown, the request process includes operations S201 to S204.
[0042] In operation S201, a connection request from a target client device is obtained, wherein the connection request carries address information.
[0043] In operation S202 , a first target security group rule is determined from a plurality of security group rules based on the address information.
[0044] In operation S203, when the security policy configured in the first target security group rule is accepted, a target server device is determined from the server device cluster.
[0045] In operation S204, a connection request is sent to the target server device.
[0046] According to an embodiment of the present disclosure, the target client device may be an electronic device belonging to a tenant in a cloud computing service.
[0047] According to the embodiments of the present disclosure, the connection request may be a data packet or a message based on a communication protocol, which is not limited herein.
[0048] According to an embodiment of the present disclosure, the address information carried in the connection request may be the IP address of the target client device.
[0049] In some embodiments, the connection request may also carry communication protocol information, port information, service type, etc., so that the load balancing server can allocate server-side devices.
[0050] According to an embodiment of the present disclosure, the load balancing server may provide a virtual IP or domain name to each client device, through which each client device may send a connection request to the load balancing server.
[0051] According to an embodiment of the present disclosure, the load balancing server can be implemented based on any type of load balancing technology, including but not limited to layer 2 load balancing, layer 4 load balancing, layer 7 load balancing, etc.
[0052] According to an embodiment of the present disclosure, each security group rule may be configured with multi-dimensional information such as transmission direction, protocol type, adaptation address range, destination port, security policy, etc.
[0053] According to an embodiment of the present disclosure, address information may be matched with an adaptation address range included in a security group rule to determine a first target security group rule from a plurality of security group rules.
[0054] According to an embodiment of the present disclosure, the server-side device cluster may include all servers that provide cloud computing.
[0055] According to an embodiment of the present disclosure, any dynamic or static load balancing algorithm may be used to determine a target server device that receives the connection request.
[0056] According to an embodiment of the present disclosure, for a connection request from a target client device, a matching first target security group rule can be determined from multiple security group rules, and then, when the security policy configured in the first target security group rule is accepted, a target server device is selected and the connection request is sent to the target server device. Through the above technical means, the load balancing request process is implemented using security group rules, and there is no need to store the connection information, so it at least partially overcomes the technical problem in the related art that the stored connection information will occupy a large amount of memory when the access traffic is large, resulting in a decrease in load balancing efficiency, thereby effectively reducing the memory consumption of the load balancing server and improving the applicability to high concurrency and low latency scenarios.
[0057] Reference below Figure 3 to Figure 5 Combined with the specific embodiment Figure 2 The method shown is further explained.
[0058] Figure 3 A flowchart of a method for determining a first target security group rule according to an embodiment of the present disclosure is schematically shown.
[0059] like Figure 3 As shown, the method includes operations S301 to S303.
[0060] In operation S301, a security group rule configured with an inbound transmission direction is selected from a plurality of security group rules to obtain at least one inbound security group rule.
[0061] In operation S302 , for each inbound security group rule, the address information of the target client device is matched with the adaptation address range of the inbound security group rule.
[0062] In operation S303, when the matching result indicates that the address information of the target client device is within the adaptation address range of the inbound security group rule, the inbound security group rule is determined to be the first target security group rule.
[0063] According to the embodiments of the present disclosure, each security group rule can be configured with a transmission direction, a protocol type, an adaptation address range, a destination port, a security policy, etc. Among them, the transmission direction may include an inbound direction and an outbound direction, the inbound direction indicates that the data flows from the client device to the server device, and the outbound direction indicates that the data flows from the server device to the client device; the protocol type may indicate that the security group rule allows data packets based on the set communication protocol to pass, and the protocol type may correspond to the destination port; the adaptation address range may be used to indicate the IP address range of the data packets allowed to pass by the security group rule; the security policy may include accept and reject, wherein when the security policy is configured to accept, it indicates that the security group rule is normally enabled, and when the security policy is configured to reject, it indicates that the security group rule is not enabled, at this time, the connection request using the security group rule may be rejected.
[0064] For example, the security group rules can be as shown in Table 1, wherein the security group rule with sequence number 1 is used to process connection requests based on a protocol type of TCP. When the address of the initiating client device of the connection request is between 192.168.0.0 and 192.168.0.255 and the destination port is 80, the connection request can pass the verification of the security group rules, and the load balancing server can forward the connection request to the server device; the security group rule with sequence number 2 is used to process response requests based on a protocol type of IP, allowing the load balancing server to forward the response request of a server device under any IP address to the client device.
[0065] Table 1
[0066] Serial number Transmission direction Protocol Type Adaptation address range Destination Port Security Policy 1 Inbound direction TCP 192.168.0.0 / 24 80 accept 2 Outward direction IP 0.0.0.0 / 0 1-65535 accept
[0067] In some embodiments, there may be multiple first target security group rules determined. At this time, when the security policy configured for any one of the multiple first target security group rules is accept, it can be considered that the connection request has passed the verification of the security group rule.
[0068] According to an embodiment of the present disclosure, when the security policies configured in all first target security group rules are rejection, the load balancing server may send feedback information of rejecting the connection to the target client device.
[0069] Figure 4 The flowchart schematically shows a response process in the load balancing method according to an embodiment of the present disclosure.
[0070] like Figure 4 As shown, the response process includes operations S401 to S403.
[0071] In operation S401, a response request from a target server device is obtained.
[0072] In operation S402, based on the address information of the target server device, a second target security group rule is determined from a plurality of security group rules.
[0073] In operation S403, when the security policy configured in the second target security group rule is acceptance, a response request is sent to the target client device.
[0074] According to an embodiment of the present disclosure, the target server device may be a server that receives a connection request, and accordingly, the response request may be generated by the target server device in response to the received connection request.
[0075] According to an embodiment of the present disclosure, the response request may carry address information, and the address information may be the IP address of the target server device.
[0076] According to an embodiment of the present disclosure, determining the second target security group rule from the plurality of security group rules may adopt a method that is the same as or similar to operation S202, which will not be described in detail herein.
[0077] According to an embodiment of the present disclosure, outbound and inbound traffic is controlled by using security group rules. When controlling outbound traffic, there is no need to access the connection information stored in OVS, and therefore, when a new connection is connected, there is no need to record the connection information of the new connection. Therefore, the memory consumption caused by OVS storage connection tracking is effectively reduced.
[0078] Figure 5 A schematic diagram of a load balancing system according to an embodiment of the present disclosure is schematically shown.
[0079] like Figure 5 As shown, in the load balancing system, the client device 510 and the three server devices 530 can be represented as virtual machines with fixed IP addresses. The IP address of the client device 510 is set to 192.168.0.2, and the IP addresses of the three server devices 530 are set to 192.168.0.6, 192.168.0.7 and 192.168.0.8 respectively.
[0080] According to an embodiment of the present disclosure, the load balancing system includes a request process in which the client device 510 sends a connection request to the server device 530 through the load balancing server 520, and a response process in which the server device 530 sends a response request to the client device 510 through the load balancing server 520.
[0081] During the request:
[0082] First, the client device 510 can access any one of the two load balancing servers 520 through a virtual IP, and send a connection request to the load balancing server 520. The virtual IP can be set to 192.168.0.3, for example, and the virtual IP can be a common data entry of the two load balancing servers 520.
[0083] Then, the load balancing server 520 that receives the connection request calls the security group rule to match and verify the connection request.
[0084] According to an embodiment of the present disclosure, the load balancing server 520 may include an OVS component 521 and an NGINX component 522. The OVS component 521 is used to call the security group rule to verify the received connection request or response request; the NGINX component 522 is used to proxy the connection request or response request after the verification is passed.
[0085] In some embodiments, the NGINX component 522 may exist as an independent proxy server, which may be configured with corresponding IP addresses, such as 192.168.0.4 and 192.168.0.1.
[0086] Afterwards, if the verification is passed, the load balancing server 520 may select the server device 530 that accepts the connection request and send the connection request to the server device 530 .
[0087] According to an embodiment of the present disclosure, a method for determining a target server device from three server devices 530 may include: determining a target application scenario based on application layer content carried in a connection request; obtaining at least one server device under the target application scenario from a server device cluster; and determining the target server device from at least one server device based on a preset load balancing algorithm.
[0088] According to an embodiment of the present disclosure, the preset load balancing algorithm can be any type of load balancing algorithm, including but not limited to random algorithm, polling, weighted polling, least connection, weighted least connection, hash algorithm, IP address hash, URL hash, etc.
[0089] For example, the polling method can be to send the connection request to each server device in sequence; the minimum connection can be to assign the connection request to the server device with the least number of connections; URL hashing can forward requests sent to the same URL to the same server.
[0090] According to an embodiment of the present disclosure, before sending the connection request to the server device 520, the NGINX component 522 may also modify the address information carried in the connection request, and modify the IP address of the client device 510 originally contained in the connection request to the IP address of the server device 520, so as to complete the proxy operation of the connection request.
[0091] During the response:
[0092] First, the server device 530 can access any one of the two load balancing servers 520 through the virtual IP, and send a response request to the load balancing server 520 .
[0093] Then, the load balancing server 520 that receives the connection request calls the security group rule to verify the response request.
[0094] Afterwards, if the verification is successful, the load balancing server 520 may choose to send the response request to the client device 510 .
[0095] In some embodiments, the service device 530 needs to perform a three-way handshake to provide services to the client device 510, that is, the server device 530 can provide services to the client device 510 only when the three request processes and response processes are successfully completed.
[0096] Figure 6 A block diagram of a load balancing device according to an embodiment of the present disclosure is schematically shown.
[0097] like Figure 6 As shown, the load balancing device 600 includes a first acquisition module 610 , a first determination module 620 , a second determination module 630 and a first sending module 640 .
[0098] The first acquisition module 610 is used to acquire a connection request from a target client device, wherein the connection request carries address information.
[0099] The first determination module 620 is used to determine a first target security group rule from multiple security group rules based on the address information.
[0100] The second determination module 630 is configured to determine a target server device from the server device cluster when the security policy configured in the first target security group rule is accepted.
[0101] The first sending module 640 is used to send a connection request to a target server device.
[0102] According to an embodiment of the present disclosure, for a connection request from a target client device, a matching first target security group rule can be determined from multiple security group rules, and then, when the security policy configured in the first target security group rule is accepted, a target server device is selected and the connection request is sent to the target server device. Through the above technical means, the load balancing request process is implemented using security group rules, and there is no need to store the connection information, so it at least partially overcomes the technical problem in the related art that the stored connection information will occupy a large amount of memory when the access traffic is large, resulting in a decrease in load balancing efficiency, thereby effectively reducing the memory consumption of the load balancing server and improving the applicability to high concurrency and low latency scenarios.
[0103] According to an embodiment of the present disclosure, the security group rule is further configured with a transmission direction and an adaptation address range, and the transmission direction includes an outbound direction and an inbound direction.
[0104] According to an embodiment of the present disclosure, the first determining module 620 includes a first determining unit, a second determining unit, and a third determining unit.
[0105] The first determining unit is used to select a security group rule whose transmission direction is configured as an inbound direction from multiple security group rules to obtain at least one inbound security group rule.
[0106] The second determining unit is configured to match the address information of the target client device with the adaptation address range of the inbound security group rule for each inbound security group rule.
[0107] The third determining unit is configured to determine the inbound security group rule as the first target security group rule when the matching result indicates that the address information of the target client device is within the adaptation address range of the inbound security group rule.
[0108] According to an embodiment of the present disclosure, the connection request also carries application layer content.
[0109] According to an embodiment of the present disclosure, the second determining module 630 includes a fourth determining unit, a fifth determining unit, and a sixth determining unit.
[0110] A fourth determining unit, configured to determine a target application scenario according to application layer content carried in the connection request;
[0111] The fifth determining unit is configured to obtain at least one server device in a target application scenario from the server device cluster.
[0112] The sixth determining unit is used to determine a target server device from at least one server device based on a preset load balancing algorithm.
[0113] According to an embodiment of the present disclosure, the preset load balancing algorithm includes any one of the following algorithms: random algorithm, polling, weighted polling, hash algorithm, IP address hash and URL hash.
[0114] According to an embodiment of the present disclosure, the load balancing device 600 further includes a first processing module.
[0115] The first processing module is used to modify the address information carried in the connection request to the address information of the target server device before sending the connection request to the target server device.
[0116] According to an embodiment of the present disclosure, the load balancing device 600 further includes a second processing module.
[0117] The second processing module is used to send feedback information of refusing connection to the target client device when the security policy configured in the first target security group rule is rejection.
[0118] According to an embodiment of the present disclosure, the load balancing device 600 further includes a second acquisition module, a third determination module and a second sending module.
[0119] The second acquisition module is used to acquire a response request from the target server device, wherein the response request includes a request generated by the target server device in response to the connection request.
[0120] The third determination module is used to determine a second target security group rule from multiple security group rules based on the address information of the target server device.
[0121] The second sending module is used to send the response request to the target client device when the security policy configured in the second target security group rule is accepted.
[0122] According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits, or at least part of the functions of any one of them can be implemented in one module. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be split into multiple modules for implementation. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be at least partially implemented as hardware circuits, such as field programmable gate arrays (FPGAs), programmable logic arrays (PLAs), systems on chips, systems on substrates, systems on packages, application specific integrated circuits (ASICs), or can be implemented by hardware or firmware in any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware, or in any appropriate combination of any of them. Alternatively, according to the embodiments of the present invention, one or more of the modules, submodules, units, and subunits can be at least partially implemented as computer program modules, and when the computer program modules are run, the corresponding functions can be performed.
[0123] For example, any multiple of the first acquisition module 610, the first determination module 620, the second determination module 630, and the first sending module 640 can be combined in one module / unit / sub-unit for implementation, or any one of the modules / units / sub-units can be split into multiple modules / units / sub-units. Alternatively, at least part of the functions of one or more of these modules / units / sub-units can be combined with at least part of the functions of other modules / units / sub-units and implemented in one module / unit / sub-unit. According to an embodiment of the present disclosure, at least one of the first acquisition module 610, the first determination module 620, the second determination module 630, and the first sending module 640 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or by any one of the three implementation methods of software, hardware, and firmware, or by a suitable combination of any of them. Alternatively, at least one of the first acquisition module 610 , the first determination module 620 , the second determination module 630 and the first sending module 640 may be at least partially implemented as a computer program module, and when the computer program module is executed, a corresponding function may be performed.
[0124] It should be noted that the load balancing device part in the embodiment of the present disclosure corresponds to the load balancing method part in the embodiment of the present disclosure. The description of the load balancing device part specifically refers to the load balancing method part, which will not be repeated here.
[0125] Figure 7 A block diagram of an electronic device suitable for implementing a load balancing method according to an embodiment of the present disclosure is schematically shown. Figure 7 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0126] like Figure 7 As shown, the computer electronic device 700 according to the embodiment of the present disclosure includes a processor 701, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 702 or the program loaded from the storage part 708 to the random access memory (RAM) 703. The processor 701 may include, for example, a general-purpose microprocessor (such as a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (for example, an application-specific integrated circuit (ASIC)), etc. The processor 701 may also include an onboard memory for caching purposes. The processor 701 may include a single processing unit or multiple processing units for performing different actions of the method flow according to the embodiment of the present disclosure.
[0127] In RAM 703, various programs and data required for the operation of electronic device 700 are stored. Processor 701, ROM 702 and RAM 703 are connected to each other via bus 704. Processor 701 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 702 and / or RAM 703. It should be noted that the program can also be stored in one or more memories other than ROM 702 and RAM 703. Processor 701 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.
[0128] According to an embodiment of the present disclosure, the electronic device 700 may further include an input / output (I / O) interface 705, which is also connected to the bus 704. The electronic device 700 may further include one or more of the following components connected to the I / O interface 705: an input portion 706 including a keyboard, a mouse, etc.; an output portion 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 708 including a hard disk, etc.; and a communication portion 709 including a network interface card such as a LAN card, a modem, etc. The communication portion 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage portion 708 as needed.
[0129] According to an embodiment of the present disclosure, the method flow according to an embodiment of the present disclosure can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the processor 701, the above-mentioned functions defined in the system of the embodiment of the present disclosure are executed. According to an embodiment of the present disclosure, the system, equipment, device, module, unit, etc. described above can be implemented by a computer program module.
[0130] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0131] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. For example, it may include, but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus, or device.
[0132] For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the ROM 702 and / or the RAM 703 described above and / or one or more memories other than the ROM 702 and the RAM 703 .
[0133] An embodiment of the present disclosure also includes a computer program product, which includes a computer program, and the computer program contains a program code for executing the method provided by the embodiment of the present disclosure. When the computer program product runs on an electronic device, the program code is used to enable the electronic device to implement the load balancing method provided by the embodiment of the present disclosure.
[0134] When the computer program is executed by the processor 701, the above functions defined in the system / device of the embodiment of the present disclosure are executed. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0135] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 709, and / or installed from the removable medium 711. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0136] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect through the Internet).
[0137] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram may represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box may also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions. It can be understood by those skilled in the art that the features recorded in the various embodiments and / or claims of the present disclosure can be combined and / or combined in a variety of ways, even if such a combination or combination is not explicitly recorded in the present disclosure. In particular, without departing from the spirit and teaching of the present disclosure, the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways. All of these combinations and / or combinations fall within the scope of the present disclosure.
[0138] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. The scope of the present disclosure is defined by the attached claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A load balancing method, comprising: Obtaining a connection request from a target client device, wherein the connection request carries address information; Based on the address information, determine a first target security group rule from multiple security group rules, wherein the security group rule is further configured with a transmission direction and an adaptation address range, the transmission direction includes an outbound direction and an inbound direction, and the adaptation address range is used to characterize an IP address range of data packets allowed to pass through by the security group rule; The security group rule is further configured with a protocol type and a security policy. The protocol type is used to indicate that the security group rule allows data packets based on a set communication protocol to pass through, and the protocol type corresponds to a destination port. The security policy includes acceptance and rejection. When the security policy is configured to accept, it indicates that the security group rule is enabled normally. When the security policy is configured to reject, it indicates that the security group rule is not enabled, so as to reject connection requests using the security group rule. When the security policy configured in the first target security group rule is accepted, determining a target server device from the server device cluster; and Sending the connection request to the target server device; Wherein, determining a first target security group rule from a plurality of security group rules based on the address information includes: Selecting a security group rule whose transmission direction is configured as an inbound direction from the multiple security group rules to obtain at least one inbound security group rule; For each of the inbound security group rules, matching the address information of the target client device with the adaptation address range of the inbound security group rule; and When the matching result indicates that the address information of the target client device is within the adaptation address range of the inbound security group rule, the inbound security group rule is determined to be the first target security group rule.
2. The method according to claim 1, wherein: The connection request also carries application layer content; Wherein, determining the target server device from the server device cluster includes: Determining a target application scenario according to application layer content carried in the connection request; Acquire at least one server device in the target application scenario from the server device cluster; and Based on a preset load balancing algorithm, the target server device is determined from at least one of the server devices.
3. The method according to claim 2, wherein: The preset load balancing algorithm includes any one of the following algorithms: random algorithm, polling, weighted polling, hash algorithm, IP address hash and URL hash.
4. The method according to claim 1, further comprising: Before sending the connection request to the target server device, the address information carried in the connection request is modified to the address information of the target server device.
5. The method according to claim 1, further comprising: When the security policy configured in the first target security group rule is rejection, feedback information of rejecting the connection is sent to the target client device.
6. The method according to claim 1, further comprising: Obtaining a response request from the target server device, wherein the response request is generated by the target server device in response to receiving the connection request; Based on the address information of the target server device, determining a second target security group rule from the plurality of security group rules; and In a case where the security policy configured in the second target security group rule is acceptance, the response request is sent to the target client device.
7. A load balancing device, comprising: A first acquisition module is used to acquire a connection request from a target client device, wherein the connection request carries address information; A first determination module is used to determine a first target security group rule from multiple security group rules based on the address information, wherein the security group rule is further configured with a transmission direction and an adaptation address range, the transmission direction includes an outbound direction and an inbound direction, and the adaptation address range is used to characterize the IP address range of the data packet allowed to pass by the security group rule; wherein the security group rule is further configured with a protocol type and a security policy, the protocol type is used to characterize that the security group rule allows the data packet based on the set communication protocol to pass, and the protocol type corresponds to the destination port; the security policy includes acceptance and rejection, and when the security policy is configured to accept, it indicates that the security group rule is normally enabled, and when the security policy is configured to reject, it indicates that the security group rule is not enabled, so as to reject the connection request using the security group rule; a second determining module, configured to determine a target server device from a server device cluster when the security policy configured in the first target security group rule is accepted; and a first sending module, configured to send the connection request to the target server device; Wherein, the first determining module includes: A first determining unit, configured to select a security group rule whose transmission direction is configured as an inbound direction from the plurality of security group rules, to obtain at least one inbound security group rule; A second determining unit is configured to match the address information of the target client device with the adaptation address range of the inbound security group rule for each inbound security group rule; and The third determining unit is configured to determine that the inbound security group rule is the first target security group rule when a matching result indicates that the address information of the target client device is within an adaptation address range of the inbound security group rule.
8. An electronic device comprising: one or more processors; A memory for storing one or more instructions, Wherein, when the one or more instructions are executed by the one or more processors, the one or more processors are enabled to implement the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having executable instructions stored thereon, wherein when the executable instructions are executed by a processor, the processor is enabled to implement the method according to any one of claims 1 to 6.
