[jboss-user] [JBossCache] - Re: Blob balancer using cache - concept help

zambak do-not-reply at jboss.com
Tue Aug 22 10:50:49 EDT 2006


"manik.surtani at jboss.com" wrote : Using the file cache loader in this manner will not work, since the file cache loader serialises the attribute map of the  node into a single file.  Your webserver will not be able to parse and serve up this file.
  | 
  | Perhaps this approach may help:
  | 
  | 1) Single, JDBC based cache loader
  | 2) Uploading an image will result in the servlet converting the file to a byte[] and putting this in cache (so it gets stored in the db)
  | 3) Register a cache listener on the cache, which when a node is created, your cache listener writes the byte[] to your filesystem in a specified place, in the file format specified.  
  | 4) Since the cache will replicate it's contents, this will trigger cache listeners on each instance in your cluster, so the file is created on the filesystems on each cluster node.

Thanks for the info. I will try this approach.
Some concerns though....

1) Since image will be uploaded and stored in the DB via admin part, can I use the same BLOB column when I configure JDBC based cache loader. I mean are the BLOBs compatible (as in case with File cache loader the map is serialized so image file and cached file are not the same, is it same true for JDBC loader?) If they are not compatible, then I am going to have to waste some DB space (duplicate BLOBS in DB one BLOB is app specific, one is for cache right?)....

2) In order to evict an item when a new image with a same name is uploaded (an update) will I need to have a listener perform this action logic?

If I understand this correctly, the listener would add/remove/update blobs in the cache every time admin action adds/removes/updates an image. Then we rely on cache achitecture to propagate same behavior across the cluster.

So we have add/update/remove image (in admin)

1) store/restore/reupdate image as a BLOB in DB (depending on concern outlined in #1)
2) add image as byte[] to cache
3) action in #2 will notify the listeners on all nodes and recreate/remove image from byte[] onto a disk




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3966722#3966722

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3966722



More information about the jboss-user mailing list