You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Mark Brouwer <ma...@virgil.nl> on 2000/04/25 17:48:16 UTC

If-Modified-Since not understood by Tomcat

Hi,

As a user of Tomcat for production environments I found a nasty thing
this weekend having a negative impact on the performance for serving
static content.

Problem:

We did some network measurements for a projects in which we will serve
over 500 local branch offices with our trading application based on
JSPs. The infrastructure in place at the local offices is IE 4.0 with an
IIS proxy server, all request will go through the proxy to our SUN E420.
At every request all static material (images, stylesheets, html and
javascript files) is retrieved from the server, the proxy doesn't cache
anything. The result: pages with a dynamic content of 3 kb are becoming
a massive 20 kb and more.

Our application has been developed as a low bandwidth application but
now it is considered a real killer application for their network. I soon
found out that if the browser sends a 'If-Modified-Since' the server
doesn't return a 304 (Not Modified) resulting in a complete retrieval of
the page, this is painful. I also noticed that the 'Date' header is not
set by Tomcat (Date has to be set according the HTTP RFCs).

By looking at the source code I found the javax.servlet.http.HttpServlet
supports the If-Modified-Since header, only for it to work you need to
override getLastModified(HttpServletRequest req) in your subclass.
That's were the problem is, the tomcat DefaultServlet server doesn't
override this method and therefore we all are punished.

Solution:

- fix Tomcat, which I will do right away (already done, but not tested
                                          to be submitted :-)
- put Apache in front for static pages, which I will definitely will
  do in time :-)

Questions with regard to Fixing the DefaultServlet:

- I would also like to fix the 'Date' header but as JSWDK did support
  this I'm wondering why this was removed.

- I did read all the material with regard to participating but I don't
  know where to leave a fix if you are not a commiter. Please help me
  out here.

- I also would like to see this feature/fix in the Tomcat 3.1 version,
  in case there are patches planned.

B.T.W. Jonathan asked how 'How good is Tomcat', well I think I can
comment on this one soon :-) We are going to do some performance test on
it (memory leaks, CPU consumption) with OptimizeIt, I hope I can publish
some results soon.
-- 
Mark Brouwer
Virgil B.V.

Re: If-Modified-Since not understood by Tomcat

Posted by Mark Brouwer <ma...@virgil.nl>.
Costin Manolache wrote:
> 
> > B.T.W. Jonathan asked how 'How good is Tomcat', well I think I can
> > comment on this one soon :-) We are going to do some performance test on
> > it (memory leaks, CPU consumption) with OptimizeIt, I hope I can publish
> > some results soon.
> 
> Can you wait for one or 2 weeks before doing that?
> I'm tuning up tomcat performance, and probably quite a few things will be
> different.
> 

Tuning up performance would be great, for what I can see right now it's
quite heavy with CPU consumption on our Sun E420. I think I can postpone
the testing for a while as it looks *our app* has no memory leaks (when
using the JSWDK you could watch it grow while using page include a lot).

But on the other hand isn't a comparison before and after a nice thing.
On Dutch television they have a lot of these programs (made in America
by the way). I personally like the ones where the women do all kind of
exercises with some exotic apparatus and look like a superstar in only
5 minutes a day :-)

> Costin
>
> ( it will probably be >2 times faster, but it needs a lot of testing. )
>

Notify me when you are at a point it is stable and I will see if I can
put some junior developers on it.

If there is someone who has a decent test scenario for JSP engines
please share it with us, for I don't have the time to invent one that
will bring me the Nobel prize.
-- 
Mark Brouwer
Virgil B.V.

Re: If-Modified-Since not understood by Tomcat

Posted by Costin Manolache <co...@costin.dnt.ro>.
> B.T.W. Jonathan asked how 'How good is Tomcat', well I think I can
> comment on this one soon :-) We are going to do some performance test on
> it (memory leaks, CPU consumption) with OptimizeIt, I hope I can publish
> some results soon.

Can you wait for one or 2 weeks before doing that?
I'm tuning up tomcat performance, and probably quite a few things will be
different.

Costin

( it will probably be >2 times faster, but it needs a lot of testing. )


Re: If-Modified-Since not understood by Tomcat

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
See below.

Mark Brouwer wrote:

> Hi,
>
> As a user of Tomcat for production environments I found a nasty thing
> this weekend having a negative impact on the performance for serving
> static content.
>
> Problem:
>
> We did some network measurements for a projects in which we will serve
> over 500 local branch offices with our trading application based on
> JSPs. The infrastructure in place at the local offices is IE 4.0 with an
> IIS proxy server, all request will go through the proxy to our SUN E420.
> At every request all static material (images, stylesheets, html and
> javascript files) is retrieved from the server, the proxy doesn't cache
> anything. The result: pages with a dynamic content of 3 kb are becoming
> a massive 20 kb and more.
>
> Our application has been developed as a low bandwidth application but
> now it is considered a real killer application for their network. I soon
> found out that if the browser sends a 'If-Modified-Since' the server
> doesn't return a 304 (Not Modified) resulting in a complete retrieval of
> the page, this is painful. I also noticed that the 'Date' header is not
> set by Tomcat (Date has to be set according the HTTP RFCs).
>
> By looking at the source code I found the javax.servlet.http.HttpServlet
> supports the If-Modified-Since header, only for it to work you need to
> override getLastModified(HttpServletRequest req) in your subclass.
> That's were the problem is, the tomcat DefaultServlet server doesn't
> override this method and therefore we all are punished.
>
> Solution:
>
> - fix Tomcat, which I will do right away (already done, but not tested
>                                           to be submitted :-)

Thanks Mark ... this will be a very helpful fix!

>
> - put Apache in front for static pages, which I will definitely will
>   do in time :-)
>
> Questions with regard to Fixing the DefaultServlet:
>
> - I would also like to fix the 'Date' header but as JSWDK did support
>   this I'm wondering why this was removed.
>

There's no guarantee that the current default servlet really started from
the same code base as the one in JSWDK -- it's also possible something got
lost in a rewrite.

>
> - I did read all the material with regard to participating but I don't
>   know where to leave a fix if you are not a commiter. Please help me
>   out here.
>

The current process is to post a message with your patch (in diff -u format
as described on the web site) to the TOMCAT-DEV list.  We're looking at
modifying this process to ask that proposed patches be submitted to the bug
tracking system <http://jakarta.apache.org/bugs> instead, because then
everyone can see the status.

>
> - I also would like to see this feature/fix in the Tomcat 3.1 version,
>   in case there are patches planned.
>

It's a little late to go back and change history :-) but a fix for this can
certainly be integrated into the next release of Tomcat.

>
> B.T.W. Jonathan asked how 'How good is Tomcat', well I think I can
> comment on this one soon :-) We are going to do some performance test on
> it (memory leaks, CPU consumption) with OptimizeIt, I hope I can publish
> some results soon.

That will be very helpful as well.

>
> --
> Mark Brouwer
> Virgil B.V.
>

Craig McClanahan