For 2023 - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.
Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!
I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Sticky Sessions with mod_jk (httpd to Tomcat)
If you're load balancing with mod_jk, you can put a load balancer worker in your jk properties file, and then have requests forwarded to all the workers that are members of that load balancer. That's a great way to share the load.
But if you're running applications that rely on a series of linked pages (sessions) the you really don't want your client's requests to be forwarded at random - you want to pass them back to the same worker they were talking to last time. In real life, this is like saying that if you go into a shop, you can pay at any till, but if you make a series of telephone calls to sort out a complicated utility bill you really want to get through to the same clerk to serve you each time.
You can set up this "sent back to the same person" scenario if your application is written using Java's session classes; in the workers configuration file add a line to specify the domain for each host, and a line to set sticky sessions on in the balance worker:
In your Tomcat configuration file on EVERY server, set the jvmRoute of the engine to be the same as the domain name stated in the worker entry - for example:
<Engine name="Catalina" defaultHost="localhost" jvmRoute="oak">
Remember that is you stop and start your various servers during testing, that will NOT have reset / cleared the cookies held at the browsers you are testing from and you may see some odd effects - what you are doing is like changing a program, but saving the variables. It's a good idea to stop everything, clear out all relevant cookies and caches, and restart as a final test before releasing the system to users.
If you are using mod_jk and have turned sticky sessions on, but your sessions are failing to stick, you have probably failed to set the domain, or you have failed to set the jvmRoute, or you are using a non-standard cookie name to implement the stickyness!
With Apache 2.2, mod_proxy_balancer
has replaced many uses of mod_jk
; similar setup principles apply - there are more mod_proxy resources here
We cover the connection of Apache httpd to Apache Tomcat on our public Deploying Apache httpd and Tomcat course
, and we also cover them as appropriate on private courses; the examples above come from this afternoon's examples on a private course.
- although the build documentation for mod_jk talks about Apache 1.3 and Apache 2.0, the (2.0) scheme works perfectly well for you to build for 2.2. However, once you have built a mod_jk library, that built file will ONLY work reliably with the version / subversion you built it for. It's no good getting someone else's 2.0.43 and expecting it to work on 2.0.44! (written 2009-02-12, updated 2009-02-13)
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articlesA601 - Web Application Deployment - Apache httpd - an overview 
Why run two different web servers - (2006-01-25) 
Web Application Components - (2006-03-28) 
The LAMP Cookbook - Linux, Apache, MySQL, PHP / Perl - (2006-11-13) 
Apache, Tomcat, Jakarta, httpd, web server - what are they? - (2007-07-13) 
Keep the client experience easy - single server contact point - (2008-03-27) 
Keeping on an even keel - (2008-11-21) 
Apache httpd and Apache Tomcat miscellany - (2009-01-30) 
Tuning httpd / the supermarket checkout comparison - (2009-02-26) 
Internal Dummy Connections on Apache httpd - (2009-03-02) 
Why put Apache httpd in front of Apache Tomcat - (2009-03-12) 
An FAQ on the Apache httpd and Apache Tomcat web servers, and on using them together - (2009-05-17) 
Apache httpd - a robust, open source web server - (2013-04-16) 
Public training courses - upcoming dates - (2015-02-21)
Some other Articles
Wiltshire Rail Service Updatehttpd, Tomcat and PHP course enhancementsError: Cant read xxxxx: no such variable (in Tcl Tk)The InvokerSticky Sessions with mod_jk (httpd to Tomcat)The Interview and The LiftJava Tag Libraries / how they work / Tomcat Deployment1234567890 ... coming up on Friday 13thThrough Snow and Flood to Linux and TomcatHuawei D100 Wireless Router - Mobile Internet
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page
This is a page archived from The Horse's Mouth at
the diary and writings of Graham Ellis.
Every attempt was made to provide current information at the time the
page was written, but things do move forward in our business - new software
releases, price changes, new techniques. Please check back via
our main site for current courses,
prices, versions, etc - any mention of a price in "The Horse's Mouth"
cannot be taken as an offer to supply at that price.
Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).