You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Bill Bainbridge <bb...@justicesystems.com> on 2007/08/06 18:32:35 UTC

Mod jk selective forwarding performance problem

I am using Tomcat 5.5.23 with Apache 2.2.4 and mod_jk.  The "payments" app uses Struts, Spring and Tiles.  I'd like to have Apache serve the images, stylesheets and other static content that is referenced in the Struts jsps, but when I try to do that, if the page isn't cached in the browser, it comes up with no buttons (from the images/ directory) until I click the browser's "Refresh" icon; then it shows up again with all the buttons.  The apache error log shows a "File does not exist:" message on the first try, e.g.:

File does not exist: /usr/apache/httpd/htdocs/payments/images/Bttn_IAgree.gif;jsessionid=FA9B1578B6A813AAF2AB528C7DD398E4, referer: http://74.205.87.59/payments/welcome.do  (we're using the IP address until we go into production, when we'll switch over the DNS for the domain name).

I don't have any problems at all when everything for the /payments/ address goes to Tomcat.  Here's the mod_jk section of httpd.conf:

LoadModule jk_module modules/mod_jk.so

JkWorkersFile /usr/apache/httpd/conf/workers.properties
JkShmFile /usr/apache/httpd/logs/mod_jk.shm
JkLogFile /usr/apache/httpd/logs/mod_jk.log
JkLogLevel warn
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkMount /payments/* worker1
JkUnMount /payments/images/* worker1
JkUnMount /payments/html/* worker1
JkUnMount /payments/css/* worker1

I get the same results (no buttons the first time) when I leave out the JkUnMount lines and change the JkMount line to:

JkMount/payments/*.do

Does anyone know why Apache can't find the image files the first time, but does the second?  Is this a page timeout thing?  Thanks!

Bill



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Mod jk selective forwarding performance problem

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bill,

Bill Bainbridge wrote:
> I'd like to have
> Apache serve the images, stylesheets and other static content that is
> referenced in the Struts jsps, but when I try to do that, if the page
> isn't cached in the browser, it comes up with no buttons (from the
> images/ directory) until I click the browser's "Refresh" icon; then
> it shows up again with all the buttons.

This is because your application is (correctly) adding the URL-encoded
jsessionid parameter to the URL. For some reason, the Apache httpd team
doesn't want to follow the HTTP specification regarding this point and
accept ; as a valid parameter delimiter (like ? and &).

There are at least two ways to fix this:

1. Use mod_rewrite. The magic incantation I used to use was:

   RewriteRule /appName/(.*);jsessionid=[0-9A-Z]*(.*) \
               /path/to/your/webapp/$1$2 [L]

Note that the RewriteRule is all on one line of text; I used "\" to
separate them for readability.

2. Since you're using mod_jk, you can use:

   JkStripSession On

This should strip session identifiers from URLs that /will not/ be sent
to Tomcat. This is super helpful since working with mod_rewrite can be
daunting, especially in complex configurations. You'll need mod_jk
version 1.2.21 or later to use the feature.

Hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGt14S9CaO5/Lv0PARAg3cAJ9mcDKsIP7xdDvOgscfO53iGAwmoQCdFeoo
ioq1AOUCLRLFqwRAPmxMaow=
=pmSo
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Mod jk selective forwarding performance problem

Posted by Hassan Schroeder <ha...@gmail.com>.
On 8/6/07, Bill Bainbridge <bb...@justicesystems.com> wrote:

> File does not exist: /usr/apache/httpd/htdocs/payments/images/Bttn_IAgree.gif;jsessionid=FA9B1578B6A813AAF2AB528C7DD398E4

It appears that Apache httpd doesn't recognize the ';' separator and
thinks the 'jessionid=....' is part of the file name. Of course, if the end
user has cookies enabled, that jsessionid in the URL goes away on the
second access so it works.

There may be a fix, or you could just not use httpd at all and save
yourself the trouble. :-)

FWIW,
-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org