This article contains step by step instructions for configuring an Apache 2.x web server which handles static content and delegates JSP (Java Server Pages) and Servlet requests to two Tomcat 4.x servers using AJP 13 connectors and a load balancing worker.

Introduction

Apache 2.0 is a standards compliant, fast and mature web server which excels at delivering static content such as static HTML pages and images. The Tomcat web server is great for serving Java Server Pages and servlets, but it is not as fast as Apache for delivering static content.

In order to build a fast, scalable web application, the requirements call for an Apache server that delegates servicing of JSP and servlet requests to multiple tomcat servers by using an Apache module, mod_jk, that performs load balancing with session affinity, also known as “sticky” sessions.

Session affinity explained. When a client browser requests a JSP page for the first time, the load balancer redirects the request received by Apache to one of the two tomcat servers; further requests originating from the same client session will be automatically forwarded to the same tomcat server, so that the user’s session data is retrieved.

This document describes how I configured Apache 2.x to dispatch JSP and servlet requests to two Tomcat 4.x instances listening on different ports. This setup was done on a Linux system. Your mileage may vary.

Read more

Post to Twitter Post to Yahoo Buzz Post to Delicious Post to Digg Post to Reddit Post to StumbleUpon

Share or Bookmark This Post With :

6 Comments

[...] unknown wrote an interesting post today onHere’s a quick excerptNow we will create a file called worker.properties, and we will place it under /usr/local/apache2/conf. The worker.properties file tells Apache about the various Tomcat servers that are running, and on which port they are listening. In my setup, I installed the two Tomcat … Until then all work is redirected to peer # worker. worker.loadbalancer.type=lb worker.loadbalancer.balanced_workers=tomcat1, tomcat2 # # END workers.properties #. That’s it, we’re done with Apache. … [...]

Mike Posted On March 1st, 2009

Just passing by.Btw, your website have great content!

Colfliaineece Posted On April 9th, 2009

FANTASTIC!

cojusibojepi Posted On April 10th, 2009

My friend on Orkut shared this link with me and I’m not dissapointed at all that I came here.

dammitAdam Posted On April 17th, 2009

I’ve got to ask – why not use mod_proxy_ajp? it supports load balancing (mod_proxy_balance), JsessionID for session affinity, and a variety of load balancing methods.

Check out my quick and dirty here: http://shatnerandsulu.wikidot.com/apache

This is about 100x simpler than what you have described here, but does require apache 2.2.

Great blog by the way!

[...] Apache 2.x + Tomcat 4.x + Load Balancing Tutor [...]

Leave a Reply

Subscribe to RSS Feeds Follow me on Twitter Add to Favourite
 
Sponsors
 
Tags
 
Network [+]
 
© Copyright 2009 - 2011 TechiePark.com. All Rights Reserved | Powered by WordPress
This work is licensed under a Creative Commons Attribution 3.0 Unported License
Php5 powered    Mysql powered    Apache powered   Best viewed with  Spread Firefox Affiliate Button