1 Reply Latest reply on Apr 12, 2013 3:15 AM by Horia Chiorean

    Binary persistence, DB or Cache?

    Brian Wallis Master

      I've been giving the binary persistence question a bit of thought lately and am wondering if I should use cache-binary-storage or db-binary-storage.


      Our application primarily stores images of scanned documents in the repository and these are accessed from the UI where the user can scroll back and forth over the images and may often come back to the same images over the course of the day.


      It seems to make sense to use the cache for the binary storage rather than the database just for the level of caching of the images provided. If I were to use the db-binary-storage then I would probably want to introduce some sort of caching at the application level anyway.


      That said, we will have a cache at the application layer for images sent to the UI anyway as the full resolution images are not usually what are displayed (as they are 200 to 300 DPI images). This cache would temporarily contain a selection of resized versions of the images for display (thumbnails and something around 100 DPI at least for letter/A4 sized images)


      Does the db-binary-storage have any caching built in or does it fetch the binary from the DB every time it is asked for it?



        • 1. Re: Binary persistence, DB or Cache?
          Horia Chiorean Master

          The DB binary storage executes a PreparedStatement each time binary content is requested. Moreover, if full text search is enabled and there are text extractors configured (e.g. Tika), an additional query is executed in order to retrieve extracted text whenever indexes are created/updated around nodes which contain binary properties.


          Personally, I think the caching solution is a superior one, because you could (if you wanted to) configure an ISPN cache with a JDBC loader & write-behind, so that you get in "one shot" both storage in a database and a caching layer.