httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keith Mashinter <kmash...@yahoo.com>
Subject id=51247 Enhance mod_proxy and _balancer with worker status flag to only accept sticky session routes
Date Mon, 23 May 2011 19:10:38 GMT
I've added a patch to the proxy/balancer to allow for route-only workers are only enabled for
sticky session routes, allowing for an even more graceful fade-out of a server than making
its lbfactor=1 compared to lbfactor=100 for others.  


Please reply/vote if you also think it's useful.


https://issues.apache.org/bugzilla/show_bug.cgi?id=51247
This enhancement, actually SVN Patched against 2.2.19, provides a worker status
flag to set a proxy worker as only accepting requests with sticky session
routes, e.g. only accept requests with a .route such as Cookie
JSESSIONID=xxx.tc2.

This allows for a graceful fade-out of servers when their sessions are removed;
they continue to receive requests for their sticky session routes but are
passed over for requests with no specified route, just as if they were
disabled.  In other words, route-only workers are only enabled for sticky
session routes.

Intended use (Tomcat JSESSIONID noted here but could be PHPSESSIONID, Ruby
_session_id, or anything with cookie or request-parameter based session ids):
1. An Apache rev-proxy running for multiple Tomcats.
2. To fade-out a Tomcat for maintenance, set route-only enabled in the
balancer-manager or reload the configuration with the worker status +R.
(This depends on Tomcat web-apps delete session cookies, see further below.)
3. Check on the balancer-manager or its Tomcat worker even a few minutes /
hours, and when it seems to have completed old sessions you can mark it fully
disabled.
4. Once done maintenance, you can then set route-only disabled (status -R) and
fully enable the worker again.

To delete a JSESSIONID Cookie from a Servlet, you need to specify the same
Domain and Path as the original Cookie and setMaxAge=0 as in the typical
example below but you should check on your own Domain and Path when a Cookie is
created, e.g. watch the Cookie headers in Firefox Firebug.

// To delete a Cookie setMaxAge(0) and also any original domain and path if
specified.
Cookie ck = new Cookie("JSESSIONID", null);
//ck.setDomain("");
ck.setPath(request.getContextPath());
ck.setMaxAge(0);
response.addCookie(ck);
 
\|/- Keith Mashinter 
kmashint@yahoo.com
Mime
View raw message