We are using oracle 9i as our database, Weblogic 8.1 cluster with Apache HTTP server.
We have some PDF files which we store in the database, which are uploaded by the user. We have to show the user the file by reading the blob, this files are in the range of 0.5 MB. We have around 200 such files and around 600 users.
The question is should we cache the files, to increase the performance if yes then what is the best way of caching them.
we have good results with caching the files in (appserver-)local filesystem and refreshing it (if necessary) when the parent object (the object that wraps the binary data and holds meta-data) is accessed.
this way, the frontend-webserver can fulfill subsequent requests, not bothering the DB or even (if your security constraints allow this) the appserver.
Thanks for the reply, but our company standards does not allow us to store the files on the local filesystem, they want the files should be stored in the database.
Therefore the option suggested by you is gone.
just to make sure i did´t chose my words right.... i did not suggest to actually store the files in the FS only, but to store them in DB as you do now (and like we do). just _cache_ them in the local app-server´s FS if you have to read them from DB (could be in RAM also, if FS not an option) and reread them from the DB _only_ if found necessary.
a simple, effective and (from what i know) common strategy.
would this break your company standards ?
if so, why ?
and where would it actually be possible to cache this data without breakin the rules ?
Thanks for the reply. I misunderstood you I thought that you were asking to store the file in the FS which is not allowed. But yes I will have to think about storing the files in the memory. Can you please suggest me a satergy to do so.
I have thought of implementing HashTable so that I can store the files and ID in the hashtable. But the only area I am concerned about Cluster, how will I notify other servers on which the code is deployed about the refresh in the cache and all such questions.
Simple, use Coherence
. Coherence provides cluster-wide location transparency, meaning each and every JVM in the cluster has the same concurrent view of the data in a cache no matter where that data is physically stored in the cluster. That combined with our partitioned cache which allows for limitless cache capacity in a cluster is a powerful combination.
Rob MisekTangosol, Inc.Coherence
: It just works.