You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jacob Hookom <ho...@uwec.edu> on 2002/10/21 12:45:39 UTC

[OT] Working with File System

Hey All,

If we are storing large amounts of files on the server, is it acceptable
(performance wise) to be querying directories straight from the file
system?  I realize Tomcat does this for directory browsing, but I don't
know if it will scale well enough that I would need to cache the
results?

My idea is to query the file system and use their hash code as a look up
in the DB for extra properties as added by the user (description, etc).

Thanks in advance for any information,
Jacob



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [OT] Working with File System

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Mon, 21 Oct 2002, Jacob Hookom wrote:

> Date: Mon, 21 Oct 2002 05:45:39 -0500
> From: Jacob Hookom <ho...@uwec.edu>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: 'Struts Users Mailing List' <st...@jakarta.apache.org>
> Subject: [OT] Working with File System
>
> Hey All,
>
> If we are storing large amounts of files on the server, is it acceptable
> (performance wise) to be querying directories straight from the file
> system?  I realize Tomcat does this for directory browsing, but I don't
> know if it will scale well enough that I would need to cache the
> results?
>

Assuming that there is a filesystem at all would make your application
non-portable, because app servers are *not* required to support that mode
of application execution.  For example, Tomcat gives you the option to run
directly from a WAR.

I would suggest using the context-relative path to the resource as the key
to your database lookups.  That way, it will work either inside or outside
a WAR.  If you need metadata about the resource itself (such as the file
size or the last modified date), you can acquire that by using the
ServletContext.getResource() method to get a URL for the resource, and
then using URL.openConnection() to get a URLConnection for it.  From this
you can read the various headers associated with the file.

> My idea is to query the file system and use their hash code as a look up
> in the DB for extra properties as added by the user (description, etc).
>

There's no general purpose answer to whether you need to cache or not.
The only way to find out is try it.

> Thanks in advance for any information,
> Jacob

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>