星期二, 3月 27, 2012

Layer 7 Switching & Load Balancing 第七層網路交換器與負載平衡器



posted on Tuesday, August 12, 2008 4:44 AM 
Modern load balancers (application delivery controllers) blend traditional load-balancing capabilities with advanced, application aware layer 7 switching to support the design of a highly scalable, optimized application delivery network. Here's the difference between the two technologies, and the benefits of combining the two into a single application delivery controller.
LOAD BALANCING
Load balancing is the process of balancing load (application requests) across a number of servers. The load balancer presents to the outside world a "virtual server" that accepts requests on behalf of a pool (also called a cluster or farm) loadbalancingof servers and distributes those requests across all servers based on a load-balancing algorithm. All servers in the pool must contain the same content.
Load balancers generally use one of several industry standard algorithms to distribute request. Some of the most common standard load balancing algorithms are:
  • round-robin
  • weighted round-robin
  • least connections
  • weighted least connections
Load balancers are used to increase the capacity of a web site or application, ensure availability through failover capabilities, and to improve application performance.
LAYER 7 SWITCHING
Layer 7 switching takes its name from the OSI model, indicating that the device switches requests based on layer 7 (application) data. Layer 7 switching is also known as "request switching", "application switching", and "content based routing".
appswitching
A layer 7 switch presents to the outside world a "virtual server" that accepts requests on behalf of a number of servers and distributes those requests based on policies that use application data to determine which server should service which request. This allows for the application infrastructure to be specifically tuned/optimized to serve specific types of content. For example, one server can be tuned to serve only images, another for execution of server-side scripting languages like PHP and ASP, and another for static content such as HTML , CSS , and JavaScript.
Unlike load balancing, layer 7 switching does not require that all servers in the pool (farm/cluster) have the same content. In fact, layer 7 switching expects that servers will have different content, thus the need to more deeply inspect requests before determining where they should be directed. Layer 7 switches are capable ofdirecting requests based on URI, host, HTTP headers, and anything in the application message.
The latter capability is what gives layer 7 switches the ability to perform content based routing for ESBs and XML/SOAP services.
LAYER 7 LOAD BALANCING
By combining load balancing with layer 7 switching, we arrive at layer 7 load balancing, a core capability of all modern load balancers (a.k.a. application delivery controllers).
layer7loadbalancingLayer 7 load balancing combines the standard load balancing features of a load balancing to provide failover and improved capacity for specific types of content. This allows the architect to design an application delivery network that is highly optimized to serve specific types of content but is also highly available.
Layer 7 load balancing allows for additional features offered by application delivery controllers to be applied based on content type, which further improves performance by executing only those policies that are applicable to the content. For example, data security in the form of data scrubbing is likely not necessary on JPG or GIF images, so it need only be applied to HTML and PHP.
Layer 7 load balancing also allows for increased efficiency of the application infrastructure. For example, only two highly tuned image servers may be required to meet application performance and user concurrency needs, while three or four optimized servers may be necessary to meet the same requirements for PHP or ASP scripting services. Being able to separate out content based on type, URI, or data allows for better allocation of physical resources in the application infrastructure.



How Does Layer 7 Load Balancing Work?第七層網路交換器如何運作??


This post explains what is meant by layer 7 load balancing and an example of content switching using HTTP URL parsing is given later in the post. In the OSI model layer 7 is the applications layer and there are a number of application protocoals that are used this layer:
  • Hypertext Transport Protocol (HTTP) for web pages
  • File Transport Protocol (FTP) for file transfer
  • Real Time Streaming Protocol (RTSP) for streaming media such as video
load balancing switch can be used at layer 7 to load balance in a number of different ways. These include:
  • HTTP header Inspection
  • HTTP URL Parsing
  • RTSP Parsing
One of the main reasons why layer 7 load balancing is used is that our company will want to ensure that differ web applications run on servers that are configured and set up to maximise the efficiency of those servers and also to minimise the cost in acquiring and running the servers.
Suppose that we are a web hosting company like Hostgator or Bluehost and we need to host many different types of website. These would include websites with just static pages, online shops with backend transaction processing, and even websites like youtube that are dedicated to providing video streaming to the world. If we did not load balance the incoming requests from the web based on content type (or application type) then we would have to make sure that all of the servers we use were of the same technical specification and capable of handling our most complex applications. This would be expensive and our finanical director would have constant headaches while us techies could gloat to our friends about all the massive servers we had. Our friends in turn would have data center envy :-). They would then give their financial director a headache from the constant requests to get bigger servers so they could gloat at us - and so on.
In reality what we would do is something like the following. First we would decide that we needed three different types of server, one for each application type:
  • a low spec server configured to run static websites
  • a higher spec server configured to run the online shops
  • an even higher spec server configured for video streaming
Then we would place a content switch in front of the three different types of servers/applications. And we would configure the content switch to send the different types of request to the different types of servers. Easy really!

HTTP URL Parsing

Lets say that on our smaller servers we only run static websites that consit mainly of html web pages and gig or jpeg images. On our medium sized servers we run complex shopping sites that use applications servers and datbase servers and so on. These are more dynamic websites and need to handle a high volume of transactions day and night (24/7).
Our content switch will need to insect incoming requests and make sure to send them to the right set of servers. It can do this by looking at the file extensions in the url. Extensions like html, gif and jpeg can go to the static website servers and the more complex (such as ASP or Java) can go to the dynamic servers.

沒有留言: