Network load balancing solutions typically fall into two categories: hardware and software. Implementing a single-tier front-end server to distribute packets across target servers in a cluster does not typically require manipulation of the servers in the cluster. However, purchasing a high-end server or hardware load balancer to sit in front of the cluster can be very costly.
To avoid the purchase of expensive hardware, commodity switches and software sitting on each target server in the cluster may be used to achieve the desired load balancing results. The switch sitting in front of the cluster is configured to send each packet to every target server in the cluster. Software running on each target server then runs the same algorithm to decide whether to keep or drop the packet. For each packet, one server in the cluster will process the packet, while all the other servers in the cluster will drop the packet. This method achieves load balancing, but the flooding of packets to every target server consumes a lot of network bandwidth and causes the switch to operate suboptimally.
The following presents a simplified summary of the disclosure in order to provide a basic understanding to the reader. This summary is not an extensive overview of the disclosure and it does not identify key/critical elements of the invention or delineate the scope of the invention. Its sole purpose is to present some concepts disclosed herein in a simplified form as a prelude to the more detailed description that is presented later.
Described herein are various technologies and techniques directed to methods and systems for load balancing via rotation of cluster identity. In accordance with one implementation of the described technologies, a cluster identity is assigned to one of the servers in a cluster of servers. The MAC address of the server owning the cluster identity is replaced with a cluster MAC address. A packet is sent from the server owning the cluster identity to a switch. One or more packets may then be received at the server owning the cluster identity from the switch. After a predetermined amount of time, the MAC address of the server owning the cluster identity is replaced with its original MAC address. The cluster identity is rotated to another server in the cluster and the process is repeated.
In another implementation of the described technologies, one of the servers in a cluster of servers is assigned the cluster identity. A packet having the cluster MAC address as the source address is sent from the server owning the cluster identity to a switch. One or more packets may be received at the server owning the cluster identity from the switch. Any packets sent from any server that does not own the cluster identity has a source address that is different from the cluster MAC address. After a predetermined amount of time, the cluster identity is rotated to another server in the cluster and the process is repeated.
In another implementation of the described technologies, one of the servers in a cluster of servers is assigned the cluster identity. A request is received from a router inquiring which MAC address maps to a cluster IP address. A response is sent indicating that the MAC address of the server owning the cluster identity maps to the cluster IP address. The response may be sent from any of the servers in the cluster. Upon receipt of the response, the router updates its router table to map the MAC address of the server owning the cluster identity to the cluster IP address. Packets with the cluster IP address as the destination IP address are then forwarded to the server owning the cluster identity. After a predetermined amount of time, the cluster identity is rotated to another server in the cluster, and the process is repeated.
Many of the attendant features will be more readily appreciated as the same becomes better understood by reference to the following detailed description considered in connection with the accompanying drawings.
The present description will be better understood from the following detailed description read in light of the accompanying drawings, wherein:
Like reference numerals are used to designate like parts in the accompanying drawings.
The detailed description provided below in connection with the appended drawings is intended as a description of the present examples and is not intended to represent the only forms in which the present example may be constructed or utilized. The description sets forth the functions of the example and the sequence of steps for constructing and operating the example. However, the same or equivalent functions and sequences may be accomplished by different examples.
Alternatively, load balancing may be achieved by rotation of cluster identity. The cluster identity may be assigned to one of the plurality of servers in system 100 and then rotated to another server after a predetermined amount of time. The MAC address of the server owning the cluster identity is changed to the cluster MAC address that maps to the cluster virtual IP address. For example, as shown in
After a predetermined amount of time, the cluster identity is rotated from server 104 to another server in system 100. The rotation of cluster identity may be done randomly, in a round robin manner, or by any other method to achieve load balancing. The predetermined amount of time may also be selected randomly or by any other algorithm. For example, after a predetermined time of three seconds, the cluster identity may be rotated from server 104 to server 106. MAC address X would be removed from server 104 and replaced with the original MAC address of X1. MAC address X2 would be removed from server 106 and replaced with MAC address X. Then, server 106 may send a packet to switch 102 with a source address of X. The packet sent to switch 102 may be a gratuitous packet. For example, the packet sent to switch 102 may be a membership heartbeat packet, which is a packet sent from one server in the cluster to let the other servers in the cluster know that it is alive so every server in the cluster has a consistent view of the cluster membership. After receiving a packet from server 106 with the source address of X, switch 102 learns that MAC address X is associated with server 106 and forwards packets with a destination MAC address of X to server 106. Then, after a predetermined amount of time, the cluster identity would be rotated to another server in system 100. For example, after a predetermined time of three seconds, the cluster identity may be rotated from server 106 to server 108. MAC address X would be removed from server 106 and replaced with the original MAC address of X2. MAC address X3 would be removed from server 108 and replaced with MAC address X. Then, server 108 may send a packet to switch 102 with a source address of X. Switch 102 learns that MAC address X is associated with server 108 and forwards incoming packets with a destination MAC address of X to server 108. Then, after a predetermined amount of time, the cluster identity would be rotated from server 108 to another server in system 100. The process continues and incoming packets are appropriately load balanced among the plurality of servers in the system.
After a predetermined amount of time, the cluster identity may be rotated to another server in the cluster. The server that owns the cluster identity would start sending packets with a source address of X. The other servers in the cluster would use spoofed or modified source addresses when sending packets. For example, after 10 seconds, the cluster identity may be rotated from server 204 to server 208. Server 208 would start using the source address X when sending packets. Servers 204 and server 206 would use spoofed or modified source addresses when sending packets. For instance, server 206 may use the source address X2 when sending packets and server 204 may use the source address X1 when sending packets. Server 208 may send a gratuitous packet, such as a heartbeat packet, to switch 202 so that switch 202 will learn that MAC address X is now associated with server 208. Switch 202 would then forward packets with a destination MAC address of X to server 208. After a predetermined amount of time, the cluster identity would rotate to another server in the cluster. The process continues and incoming packets are appropriately load balanced among the plurality of servers in the system.
The router 310 maintains a router table that maps IP addresses to MAC addresses. The router 310 may periodically send out a request to update a mapping of an IP address to a MAC address. The request may be an Address Resolution Protocol (ARP) request. The request sent by router 310 may ask which MAC address maps to a specified cluster IP address. One or more of the plurality of servers in system 300 would respond to this request from router 310 with the MAC address of the server that currently owns the cluster identity. For example, suppose the cluster identity is assigned to server 304, which has a MAC address of X1. When router 310 sends out a request inquiring which MAC address maps to IP address A, server 304, 306, and/or 308 may respond to the request with the MAC address X1. Upon receipt of the response to the request, router 310 would update its router table to map IP address A to MAC address X1. Then, incoming packets with a destination IP address A would be forwarded to server 304.
After a predetermined amount of time, the cluster identity would be rotated to another server in the cluster. For example, after 5 seconds, the cluster identity may be rotated from server 304 to server 306. When the router 310 sends a request inquiring which MAC address maps to IP address A, server 304, 306, and/or 308 would respond with the MAC address X2. Alternatively, after obtaining the cluster identity, server 306 may send a gratuitous response, such as a gratuitous ARP, that indicates a mapping of the IP address A to MAC address X2 so that router 310 may update its router table. After the router table of router 310 is updated to map IP address A to MAC address X2, incoming packets with a destination IP address of A would be forwarded to server 306. After a predetermined amount of time, the cluster identity would be rotated from server 306 to another server in the system 300, and the process continues.
In the systems of
As shown in
The technologies described herein may be operational with numerous other general purpose or special purpose computing environments or configurations. Examples of well known computing environments and/or configurations that may be suitable for use with the technologies described herein include, but are not limited to, personal computers, server computers, hand-held or laptop devices, tablet devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like.
With reference to
Processing unit 812 may include one or more general or special purpose processors, ASICs, or programmable logic chips. Depending on the configuration and type of computing device, memory 814 may be volatile (such as RAM), non-volatile (such as ROM, flash memory, etc.) or some combination of the two. Computing device 810 may also include additional storage (removable and/or non-removable) including, but not limited to, magnetic or optical disks or tape. Such additional storage is illustrated in
Computing device 810 may also contain communication connection(s) 822 that allow the computing device 810 to communicate with other devices, such as with other computing devices through network 830. Communications connection(s) 822 is an example of communication media. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. The term ‘modulated data signal’ means a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, radio frequency, infrared, and other wireless media. The term computer readable media as used herein includes storage media.
Computing device 810 may also have input device(s) 818 such as a keyboard, a mouse, a pen, a voice input device, a touch input device, and/or any other input device. Output device(s) 820 such as one or more displays, speakers, printers, and/or any other output device may also be included.
While the invention has been described in terms of several exemplary implementations, those of ordinary skill in the art will recognize that the invention is not limited to the implementations described, but can be practiced with modification and alteration within the spirit and scope of the appended claims. The description is thus to be regarded as illustrative instead of limiting.