Lec7 English
Lec7 English
عبدالملك الحميري/د
Introduction
2
Introduction
3
Why load balancing is employed
The required capacity is too large for a single machine. When running
processes that consume a large amount of system resources (e.g. CPU and
memory), it often makes sense to employ multiple servers to distribute the
work instead of constantly adding capacity to a single server. In plenty of
cases, it’s not even possible to allocate enough memory or CPU to a single
machine to handle all of the work! Load balancing across multiple servers
makes it possible to host high traffic websites or run complex data
processing jobs that demand more resources than a single server can deliver.
4
why load balancing is employed
5
Redundancy
Servers crash, this is the rule, not the exception. Your architecture should be
devised in a way to reduce or eliminate single points of failure (SPOF). Load
balancing a cluster of servers that perform the same role provides room for a
server to be taken out manually for maintenance tasks, without taking down the
system. You can also withstand a server crashing. This is called High
Availability, or HA for short. Load balancing is a tactic that assists with High
Availability, but is not High Availability by itself. To achieve high availability,
you need automated monitoring that checks the status of the applications in your
cluster, and automates taking servers out of rotation, in response to failure
detected. These tools are often bundled into Load Balancing software and
appliances, but sometimes need to be programmed independently
6
Network Load Balancing
NLB is a scalable, high availability feature that you can install on all editions
of Windows Server 2012. A scalable technology is one where you can add
additional components (in this case additional cluster nodes) to meet increasing
demand. A node in a Windows Server 2012 NLB cluster is a computer, either
physical or virtual, that is running the Windows Server 2012 operating
system.
7
Network Load Balancing
Windows Server 2012 NLB clusters can have between 2 and 32 nodes. When
you create an NLB cluster, it creates a virtual network address and virtual
network adapter. The virtual network adapter has an IP address and a media
access control (MAC) address. Network traffic to this address is distributed
evenly across the nodes in the cluster. In a basic NLB configuration, each node
in an NLB cluster will service requests at a rate that is approximately equal to
that of all other nodes in the cluster. When an NLB cluster receives a request, it
will forward that request to the node that is currently least utilized. You can
configure NLB to preference some nodes over others.
8
Network Load Balancing
NLB is failure-aware. This means that if one of the nodes in the NLB cluster
goes offline, requests will no longer be forwarded to that node, but other nodes
in the cluster will continue to accept requests. When the failed node returns to
service, incoming requests will be redirected until traffic is balanced across all
nodes in the cluster.
9
How NLB Works
When you configure an application to use NLB, clients address the application
using the NLB cluster address rather than the address of nodes that participate
in the NLB cluster. The NLB cluster address is a virtual address that is shared
between the hosts in the NLB cluster.
NLB directs traffic in the following manner: All hosts in the NLB cluster
receive the incoming traffic, but only one node in the cluster, which is
determined through the NLB process, will accept that traffic. All other nodes in
the NLB cluster will drop the traffic.
10
How NLB Works
11
How NLB Works
Which node in the NLB cluster accepts the traffic depends on the configuration of
port rules and affinity settings. Through these settings, you can determine if traffic
that uses a particular port and protocol will be accepted by a particular node, or
whether any node in the cluster will be able to accept and respond.
NLB also sends traffic to nodes based on current node utilization. New traffic is
directed to nodes that are being least utilized. For example, if you have a four node
cluster where three of the nodes are responding to requests from 10 clients and one
node is responding to requests from 5 clients, the node that has fewer clients will
receive more incoming traffic until utilization is more evenly balanced across the
nodes.
12
How NLB Works with Server Failures and Recovery
NLB is able to detect the failure of cluster nodes. When a cluster node is in a
failed state, it is removed from the cluster, and the cluster does not direct new
traffic to the node. Failure is detected by using heartbeats. NLB cluster
heartbeats are transmitted every second between nodes in a cluster. A
node is automatically removed from a NLB cluster if it misses five
consecutive heartbeats. Heartbeats are transmitted over a network that is
usually different from the network that the client uses to access the cluster.
When a node is added or removed from a cluster, a process known as
convergence occurs. Convergence allows the cluster to determine its current
configuration.
13
Deployment Requirements for NLB
NLB requires that all hosts in the NLB cluster reside on the same TCP/IP
subnet. Although TCP/IP subnets can be configured to span multiple
geographic locations, NLB clusters are unlikely to achieve convergence
successfully if the latency between nodes exceeds 250 milliseconds (ms).
When you are designing geographically dispersed NLB clusters, you should
instead choose to deploy an NLB cluster at each site, and then use Domain
Name System (DNS) round robin to distribute traffic between sites.
14
Deployment Requirements for NLB
You can only use TCP/IP protocol with network adapters that participate in
NLB clusters. NLB supports IPv4 and IPv6. The IP addresses of servers that
participate in an NLB cluster must be static and must not be dynamically
allocated. When you install NLB, Dynamic Host Configuration Protocol
(DHCP) is disabled on each interface that you configure to participate in the
cluster.
15
Deployment Requirements for NLB
All editions of Windows Server 2012 support NLB. Microsoft supports NLB
clusters with nodes that are running different editions of Windows Server
2012. However, as a best practice, NLB cluster nodes should be computers
with similar hardware specifications, and that are running the same
edition of the Windows Server 2012 operating system.
16
What Is Server Load Balancing?
Server load balancing means to spread the workload among the servers
hosting the same application content. Server Load Balancer (SLB) is a device
that performs the load-balancing function. A load balancer receives the client
request, analyzes the information in the request, and based on the load
balancing algorithm, it divides the load appropriately between the servers.
Load balancing can be done for client-to-server traffic, and for server-to-server
traffic. Figure 19-1 shows an example of a typical load-balancing setup.
17
What Is Server Load Balancing?
18
What Is Server Load Balancing?
When a load balancer receives multiple requests from clients for servers in a
load-balanced farm, it distributes the requests evenly across all servers in the
farm. Figure 19-2 shows an example where there are three servers in a data
center. There is a load balancer between the clients and the servers, and this
load balancer is configured for round-robin load balancing. The load balancer
receives three requests from the clients. It divides these requests evenly among
the three servers. Therefore, all three servers are equally busy serving the
clients. The Cisco Application Control Engine (ACE) is an example of a
network-based load balancer that can perform this task.
19
What Is Server Load Balancing?
20
Load balance algorithm
Weighted round robin: Server are rated based on the relative amount of
requests each is able to process. Those having higher capacities are sent more
requests.
Least connections: Requests are sent to the server having the fewest number
of active connections, assuming all connections generate an equal amount of
server load.
21
Load balance algorithm
Least latency: Makes a quick HTTP options request to backend server, and
sends the request to the first server to answer.
22
Benefits of Server Load Balancing
24
Benefits of Server Load Balancing
High Availability: In a load-balanced server farm, many servers are serving the
client requests. Therefore, if one server in the farm goes down, the load
balancer can shift the load to an alternate server. The load balancer also
performs a health check for each server in the server farm. If a server is not
healthy it can be removed from the service to avoid interruption to the clients.
25
Benefits of Server Load Balancing
Security: In a load-balancing environment, all the client requests are first received by a
load balancer; therefore, the load balancer can perform certain security checks
before forwarding these requests to the servers. One of the important security
features that load balancers can apply is the access control list (ACL), where you can
allow or deny traffic based on the information in the client request. Another example of
a security task that load balancers typically perform is application protocol inspection,
which helps to verify the protocol behavior and identify unwanted or malicious traffic
that passes through the load balancer. You can define policies to accept or reject the
packets to ensure the secure use of applications and services. Load balancers can also
perform IP and TCP normalization, which protects against a variety of network attacks
by performing general security checks, within IP and TCP headers.
26
Benefits of Server Load Balancing
27
Methods of Server Load Balancing
The following methods are used in the industry to perform server load balancing:
DNS server has no knowledge of server health. It can resolve the name to an
IP even if the server is down.
DNS caching works against the load balancing.
It supports only a very basic method of load balancing.
28
Methods of Server Load Balancing
29
Methods of Server Load Balancing
31
Load Balance Type
32