-----Original Message-----
From: Brian P. Rickabaugh [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 25, 1999 1:10 PM
To: [EMAIL PROTECTED]
Subject: RE: file cache


Martin,

I'm using a file cache that is populated when the init () methods runs.
Basically, the init method loads in x number of files and then the actual
methods within the servlet use that cache to obtain a String representation
of the file, usually an HTML file.  So really, this is strictly a text file
cache.  Note that this cache does not get reloaded until the servlet is
destroyed and re-init'd such as when a restart of the servlet engine occurs.

I have noticed a better than expected decrease (10-15%) in execution time on
a Sun host running JRun.

In Linux, any caching that you're seeing is very limited and wouldn't be
consistent across multiple calls to a servlet, over a long period of time,
on a busy server.  You're much better of not worrying about the file i/o
intricacies as the o/s and filesystem may dump your file from the cache at
any time.

The method that you're using, by loading the file into your servlets data
address space should, overtime, see much better performance and be more
reliable.  If you for some reason migrate to another O/S you won't be
guaranteed any of these filesystem behaviors.  If you're seeing little or no
performance increase, maybe its b/c Linux is such an efficient O/S.  ;-)

Regards,

Brian

-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Eric
Fialkowski
Sent: Tuesday, May 25, 1999 2:34 PM
To: [EMAIL PROTECTED]
Subject: Re: file cache


I don't think you can turn off file caching in Linux (at least with the
2.0.x kernels).

Also, depending on the size of files, the memory the cached versions are
occupying could be getting paged to disk so you won't get much of a gain.

-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
Martin Gloeckle
Sent: Tuesday, May 25, 1999 11:26 AM
To: [EMAIL PROTECTED]
Subject: file cache


*** i'm writing a file cache to use together with my servlets.

pretty straight forward: when a file first is requested, load it from file
and put it into memory. from then on use the copy from memory.

the problem that i have is that there is _no_ performance gain at all when
reading a file from the cache as opposed to reading it from the file system.
my programming may not be perfect but i should see _some_ gain.

it looks like linux itself is caching the file, because the first access
from the file system is a little slower than subsequent access from the file
system.

is this possible? can i turn the file caching on the operating system level
off (for testing purposes)?
any other ideas?

and, is there source code for a file cache available somewhere?

thanks,
- martin

___________________________________________________________________________
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

___________________________________________________________________________
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