tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Lamprecht" <clampre...@gmail.com>
Subject adding communication between mod_jk and servlet code
Date Wed, 29 Nov 2006 06:06:26 GMT
Hi all,
I previously submitted the lb 'busyness' patch for mod_jk, and it has worked
well for us.

Now we need some additional functionality from mod_jk and I'd like to get
feedback here first before I start patching.  I'd prefer to implement
something that is generally useful to others, and submit the patch, so it
becomes part of the mod_jk codebase.

First, the problem.  Currently there isn't any direct way for a servlet to
tell mod_jk that it should be marked as being in 'Error' state (as being
down).  We have a backend HTTP service that requires high availability.  If
the servlet detects that something is wrong, it should "take itself out" of
the mod_jk load balancer, at least temporarily.  There are two ways I can
think of to accomplish this right now.  The first, which I've done, is set
the reply_timeout to a fairly low value, like 4000ms, and then make the
servlet intentionally sleep for 5000ms to cause it to go into Error state.
This works, but having the reply_timeout so low is a risk -- if the backend
servers are slow for some reason (copying large files, etc), they can all be
marked as down -- oops.  The second method, which I have not tried, is to
have the servlet do a GET request to the mod_jk JkStatus page, to take
itself out of rotation.  While it may work, I just don't have good feelings
about this method.  If anyone has  other suggestions on ways for a servlet
to force itself to be marked as in 'Error' state, please reply.

So, I looked through mod_jk code hoping that I could have the servlet throw
an HTTP 50x error that mod_jk would interpret as "down", but no such luck.
There has been talk before about writing a "meta" communication layer
between servlets and mod_jk.  This could open up the doors to some cool
things:  Servlets could provide JK with load information, average response
times, available webapp contexts, etc.  See this thread:
http://mail-archives.apache.org/mod_mbox/httpd-dev/200606.mbox/%3C449703AA.2070703@kippdata.de%3E

For my current purposes, I just need the servlet to tell mod_jk "even though
I'm available, mark me as in Error state!".   How should we do this?  Using
a "hidden" HTTP response header might work for communicating general
strings, or returning certain "reserved" HTTP responses (HTTP 599 = error,
etc) -- these are two options that come to mind.  I'm willing to implement
and test the mods, including under heavy load.


Thanks,
Chris

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message