Load balancing with the Apache http server

Sticky Sessions

Another typical configuration is used to support sticky sessions:

BalancerMember http://server6:1080... stickysession=JSESSIONID

The stickysession parameter, combined with the name of a cookie supported by the back ends, means that requests originating with individual users are always sent to the same back-end server.

This kind of limited distribution ensures the persistence of the requests, but it does interfere with the actual task of load balancing.

To forward information to the back-end servers in a targeted way, or to influence communications with the the back end, the proxy module also supports custom environmental variables and http headers, which you can use to restrict the connections to the back end or to advertise the use of SSL:

SetEnv proxy-nokeepalive 1
...
RequestHeader set Front-End-Https "On"

A number of standard variables and headers, such as proxy-nokeepalive, proxy-sendcl, X-Forwarded-For, or X-Forwarded-Server, saves typing and makes life easier for administrators.

Other modules support caching or filtering of content generated by the back ends. In addition to improving performance, caching also reduces the overall traffic volume and generally offloads some of the work from the back-end servers. Listing 2 enables a simple, file-based cache, including compression, for the whole URL space /. (Just to demonstrate how the exclusion feature works, the whole URL space below /users has been excluded.)

Listing 2

mod_cache Sample Configuration

01 CacheEnable disk /
02 CacheDisable /users
03 CacheRoot /var/cache/httpd
04 ...
05 AddOutputFilterByType DEFLATE text/html

Administration

If you loaded the status module (mod_status) when you launched the server, the proxy module also provides a simple but practical web interface (Figure 2). The simple configuration involves assigning a handler:

<Location "/.balancer-manager">
  SetHandler balancer-manager
</Location>
...
ProxyPass /.balancer-manager !

However, it is important to take access control into consideration and to exclude processing individual URLs within the load balancer, which is achieved by means of a negative ProxyPass command. If you use the Apache rewrite module (mod_rewrite), you can define a separate rule to handle this case.

Figure 2: The balancer manager web interface supports basic load balancer management.
Figure 2: See the Apache Foundation website for more resources.

Management Restrictions

Management is restricted to viewing the status of all configured balancers, disabling individual pool members, or modifying some basic settings, but it is extremely useful if you encounter a problem, or if you wish to monitor multiple load balancers.

Read full article as PDF:

034-037_apacheload.pdf  (1.12 MB)

Related content

  • Perlbal

    Let the nimble Perlbal web server keep your traffic in balance.

  • Zeus Load Balancer

    On today’s networks, distributing requests in a cluster of web servers requires more than just assigning the requests in a round robin. The Zeus ZXTM 7400 appliance demonstrates the technical finesse necessary to keep busy websites running.

  • Nginx

    The fast and practical Nginx web server is easy to configure and extend.

  • Apache HTTP Server 2.4

    Apache HTTP Server version 2.4 is full of exciting new features. We share a few of them with you.

  • Liferay CMS

    Liferay is a powerful and easily customizable CMS that is ideal for community collaboration – once you get it configured.

comments powered by Disqus

Direct Download

Read full article as PDF:

034-037_apacheload.pdf  (1.12 MB)

News

njobs Europe
What:
Where:
Country:
Njobs Netherlands Njobs Deutschland Njobs United Kingdom Njobs Italia Njobs France Njobs Espana Njobs Poland
Njobs Austria Njobs Denmark Njobs Belgium Njobs Czech Republic Njobs Mexico Njobs India Njobs Colombia