Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Mapping in workers2.properties

Mark Eggers

2004-01-10

Replies:

There are actually several ways to map between Apache
and Tomcat via mod_jk2.

The first is using workers2.properties. If you've
compiled with -pcre, then perl regular expressions
should work as well as individual names.

Also, remember that servlets traditionally live in
/<app-name>/servlet/<servlet-name>. This is
controlled by the web.xml for the particular
application (context) and is found in:

$TOMCAT_HOME/webapps/<app-name>/WEB-INF/web.xml

The example context is especially confusing, primarily
due to the name. In Tomcat 4.1.29, you have the
following:

/examples/jsp/index.html
/examples/servlets/index.html

However, the actual location of the servlets according
to web.xml would be:

/examples/servlet/<servlet-name>

So, in your workers2.properties file you will need to
have the following in order to map all servlets in the
examples:

[uri:/examples/servlet/*]
worker=ajp13:unixsocket

or whatever you called your worker name.

While workers2.properties works well for a small
number of sites, it does not scale very well since the
match lookup is linear. Another way to manage mod_jk2
mapping is detailed in the source of mod_jk2.

I know, I know, reading the source is not supposed to
be a requirement, but then again this is open source
so you do have the opportunity.

Anyway, in jk/native2/server/apache2/mod_jk2.c, there
is a little documentation concerning JkUriSet.

Basically, you use Apache constructs to map the
location and within that you use the JkUriSet
directive to map the location to the appropriate
worker.

I've tried both ways, and they both work well.
According to the source, using JkUriSet is the
preferred method.

As for in-process, there has been some discussion on
this mailing list about why in-process does not work
with the current MPM (multi-processor modules)
available for Apache httpd. The real problem seems to
be that there is currently no MPM that runs all of
apache within one process in UNIX, using threads
exclusively to handle separate requests.

Actually, this is not quite true since there is an
experimental MPM that accomplishes this. However,
according to the documentation this is slower than the
current worker model (multi-process, multi-thread) and
not recommended for production work.

The problem is that when multiple processes get
started, each process attempts to start its own Tomcat
(if in-process is being used). This can't be done
using the same server,xml.

In recent kernels (Redhat 2.4.2x, generic 2.6.0,
2.6.1) there has been a new implementation of threads.
It might be possible to build a new MPM that takes
advantage of this. As far as I know, this is not
being done (yet). This sounds like a great
opportunity to make a contribution :-).

Hope this has been helpful.

/mde/
just my two cents . . .

__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)



©2008 junlu.com - Jax Systems, LLC, U.S.A.