Load balancing processing method, device, equipment and storage medium
In the load balancing process between k8s and vm, the policy matching analysis of the content switching virtual machine and the target reverse proxy is shortened, the load balancing network link is solved, and the problem of network performance loss is achieved, and more efficient load is achieved Equalization.
Patent Information
- Application Number
- CN202110514177.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-12
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2041-05-12
AI Technical Summary
During the switching between k8s and vm, the lengthening of the load balancing network link leads to large network performance losses, and existing solutions cannot effectively shorten the link and reduce performance losses.
By receiving application access requests, the preset application switch forwards it to the content switch virtual machine, extracts the converging domain name address and redirection address, and performs matching analysis of policy binding rules based on this information, determines the target load forwarding strategy, and then Forward the request to the target virtual host and reverse proxy to achieve load balancing.
Through this method, the load balancing network link is shortened, network performance loss is reduced, and virtualization technology is smoothly converted according to business needs, improving system performance.
Smart Images

Figure CN113271260B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of business data distribution of cloud services, and in particular to a load balancing processing method, device, equipment and storage medium. Background Art
[0002] With the rise of the orchestration management tool k8s cloud native, more and more companies are joining its camp. However, in k8s, there are often applications or clusters that are not sufficiently compatible with containers and need to be gradually migrated. The applications or clusters will switch between the original virtual machine vm solution and the new k8s.
[0003] The switch between VM and K8s can be solved by general load balancing devices. K8s can achieve load balancing based on the reverse proxy load balancer ingress, while the original VM achieves load balancing based on the reverse proxy network server nginx. In this case, most companies use ingress after nginx load balancing to be responsible for K8s load balancing. Although this solution is simple, it has the problem of lengthening the load balancing network link, resulting in a large loss of network performance. Summary of the invention
[0004] The present invention provides a load balancing processing method, device, equipment and storage medium, which are used to shorten the load balancing network link and reduce network performance loss.
[0005] To achieve the above-mentioned objectives, the first aspect of the present invention provides a load balancing processing method, including: receiving an application access request, forwarding the application access request to a content switching virtual machine through a preset application switch; extracting a convergence domain name address and a redirection address from the application access request through the content switching virtual machine; matching and analyzing the policy binding rules corresponding to the content switching virtual machine according to the convergence domain name address and the redirection address to obtain a target load forwarding policy, wherein the policy binding rules corresponding to the content switching virtual machine include multiple load forwarding policies and multiple pattern matching data sets, and each load forwarding policy corresponds to each pattern matching data set one-to-one; forwarding the application access request to a target virtual host according to the target load forwarding policy, forwarding the application access request to a target reverse proxy through the target virtual host, and performing load balancing processing on the application access request through the target reverse proxy.
[0006] Optionally, in a first implementation manner of the first aspect of the present invention, the receiving an application access request and forwarding the application access request to a content switching virtual machine through a preset application switch includes: receiving an application access request, intercepting the application access request through a preset application switch, and obtaining terminal address information; determining whether there is an exception in the application access request based on the terminal address information; if there is an exception in the application access request, generating and recording request exception information, and sending the request exception information to the terminal; if there is no exception in the application access request, forwarding the application access request to the content switching virtual machine through the preset application switch according to a preset binding relationship, wherein the preset binding relationship is used to indicate an association mapping between the content switching virtual machine and the preset application switch.
[0007] Optionally, in a second implementation method of the first aspect of the present invention, the extracting the convergent domain name address and the redirection address from the application access request through the content exchange virtual machine includes: through the content exchange virtual machine, setting a uniform resource locator object for the application access request according to a preset constructor, and calling a domain name acquisition function based on the uniform resource locator object to obtain a convergent domain name address; extracting the redirection address from the application access request according to a preset regular matching rule, wherein the preset regular matching rule is used to instruct character matching and segmentation processing of the application access request.
[0008] Optionally, in a third implementation method of the first aspect of the present invention, the policy binding rules corresponding to the content switching virtual machine are matched and analyzed according to the convergent domain name address and the redirection address to obtain a target load forwarding policy, and the policy binding rules corresponding to the content switching virtual machine include multiple load forwarding strategies and multiple pattern matching data sets, and each load forwarding strategy corresponds to each pattern matching data set one-to-one, including: matching and parsing the policy binding rules corresponding to the content switching virtual machine based on the convergent domain name address to obtain multiple load forwarding strategies and multiple pattern matching data sets associated and bound with the convergent domain name address, each load forwarding strategy has a corresponding priority value and a corresponding unique identifier, and each load forwarding strategy corresponds to each pattern matching data set one-to-one; accessing each load forwarding strategy in order from low to high according to the priority value corresponding to each load forwarding strategy, and judging whether the redirection address exists in the pattern matching data set corresponding to each load forwarding strategy; if the redirection address exists in the pattern matching data set corresponding to each load forwarding strategy, determining the target pattern matching data set, and determining the target load forwarding strategy according to the target pattern matching data set.
[0009] Optionally, in a fourth implementation manner of the first aspect of the present invention, the application access request is forwarded to the target virtual host according to the target load forwarding policy, the application access request is forwarded to the target reverse proxy through the target virtual host, and the application access request is load balanced through the target reverse proxy, including: obtaining a policy identifier corresponding to the target load forwarding policy, querying preset configuration information according to the policy identifier, obtaining the target virtual host, and forwarding the application access request to the target virtual host; when the application access request reaches the target virtual host, the application access request is transmitted to the target reverse proxy through the target virtual host, and the target virtual host and the target reverse proxy correspond one-to-one; when the application access request reaches the target reverse proxy, the application access request is allocated and sent to the target host through the target reverse proxy, and the target host belongs to a preset distributed cluster.
[0010] Optionally, in a fifth implementation of the first aspect of the present invention, before receiving an application access request and forwarding the application access request to a content switching virtual machine through a preset application switch, the load balancing processing method further includes: obtaining the convergent domain name address and the service type, adding at least one pattern matching data set according to the convergent domain name address and the service type, and performing data initialization on at least one pattern matching data set; setting at least one load forwarding strategy according to the convergent domain name address and the service type, and associating and binding each load forwarding strategy with each pattern matching data set; performing association mapping processing on each load forwarding strategy, the content switching virtual machine, and the target virtual host, and assigning a corresponding priority value to each load forwarding strategy according to a preset priority allocation rule.
[0011] Optionally, in a sixth implementation of the first aspect of the present invention, after forwarding the application access request to the target virtual host according to the target load forwarding strategy, forwarding the application access request to the target reverse proxy through the target virtual host, and performing load balancing processing on the application access request through the target reverse proxy, the load balancing processing method also includes: obtaining a load balancing access log, performing data mining and analysis on the load balancing access log according to a preset machine learning algorithm to obtain a target access data volume, wherein the target access data volume is used to indicate the number of application access requests and the distribution number of the target reverse proxy within a preset time period; sending the target access data volume to the terminal so that the terminal generates and displays a heat map based on the target access data volume.
[0012] The second aspect of the present invention provides a load balancing processing device, including: a receiving module, used to receive an application access request, and forward the application access request to a content switching virtual machine through a preset application switch; an extraction module, used to extract a convergence domain name address and a redirection address from the application access request through the content switching virtual machine; an analysis module, used to match and analyze the policy binding rules corresponding to the content switching virtual machine according to the convergence domain name address and the redirection address to obtain a target load forwarding policy, wherein the policy binding rules corresponding to the content switching virtual machine include multiple load forwarding policies and multiple pattern matching data sets, and each load forwarding policy corresponds to each pattern matching data set one by one; a processing module, used to forward the application access request to a target virtual host according to the target load forwarding policy, forward the application access request to a target reverse proxy through the target virtual host, and perform load balancing processing on the application access request through the target reverse proxy.
[0013] Optionally, in a first implementation manner of the second aspect of the present invention, the receiving module is specifically used to: receive an application access request, intercept the application access request through a preset application switch, and obtain terminal address information; determine whether there is an exception in the application access request based on the terminal address information; if there is an exception in the application access request, generate and record request exception information, and send the request exception information to the terminal; if there is no exception in the application access request, forward the application access request to the content switching virtual machine through the preset application switch according to a preset binding relationship, and the preset binding relationship is used to indicate the association mapping between the content switching virtual machine and the preset application switch.
[0014] Optionally, in a second implementation method of the second aspect of the present invention, the extraction module is specifically used to: through the content exchange virtual machine, set a uniform resource locator object for the application access request according to a preset constructor, and call a domain name acquisition function based on the uniform resource locator object to obtain a converged domain name address; extract a redirection address from the application access request according to a preset regular matching rule, and the preset regular matching rule is used to indicate character matching and segmentation processing for the application access request.
[0015] Optionally, in a third implementation method of the second aspect of the present invention, the analysis module is specifically used to: match and parse the policy binding rules corresponding to the content switching virtual machine based on the convergent domain name address, and obtain multiple load forwarding strategies and multiple pattern matching data sets associated with the convergent domain name address, each load forwarding policy having a corresponding priority value and a corresponding unique identifier, and each load forwarding strategy and each pattern matching data set corresponding to one-to-one; access each load forwarding policy in order from low to high according to the priority value corresponding to each load forwarding policy, and determine whether the redirection address exists in the pattern matching data set corresponding to each load forwarding policy; if the redirection address exists in the pattern matching data set corresponding to each load forwarding policy, determine the target pattern matching data set, and determine the target load forwarding policy based on the target pattern matching data set.
[0016] Optionally, in a fourth implementation method of the second aspect of the present invention, the processing module is specifically used to: obtain a policy identifier corresponding to the target load forwarding policy, query the preset configuration information according to the policy identifier, obtain the target virtual host, and forward the application access request to the target virtual host; when the application access request reaches the target virtual host, the application access request is transmitted to the target reverse proxy through the target virtual host, and the target virtual host and the target reverse proxy correspond one-to-one; when the application access request reaches the target reverse proxy, the application access request is allocated and sent to the target host through the target reverse proxy, and the target host belongs to a preset distributed cluster.
[0017] Optionally, in a fifth implementation of the second aspect of the present invention, the load balancing processing device also includes: an initialization module, used to obtain the convergent domain name address and the service type, add at least one pattern matching data set according to the convergent domain name address and the service type, and perform data initialization on at least one pattern matching data set; a binding module, used to set at least one load forwarding strategy according to the convergent domain name address and the service type, and associate and bind each load forwarding strategy with each pattern matching data set; an allocation module, used to perform association mapping processing on each load forwarding strategy, the content switching virtual machine and the target virtual host, and assign a corresponding priority value to each load forwarding strategy according to a preset priority allocation rule.
[0018] Optionally, in a sixth implementation of the second aspect of the present invention, the load balancing processing device also includes: a mining module, used to obtain load balancing access logs, and perform data mining and analysis on the load balancing access logs according to a preset machine learning algorithm to obtain a target access data volume, wherein the target access data volume is used to indicate the number of application access requests and the number of distributions of the target reverse proxy within a preset time period; a display module, used to send the target access data volume to a terminal so that the terminal generates and displays a heat map based on the target access data volume.
[0019] The third aspect of the present invention provides a load balancing processing device, comprising: a memory and at least one processor, wherein the memory stores instructions; the at least one processor calls the instructions in the memory so that the load balancing processing device executes the above-mentioned load balancing processing method.
[0020] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the above-mentioned load balancing processing method.
[0021] In the technical solution provided by the present invention, an application access request is received, and the application access request is forwarded to a content switching virtual machine through a preset application switch; a convergence domain name address and a redirection address are extracted from the application access request through the content switching virtual machine; a policy binding rule corresponding to the content switching virtual machine is matched and analyzed according to the convergence domain name address and the redirection address to obtain a target load forwarding policy, and the policy binding rule corresponding to the content switching virtual machine includes multiple load forwarding policies and multiple pattern matching data sets, and each load forwarding policy corresponds to each pattern matching data set one by one; the application access request is forwarded to a target virtual host according to the target load forwarding policy, and the application access request is forwarded to a target reverse proxy through the target virtual host, and the application access request is load balanced through the target reverse proxy. In an embodiment of the present invention, the application access request is forwarded to a content switching virtual machine through a preset application switch; the policy binding rule corresponding to the content switching virtual machine is matched and analyzed according to the convergence domain name address and the redirection address to obtain a target load forwarding policy; the application access request is forwarded to a target virtual host according to the target load forwarding policy, and the application access request is forwarded to a target reverse proxy through the target virtual host, and the application access request is load balanced through the target reverse proxy. Smoothly switch application virtualization technology according to business needs, shorten the load balancing network link, and reduce network performance loss. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1A schematic diagram of an embodiment of a load balancing processing method in an embodiment of the present invention;
[0023] Figure 2 A schematic diagram of another embodiment of a load balancing processing method in an embodiment of the present invention;
[0024] Figure 3 A schematic diagram of an embodiment of a load balancing processing device in an embodiment of the present invention;
[0025] Figure 4 A schematic diagram of another embodiment of a load balancing processing device in an embodiment of the present invention;
[0026] Figure 5 The figure is a schematic diagram of an embodiment of a load balancing processing device in an embodiment of the present invention. DETAILED DESCRIPTION
[0027] The embodiments of the present invention provide a load balancing processing method, device, equipment and storage medium, which are used to smoothly convert application virtualization technology according to business needs, shorten load balancing network links, and reduce network performance loss.
[0028] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0029] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 , an embodiment of the load balancing processing method in the embodiment of the present invention includes:
[0030] 101. Receive an application access request, and forward the application access request to a content switching virtual machine through a preset application switch.
[0031] Among them, the application access request is used to indicate the uniform resource locator of the business operation sent by one or more terminals. For example, the application access request can be used to request online medical services, pharmaceutical e-commerce services, and can also be used to request health education services, which are not limited here. The preset application switch is used to intercept and verify the application access request. The preset application switch can be a hardware load balancing switch netscaler, or other load balancing switches, which are not limited here. The content switching virtual machine is used to perform load balancing processing on the application access request. Specifically, the server receives the application access request and obtains the terminal address information; the server determines whether the terminal address information exists in the preset network protocol address information table; if the terminal address information exists in the preset network protocol address information table, the server forwards it to the content switching virtual machine through the preset application switch, and the content switching virtual machine is used to indicate domain name resolution and load balancing processing for the application access request. For example, when the application access request sent by the terminal is http: / / srv.pajk-ent.com / timeline, and http: / / srv.pajk-ent.com / timeline reaches the hardware load balancing switch (that is, the preset application switch) netscaler in the server, the server verifies and / or forwards the application access request through netscaler.
[0032] It is understandable that the execution subject of the present invention may be a load balancing processing device, or a terminal or a server, which is not limited here. The embodiment of the present invention is described by taking a server as the execution subject as an example.
[0033] 102. Extract the converged domain name address and the redirection address from the application access request through the content switching virtual machine.
[0034] Among them, the application side request can be a get request method or a post request method, which is not limited here. The application access request includes a converged domain name address, a redirection address and parameter information. For example, when the application access request is a get request method, the application access request is http: / / srv.pajk-ent.com / timeline / id=xx, and when the application access request is a post request method, the application access request is http: / / srv.pajk-ent.com / timeline. Specifically, the server obtains the application access request through a preset full-path acquisition function, wherein the preset full-path acquisition function can be request.getRequestURL(); then, the server parses the application access request through the content exchange virtual machine (such as cs_1b) according to the hypertext transfer protocol protocol to obtain the converged domain name address and the redirection address, wherein the converged domain name address is srv.pajk-ent.com, and the redirection address is timeline, which is used to achieve traffic distribution.
[0035] 103. Match and analyze the policy binding rules corresponding to the content switching virtual machine according to the converged domain name address and the redirection address to obtain the target load forwarding strategy. The policy binding rules corresponding to the content switching virtual machine include multiple load forwarding strategies and multiple pattern matching data sets, and each load forwarding strategy corresponds to each pattern matching data set one by one.
[0036] Among them, the content exchange virtual machine is used to achieve seven-layer load balancing. Specifically, the server sets multiple policy identifiers and multiple pattern identifiers according to the converged domain name address according to the preset policy generation rules and the preset pattern generation rules. The server matches and analyzes the policy binding rules corresponding to the content exchange virtual machine according to the multiple policy identifiers and the multiple pattern identifiers, and obtains multiple load forwarding strategies and multiple pattern matching data sets. Each load forwarding strategy location corresponds to each pattern matching data set patset. For example, the server establishes a vm patset for a certain domain name that needs to access the location of the virtual machine service type vm, and establishes a k8s patset for the location that needs to access the container service type k8s; the server traverses and accesses each load forwarding strategy in order from low to high according to the priority corresponding to each load forwarding strategy. When the pattern matching data set corresponding to each load forwarding strategy contains a redirection address, the server determines that the load forwarding strategy corresponding to the pattern matching data set is the target strategy (that is, the target load forwarding strategy), and obtains the target policy identifier, wherein the target policy identifier can be the name of each load forwarding strategy. Further, the server stores the policy binding rules in the blockchain database, which is not specifically limited here.
[0037] 104. Forward the application access request to the target virtual host according to the target load forwarding strategy, forward the application access request to the target reverse proxy through the target virtual host, and perform load balancing on the application access request through the target reverse proxy.
[0038] Among them, the target virtual host belongs to NetScaler, and the target virtual host includes a virtual host of a virtual machine service type VM and a virtual host of a container service type K8S (that is, Kubernetes). The target virtual host can be used to serve various operators. Specifically, the server performs load forwarding processing on the application access request according to the target load forwarding policy policy and the target pattern matching data set patset (that is, the server determines the target virtual host from multiple virtual hosts). When the target virtual host receives the application access request, the server forwards the application access request to the target reverse proxy (for example, ingress or nginx) through the target virtual host. The target virtual host and the target reverse proxy correspond one to one. For example, the target reverse proxy corresponding to the target virtual host of the VM type is VM / Nginx, and the target reverse proxy corresponding to the target virtual host of the K8s type is K8s / INGress. Then, the server performs load balancing processing on the application access request through the target reverse proxy.
[0039] In an embodiment of the present invention, the application switch is preset to forward the request to the content switching virtual machine; the policy binding rules corresponding to the content switching virtual machine are analyzed according to the converged domain name address and the redirection address match to obtain the target load forwarding strategy; the application access request is forwarded to the target virtual host according to the target load forwarding strategy, and the application access request is forwarded to the target reverse proxy through the target virtual host, and the application access request is load balanced through the target reverse proxy. The application virtualization technology is smoothly converted according to business needs, the load balancing network link is shortened, and the network performance loss is reduced. This solution can be applied in the field of smart medical care, thereby promoting the construction of smart cities.
[0040] See also Figure 2 Another embodiment of the load balancing processing method in the embodiment of the present invention includes:
[0041] 201. Obtain a convergent domain name address and a service type, add at least one pattern matching data set according to the convergent domain name address and the service type, and initialize data for the at least one pattern matching data set.
[0042] Specifically, the server sets at least one pattern matching data set pattern matching data set patset corresponding to the collection name according to the convergent domain name address and service type. The collection name is used to indicate that the prefix, convergent domain name address and suffix are combined in a manner of "_". The prefix can be p or policy, which is not limited here, and the suffix is the service type. Optionally, a converged domain name address can correspond to two patset data sets. For example, the server executes add policy patset p_testk8s_dev_pajkdc_com_vm to create a first pattern matching data set named testk8s_dev_pajkdc_com_vm, which is used to store the domain name location that needs to be forwarded to vm / nginx under the domain name; or the server executes add policy patset p_testk8s_dev_pajkdc_com_k8s to create a second pattern matching data set named testk8s_dev_pajkdc_com_k8s, which is used to store the domain name location that needs to be forwarded to k8s / ingress under the domain name. Then, the server initializes at least one pattern matching data set (for example, patset data set), that is, the server assigns the corresponding redirection address (the redirection address is string data) to the patset data set. When the application has addition, deletion, and modification operations, or when vm and k8s are migrated, the server only needs to maintain these two patset data sets.
[0043] 202. Set at least one load forwarding strategy according to the converged domain name address and the service type, and associate and bind each load forwarding strategy with each pattern matching data set.
[0044] Specifically, the server sets the policy name corresponding to each load forwarding policy according to the converged domain name address and service type. The policy name is used to indicate that the prefix, converged domain name address and suffix are concatenated in accordance with "_"; then, the server sets at least one load forwarding policy according to the policy name corresponding to each load forwarding policy, and associates and binds each load forwarding policy with each pattern matching data set. The prefix can be an empty value or other values, which are not limited here, and the suffix is the service type. A converged domain name address can set three load forwarding policies:
[0045] add cs policy srv_pajk-ent_com_VM-rule
[0046] "HTTP.REQ.HOSTNAME.EQ(\"srv.pajk-ent.com\")&&
[0047] HTTP.REQ.URL.PATH.GET(1).set_text_mode(IGNORECASE).EQUALS_ANY(\"p_srv_pajk-ent_com_VM\");
[0048] This instruction is used to create the first load forwarding policy srv_pajk-ent_com_VM, which only processes the p_srv_pajk-ent_com_VM domain name, and the first location of the domain name belongs to the vmpatset data set created by the signature (that is, p_srv_pajk-ent_com_VM).
[0049] add cs policy srv_pajk-ent_com_k8s-rule
[0050] "HTTP.REQ.HOSTNAME.EQ(\"srv.pajk-ent.com\")&&
[0051] HTTP.REQ.URL.PATH.GET(1).set_text_mode(IGNORECASE).EQUALS_ANY(\"p_srv_pajk-ent_com_k8s\");
[0052] This instruction is used to create a second load forwarding strategy srv_pajk-ent_com_k8s, which only processes the srv_pajk-ent_com_k8s domain name, and the first location of the domain name belongs to the k8spatset data set established by the signature (that is, p_srv_pajk-ent_com_k8s).
[0053] add cs policy srv_pajk-ent_com_Default-rule
[0054] "HTTP.REQ.HOSTNAME.EQ(\"srv.pajk-ent.com\")&&
[0055] HTTP.REQ.URL.STARTSWITH(\" / \")";
[0056] This instruction is used to create a third load forwarding policy srv_pajk-ent_com_Default, which is used to process the srv.pajk-ent.com converged domain name address, and the converged domain name address starts with the root (" / "). This load forwarding policy is used to process all traffic under the domain name to achieve all forwarding that fully includes the converged domain name address.
[0057] 203. Perform association mapping processing on each load forwarding strategy, content switching virtual machine and target virtual host, and assign a corresponding priority value to each load forwarding strategy according to a preset priority assignment rule.
[0058] There can be multiple load forwarding policies corresponding to each converged domain name address. The server sets a priority for each load forwarding policy to implement the policy matching order by the priority specified when binding each load forwarding policy. For example, the server sets vm to match first, k8s to match second, and default to match last. The specific binding process is as follows:
[0059] bind cs vserver cs_lb–policyName srv_pajk-ent_com_vm-targetLBVservervm_lb-priority 1;
[0060] The server executes the instruction to bind the first load forwarding policy srv_pajk-ent_com_vm to the content switching virtual machine cs_lb. The server forwards the traffic arriving at cs_lb to the target virtual host vm_lb and assigns the highest priority value 1.
[0061] bind cs vserver cs_lb-policyName srv_pajk-ent_com_k8s-targetLBVserverk8s_lb-priority 2;
[0062] The server executes the instruction to bind the second load forwarding policy srv_pajk-ent_com_k8s to the content switching virtual machine cs_lb. The server forwards the traffic arriving at cs_lb to the target virtual host k8s_lb and assigns the second highest priority value 2.
[0063] bind cs vserver cs_lb-policyName testk8s_dev_pajkdc_com_default-targetLBVserver vm_lb-priority 3;
[0064] The server executes this instruction to bind the third load forwarding policy testk8s_dev_pajkdc_com_default to the content switching virtual machine cs_lb. The server forwards the traffic reaching cs_lb to the target virtual host vm_lb and assigns the lowest priority value 3.
[0065] It should be noted that cs_lb can be a content switching virtual machine corresponding to a certain operator, which is used to abstract three groups of virtual hosts into a combination. When the traffic reaches cs_lb, the server performs logical operations through cs_lb according to the preset operation rules. The preset operation rules are to match the load forwarding strategy with a low priority first. When the match is successful, the server will transfer the application access request to the matching load forwarding strategy targetLBVserver. The server binds the patset data set to the corresponding load forwarding strategy to make the patset data set (that is, the pattern matching data set) effective. The server establishes three pattern matching data sets and three load forwarding strategies, that is, a vm set and a vm strategy, a k8s set and a k8s strategy, and a default set. In this embodiment, the default set uses a default strategy for a string " / ", and associates the three pattern matching data sets with the three load forwarding strategies one by one. Finally, the server binds the associated load forwarding strategies and pattern matching data sets to the same content switching virtual machine.
[0066] 204. Receive an application access request, and forward the application access request to a content switching virtual machine through a preset application switch.
[0067] Furthermore, the server identifies whether the connection method with the terminal is a Hypertext Transfer Protocol proxy method or a load balancing method through the request header field XFF (that is, X-Forwarded-For); if the connection method with the terminal is a Hypertext Transfer Protocol proxy method, the server calls the preset address acquisition function request.getRemoteAddr() to obtain the terminal address information; if the connection method with the terminal is a load balancing method, the server obtains the request header field through the firewall and extracts the terminal address information from the request header field. Optionally, the server receives an application access request, intercepts the application access request through a preset application switch, and obtains terminal address information; the server determines whether there is an exception in the application access request based on the terminal address information. Specifically, the server determines whether the terminal address information exists in a preset network protocol address information table. If the terminal address information does not exist in the preset network protocol address information table, the server determines that there is an exception in the application access request. If the terminal address information exists in the preset network protocol address information table, the server determines that the application access request is normal; if there is an exception in the application access request, the server generates and records the request exception information, and sends the request exception information to the terminal. Further, the terminal displays the request exception information and prompts that the access rights of the target user terminal are restricted; if there is no exception in the application access request, the server forwards the application access request to the content switching virtual machine through the preset application switch according to the preset binding relationship. The preset binding relationship is used to indicate the association mapping between the content switching virtual machine and the preset application switch.
[0068] 205. Extract the converged domain name address and the redirection address from the application access request through the content switching virtual machine.
[0069] Furthermore, the server can also obtain the convergent domain name address through the preset host name acquisition function getRemoteHost(). Then the server obtains the to-be-verified rule corresponding to the convergent domain name address; the server verifies the convergent domain name address according to the to-be-verified rule; if the convergent domain name address fails the test, the server generates and records the verification failure information. Optionally, the server sets a uniform resource locator object for the application access request according to the preset constructor through the content exchange virtual machine, and calls the domain name acquisition function based on the uniform resource locator object to obtain the convergent domain name address; the server extracts the redirection address from the application access request according to the preset regular matching rule, and the preset regular matching rule is used to indicate character matching and segmentation processing for the application access request.
[0070] For example, application access request A is http: / / srv.pajk-ent.com / timeline, application access request B is http: / / srv.pajk-ent.com / timeline / hellowrod.html, and application access request C is http: / / srv.pajk-ent.com / timeline / hellowrod.html?param=1. The server performs character matching and segmentation processing on application access request A, application access request B, and application access request C according to the preset regular matching rule, and obtains that the redirection address is all timeline. Furthermore, the server can also unify the case of the converged domain name address and the redirection address.
[0071] 206. Match and analyze the policy binding rules corresponding to the content switching virtual machine according to the converged domain name address and the redirection address to obtain the target load forwarding policy. The policy binding rules corresponding to the content switching virtual machine include multiple load forwarding policies and multiple pattern matching data sets, and each load forwarding policy corresponds to each pattern matching data set one by one.
[0072] That is, the server preferentially selects low-priority load forwarding strategies for policy matching. Furthermore, the server can also access each domain name strategy in order from low to high according to the priority value corresponding to each load forwarding strategy. The pattern matching data set patset corresponding to each load forwarding policy policy is a string data set, which can be used to store any non-repeating string, and is mainly used to store the redirection address location of the converged domain name address. Location is the first string separated by the underslash / character in the uniform resource locator url. A converged domain name address corresponds to multiple applications. In this embodiment, it usually corresponds to a specific application name. The pattern matching data set patset is bound to the converged domain name address through the corresponding load forwarding strategy. For example, when the terminal access form is srv.pajk-ent.com / cc, the server matches the string of cc in patset.
[0073] Optionally, the server matches and parses the policy binding rules corresponding to the content switching virtual machine based on the convergent domain name address, and obtains multiple load forwarding policies and multiple pattern matching data sets associated with the convergent domain name address, each load forwarding policy has a corresponding priority value and a corresponding unique identifier, and each load forwarding policy and each pattern matching data set correspond one to one; the server accesses each load forwarding policy in order from low to high according to the priority value corresponding to each load forwarding policy, and determines whether there is a redirection address in the pattern matching data set corresponding to each load forwarding policy; if there is a redirection address in the pattern matching data set corresponding to each load forwarding policy, the server determines the target pattern matching data set, and determines the target load forwarding policy based on the target pattern matching data set.
[0074] It should be noted that the content switching virtual machine can be bound to multiple load forwarding strategies, and the execution order of each load forwarding strategy is executed in a pre-set priority order. The server matches each load forwarding strategy one by one according to the priority value. When the server matches the target policy through the converged domain name address and the redirected address, the server determines the target policy identifier, stops matching, and executes step 207 according to the target policy identifier. When the server does not match the target policy through the converged domain name address and the redirected address, the server determines to stop matching, generates a prompt message, and sends the prompt message to the terminal. The prompt message is used to indicate that the application access request has not matched the business server. The target pattern matching data set and the target pattern matching data set are respectively bound to the converged domain name, thereby realizing load balancing based on the domain name level.
[0075] 207. Forward the application access request to the target virtual host according to the target load forwarding strategy, forward the application access request to the target reverse proxy through the target virtual host, and perform load balancing processing on the application access request through the target reverse proxy.
[0076] Furthermore, the server forwards the application access request to the target host corresponding to at least one preset distributed cluster through the target reverse proxy, and returns the response result of the target host to the terminal connected to the application access request. For example, for the application access request http: / / Srv.pajk-ent.com / timeline, the server forwards the application access request to the running instance pod of k8s; the server forwards the application request http: / / Srv.pajk-ent.com / cc and http: / / Srv.pajk-ent.com to the machine instance of the vm.
[0077] Optionally, the server obtains a policy identifier corresponding to the target load forwarding policy, queries the preset configuration information according to the policy identifier, obtains the target virtual host, and forwards the application access request to the target virtual host; when the application access request reaches the target virtual host, the server transmits the application access request to the target reverse proxy through the target virtual host, and the target virtual host and the target reverse proxy correspond one to one; when the application access request reaches the target reverse proxy, the server allocates the application access request through the target reverse proxy and sends it to the target host, and the target host belongs to the preset distributed cluster.
[0078] Furthermore, the server obtains the load balancing access log, performs data mining and analysis on the load balancing access log according to the preset machine learning algorithm, and obtains the target access data volume, which is used to indicate the number of application access requests and the number of distributions of the target reverse proxy within the preset time period; the server sends the target access data volume to the terminal, so that the terminal generates and displays a heat map according to the target access data volume. Among them, the preset machine learning algorithm can include a decision tree algorithm, a Bayesian classification algorithm, and can also include other machine learning algorithms, which are not specifically limited here.
[0079] In an embodiment of the present invention, the application switch is preset to forward the request to the content switching virtual machine; the policy binding rules corresponding to the content switching virtual machine are analyzed according to the converged domain name address and the redirection address match to obtain the target load forwarding strategy; the application access request is forwarded to the target virtual host according to the target load forwarding strategy, and the application access request is forwarded to the target reverse proxy through the target virtual host, and the application access request is load balanced through the target reverse proxy. The application virtualization technology is smoothly converted according to business needs, the load balancing network link is shortened, and the network performance loss is reduced. This solution can be applied in the field of smart medical care, thereby promoting the construction of smart cities.
[0080] The load balancing processing method in the embodiment of the present invention is described above. The load balancing processing device in the embodiment of the present invention is described below. Figure 3 , an embodiment of the load balancing processing device in the embodiment of the present invention includes:
[0081] The receiving module 301 is used to receive an application access request and forward the application access request to the content switching virtual machine through a preset application switch;
[0082] An extraction module 302 is used to extract a converged domain name address and a redirection address from an application access request through a content switching virtual machine;
[0083] The analysis module 303 is used to match and analyze the policy binding rules corresponding to the content switching virtual machine according to the converged domain name address and the redirection address to obtain the target load forwarding policy, where the policy binding rules corresponding to the content switching virtual machine include multiple load forwarding policies and multiple pattern matching data sets, and each load forwarding policy corresponds to each pattern matching data set one by one;
[0084] The processing module 304 is used to forward the application access request to the target virtual host according to the target load forwarding strategy, forward the application access request to the target reverse proxy through the target virtual host, and perform load balancing processing on the application access request through the target reverse proxy.
[0085] Furthermore, the policy binding rules are stored in the blockchain database, which is not specifically limited here.
[0086] In the embodiment of the present invention, the application switch is used to forward the request to the content switching virtual machine; the policy binding rule corresponding to the content switching virtual machine is analyzed according to the converged domain name address and the redirection address matching to obtain the target load forwarding strategy; the application access request is forwarded to the target virtual host according to the target load forwarding strategy, the application access request is forwarded to the target reverse proxy through the target virtual host, and the application access request is load balanced through the target reverse proxy. The application virtualization technology is smoothly converted according to business needs, the load balancing network link is shortened, and the network performance loss is reduced.
[0087] See also Figure 4 Another embodiment of the load balancing processing device in the embodiment of the present invention includes:
[0088] The receiving module 301 is used to receive an application access request and forward the application access request to the content switching virtual machine through a preset application switch;
[0089] An extraction module 302 is used to extract a converged domain name address and a redirection address from an application access request through a content switching virtual machine;
[0090] The analysis module 303 is used to match and analyze the policy binding rules corresponding to the content switching virtual machine according to the converged domain name address and the redirection address to obtain the target load forwarding policy, where the policy binding rules corresponding to the content switching virtual machine include multiple load forwarding policies and multiple pattern matching data sets, and each load forwarding policy corresponds to each pattern matching data set one by one;
[0091] The processing module 304 is used to forward the application access request to the target virtual host according to the target load forwarding strategy, forward the application access request to the target reverse proxy through the target virtual host, and perform load balancing processing on the application access request through the target reverse proxy.
[0092] Optionally, the receiving module 301 may also be specifically used for:
[0093] Receive application access requests, intercept the application access requests through a preset application switch, and obtain terminal address information;
[0094] Determine whether the application access request is abnormal based on the terminal address information;
[0095] If there is an exception in the application access request, the request exception information is generated and recorded, and the request exception information is sent to the terminal;
[0096] If there is no abnormality in the application access request, the application access request is forwarded to the content switching virtual machine through the preset application switch according to the preset binding relationship, and the preset binding relationship is used to indicate the association mapping between the content switching virtual machine and the preset application switch.
[0097] Optionally, the extraction module 302 may also be specifically used for:
[0098] Through the content exchange virtual machine, a uniform resource locator object is set for the application access request according to a preset constructor, and a domain name acquisition function is called based on the uniform resource locator object to obtain a converged domain name address;
[0099] The redirection address is extracted from the application access request according to a preset regular matching rule, where the preset regular matching rule is used to instruct character matching and segmentation processing to be performed on the application access request.
[0100] Optionally, the analysis module 303 may also be specifically used for:
[0101] Based on the converged domain name address, the policy binding rules corresponding to the content switching virtual machine are matched and parsed to obtain multiple load forwarding strategies and multiple pattern matching data sets associated and bound with the converged domain name address, each load forwarding strategy has a corresponding priority value and a corresponding unique identifier, and each load forwarding strategy corresponds to each pattern matching data set one by one;
[0102] Access each load forwarding strategy in order from low to high according to the priority value corresponding to each load forwarding strategy, and determine whether there is a redirection address in the pattern matching data set corresponding to each load forwarding strategy;
[0103] If a redirection address exists in the pattern matching data set corresponding to each load forwarding strategy, a target pattern matching data set is determined, and a target load forwarding strategy is determined according to the target pattern matching data set.
[0104] Optionally, the processing module 304 may also be specifically configured to:
[0105] Obtain the policy identifier corresponding to the target load forwarding policy, query the preset configuration information according to the policy identifier, obtain the target virtual host, and forward the application access request to the target virtual host;
[0106] When the application access request reaches the target virtual host, the application access request is transparently transmitted to the target reverse proxy through the target virtual host. The target virtual host and the target reverse proxy correspond one to one;
[0107] When the application access request reaches the target reverse proxy, the application access request is distributed and sent to the target host through the target reverse proxy. The target host belongs to the preset distributed cluster.
[0108] Optionally, the load balancing processing device further includes:
[0109] Initialization module 305, used to obtain the converged domain name address and service type, add at least one pattern matching data set according to the converged domain name address and service type, and initialize data for at least one pattern matching data set;
[0110] A binding module 306, configured to set at least one load forwarding strategy according to the converged domain name address and the service type, and associate and bind each load forwarding strategy with each pattern matching data set;
[0111] The allocation module 307 is used to perform association mapping processing on each load forwarding strategy, content switching virtual machine and target virtual host, and allocate a corresponding priority value to each load forwarding strategy according to a preset priority allocation rule.
[0112] Optionally, the load balancing processing device further includes:
[0113] A mining module 308 is used to obtain a load balancing access log, perform data mining and analysis on the load balancing access log according to a preset machine learning algorithm, and obtain a target access data volume, where the target access data volume is used to indicate the number of application access requests and the number of distributions of the target reverse proxy within a preset time period;
[0114] The display module 309 is used to send the target access data volume to the terminal, so that the terminal generates and displays a heat map according to the target access data volume.
[0115] In the embodiment of the present invention, the application switch is used to forward the request to the content switching virtual machine; the policy binding rule corresponding to the content switching virtual machine is analyzed according to the converged domain name address and the redirection address matching to obtain the target load forwarding strategy; the application access request is forwarded to the target virtual host according to the target load forwarding strategy, the application access request is forwarded to the target reverse proxy through the target virtual host, and the application access request is load balanced through the target reverse proxy. The application virtualization technology is smoothly converted according to business needs, the load balancing network link is shortened, and the network performance loss is reduced.
[0116] above Figure 3 and Figure 4 The load balancing processing device in the embodiment of the present invention is described in detail from the perspective of modularization. The load balancing processing device in the embodiment of the present invention is described in detail from the perspective of hardware processing.
[0117] Figure 5 1 is a schematic diagram of the structure of a load balancing processing device provided by an embodiment of the present invention. The load balancing processing device 500 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 510 (for example, one or more processors) and a memory 520, and one or more storage media 530 (for example, one or more mass storage devices) storing application programs 533 or data 532. Among them, the memory 520 and the storage medium 530 can be short-term storage or permanent storage. The program stored in the storage medium 530 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the load balancing processing device 500. Furthermore, the processor 510 can be configured to communicate with the storage medium 530 to execute a series of instruction operations in the storage medium 530 on the load balancing processing device 500.
[0118] The load balancing processing device 500 may also include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input and output interfaces 560, and / or one or more operating systems 531, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art will appreciate that Figure 5 The structure of the load balancing processing device shown does not constitute a limitation on the load balancing processing device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0119] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the steps of the load balancing processing method.
[0120] The present invention also provides a load balancing processing device, which includes a memory and a processor. The memory stores instructions, and when the instructions are executed by the processor, the processor executes the steps of the load balancing processing method in the above embodiments.
[0121] Furthermore, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.
[0122] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0123] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0124] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.
[0125] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A load balancing processing method, characterized in that: The load balancing processing method comprises: receiving an application access request, and forwarding the application access request to a content switching virtual machine through a preset application switch; Extracting a converged domain name address and a redirection address from the application access request through the content switching virtual machine; Based on the converged domain name address, the policy binding rule corresponding to the content switching virtual machine is matched and parsed to obtain multiple load forwarding strategies and multiple pattern matching data sets associated and bound with the converged domain name address, each load forwarding strategy has a corresponding priority value and a corresponding unique identifier, and each load forwarding strategy corresponds to each pattern matching data set one by one; Access each load forwarding strategy in order from low to high according to the priority value corresponding to each load forwarding strategy, and determine whether the redirection address exists in the pattern matching data set corresponding to each load forwarding strategy; If the redirection address exists in the pattern matching data set corresponding to each load forwarding strategy, a target pattern matching data set is determined, and a target load forwarding strategy is determined according to the target pattern matching data set; The application access request is forwarded to the target virtual host according to the target load forwarding strategy, the application access request is forwarded to the target reverse proxy through the target virtual host, and the application access request is load balanced through the target reverse proxy.
2. The load balancing processing method according to claim 1, characterized in that: The receiving the application access request and forwarding the application access request to the content switching virtual machine through a preset application switch includes: Receive an application access request, intercept the application access request through a preset application switch, and obtain terminal address information; Determining whether the application access request is abnormal according to the terminal address information; If the application access request is abnormal, generating and recording request abnormality information, and sending the request abnormality information to the terminal; If there is no abnormality in the application access request, the application access request is forwarded to the content switching virtual machine through the preset application switch according to the preset binding relationship, and the preset binding relationship is used to indicate the association mapping between the content switching virtual machine and the preset application switch.
3. The load balancing processing method according to claim 1, characterized in that: The extracting the converged domain name address and the redirection address from the application access request by the content switching virtual machine includes: By means of the content exchange virtual machine, a uniform resource locator object is set for the application access request according to a preset constructor, and a domain name acquisition function is called based on the uniform resource locator object to obtain a converged domain name address; A redirection address is extracted from the application access request according to a preset regular matching rule, wherein the preset regular matching rule is used to instruct to perform character matching and segmentation processing on the application access request.
4. The load balancing processing method according to claim 1, characterized in that: The method of forwarding the application access request to a target virtual host according to the target load forwarding strategy, forwarding the application access request to a target reverse proxy through the target virtual host, and performing load balancing processing on the application access request through the target reverse proxy includes: Obtaining a policy identifier corresponding to the target load forwarding policy, querying preset configuration information according to the policy identifier, obtaining a target virtual host, and forwarding the application access request to the target virtual host; When the application access request reaches the target virtual host, the application access request is transparently transmitted to the target reverse proxy through the target virtual host, and the target virtual host and the target reverse proxy correspond one to one; When the application access request reaches the target reverse proxy, the application access request is distributed by the target reverse proxy and sent to a target host, where the target host belongs to a preset distributed cluster.
5. The load balancing processing method according to any one of claims 1 to 4, characterized in that: Before receiving the application access request and forwarding the application access request to the content switching virtual machine through the preset application switch, the load balancing processing method further includes: Acquire the convergent domain name address and the service type, add at least one pattern matching data set according to the convergent domain name address and the service type, and initialize data for at least one pattern matching data set; Setting at least one load forwarding strategy according to the converged domain name address and the service type, and associating and binding each load forwarding strategy with each pattern matching data set; An association mapping process is performed on each load forwarding strategy, the content switching virtual machine and the target virtual host, and a corresponding priority value is allocated to each load forwarding strategy according to a preset priority allocation rule.
6. The load balancing processing method according to any one of claims 1 to 4, characterized in that: After forwarding the application access request to the target virtual host according to the target load forwarding strategy, forwarding the application access request to the target reverse proxy through the target virtual host, and performing load balancing processing on the application access request through the target reverse proxy, the load balancing processing method further includes: Obtain a load balancing access log, perform data mining and analysis on the load balancing access log according to a preset machine learning algorithm, and obtain a target access data volume, where the target access data volume is used to indicate the number of application access requests and the number of distributions of the target reverse proxy within a preset time period; The target access data volume is sent to a terminal, so that the terminal generates and displays a heat map according to the target access data volume.
7. A load balancing processing device, characterized in that: The load balancing processing device comprises: A receiving module, configured to receive an application access request and forward the application access request to a content switching virtual machine via a preset application switch; An extraction module, configured to extract a converged domain name address and a redirection address from the application access request through the content switching virtual machine; An analysis module is used to match and parse the policy binding rules corresponding to the content switching virtual machine based on the converged domain name address, and obtain multiple load forwarding strategies and multiple pattern matching data sets associated and bound with the converged domain name address, each load forwarding strategy has a corresponding priority value and a corresponding unique identifier, and each load forwarding strategy corresponds to each pattern matching data set one by one; access each load forwarding strategy in order from low to high according to the priority value corresponding to each load forwarding strategy, and determine whether the redirection address exists in the pattern matching data set corresponding to each load forwarding strategy; if the redirection address exists in the pattern matching data set corresponding to each load forwarding strategy, determine the target pattern matching data set, and determine the target load forwarding strategy according to the target pattern matching data set; A processing module is used to forward the application access request to the target virtual host according to the target load forwarding strategy, forward the application access request to the target reverse proxy through the target virtual host, and perform load balancing processing on the application access request through the target reverse proxy.
8. A load balancing processing device, characterized in that: The load balancing processing device comprises: a memory and at least one processor, wherein instructions are stored in the memory; The at least one processor calls the instruction in the memory so that the load balancing processing device executes the load balancing processing method according to any one of claims 1 to 6.
9. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instruction is executed by the processor, the load balancing processing method as described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Reverse connection method and device and server system
CN111726400A
Load balancing implementation method and device for virtualized cloud platform and readable storage medium
CN111901409A
