File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Linux / UNIX and the fly likes http file caching on linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "http file caching on linux" Watch "http file caching on linux" New topic

http file caching on linux

Jared Ojared

Joined: Nov 24, 2011
Posts: 2
If I have a jdk installed on a suse linux box is there some soft of default folder where http files are cached? I know with webstart you can locate some kind of cache folder, wondering if that cache is similar in nature to the cache for web browsers.

I am running a tomcat instance and would like to know how to cache a file to speed up requests.

Any ideas?
Peter Johnson

Joined: May 14, 2008
Posts: 5812

I'm confused. Are you running Tomcat on this Linux box? Or is Tomcat running elsewhere and you are running a browser on a Linux box and accessing Tomcat? If the latter, then the browser should automatically cache the file somewhere in a hidden directory in your home directory (exact location depends on the browser).

JBoss In Action
Jared Ojared

Joined: Nov 24, 2011
Posts: 2
Peter not quite:

Tomcat etc on a linux box. A method inside my tomcat server is http getting another url (not hosted by me, an external url) through URL and URLConnection.

This URL connection response is large, slow and I want to cache it. I think the only way to do it is to use squid to cache the response.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15964

Tomcat is a server and does not cache anything. The clients have to do their own caching, or (as you mentioned), access via a caching proxy, such as squid. Java itself has no caching capabilities.

Customer surveys are for companies who didn't pay proper attention to begin with.
luke swagger

Joined: Dec 22, 2011
Posts: 3
I need to do some speed tests and benchmarks on my hard disk drive. Unfortunately the files being written/read are being cached, (normally it's a good thing, but not when I need to accurately measure the performance of the harddisk). I looked in 'mount' options, 'hdparm', even the kernel configuration. Unfortunately I couldn't find anything. I feel that it should be a simple switch somewhere, but I'm just missing it.
Please, if any one knows how to disable the cache, I'd appreciate the help. Even if it takes to hack the kernel, I have no problem.
Thanks in advance,

Samsung Galaxy Tab accessories
wave power
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15964

The Gold Standard for Linux-based disk performance testing is Bonnie.

However, Bonnie is designed specifically to test the physical hard drive and filesystem performance.

If you're looking for performance specific to a single application system, such as Tomcat, then you need to construct a test framework that mimics the production loads as accurately as possible. Programs such as jMeter can help there.
evan tanski

Joined: Jan 06, 2012
Posts: 5
Linux loves to cache I/O. It likes it so much, that it’ll try to cache virtually everything you throw at it. Generally, this is a good thing. Caching files means that the file that’s on the hard disk is placed inside the system memory.
Don't get me started about those stupid light bulbs.
subject: http file caching on linux
Similar Threads
How to upload a file?
Install Issues - Fedora Core 1
Linux problem getting error in creating folder via tomcat app
Eclipse startup
symbolic link