Hi Jamey,

You are touching a very important subject in the mod_jk
implementation. And YES, you are absolutely right ( IMHO ) - Apache, IIS,
NES, AOLServer are pretty good at processing requests - after all that's
their main business.
Each requests is mapped by the ( optimized ) mappers of
the native web server, and then the same operation is duplicated in
mod_jk - adding a performance hit on all served requests. 

Unfortunately, doing the "right thing" is hard and tricky - the current
solution works and the overhead it adds is acceptable.

The problem is that configuring the server is tricky and few people know
how to do it. An attempt has been made to generate server config file
automatically, but web.xml is quite complex and a lot is missing. 

mod_jk has a lot of flexibility - it can send all the requests for a 
particular context to tomcat ( where all web.xml settings will be
respected ). 
Or you can translate the mapping from web.xml in server configs - and
operate in the most efficient way. 

The translation is not easy and requires knowledge of the server. All
settings in web.xml have equivalent in the server settings - but not too
many people know how to do it. And it's even harder to do it
automatically. But what you get is maximum flexibility, you can authorize
using any of the server modules, etc. 

That's why forwarding the whole context is sometimes an acceptable
solution ( and it automatically respects all settings in web.xml :-). The
only problem - static files in webapps will still be served by tomcat, and
the server is just a proxy.

I have serious doubts that an automated solution is the best for all
cases, but improvements to the current "forward all" are needed. On the
other side, I think it is very important to support/enhance the flexible
aproach where a server admin has the chance to tune the settings.

Case: authentication. There is no easy way to guess what mod_auth is used
by the server ( you may have multiple modules doing that ). A "manual
tunning" would allow the deployer to do implement his site policies and
tune the deployment. A "automated" deployment should be possible, but I
doubt it is the best for big production sites. 

(thanks for reviewing the code, any enhancements in this area are
wellcomed )

Costin




> Many thanks,
>       I was wondering why both the mod_jk module and IIS isapi act as filters
> instead of an Apache handler or an IIS application respectively.  In their
> current implementation they scan all request URIs for ones that they are
> responsible for and then, in the case of Apache anyway, register a call back
> to a handler to handle the actual request.  I have had this cause problems
> for me with Apache in the case where I have a servlet named foo and another
> file named foo.xxx.  mod_jk correctly maps /foo to the servlet and registers
> the callback but Apache never calls the callback and instead some other
> module or the Apache core make a best guess that the request really meant
> foo.xxx since no /foo exists as far as Apache is concerned.  By adding
> handler entries to Apache's httpd.conf file like the following (pardon my
> syntax if it is somewhat off)
> 
> <location path="/login">
>       <handler name="jakarta-servlet">
> </location>
> 
> Apache then automatically sends that URI to mod_jk without any filtering
> needed.  All mod_jk need now do is determine which Tomcat handler to use
> (ajp12, ajp13, lb, etc...).  Filtering is also more expensive because all
> modules get a chance to act on the URI before the callback handler.  By
> registering mod_jk as a handler directly, Apache maps the URI directly to
> mod_jk with basically no overhead or searching.  I've made some code changes
> (about four changed lines) to mod_jk that make it behave as a pure handler
> with no filtering and it seems to run great but I'd like to know before
> proposing a change if there were specific reasons for the filter
> implementation.  Many thanks to anyone who can help:)
> -Jamey
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 22, 2001 7:23 PM
> To: [EMAIL PROTECTED]
> Subject: cvs commit: jakarta-tomcat/src/native/mod_jk/common
> jk_uri_worker_map.c
> 
> 
> danmil      01/01/22 19:23:03
> 
>   Modified:    src/native/mod_jk/common jk_uri_worker_map.c
>   Log:
>   Adding more thorough DEBUG-level to describe what mapping the module is
>   using for a given request.
> 
>   Submitted by: James Courtney
> 
>   Revision  Changes    Path
>   1.3       +18 -6
> jakarta-tomcat/src/native/mod_jk/common/jk_uri_worker_map.c
> 
>   Index: jk_uri_worker_map.c
>   ===================================================================
>   RCS file:
> /home/cvs/jakarta-tomcat/src/native/mod_jk/common/jk_uri_worker_map.c,v
>   retrieving revision 1.2
>   retrieving revision 1.3
>   diff -u -r1.2 -r1.3
>   --- jk_uri_worker_map.c     2000/11/10 18:48:50     1.2
>   +++ jk_uri_worker_map.c     2001/01/23 03:23:03     1.3
>   @@ -65,7 +65,7 @@
>     * servlet container.
> *
>     *
> *
>     * Author:      Gal Shachor <[EMAIL PROTECTED]>
> *
>   - * Version:     $Revision: 1.2 $
> *
>   + * Version:     $Revision: 1.3 $
> *
> 
> ***************************************************************************/
> 
>    #include "jk_pool.h"
>   @@ -358,6 +358,7 @@
>                uri = clean_uri;
>            }
> 
>   +           jk_log(l, JK_LOG_DEBUG, "Attempting to map URI %s\n", uri);
>            for(i = 0 ; i < uw_map->size ; i++) {
> 
>                if(uw_map->maps[i].ctxt_len < longest_match) {
>   @@ -369,10 +370,20 @@
>                                uw_map->maps[i].ctxt_len)) {
>                    if(MATCH_TYPE_EXACT == uw_map->maps[i].match_type) {
>                        if(strlen(uri) == uw_map->maps[i].ctxt_len) {
>   +                   jk_log(l,
>   +                          JK_LOG_DEBUG,
>   +                          "jk_uri_worker_map_t::map_uri_to_worker, Found an exact 
>match
> %s ->%s\n",
>   +                          uw_map->maps[i].worker_name,
>   +                          uw_map->maps[i].context );
>                            return uw_map->maps[i].worker_name;
>                        }
>                    } else if(MATCH_TYPE_CONTEXT ==
> uw_map->maps[i].match_type) {
>                        if(uw_map->maps[i].ctxt_len > longest_match) {
>   +                   jk_log(l,
>   +                          JK_LOG_DEBUG,
>   +                          "jk_uri_worker_map_t::map_uri_to_worker, Found a 
>context match
> %s -> %s\n",
>   +                          uw_map->maps[i].worker_name,
>   +                          uw_map->maps[i].context );
>                            longest_match = uw_map->maps[i].ctxt_len;
>                            best_match = i;
>                        }
>   @@ -393,6 +404,11 @@
>                            if(0 == strcmp(suffix, uw_map->maps[i].suffix)) {
>    #endif
>                                if(uw_map->maps[i].ctxt_len >= longest_match)
> {
>   +                           jk_log(l,
>   +                                  JK_LOG_DEBUG,
>   +                                  "jk_uri_worker_map_t::map_uri_to_worker, Found 
>a suffix match
> %s -> *.%s\n",
>   +                                  uw_map->maps[i].worker_name,
>   +                                  uw_map->maps[i].suffix );
>                                    longest_match = uw_map->maps[i].ctxt_len;
>                                    best_match = i;
>                                }
>   @@ -403,10 +419,6 @@
>            }
> 
>            if(-1 != best_match) {
>   -            jk_log(l, JK_LOG_DEBUG,
>   -                   "jk_uri_worker_map_t::map_uri_to_worker, Found a match
> %s\n",
>   -                   uw_map->maps[best_match].worker_name);
>   -
>                return uw_map->maps[best_match].worker_name;
>            } else {
>                /*
>   @@ -435,4 +447,4 @@
>               "jk_uri_worker_map_t::map_uri_to_worker, done without a
> match\n");
> 
>        return NULL;
>   -}
>   \ No newline at end of file
>   +}
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
> 
> 
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
> 

-- 
Costin


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to