users@glassfish.java.net

Re: How to set jvmRoute for AJP/mod_jk load balancing

From: <glassfish_at_javadesktop.org>
Date: Thu, 25 Oct 2007 18:10:23 PDT

Hi Jess,

we've had some internal discussions on how to support AJP/mod_jk load balancing without impacting the session management code in GlassFish.

To summarize our discussion, we will strip any jvmRoute from a session id "on the way in", and we will append a jvmRoute to the session id "on the way out".

More specifically:

- On the way in, we strip any jvmRoute (if present) from the
  session id, whether it was supplied as a cookie or encoded
  in the request URL.

- When creating a new session, we append the jvmRoute at the time when
  we add the JSESSIONID cookie to the response, or at the time when the
  session id is encoded in the response.

- On the way out (right when the response is about to be committed),
  if cookies are supported, and the response does not yet contain any
  Set-Cookie header, but a session has been active in the request,
  we add a JSESSIONID cookie to the response, whose value is the session
  id with the jvmRoute appended to it.

- A jvmRoute is added only if the "jvmRoute" system property has been
  set in domain.xml, e.g., by adding:

  <jvm-options>-DjvmRoute=<instance-name></jvm-options>

- With this approach, a session will *always* be sticky to the new instance after a
  failover (since we never preserve the jvmRoute that was passed in), but you
  mentioned that this would be acceptable as a first approximation.

I'm about to attach a patch (in the form of a JAR file) to

  https://glassfish.dev.java.net/issues/show_bug.cgi?id=3796

To activate it, you must add its location to the classpath-prefix attribute of the <java-config> element in your domain.xml, like this:

  <java-config classpath-prefix="<path-to-jar>" ...

Please try out the patch when it is available, and let us know.

Thanks,

Jan
[Message sent by forum member 'jluehe' (jluehe)]

http://forums.java.net/jive/thread.jspa?messageID=242247