2

I'm curious, can EhCache be used to distribute files across multiple servers, or do I have to use a different solution for such?

The reason I'm asking is that we have an application that generates small binary files on request, and we're trying to figure out the easiest way to have these files available through a webserver.

EhCache has been mentioned briefly, but I've got the feeling it's more meant for caching data results and not in any way faster/cheaper than serving such binary files through a regular folder on a web server.

OddBeck
  • 835
  • 8
  • 19
  • 1
    Why not use a filesystems like NFS or CIFS? It is the fastest way to distribute files. – Peter Lawrey Jun 21 '13 at 12:37
  • @PeterLawrey - yes, that would be an option - the thing is, these binary files should be deleted once in a while and instead of running a cron-job every now and then it would be nice to have some sort of "cache" that would remove files that aren't that often used. – OddBeck Jun 21 '13 at 12:40
  • In a distributed system, it is very hard/expensive to maintain a LRU list. – Peter Lawrey Jun 21 '13 at 12:43
  • @PeterLawrey: so it seems that the best solution would be an NFS-store, and then a database with a timestamp of all accessed objects, and then some sort of job that would run now and then and delete files that haven't been accessed in so and so long? – OddBeck Jun 21 '13 at 12:45
  • Yes, or you could use ehcache (or something like it) to maintain the last used timestamps and other meta data about the files. I would avoid using an RDBMS database as they can be pretty slow. – Peter Lawrey Jun 21 '13 at 12:47
  • Something like [Infinispan](http://www.jboss.org/infinispan/) might suit your needs - it's a distributed in-memory key-value store. – Zim-Zam O'Pootertoot Jun 21 '13 at 14:22
  • It seems that we're probably rewriting a tiny part of the code in order to cache the files (4-10 KB-files) using EhCache instead of writing them to disc. If things go wrong (i.e too many requests) we're just 'rolling back' to the disc-solution and will then involve some distributed file system. Thanks for your replies :-) – OddBeck Jun 24 '13 at 10:09

0 Answers0