Heiko Grussbach <[EMAIL PROTECTED]> wrote:
>I'm currently trying to optimize my servlet for more throughput. The
>servlet sends dynamic content, which is however, known, not to change very
>often. So my first idea was to use the HttpServletResponse-header field
>Last-Modified and check, if the document had been modified. If not, I just
>send an SC_NOT_MODIFIED back. This helps a bit, but still the browser asks
>the servlet for each document. So I went back to the description of the
>Http headers and found the Expires header. For documents for which I have
>the information, I then set this header to some value (i.e. current time+1
>hour), so that the browser doesnt even have to ask for the document, but
>can directly use its cached version.
>
>Are there any other methods for optimizing throughput of documents which
>are known not to change too often? Any suggestions would be greatly
>appreciated.


You could try creating a cache of the documents. A hashtable with the
request URI as the key and the contents as the value would probably be
sufficient. If the document isn't in the cache, then it can be generated,
put in the cache and then returned. If it is in the cache, it is returned
from there. If your data changes at known times, you can update the cache
via an external (non-servlet) thread when the data changes.

It wouldn't cause the servlet to get called any less frequently, but it
would increase the speed at which the servlet could return the data.


Erik

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to