技术领域Technical Field
本申请实施例涉及分布式系统技术领域,特别涉及一种负载均衡系统的管理方法、装置、计算机设备及存储介质。The embodiments of the present application relate to the technical field of distributed systems, and in particular to a management method, apparatus, computer equipment, and storage medium for a load balancing system.
背景技术Background Art
软件负载均衡是软件定义的运行在物理服务器或虚拟机操作系统层上的网络负载均衡器。由于其成本低、配置灵活,在云环境中作为应用服务的关键流量处理节点,得到了大规模的应用。为提高负载均衡系统的处理能力和高可用能力,现有的软件负载均衡通常以多副本、分布式的方式部署和运行。目前,分布式部署的软件负载均衡副本实例均保持独立、相同的功能,每个副本实例均对外提供流量入口,并且副本实例与业务建立的会话信息也仅由该实例保存。Software load balancing is a software-defined network load balancer that runs on the operating system layer of a physical server or virtual machine. Due to its low cost and flexible configuration, it has been widely used as a key traffic processing node for application services in cloud environments. In order to improve the processing power and high availability of the load balancing system, existing software load balancing is usually deployed and run in a multi-copy, distributed manner. At present, the distributed deployment of software load balancing replica instances maintains independent and identical functions. Each replica instance provides a traffic entry to the outside world, and the session information established between the replica instance and the business is only saved by the instance.
然而,由于每个软件负载均衡的副本实例都以自身的IP(Internet Protocol,互联网协议)地址和端口作为流量入口,在副本扩容时,副本数的变化会导致流量入口IP和端口的变化,新增流量入口的开放需要将新的副本实例信息更新至DNS服务器(Domain NameSystem Server,域名系统服务器)或者硬件负载均衡,效率低,对业务影响程度较高,且新增的流量入口增加了潜在的链路故障点,使得系统稳定性较差,用户体验感较差。However, since each replica instance of the software load balancing uses its own IP (Internet Protocol) address and port as the traffic entrance, when the replicas are expanded, the change in the number of replicas will lead to changes in the traffic entrance IP and port. The opening of new traffic entrances requires updating the new replica instance information to the DNS server (Domain Name System Server) or hardware load balancing, which is inefficient and has a high impact on the business. In addition, the new traffic entrances increase potential link failure points, resulting in poor system stability and a poor user experience.
发明内容Summary of the invention
本申请实施例提供了一种负载均衡系统的管理方法、装置、计算机设备及存储介质,可以实现业务对分布式软件负载均衡系统的多副本实例节点变化无感知,减小副本实例变化对业务的影响程度,提高系统稳定性以及用户体验效果。该技术方案如下:The embodiment of the present application provides a management method, device, computer equipment and storage medium for a load balancing system, which can achieve the business being unaware of the changes in the multiple replica instance nodes of the distributed software load balancing system, reduce the impact of the replica instance changes on the business, and improve the system stability and user experience. The technical solution is as follows:
一方面,提供了一种负载均衡系统的管理方法,所述方法包括:In one aspect, a method for managing a load balancing system is provided, the method comprising:
通过入口节点接收目标业务流量请求;所述入口节点是分布式软件负载均衡系统中开启地址解析协议ARP响应的节点;Receive a target service traffic request through an entry node; the entry node is a node that enables an address resolution protocol ARP response in a distributed software load balancing system;
通过所述入口节点的路由转发组件查询所述目标业务流量请求对应的各个副本实例节点的路由信息;所述副本实例节点是所述分布式软件负载均衡系统中未开启ARP响应的节点;所述路由信息中包含节点互联网协议IP地址以及节点媒体访问控制MAC地址;The routing information of each replica instance node corresponding to the target service traffic request is queried through the routing forwarding component of the entry node; the replica instance node is a node in the distributed software load balancing system in which the ARP response is not enabled; the routing information includes a node Internet Protocol IP address and a node Media Access Control MAC address;
基于查询到的所述目标业务流量请求对应的各个副本实例节点的路由信息,通过所述路由转发组件按照均衡分发原则将所述目标业务流量请求分发到对应的副本实例节点中进行处理。Based on the queried routing information of each replica instance node corresponding to the target business traffic request, the target business traffic request is distributed to the corresponding replica instance node for processing according to the balanced distribution principle through the routing forwarding component.
另一方面,提供了一种负载均衡系统的管理装置,所述装置包括:In another aspect, a management device for a load balancing system is provided, the device comprising:
接收模块,用于通过入口节点接收目标业务流量请求;所述入口节点是分布式软件负载均衡系统中开启地址解析协议ARP响应的节点;A receiving module, used to receive a target service traffic request through an entry node; the entry node is a node in the distributed software load balancing system that enables an address resolution protocol ARP response;
查询模块,用于通过所述入口节点的路由转发组件查询所述目标业务流量请求对应的各个副本实例节点的路由信息;所述副本实例节点是所述分布式软件负载均衡系统中未开启ARP响应的节点;所述路由信息中包含节点互联网协议IP地址以及节点媒体访问控制MAC地址;A query module, used to query the routing information of each replica instance node corresponding to the target service traffic request through the routing forwarding component of the entry node; the replica instance node is a node in the distributed software load balancing system that does not enable ARP response; the routing information includes a node Internet Protocol IP address and a node Media Access Control MAC address;
分发模块,用于基于查询到的所述目标业务流量请求对应的各个副本实例节点的路由信息,通过所述路由转发组件按照均衡分发原则将所述目标业务流量请求分发到对应的副本实例节点中进行处理。The distribution module is used to distribute the target business traffic request to the corresponding replica instance node for processing according to the balanced distribution principle through the routing forwarding component based on the routing information of each replica instance node corresponding to the target business traffic request.
在一种可能的实现方式中,所述分发模块,包括:In a possible implementation, the distribution module includes:
查询子模块,用于基于查询到所述目标业务流量请求对应的各个副本实例节点的路由信息,通过所述路由转发组件将所述目标业务流量请求对应的目的MAC地址修改为目标副本实例节点的节点MAC地址;所述目标副本实例节点是所述业务流量请求对应的各个副本实例节点中的一个;A query submodule, configured to modify the destination MAC address corresponding to the target service traffic request to a node MAC address of a target replica instance node through the routing forwarding component based on the query of the routing information of each replica instance node corresponding to the target service traffic request; the target replica instance node is one of the replica instance nodes corresponding to the service traffic request;
分发子模块,用于基于所述目标业务流量请求对应的节点MAC地址,将所述目标业务流量请求路由转发到所述目标副本实例节点中进行处理。The distribution submodule is used to route and forward the target business traffic request to the target replica instance node for processing based on the node MAC address corresponding to the target business traffic request.
在一种可能的实现方式中,各个副本实例节点具有对应的会话状态同步组件,所述装置还包括:In a possible implementation, each replica instance node has a corresponding session state synchronization component, and the device further includes:
同步模块,用于在通过各个副本实例节点对对应的业务流量请求进行处理的过程中,通过各个副本实例节点的会话状态同步组件,将各个副本实例节点产生的业务会话信息实时同步到分布式软件负载均衡系统内的其他副本实例节点中;所述分布式软件负载均衡系统内的各个副本实例节点的会话状态同步组件之间建立有通信连接关系。The synchronization module is used to synchronize the business session information generated by each replica instance node to other replica instance nodes in the distributed software load balancing system in real time through the session state synchronization component of each replica instance node during the process of processing the corresponding business traffic request through each replica instance node; a communication connection relationship is established between the session state synchronization components of each replica instance node in the distributed software load balancing system.
在一种可能的实现方式中,所述装置还包括:In a possible implementation manner, the device further includes:
流量转发模块,用于在第一副本实例节点发生异常,且所述第一副本实例节点中存在正在处理的第一业务流量请求时,通过所述路由转发组件将所述第一业务流量请求转发到第二副本实例节点;所述第一副本实例节点与第二副本实例节点是所述分布式软件负载均衡系统内的副本实例节点;A traffic forwarding module, configured to forward the first service traffic request to a second replica instance node through the routing forwarding component when an exception occurs in the first replica instance node and there is a first service traffic request being processed in the first replica instance node; the first replica instance node and the second replica instance node are replica instance nodes in the distributed software load balancing system;
处理模块,用于通过所述第二副本实例节点调用所述第一业务流量请求的历史会话信息对所述第一业务流量请求继续进行处理。A processing module is used to continue processing the first business traffic request by calling the historical session information of the first business traffic request through the second replica instance node.
在一种可能的实现方式中,所述装置还包括:In a possible implementation manner, the device further includes:
读取模块,用于通过目标会话状态同步组件实时读取路由分发列表中的副本实例节点的IP信息,所述路由分发列表中包含至少两个副本实例节点的路由信息;所述目标会话状态同步组件是至少两个会话状态同步组件中的任意一个;A reading module, used to read in real time the IP information of the replica instance node in the routing distribution list through the target session state synchronization component, wherein the routing distribution list contains routing information of at least two replica instance nodes; the target session state synchronization component is any one of the at least two session state synchronization components;
请求发送模块,用于向其他会话状态同步组件发送组网请求;A request sending module, used to send a networking request to other session state synchronization components;
关系建立模块,用于在接收到其他会话状态同步组件返回的组网确认信息后,建立所述目标会话状态同步组件与其他会话状态同步组件之间的通信连接关系。The relationship establishing module is used to establish a communication connection relationship between the target session state synchronization component and other session state synchronization components after receiving the networking confirmation information returned by other session state synchronization components.
在一种可能的实现方式中,所述装置还包括:In a possible implementation manner, the device further includes:
节点创建模块,用于基于用户发起的创建请求,创建并启动n+1个副本实例节点;n为正整数;The node creation module is used to create and start n+1 replica instance nodes based on the creation request initiated by the user; n is a positive integer;
地址生成模块,用于通过入口控制组件生成入口节点IP地址;An address generation module, used to generate an entry node IP address through an entry control component;
节点选取模块,用于通过所述入口控制组件从n+1个副本实例节点中选取一个作为候选入口节点;A node selection module, used to select one of the n+1 replica instance nodes as a candidate entry node through the entry control component;
第一节点配置模块,用于为所述候选入口节点配置所述入口节点IP地址以及开启所述候选入口节点的ARP响应,得到所述入口节点;A first node configuration module, configured to configure the entry node IP address for the candidate entry node and enable the ARP response of the candidate entry node to obtain the entry node;
第二节点配置模块,用于为剩余n个副本实例节点配置对应的节点IP地址以及关闭剩余n个副本实例节点的ARP响应。The second node configuration module is used to configure corresponding node IP addresses for the remaining n replica instance nodes and to close the ARP responses of the remaining n replica instance nodes.
在一种可能的实现方式中,所述查询模块,包括:In a possible implementation, the query module includes:
信息获取子模块,用于获取所述目标业务流量请求的五元组信息;所述五元组信息包括源IP地址、目标IP地址、源端口号、目标端口号以及传输协议;An information acquisition submodule, used to acquire the five-tuple information of the target service traffic request; the five-tuple information includes a source IP address, a target IP address, a source port number, a target port number, and a transmission protocol;
第一查询子模块,用于基于所述目标业务流量请求的五元组信息对应的连接五元组哈希查询传输控制协议TCP连接表,以获取业务流量请求对应的副本实例节点的路由信息;其中,连接五元组哈希是指对五元组信息进行哈希计算得到的哈希值;所述TCP连接表中包含TCP连接哈希值以及对应的副本实例节点的路由信息;The first query submodule is used to query the transmission control protocol TCP connection table based on the connection five-tuple hash corresponding to the five-tuple information of the target business traffic request to obtain the routing information of the replica instance node corresponding to the business traffic request; wherein the connection five-tuple hash refers to the hash value obtained by hashing the five-tuple information; the TCP connection table contains the TCP connection hash value and the corresponding routing information of the replica instance node;
第二查询子模块,用于在所述目标业务流量请求对应的所述连接五元组哈希与所述TCP连接表中的TCP连接哈希值不匹配时,基于所述目标业务流量请求的五元组信息从路由分发列表中查询所述目标业务流量请求对应副本实例节点的路由信息。The second query sub-module is used to query the routing information of the replica instance node corresponding to the target business traffic request from the routing distribution list based on the quintuple information of the target business traffic request when the connection quintuple hash corresponding to the target business traffic request does not match the TCP connection hash value in the TCP connection table.
另一方面,提供了一种计算机设备,所述计算机设备包含处理器和存储器,所述存储器存储有至少一条计算机程序,所述至少一条计算机程序由所述处理器加载并执行以实现上述的负载均衡系统的管理方法。On the other hand, a computer device is provided, the computer device comprising a processor and a memory, the memory storing at least one computer program, the at least one computer program being loaded and executed by the processor to implement the above-mentioned load balancing system management method.
另一方面,提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有至少一条计算机程序,所述计算机程序由处理器加载并执行以实现上述的负载均衡系统的管理方法。On the other hand, a computer-readable storage medium is provided, in which at least one computer program is stored. The computer program is loaded and executed by a processor to implement the above-mentioned load balancing system management method.
另一方面,提供了一种计算机程序产品,所述计算机程序产品包括至少一条计算机程序,所述计算机程序由处理器加载并执行以实现上述各种可选实现方式中提供的负载均衡系统的管理方法。On the other hand, a computer program product is provided, the computer program product comprising at least one computer program, the computer program being loaded and executed by a processor to implement the load balancing system management method provided in the above-mentioned various optional implementations.
本申请提供的技术方案可以包括以下有益效果:The technical solution provided by this application may have the following beneficial effects:
本申请实施例提供的负载均衡系统的管理方法,通过在分布式软件负载均衡系统中设置统一的入口节点,用以接收业务流量请求,并通过入口节点的路由转发组件查询各个副本实例节点的路由信息,根据各个副本实例节点的路由信息将业务流量请求均衡分发到各个副本实例节点中进行处理。通过统一分布式负载均衡系统中多副本实例节点的流量入口,以及在分布式负载均衡系统中对业务流量请求直接路由转发,可以实现业务对分布式软件负载均衡系统的多副本实例节点变化无感知,减小副本实例变化对业务的影响程度,提高了系统稳定性以及用户体验效果。The management method of the load balancing system provided in the embodiment of the present application is to set a unified entry node in the distributed software load balancing system to receive business traffic requests, and query the routing information of each replica instance node through the routing forwarding component of the entry node, and evenly distribute the business traffic requests to each replica instance node for processing according to the routing information of each replica instance node. By unifying the traffic entry of multiple replica instance nodes in the distributed load balancing system and directly routing and forwarding business traffic requests in the distributed load balancing system, it is possible to achieve that the business is unaware of the changes in the multiple replica instance nodes of the distributed software load balancing system, reduce the impact of the replica instance changes on the business, and improve the system stability and user experience.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本申请。It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本申请的实施例,并与说明书一起用于解释本申请的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
图1示出了本申请一示例性实施例提供的负载均衡系统的管理方法的流程图;FIG1 shows a flow chart of a method for managing a load balancing system provided by an exemplary embodiment of the present application;
图2示出了本申请一示例性实施例提供的负载均衡系统的管理方法的流程图;FIG2 shows a flow chart of a method for managing a load balancing system provided by an exemplary embodiment of the present application;
图3示出了本申请一示例性实施例提供的会话信息同步过程的交互示意图;FIG3 shows an interactive schematic diagram of a session information synchronization process provided by an exemplary embodiment of the present application;
图4示出了本申请一示例性实施例提供的分布式负载均衡系统的架构图;FIG4 shows an architecture diagram of a distributed load balancing system provided by an exemplary embodiment of the present application;
图5示出了本申请一示例性实施例提供的统一入口节点流量分发过程的示意图;FIG5 is a schematic diagram showing a unified ingress node traffic distribution process provided by an exemplary embodiment of the present application;
图6示出了本申请一示例性实施例提供的负载均衡系统的管理装置的方框图;FIG6 shows a block diagram of a management device of a load balancing system provided by an exemplary embodiment of the present application;
图7是根据一示例性实施例示出的计算机设备的结构框图。Fig. 7 is a structural block diagram of a computer device according to an exemplary embodiment.
具体实施方式DETAILED DESCRIPTION
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
本申请实施例提供了一种负载均衡系统的管理方法,能够实现基于分布式软件复杂均衡的流量入口统一,从而有效降低分布式软件负载均衡在副本实例变化时对业务访问的影响,实现了分布式软件负载均衡系统中多副本实例的变化对业务的透明化,即业务对分布式软件负载均衡系统中的副本实例变化无感知。图1示出了本申请一示例性实施例提供的负载均衡系统的管理方法的流程图,该方法可以由分布式软件负载均衡系统执行,该分布式软件负载均衡系统可以实现为服务器,如图1所示,该负载均衡系统的管理方法可以包括以下步骤:The embodiment of the present application provides a method for managing a load balancing system, which can unify traffic entrances based on distributed software complex balancing, thereby effectively reducing the impact of distributed software load balancing on business access when replica instances change, and realizing the transparency of changes in multiple replica instances in the distributed software load balancing system to the business, that is, the business is unaware of the changes in replica instances in the distributed software load balancing system. Figure 1 shows a flow chart of a method for managing a load balancing system provided by an exemplary embodiment of the present application, which method can be executed by a distributed software load balancing system, and the distributed software load balancing system can be implemented as a server. As shown in Figure 1, the method for managing a load balancing system can include the following steps:
步骤110,通过入口节点接收目标业务流量请求;该入口节点是分布式软件负载均衡系统中开启地址解析协议ARP响应的节点。Step 110, receiving a target service traffic request through an entry node; the entry node is a node in the distributed software load balancing system that enables an address resolution protocol ARP response.
本申请实施例中,在分布式软件负载均衡系统中创建一个统一的入口节点,作为业务访问分布式软件负载均衡系统的唯一网络地址,用于为分布式软件复杂均衡系统中的副本实例节点提供统一的入口IP地址和IP端口信息,通过该入口节点接收客户端发送的业务流量请求,以将接收到的业务流量请求均衡分发到不同的副本实例节点进行处理。In an embodiment of the present application, a unified entry node is created in a distributed software load balancing system as the unique network address for business access to the distributed software load balancing system, and is used to provide a unified entry IP address and IP port information for the replica instance nodes in the distributed software complex balancing system. The business traffic requests sent by the client are received through the entry node, so as to evenly distribute the received business traffic requests to different replica instance nodes for processing.
在本申请实施例提供的分布式软件负载均衡系统中,入口节点开启ARP响应使得该入口节点可以响应ARP广播请求,非入口节点(即副本实例节点)关闭ARP响应,使得非入口节点抑制ARP广播请求,从而实现入口节点对业务流量请求可达,业务流量请求均统一从入口节点进行分布式软件负载均衡系统的效果,在此情况下,即使分布式软件负载均衡系统中的副本实例节点的数量发生变化(比如副本实例扩容,副本实例缩容,副本实例部分故障等等),业务对副本实例节点的数量变化也无感知,使得副本实例节点的变化对业务透明。In the distributed software load balancing system provided in the embodiment of the present application, the entry node turns on the ARP response so that the entry node can respond to the ARP broadcast request, and the non-entry node (i.e., the replica instance node) turns off the ARP response, so that the non-entry node suppresses the ARP broadcast request, thereby achieving the effect that the entry node is reachable to the business traffic request, and the business traffic requests are all uniformly performed from the entry node to the distributed software load balancing system. In this case, even if the number of replica instance nodes in the distributed software load balancing system changes (such as replica instance expansion, replica instance reduction, partial failure of replica instance, etc.), the business is unaware of the change in the number of replica instance nodes, making the change of the replica instance nodes transparent to the business.
步骤120,通过入口节点的路由转发组件查询目标业务流量请求对应的各个副本实例节点的路由信息;该副本实例节点是分布式软件负载均衡系统中未开启ARP响应的节点;该路由信息中包含节点互联网协议IP地址以及节点媒体访问控制MAC地址。Step 120, query the routing information of each replica instance node corresponding to the target business traffic request through the routing forwarding component of the entry node; the replica instance node is a node in the distributed software load balancing system that does not have ARP response enabled; the routing information includes the node Internet Protocol IP address and the node Media Access Control MAC address.
路由转发组件在通过入口节点接收到业务流量请求后,查询该业务流量请求对应的副本实例节点的路由信息,以根据查询到业务流量请求对应的副本实例节点的路由信息对业务流量请求进行直接路由转发。After receiving a service traffic request through the entry node, the routing forwarding component queries the routing information of the replica instance node corresponding to the service traffic request, and directly routes and forwards the service traffic request based on the routing information of the replica instance node corresponding to the service traffic request.
步骤130,基于查询到的目标业务流量请求对应的各个副本实例节点的路由信息,通过路由转发组件按照均衡分发原则将目标业务流量请求分发到对应的副本实例节点中进行处理。Step 130 , based on the queried routing information of each replica instance node corresponding to the target service traffic request, the target service traffic request is distributed to the corresponding replica instance node for processing through the routing forwarding component according to the balanced distribution principle.
在查询到目标业务流量请求对应的各个副本实例节点的理由信息后,路由转发组件可以根据各个副本实例节点的负载情况,按照均衡分发原则确定将目标业务流量请求分发到的副本实例节点,示意性的,该均衡分发原则可以包括轮询原则,最小连接数原则,最短响应时间原则,基于权重配置分发原则等等中的一种或几种;比如,路由转发组件可以将目标业务流量请求分发到各个副本实例节点中负载最低的副本实例节点;在负载最低的副本实例节点有多个时,路由转发组件可以随机选取一个作为目标业务流量请求对应的副本实例节点等等。After querying the reason information of each replica instance node corresponding to the target business traffic request, the routing forwarding component can determine the replica instance node to which the target business traffic request is distributed according to the load conditions of each replica instance node and the balanced distribution principle. Schematically, the balanced distribution principle can include one or more of the polling principle, the minimum number of connections principle, the shortest response time principle, the distribution principle based on weight configuration, etc.; for example, the routing forwarding component can distribute the target business traffic request to the replica instance node with the lowest load among the replica instance nodes; when there are multiple replica instance nodes with the lowest load, the routing forwarding component can randomly select one as the replica instance node corresponding to the target business traffic request, and so on.
在接收到目标业务流量请求之后,副本实例节点通过TCP(Transmission ControlProtocol,传输控制协议)/IP协议栈进入副本实例处理:根据用户设置的负载均衡算法将目标业务流量请求转发到下层应用服务,应用服务响应业务流量请求,并通过分布式软件负载均衡系统的副本实例节点将请求响应返回至客户端。After receiving the target business traffic request, the replica instance node enters the replica instance processing through the TCP (Transmission Control Protocol)/IP protocol stack: the target business traffic request is forwarded to the lower-level application service according to the load balancing algorithm set by the user, and the application service responds to the business traffic request and returns the request response to the client through the replica instance node of the distributed software load balancing system.
综上所述,本申请实施例提供的负载均衡系统的管理方法,通过在分布式软件负载均衡系统中设置统一的入口节点,用以接收业务流量请求,并通过入口节点的路由转发组件查询各个副本实例节点的路由信息,根据各个副本实例节点的路由信息将业务流量请求均衡分发到各个副本实例节点中进行处理。通过统一分布式负载均衡系统中多副本实例节点的流量入口,以及在分布式负载均衡系统中对业务流量请求直接路由转发,可以实现业务对分布式软件负载均衡系统的多副本实例节点变化无感知,减小副本实例变化对业务的影响程度,提高了系统稳定性以及用户体验效果。In summary, the management method of the load balancing system provided by the embodiment of the present application is to set a unified entry node in the distributed software load balancing system to receive business traffic requests, and query the routing information of each replica instance node through the routing forwarding component of the entry node, and evenly distribute the business traffic requests to each replica instance node for processing according to the routing information of each replica instance node. By unifying the traffic entry of multiple replica instance nodes in the distributed load balancing system and directly routing and forwarding business traffic requests in the distributed load balancing system, it is possible to achieve that the business is unaware of the changes in the multiple replica instance nodes of the distributed software load balancing system, reduce the impact of the replica instance changes on the business, and improve the system stability and user experience.
图2示出了本申请一示例性实施例提供的负载均衡系统的管理方法的流程图,该方法可以由分布式软件负载均衡系统执行,该分布式软件负载均衡系统可以实现为服务器,如图2所示,该负载均衡系统的管理方法可以包括以下步骤:FIG2 shows a flow chart of a method for managing a load balancing system provided by an exemplary embodiment of the present application. The method may be executed by a distributed software load balancing system. The distributed software load balancing system may be implemented as a server. As shown in FIG2 , the method for managing a load balancing system may include the following steps:
步骤210,通过入口节点接收目标业务流量请求;该入口节点是分布式软件负载均衡系统中开启地址解析协议ARP响应的节点。Step 210, receiving a target service traffic request through an entry node; the entry node is a node in the distributed software load balancing system that enables an address resolution protocol ARP response.
在一种可能的实现方式中,该入口节点可以是在分布式软件负载均衡系统中新增的开启ARP响应的节点;在另一种可能的实现方式中,该入口节点是通过将副本实例节点中的其中一个进行IP地址配置以及开启ARP响应的节点,在此情况下,对入口节点以及副本实例节点的配置过程可以实现为:In one possible implementation, the entry node may be a node newly added in the distributed software load balancing system with ARP response enabled; in another possible implementation, the entry node is a node configured with an IP address of one of the replica instance nodes and with ARP response enabled. In this case, the configuration process of the entry node and the replica instance node may be implemented as follows:
基于用户发起的创建请求,创建并启动n+1个副本实例节点;n为正整数;Based on the creation request initiated by the user, n+1 replica instance nodes are created and started; n is a positive integer;
通过入口控制组件生成入口节点IP地址;Generate the entry node IP address through the entry control component;
通过入口控制组件从n+1个副本实例节点中选取一个作为候选入口节点;The ingress control component selects one of the n+1 replica instance nodes as a candidate ingress node;
为候选入口节点配置入口节点IP地址以及开启候选入口节点的ARP响应,得到入口节点;Configure the entry node IP address for the candidate entry node and enable the ARP response of the candidate entry node to obtain the entry node;
为剩余n个副本实例节点配置对应的节点IP地址以及关闭剩余n个副本实例节点的ARP响应。Configure corresponding node IP addresses for the remaining n replica instance nodes and disable ARP responses for the remaining n replica instance nodes.
在本申请实施例中,分布式软件负载均衡系统可以通过路由分发表来记录该系统中各个节点的节点路由信息,包括入口节点的路由信息以及副本实例节点的路由信息。在此情况下,在分布式软件负载均衡系统基于用户发起的创建请求创建并启动副本实例节点时,生成本次创建的分布式软件负载均衡系统的系统ID,获取各个副本实例节点的路由信息并写入路由分发表,示意性的,路由分发表的结构如表1所示:In an embodiment of the present application, the distributed software load balancing system can record the node routing information of each node in the system through a routing distribution table, including the routing information of the entry node and the routing information of the replica instance node. In this case, when the distributed software load balancing system creates and starts the replica instance node based on the creation request initiated by the user, the system ID of the distributed software load balancing system created this time is generated, the routing information of each replica instance node is obtained and written into the routing distribution table. Schematically, the structure of the routing distribution table is shown in Table 1:
表1Table 1
其中,ID为一个分布式软件负载均衡系统的唯一标识;入口IP地址和入口IP端口是业务访问分布式软件负载均衡系统的唯一网络地址;副本实例节点IP地址和副本实例节点MAC地址是分布式软件负载均衡系统的副本实例节点的路由信息。Among them, ID is the unique identifier of a distributed software load balancing system; the entry IP address and entry IP port are the unique network addresses for business access to the distributed software load balancing system; the replica instance node IP address and replica instance node MAC address are the routing information of the replica instance node of the distributed software load balancing system.
在将各个副本实例节点的路由信息写入路由分发表中后,调用入口控制组件生成入口IP地址,此时,入口控制组件可以以系统ID为主键,查询路由分发表,并将入口IP地址更新到路由分发表中的对应字段。After writing the routing information of each replica instance node into the routing distribution table, the entry control component is called to generate the entry IP address. At this time, the entry control component can use the system ID as the primary key to query the routing distribution table and update the entry IP address to the corresponding field in the routing distribution table.
在通过入口控制组件从n+1个副本实例节点中选取一个作为候选入口节点,并配置成入口节点时,入口控制组件可以查询路由分发表中的副本实例节点IP字段,生成副本实例节点列表Ln=(N1,N2,…Nn),并从中随机选取一个节点Ni作为候选入口节点,配置节点Ni的IP地址为上述入口控制组件生成的入口节点IP地址并开启节点Ni的ARP响应,从而得到入口节点,并将列表Ln中的节点Ni删除,基于上述操作更新路由分发表;之后,对Ln中剩余的节点配置对应的节点IP地址,并关闭ARP响应。When one is selected from n+1 replica instance nodes as a candidate entry node through the entry control component and configured as an entry node, the entry control component can query the replica instance node IP field in the routing distribution table, generate a replica instance node listLn = (N1 ,N2 , ...Nn ), and randomly select a nodeNi as a candidate entry node, configure the IP address of nodeNi to be the entry node IP address generated by the above entry control component and turn on the ARP response of nodeNi , thereby obtaining the entry node, and delete nodeNi in the listLn , and update the routing distribution table based on the above operation; thereafter, configure the corresponding node IP addresses for the remaining nodes inLn , and turn off the ARP response.
通过上述操作完成对分布式系统负载均衡节点中的入口节点以及副本实例节点的配置,并基于副本实例扩容或者副本实例缩容的情况,实时更新该路由分发表。The above operations complete the configuration of the entry node and the replica instance node in the distributed system load balancing node, and update the routing distribution table in real time based on the expansion or reduction of the replica instance.
在接收到业务流量请求时,由于入口节点开启了ARP响应,而副本实例节点关闭ARP响应,因此,入口节点对业务流量请求可达,业务流量请求统一从入口节点进入。When receiving a business traffic request, since the entry node turns on the ARP response and the replica instance node turns off the ARP response, the entry node is reachable to the business traffic request and the business traffic requests enter uniformly from the entry node.
步骤220,通过入口节点的路由转发组件查询目标业务流量请求对应的各个副本实例节点的路由信息;该副本实例节点是分布式软件负载均衡系统中未开启ARP响应的节点;该路由信息中包含节点互联网协议IP地址以及节点媒体访问控制MAC地址。Step 220, query the routing information of each replica instance node corresponding to the target business traffic request through the routing forwarding component of the entry node; the replica instance node is a node in the distributed software load balancing system that does not have ARP response enabled; the routing information includes the node Internet Protocol IP address and the node Media Access Control MAC address.
路由转发组件查询副本实例节点的路由信息的过程可以实现为:The process of the routing forwarding component querying the routing information of the replica instance node can be implemented as follows:
获取目标业务流量请求的五元组信息;该五元组信息包括源IP地址、目标IP地址、源端口号、目标端口号以及传输协议;Obtain five-tuple information of the target service traffic request; the five-tuple information includes the source IP address, the target IP address, the source port number, the target port number and the transmission protocol;
基于目标业务流量请求的五元组信息对应的连接五元组哈希查询传输控制协议TCP连接表,以获取业务流量请求对应的副本实例节点的路由信息;其中,连接五元组哈希是指对五元组信息进行哈希计算得到的哈希值;该TCP连接表中包含TCP连接哈希值以及对应的副本实例节点的路由信息;Based on the connection five-tuple hash corresponding to the five-tuple information of the target business traffic request, the transmission control protocol TCP connection table is queried to obtain the routing information of the replica instance node corresponding to the business traffic request; wherein the connection five-tuple hash refers to the hash value obtained by hashing the five-tuple information; the TCP connection table contains the TCP connection hash value and the corresponding routing information of the replica instance node;
在目标业务流量请求对应的连接五元组哈希与TCP连接表中的TCP连接哈希值不匹配时,基于目标业务流量请求的五元组信息从路由分发列表中查询目标业务流量请求对应副本实例节点的路由信息。When the connection quintuple hash corresponding to the target business traffic request does not match the TCP connection hash value in the TCP connection table, the routing information of the replica instance node corresponding to the target business traffic request is queried from the routing distribution list based on the quintuple information of the target business traffic request.
也就是说,入口节点的路由转发组件在接收到业务流量请求后,可以先在TCP连接表中进行查询,该TCP连接表中记录了活动TCP连接的数据结构信息,示意性的,数据结构信息可以包括连接的源IP地址、源端口号、目标IP地址、目标端口号等;若入口节点接收到的业务流量请求对应于已建立的是活动TCP连接,则可以通过在TCP连接表中的查询,获取该TCP连接对应的副本实例节点的路由信息;这样,入口节点可以将业务流量请求直接路由转发到对应的副本实例节点上,实现负载均衡。其中,TCP连接表的结构如表2所示:That is to say, after receiving the service traffic request, the routing forwarding component of the entry node can first query the TCP connection table, which records the data structure information of the active TCP connection. Schematically, the data structure information may include the source IP address, source port number, target IP address, target port number, etc. of the connection; if the service traffic request received by the entry node corresponds to an established active TCP connection, the routing information of the replica instance node corresponding to the TCP connection can be obtained by querying the TCP connection table; in this way, the entry node can directly route and forward the service traffic request to the corresponding replica instance node to achieve load balancing. The structure of the TCP connection table is shown in Table 2:
表2Table 2
其中,TCP连接哈希值是对连接五元组信息(源IP+源端口+目的IP+目的端口+连接协议)进行哈希运算的结果,唯一标识一个TCP连接;副本实例节点IP地址和副本实例节点MAC地址是分布式软件负载均衡系统的副本实例节点的路由信息。Among them, the TCP connection hash value is the result of hashing the connection five-tuple information (source IP + source port + destination IP + destination port + connection protocol), which uniquely identifies a TCP connection; the replica instance node IP address and the replica instance node MAC address are the routing information of the replica instance node of the distributed software load balancing system.
若在TCP连接表中查询到业务流量请求对应的副本实例节点的路由信息,则结束查询;若在TCP连接表中未查询到业务流量请求对应的副本实例节点的路由信息,则根据业务流量请求的五元组信息,从路由分发表中查询业务流量请求对应的副本实例节点的路由信息。If the routing information of the replica instance node corresponding to the business traffic request is found in the TCP connection table, the query is terminated; if the routing information of the replica instance node corresponding to the business traffic request is not found in the TCP connection table, the routing information of the replica instance node corresponding to the business traffic request is queried from the routing distribution table based on the five-tuple information of the business traffic request.
步骤230,基于查询到目标业务流量请求对应的各个副本实例节点的路由信息,通过路由转发组件将目标业务流量请求对应的目的MAC地址修改为目标副本实例节点的节点MAC地址;该目标副本实例节点是按照均衡分发原则从业务流量请求对应的各个副本实例节点中确定的副本实例节点。Step 230, based on the routing information of each replica instance node corresponding to the target business traffic request, the destination MAC address corresponding to the target business traffic request is modified to the node MAC address of the target replica instance node through the routing forwarding component; the target replica instance node is a replica instance node determined from the replica instance nodes corresponding to the business traffic request according to the principle of balanced distribution.
路由转发组件根据查询到的节点IP信息和节点MAC地址信息,修改目标业务流量请求的目的MAC地址为查询到的目标副本实例节点的节点MAC地址,从而进行直接路由转发。The routing forwarding component modifies the destination MAC address of the target service traffic request to the node MAC address of the queried target replica instance node based on the queried node IP information and node MAC address information, thereby performing direct routing forwarding.
进一步的,路由转发组件可以将连接信息更新到TCP连接表,并在连接结束后,将TCP连接表对应的连接信息删除,通过更新TCP连接表,路由转发组件可以跟踪和管理每个连接的状态和信息;当连接结束后,路由转发组件从TCP连接表中删除相应的连接信息,以清理和释放资源,以使得TCP连接表保持最新的连接状态,并为后续的连接请求提供准确的信息。Furthermore, the routing and forwarding component can update the connection information to the TCP connection table, and delete the corresponding connection information in the TCP connection table after the connection ends. By updating the TCP connection table, the routing and forwarding component can track and manage the status and information of each connection; when the connection ends, the routing and forwarding component deletes the corresponding connection information from the TCP connection table to clean up and release resources, so that the TCP connection table maintains the latest connection status and provides accurate information for subsequent connection requests.
步骤240,基于目标业务流量请求对应的节点MAC地址,将目标业务流量请求路由转发到目标副本实例节点中进行处理。Step 240 , based on the node MAC address corresponding to the target service traffic request, route and forward the target service traffic request to the target replica instance node for processing.
在接收到目标业务流量请求之后,目标副本实例节点通过TCP/IP协议栈进入副本实例处理:根据用户设置的负载均衡算法将目标业务流量请求转发到下层应用服务,应用服务响应业务流量请求,并通过分布式软件负载均衡系统的副本实例节点将请求响应返回至客户端。After receiving the target business traffic request, the target replica instance node enters the replica instance processing through the TCP/IP protocol stack: the target business traffic request is forwarded to the lower-level application service according to the load balancing algorithm set by the user, and the application service responds to the business traffic request and returns the request response to the client through the replica instance node of the distributed software load balancing system.
在现有技术中,每个副本实例节点独立维护自身会话信息,当软件负载均衡系统中的某一副本实例节点发生故障时,需要将业务流量请求重新转发到其他副本实例节点并建立会话,但由于副本实例节点之间的会话信息不同步,因此在新的副本实例节点中会由于原有的会话信息丢失引发业务中断;为了解决上述问题,在本申请实施例提供的系统软件负载均衡系统中,每个副本实例节点配置有对应的会话状态同步组件,在此基础上,在通过各个副本实例节点对对应的业务流量请求进行处理的过程中,通过各个副本实例节点的会话状态同步组件,将各个副本实例节点产生的业务会话信息实时同步到分布式软件负载均衡系统内的其他副本实例节点中;该分布式软件负载均衡系统内的各个副本实例节点的会话状态同步组件之间建立有通信连接关系。In the prior art, each replica instance node independently maintains its own session information. When a replica instance node in the software load balancing system fails, it is necessary to re-forward the business traffic request to other replica instance nodes and establish a session. However, since the session information between the replica instance nodes is not synchronized, the business interruption will be caused in the new replica instance node due to the loss of the original session information. In order to solve the above problem, in the system software load balancing system provided in the embodiment of the present application, each replica instance node is configured with a corresponding session state synchronization component. On this basis, in the process of processing the corresponding business traffic request through each replica instance node, the business session information generated by each replica instance node is synchronized in real time to other replica instance nodes in the distributed software load balancing system through the session state synchronization component of each replica instance node; a communication connection relationship is established between the session state synchronization components of each replica instance node in the distributed software load balancing system.
以各个副本实例节点的会话状态组件中的任意一个为例,建立副本实例节点之间的通信连接关系的过程可以实现为:Taking any one of the session state components of each replica instance node as an example, the process of establishing a communication connection relationship between the replica instance nodes can be implemented as follows:
通过目标会话状态同步组件实时读取路由分发列表中的副本实例节点的IP信息,该路由分发列表中包含至少两个副本实例节点的路由信息;该目标会话状态同步组件是至少两个会话状态同步组件中的任意一个;Reading the IP information of the replica instance node in the routing distribution list in real time through the target session state synchronization component, the routing distribution list includes routing information of at least two replica instance nodes; the target session state synchronization component is any one of the at least two session state synchronization components;
向其他会话状态同步组件发送组网请求;Send networking requests to other session state synchronization components;
在接收到其他会话状态同步组件返回的组网确认信息后,建立目标会话状态同步组件与其他会话状态同步组件之间的通信连接关系。After receiving the networking confirmation information returned by other session state synchronization components, a communication connection relationship is established between the target session state synchronization component and other session state synchronization components.
可选的,每个会话状态同步组件主动发起组网,并维护组网信息。Optionally, each session state synchronization component actively initiates networking and maintains networking information.
示意性的,对于已存在的会话状态同步组件而言,在副本实例扩容时,各个会话状态同步组件通过实时读取路由分发列表,发现新增的副本实例节点,向该副本实例节点发起组网请求;在副本实例缩容时,各个会话状态同步组件通过实时读取路由分发列表,发现某个副本实例节点不可用,将该副本实例节点的会话状态同步组件的信息从组网信息中删除。Illustratively, for existing session state synchronization components, when a replica instance is expanded, each session state synchronization component discovers a newly added replica instance node by reading the routing distribution list in real time, and initiates a networking request to the replica instance node; when a replica instance is reduced in capacity, each session state synchronization component discovers that a replica instance node is unavailable by reading the routing distribution list in real time, and deletes the information of the session state synchronization component of the replica instance node from the networking information.
为了确定组网状态,会话状态同步组件之间可以相互发送心跳探测请求,并进行请求响应,在将探测失败节点的确认为不可用,并将路由分发列表中探测失败节点的状态标记为不可用。In order to determine the networking status, the session state synchronization components can send heartbeat detection requests to each other and respond to the requests. When the detection failure node is confirmed as unavailable, the status of the detection failure node in the routing distribution list is marked as unavailable.
以两个会话状态同步组件之间的会话信息同步过程为例,图3示出了本申请一示例性实施例提供的会话信息同步过程的交互示意图,如图3所示,会话状态同步组件1与会话状态同步组件2相互发送组网广播,在分别接收到各自的组网确认信息后,建立两者之间的通信连接关系;在组网成功后,两个会话状态同步组件之间周期性发送心跳探测请求,在接收到对应的请求响应之后,确定探测成功,在未接收到对应的请求响应时,确定探测失败。Taking the session information synchronization process between two session state synchronization components as an example, Figure 3 shows an interactive schematic diagram of the session information synchronization process provided by an exemplary embodiment of the present application. As shown in Figure 3, session state synchronization component 1 and session state synchronization component 2 send networking broadcasts to each other, and after receiving their respective networking confirmation information, establish a communication connection relationship between the two; after the networking is successful, the two session state synchronization components periodically send heartbeat detection requests, and after receiving the corresponding request response, determine that the detection is successful, and when the corresponding request response is not received, determine that the detection has failed.
当新增副本实例节点或者新增会话信息时,两个会话状态组件各自执行对应的会话同步流程,并更新保存于本地的会话信息表中,会话信息表的结构如表3所示:When a new replica instance node or new session information is added, the two session state components each execute the corresponding session synchronization process and update the session information table saved locally. The structure of the session information table is shown in Table 3:
表3Table 3
其中,会话ID是会话的唯一标识;会话Cookie用于记录转发到对应后端实列的IP地址和端口信息;最后连接时间是指会话最后一次连接的时间。当超过设置的超时时间(T超时时间=T当前时间-T最后连接时间)时,将该条会话信息从表里删除;同步状态用于标记和组网的其他节点会话信息是否同步。Among them, the session ID is the unique identifier of the session; the session cookie is used to record the IP address and port information forwarded to the corresponding backend instance; the last connection time refers to the time when the session was last connected. When the set timeout time (Ttimeout time = Tcurrent time - Tlast connection time ) is exceeded, the session information is deleted from the table; the synchronization status is used to mark whether the session information is synchronized with other nodes in the network.
会话状态组件之间的会话同步包括全量同步以及差异同步;其中,当分布式软件负载均衡系统中新增副本实例节点时,会话同步为全量同步,即该新增副本实例节点的会话状态同步组件与组网内的任意副本实例节点的会话信息表中的全部记录进行全量同步。当新的会话产生或会话的最后连接时间更新时,会话同步为差异同步,其中,在新的会话产生时,所在副本实例节点的会话状态同步组件生成新的会话ID,并将该会话ID相关信息更新至会话信息表,同时通过会话状态同步组件之间的信息交互,向组内的其他n-1个副本实例节点的会话信息表同步该新增记录。在会话最后连接时间更新时,所在副本实例节点的会话状态同步组件通过会话状态同步组件之间的信息交互,将更新的最后连接时间同步到组网内的其他n-1个副本实例节点的会话信息表。此外,当会话超时时,所在副本实例节点删除会话信息表中的对应会话信息,并通过会话状态同步组件之间的信息交互指示其他n-1个副本实例节点删除会话信息表中的对应会话信息。The session synchronization between session state components includes full synchronization and differential synchronization; wherein, when a new replica instance node is added to the distributed software load balancing system, the session synchronization is full synchronization, that is, the session state synchronization component of the newly added replica instance node is fully synchronized with all records in the session information table of any replica instance node in the network. When a new session is generated or the last connection time of the session is updated, the session synchronization is differential synchronization, wherein, when a new session is generated, the session state synchronization component of the replica instance node generates a new session ID, and updates the session ID related information to the session information table, and at the same time synchronizes the newly added record to the session information table of the other n-1 replica instance nodes in the group through information interaction between the session state synchronization components. When the last connection time of the session is updated, the session state synchronization component of the replica instance node synchronizes the updated last connection time to the session information table of the other n-1 replica instance nodes in the network through information interaction between the session state synchronization components. In addition, when the session times out, the replica instance node deletes the corresponding session information in the session information table, and instructs the other n-1 replica instance nodes to delete the corresponding session information in the session information table through information interaction between the session state synchronization components.
会话状态组件之间的会话同步过程如图3所示,若会话状态同步组件1对应的副本实例节点为组网中新增的副本实例节点时,会话状态同步组件1通过全量同步指令与会话状态同步组件2对会话信息表中的全部记录进行全量同步;而当后续有新的会话产生或者会话最后连接时间更新等情况时,通过差异同步指令将更新的信息与组网内的会话状态同步组件2进行同步。The session synchronization process between session state components is shown in Figure 3. If the replica instance node corresponding to the session state synchronization component 1 is a newly added replica instance node in the network, the session state synchronization component 1 synchronizes all records in the session information table with the session state synchronization component 2 through a full synchronization instruction; and when a new session is generated or the last connection time of the session is updated, the updated information is synchronized with the session state synchronization component 2 in the network through a differential synchronization instruction.
由于各个副本实例节点的会话状态同步组件之间的通信连接关系的建立以及各个会话状态同步组件实现的副本实例节点之间的信息同步,使得在某一副本实例节点上的业务流量请求被转发到其他副本实例节点中时,其他副本实例节点可以直接获取业务流量请求在原副本实例节点上的原有会话信息,消除原会话信息缺失造成对业务的影响在各个副本实例节点中均保留在以分布式软件负载均衡系统内的一个副本实例节点发生故障的情况为例,该方法还包括:Due to the establishment of the communication connection relationship between the session state synchronization components of each replica instance node and the information synchronization between the replica instance nodes implemented by each session state synchronization component, when the service flow request on a certain replica instance node is forwarded to other replica instance nodes, the other replica instance nodes can directly obtain the original session information of the service flow request on the original replica instance node, eliminating the impact on the service caused by the loss of the original session information. All the information is retained in each replica instance node. Taking the case where a replica instance node in the distributed software load balancing system fails as an example, the method also includes:
在第一副本实例节点发生异常,且第一副本实例节点中存在正在处理的目标业务流量请求时,通过路由转发组件将目标业务流量请求转发到第二副本实例节点;第一副本实例节点与第二副本实例节点是分布式软件负载均衡系统内的副本实例节点;When an exception occurs in the first replica instance node and there is a target business traffic request being processed in the first replica instance node, the target business traffic request is forwarded to the second replica instance node through the routing forwarding component; the first replica instance node and the second replica instance node are replica instance nodes in the distributed software load balancing system;
通过第二副本实例节点调用目标业务流量请求的历史会话信息对目标业务流量请求继续进行处理。The target service traffic request is continued to be processed by calling the historical session information of the target service traffic request through the second replica instance node.
综上所述,本申请实施例提供的负载均衡系统的管理方法,通过在分布式软件负载均衡系统中设置统一的入口节点,用以接收业务流量请求,并通过入口节点的路由转发组件查询各个副本实例节点的路由信息,根据各个副本实例节点的路由信息将业务流量请求均衡分发到各个副本实例节点中进行处理。通过统一分布式负载均衡系统中多副本实例节点的流量入口,以及在分布式负载均衡系统中对业务流量请求直接路由转发,可以实现业务对分布式软件负载均衡系统的多副本实例节点变化无感知,减小副本实例变化对业务的影响程度,提高了系统稳定性以及用户体验效果;In summary, the management method of the load balancing system provided in the embodiment of the present application is to set a unified entry node in the distributed software load balancing system to receive business traffic requests, and query the routing information of each replica instance node through the routing forwarding component of the entry node, and evenly distribute the business traffic requests to each replica instance node for processing according to the routing information of each replica instance node. By unifying the traffic entry of multiple replica instance nodes in the distributed load balancing system and directly routing and forwarding business traffic requests in the distributed load balancing system, it is possible to achieve that the business is unaware of the changes in the multiple replica instance nodes of the distributed software load balancing system, reduce the impact of replica instance changes on the business, and improve system stability and user experience.
此外,通过为分布式软件均衡系统中的每个副本实例节点进行对应的会话状态同步组件配置,可以实现副本实例节点间的会话信息同步,副本实例节点之间对等,消除了副本实例故障切换时新建会话导致原有会话信息丢失对业务的影响,进一步提高了系统稳定性以及用户体验效果。In addition, by configuring corresponding session state synchronization components for each replica instance node in the distributed software balancing system, session information synchronization between replica instance nodes can be achieved, and replica instance nodes can be equal, eliminating the impact of the loss of original session information caused by the creation of new sessions during replica instance failover on the business, further improving system stability and user experience.
图4示出了本申请一示例性实施例提供的分布式负载均衡系统的架构图,如图4所示,该分布式软件均衡系统中包含路由分发层410,负载均衡处理层420以及业务处理层430。其中,路由分发层410负责提供统一的业务流量请求入口IP和流量分发功能。负载均衡处理层420负责将业务流量请求转发至下层应用服务,实现服务路由功能,并通过会话同步技术实现在不同副本实例之间的会话信息同步。业务处理层430负责处理具体的业务请求。FIG4 shows an architecture diagram of a distributed load balancing system provided by an exemplary embodiment of the present application. As shown in FIG4 , the distributed software balancing system includes a routing distribution layer 410, a load balancing processing layer 420, and a business processing layer 430. Among them, the routing distribution layer 410 is responsible for providing a unified business traffic request entry IP and traffic distribution function. The load balancing processing layer 420 is responsible for forwarding business traffic requests to lower-level application services, realizing service routing functions, and realizing session information synchronization between different replica instances through session synchronization technology. The business processing layer 430 is responsible for processing specific business requests.
在分布式负载均衡系统中,入口节点开启了ARP响应,副本实例节点关闭了ARP响应,因此,入口节点可以响应ARP广播请求,而副本实例节点抑制APR广播请求,使得入口节点对业务流量请求可达,业务流量请求均统一从入口节点进行分布式软件负载均衡系统;图5示出了本申请一示例性实施例提供的统一入口节点流量分发过程的示意图,如图5所示在通过统一的入口节点将接收到业务流量请求后,向路由分发层中的路由转发组件发送业务请求,路由转发组件从TCP连接表和/或路由分发表中查询各个业务流量请求对应的副本实例节点,并进行业务流量请求分发,基于业务流量请求分发结果将对应的业务流量请求发送到负载均衡处理层中的副本实例节点中;副本实例节点接收到业务流量请求后,通过本机TCP/IP协议栈进入副本实例处理,并通过会话同步组件保持多个副本实例节点之间的会话信息同步,每个副本实例节点对等;其中,副本实例处理时,各个副本实例节点根据用户设置的负载均衡算法将业务请求转发到业务处理层中对应的应用服务中,应用服务响应业务流量请求,并通过副本实例节点将请求响应返回至客户端。In the distributed load balancing system, the entry node turns on ARP response and the replica instance node turns off ARP response. Therefore, the entry node can respond to ARP broadcast requests, while the replica instance node suppresses ARP broadcast requests, so that the entry node is reachable to the service traffic request, and the service traffic requests are uniformly processed from the entry node in the distributed software load balancing system; Figure 5 shows a schematic diagram of a unified entry node traffic distribution process provided by an exemplary embodiment of the present application. As shown in Figure 5, after receiving the service traffic request through the unified entry node, the service request is sent to the routing forwarding component in the routing distribution layer, and the routing forwarding component queries each service traffic from the TCP connection table and/or the routing distribution table. Request the corresponding replica instance node and distribute the business traffic request. Based on the business traffic request distribution result, send the corresponding business traffic request to the replica instance node in the load balancing processing layer. After receiving the business traffic request, the replica instance node enters the replica instance processing through the local TCP/IP protocol stack, and keeps the session information between multiple replica instance nodes synchronized through the session synchronization component, and each replica instance node is equal. During the replica instance processing, each replica instance node forwards the business request to the corresponding application service in the business processing layer according to the load balancing algorithm set by the user. The application service responds to the business traffic request and returns the request response to the client through the replica instance node.
图6示出了本申请一示例性实施例提供的负载均衡系统的管理装置的方框图,该装置可以执行如图1或图2所示实施例的全部或部分步骤,如图6所示,该负载均衡系统的管理装置可以包括:FIG6 shows a block diagram of a management device of a load balancing system provided by an exemplary embodiment of the present application. The device may execute all or part of the steps of the embodiment shown in FIG1 or FIG2 . As shown in FIG6 , the management device of the load balancing system may include:
接收模块610,用于通过入口节点接收目标业务流量请求;所述入口节点是分布式软件负载均衡系统中开启地址解析协议ARP响应的节点;The receiving module 610 is used to receive a target service traffic request through an entry node; the entry node is a node in the distributed software load balancing system that enables the address resolution protocol ARP response;
查询模块620,用于通过所述入口节点的路由转发组件查询所述目标业务流量请求对应的各个副本实例节点的路由信息;所述副本实例节点是所述分布式软件负载均衡系统中未开启ARP响应的节点;所述路由信息中包含节点互联网协议IP地址以及节点媒体访问控制MAC地址;The query module 620 is used to query the routing information of each replica instance node corresponding to the target service traffic request through the routing forwarding component of the entry node; the replica instance node is a node in the distributed software load balancing system that does not enable ARP response; the routing information includes a node Internet Protocol IP address and a node Media Access Control MAC address;
分发模块630,用于基于查询到的所述目标业务流量请求对应的各个副本实例节点的路由信息,通过所述路由转发组件按照均衡分发原则将所述目标业务流量请求分发到对应的副本实例节点中进行处理。The distribution module 630 is used to distribute the target business traffic request to the corresponding replica instance node for processing according to the balanced distribution principle through the routing forwarding component based on the queried routing information of each replica instance node corresponding to the target business traffic request.
在一种可能的实现方式中,所述分发模块630,包括:In a possible implementation, the distribution module 630 includes:
查询子模块,用于基于查询到所述目标业务流量请求对应的各个副本实例节点的路由信息,通过所述路由转发组件将所述目标业务流量请求对应的目的MAC地址修改为目标副本实例节点的节点MAC地址;所述目标副本实例节点是所述业务流量请求对应的各个副本实例节点中的一个;A query submodule, configured to modify the destination MAC address corresponding to the target service traffic request to a node MAC address of a target replica instance node through the routing forwarding component based on the query of the routing information of each replica instance node corresponding to the target service traffic request; the target replica instance node is one of the replica instance nodes corresponding to the service traffic request;
分发子模块,用于基于所述目标业务流量请求对应的节点MAC地址,将所述目标业务流量请求路由转发到所述目标副本实例节点中进行处理。The distribution submodule is used to route and forward the target business traffic request to the target replica instance node for processing based on the node MAC address corresponding to the target business traffic request.
在一种可能的实现方式中,各个副本实例节点具有对应的会话状态同步组件,所述装置还包括:In a possible implementation, each replica instance node has a corresponding session state synchronization component, and the device further includes:
同步模块,用于在通过各个副本实例节点对对应的业务流量请求进行处理的过程中,通过各个副本实例节点的会话状态同步组件,将各个副本实例节点产生的业务会话信息实时同步到分布式软件负载均衡系统内的其他副本实例节点中;所述分布式软件负载均衡系统内的各个副本实例节点的会话状态同步组件之间建立有通信连接关系。The synchronization module is used to synchronize the business session information generated by each replica instance node to other replica instance nodes in the distributed software load balancing system in real time through the session state synchronization component of each replica instance node during the process of processing the corresponding business traffic request through each replica instance node; a communication connection relationship is established between the session state synchronization components of each replica instance node in the distributed software load balancing system.
在一种可能的实现方式中,所述装置还包括:In a possible implementation manner, the device further includes:
流量转发模块,用于在第一副本实例节点发生异常,且所述第一副本实例节点中存在正在处理的第一业务流量请求时,通过所述路由转发组件将所述第一业务流量请求转发到第二副本实例节点;所述第一副本实例节点与第二副本实例节点是所述分布式软件负载均衡系统内的副本实例节点;A traffic forwarding module, configured to forward the first service traffic request to a second replica instance node through the routing forwarding component when an exception occurs in the first replica instance node and there is a first service traffic request being processed in the first replica instance node; the first replica instance node and the second replica instance node are replica instance nodes in the distributed software load balancing system;
处理模块,用于通过所述第二副本实例节点调用所述第一业务流量请求的历史会话信息对所述第一业务流量请求继续进行处理。A processing module is used to continue processing the first business traffic request by calling the historical session information of the first business traffic request through the second replica instance node.
在一种可能的实现方式中,所述装置还包括:In a possible implementation manner, the device further includes:
读取模块,用于通过目标会话状态同步组件实时读取路由分发列表中的副本实例节点的IP信息,所述路由分发列表中包含至少两个副本实例节点的路由信息;所述目标会话状态同步组件是至少两个会话状态同步组件中的任意一个;A reading module, used to read in real time the IP information of the replica instance node in the routing distribution list through the target session state synchronization component, wherein the routing distribution list contains routing information of at least two replica instance nodes; the target session state synchronization component is any one of the at least two session state synchronization components;
请求发送模块,用于向其他会话状态同步组件发送组网请求;A request sending module, used to send a networking request to other session state synchronization components;
关系建立模块,用于在接收到其他会话状态同步组件返回的组网确认信息后,建立所述目标会话状态同步组件与其他会话状态同步组件之间的通信连接关系。The relationship establishing module is used to establish a communication connection relationship between the target session state synchronization component and other session state synchronization components after receiving the networking confirmation information returned by other session state synchronization components.
在一种可能的实现方式中,所述装置还包括:In a possible implementation manner, the device further includes:
节点创建模块,用于基于用户发起的创建请求,创建并启动n+1个副本实例节点;n为正整数;The node creation module is used to create and start n+1 replica instance nodes based on the creation request initiated by the user; n is a positive integer;
地址生成模块,用于通过入口控制组件生成入口节点IP地址;An address generation module, used to generate an entry node IP address through an entry control component;
节点选取模块,用于通过所述入口控制组件从n+1个副本实例节点中选取一个作为候选入口节点;A node selection module, used to select one of the n+1 replica instance nodes as a candidate entry node through the entry control component;
第一节点配置模块,用于为所述候选入口节点配置所述入口节点IP地址以及开启所述候选入口节点的ARP响应,得到所述入口节点;A first node configuration module, configured to configure the entry node IP address for the candidate entry node and enable the ARP response of the candidate entry node to obtain the entry node;
第二节点配置模块,用于为剩余n个副本实例节点配置对应的节点IP地址以及关闭剩余n个副本实例节点的ARP响应。The second node configuration module is used to configure corresponding node IP addresses for the remaining n replica instance nodes and to close the ARP responses of the remaining n replica instance nodes.
在一种可能的实现方式中,所述查询模块620,包括:In a possible implementation, the query module 620 includes:
信息获取子模块,用于获取所述目标业务流量请求的五元组信息;所述五元组信息包括源IP地址、目标IP地址、源端口号、目标端口号以及传输协议;An information acquisition submodule, used to acquire the five-tuple information of the target service traffic request; the five-tuple information includes a source IP address, a target IP address, a source port number, a target port number, and a transmission protocol;
第一查询子模块,用于基于所述目标业务流量请求的五元组信息对应的连接五元组哈希查询传输控制协议TCP连接表,以获取业务流量请求对应的副本实例节点的路由信息;其中,连接五元组哈希是指对五元组信息进行哈希计算得到的哈希值;所述TCP连接表中包含TCP连接哈希值以及对应的副本实例节点的路由信息;The first query submodule is used to query the transmission control protocol TCP connection table based on the connection five-tuple hash corresponding to the five-tuple information of the target business traffic request to obtain the routing information of the replica instance node corresponding to the business traffic request; wherein the connection five-tuple hash refers to the hash value obtained by hashing the five-tuple information; the TCP connection table contains the TCP connection hash value and the corresponding routing information of the replica instance node;
第二查询子模块,用于在所述目标业务流量请求对应的所述连接五元组哈希与所述TCP连接表中的TCP连接哈希值不匹配时,基于所述目标业务流量请求的五元组信息从路由分发列表中查询所述目标业务流量请求对应副本实例节点的路由信息。The second query sub-module is used to query the routing information of the replica instance node corresponding to the target business traffic request from the routing distribution list based on the quintuple information of the target business traffic request when the connection quintuple hash corresponding to the target business traffic request does not match the TCP connection hash value in the TCP connection table.
综上所述,本申请实施例提供的负载均衡系统的管理装置,通过在分布式软件负载均衡系统中设置统一的入口节点,用以接收业务流量请求,并通过入口节点的路由转发组件查询各个副本实例节点的路由信息,根据各个副本实例节点的路由信息将业务流量请求均衡分发到各个副本实例节点中进行处理。通过统一分布式负载均衡系统中多副本实例节点的流量入口,以及在分布式负载均衡系统中对业务流量请求直接路由转发,可以实现业务对分布式软件负载均衡系统的多副本实例节点变化无感知,减小副本实例变化对业务的影响程度,提高了系统稳定性以及用户体验效果。In summary, the management device of the load balancing system provided in the embodiment of the present application sets a unified entry node in the distributed software load balancing system to receive business traffic requests, and queries the routing information of each replica instance node through the routing forwarding component of the entry node, and evenly distributes the business traffic requests to each replica instance node for processing according to the routing information of each replica instance node. By unifying the traffic entry of multiple replica instance nodes in the distributed load balancing system and directly routing and forwarding business traffic requests in the distributed load balancing system, it is possible to achieve that the business is unaware of the changes in the multiple replica instance nodes of the distributed software load balancing system, reduce the impact of the replica instance changes on the business, and improve the system stability and user experience.
图7示出了本申请一示例性实施例示出的计算机设备700的结构框图。该计算机设备可以实现为本申请上述方案中的分布式软件负载均衡系统。所述计算机设备700包括中央处理单元(Central Processing Unit,CPU)701、包括随机存取存储器(Random AccessMemory,RAM)702和只读存储器(Read-Only Memory,ROM)703的系统存储器704,以及连接系统存储器704和中央处理单元701的系统总线705。所述计算机设备700还包括用于存储操作系统709、应用程序710和其他程序模块711的大容量存储设备706。FIG7 shows a block diagram of a computer device 700 shown in an exemplary embodiment of the present application. The computer device can be implemented as a distributed software load balancing system in the above-mentioned solution of the present application. The computer device 700 includes a central processing unit (CPU) 701, a system memory 704 including a random access memory (RAM) 702 and a read-only memory (ROM) 703, and a system bus 705 connecting the system memory 704 and the central processing unit 701. The computer device 700 also includes a large-capacity storage device 706 for storing an operating system 709, an application program 710, and other program modules 711.
不失一般性,所述计算机可读介质可以包括计算机存储介质和通信介质。计算机存储介质包括以用于存储诸如计算机可读指令、数据结构、程序模块或其他数据等信息的任何方法或技术实现的易失性和非易失性、可移动和不可移动介质。计算机存储介质包括RAM、ROM、可擦除可编程只读寄存器(Erasable Programmable Read Only Memory,EPROM)、电子抹除式可复写只读存储器(Electrically-Erasable Programmable Read-OnlyMemory,EEPROM)闪存或其他固态存储其技术,CD-ROM、数字多功能光盘(DigitalVersatile Disc,DVD)或其他光学存储、磁带盒、磁带、磁盘存储或其他磁性存储设备。当然,本领域技术人员可知所述计算机存储介质不局限于上述几种。上述的系统存储器704和大容量存储设备706可以统称为存储器。Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, Erasable Programmable Read Only Memory (EPROM), Electronically-Erasable Programmable Read-Only Memory (EEPROM) flash memory or other solid-state storage technology, CD-ROM, Digital Versatile Disc (DVD) or other optical storage, cassette, tape, disk storage or other magnetic storage devices. Of course, those skilled in the art will know that the computer storage medium is not limited to the above. The above-mentioned system memory 704 and mass storage device 706 can be collectively referred to as memory.
根据本申请的各种实施例,所述计算机设备700还可以通过诸如因特网等网络连接到网络上的远程计算机运行。也即计算机设备700可以通过连接在所述系统总线705上的网络接口单元707连接到网络708,或者说,也可以使用网络接口单元707来连接到其他类型的网络或远程计算机系统(未示出)。According to various embodiments of the present application, the computer device 700 can also be connected to a remote computer on the network through a network such as the Internet. That is, the computer device 700 can be connected to the network 708 through the network interface unit 707 connected to the system bus 705, or the network interface unit 707 can be used to connect to other types of networks or remote computer systems (not shown).
所述存储器还包括至少一条指令、至少一段程序、代码集或指令集,所述至少一条指令、至少一段程序、代码集或指令集存储于存储器中,中央处理器701通过执行该至少一条指令、至少一段程序、代码集或指令集来实现上述各个实施例所示的负载均衡系统的管理方法中的全部或部分步骤。The memory also includes at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is stored in the memory. The central processing unit 701 implements all or part of the steps in the management method of the load balancing system shown in the above-mentioned embodiments by executing the at least one instruction, at least one program, code set or instruction set.
在一示例性实施例中,还提供了一种计算机可读存储介质,该计算机可读存储介质中存储有至少一条计算机程序,该计算机程序由处理器加载并执行以实现上述负载均衡系统的管理方法中的全部或部分步骤。例如,该计算机可读存储介质可以是只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、只读光盘(Compact Disc Read-Only Memory,CD-ROM)、磁带、软盘和光数据存储设备等。In an exemplary embodiment, a computer-readable storage medium is also provided, in which at least one computer program is stored, and the computer program is loaded and executed by a processor to implement all or part of the steps in the management method of the load balancing system. For example, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.
在一示例性实施例中,还提供了一种计算机程序产品,该计算机程序产品包括至少一条计算机程序,该计算机程序由处理器加载并执行上述图1或图2任一实施例所示的负载均衡系统的管理方法的全部或部分步骤。In an exemplary embodiment, a computer program product is also provided, which includes at least one computer program, which is loaded by a processor and executes all or part of the steps of the load balancing system management method shown in any of the embodiments of Figure 1 or Figure 2.
本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本申请的其它实施方案。本申请旨在涵盖本申请的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本申请的一般性原理并包括本申请未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本申请的真正范围和精神由下面的权利要求指出。Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
应当理解的是,本申请并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本申请的范围仅由所附的权利要求来限制。It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202311616188.8ACN118802920A (en) | 2023-11-29 | 2023-11-29 | Management method, device, equipment and storage medium of load balancing system |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202311616188.8ACN118802920A (en) | 2023-11-29 | 2023-11-29 | Management method, device, equipment and storage medium of load balancing system |
| Publication Number | Publication Date |
|---|---|
| CN118802920Atrue CN118802920A (en) | 2024-10-18 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202311616188.8APendingCN118802920A (en) | 2023-11-29 | 2023-11-29 | Management method, device, equipment and storage medium of load balancing system |
| Country | Link |
|---|---|
| CN (1) | CN118802920A (en) |
| Publication | Publication Date | Title |
|---|---|---|
| TWI813743B (en) | Independent datastore in a network routing environment | |
| US8582469B2 (en) | Peer-to-peer network including routing protocol enhancement | |
| US7859992B2 (en) | Router redundancy in data communication networks | |
| US7684352B2 (en) | Distributed storage of routing information in a link state protocol controlled network | |
| CN101535977B (en) | Consistency within the federation infrastructure | |
| JP5227955B2 (en) | A distributed hash mechanism for self-regulating networks | |
| CN106549875B (en) | A session management method, device and load balancer | |
| US9432321B2 (en) | Method and apparatus for messaging in the cloud | |
| CN118802920A (en) | Management method, device, equipment and storage medium of load balancing system | |
| US12445324B2 (en) | Single node and multiple node datastore architecture in a network routing environment | |
| CN119182828B (en) | Extranet access method, device, computer equipment, readable storage medium and product |
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |