I am curious as to where ehcache stores its data? in heap? RAM? disk? file?
if it's in disk or file, then it's roughly the same as storing in DB under the same box, right? where you can still see I/O related bottleneck
if it's in heap / RAM, then he size of stored object is limited, right?
can anyone please explain how this one works?
David Spades wrote:I am curious as to where ehcache stores its data? in heap? RAM? disk? file?
There are many options, so all of the above.
Regardless of where the data is actually stored, one of the neat features about ehCache is that it can maintain a cache across multiple JVM's even across multiple physical machines. This is handy when running an application in a cluster. The size of the cache is configurable.
One of the really neat features, in my opinion, is their offering called BigMemory which is an off heap in memory database. Because it is off heap the GC isn't interested in it which means that performance is really good and isn't hindered by the GC doing 'stop the world' clean ups all the while. EhCache manages the memory completely.
ok, so lets say it's BigMemory's offheap storage, is this the same like accessing file when my java app is trying to retrieve the data residing there? because anything I/O related (file and DB) is the bottleneck I want to avoid. thanks
No. Accessing memory is not the same as accessing a file. Memory access is very fast, where file access is very slow.
I trust that you have already identified through testing and profiling that the file IO is causing a bottleneck in your system, and that there's a legitimate need to eliminate it? Otherwise there's a good chance that this is all a waste of time and effort. The latency from a simpler db or file approach might not be a problem. Always go for the simplest solution that satisfies the requirements.
when googling, I see that people are comparing ehcache and mongodb. I thought that both are different products, one is caching FW, while mongo is DB system. this is most curious since I'm planning to use ehcache for mongodb. any explanation on this?
and while we're at it, any good tutorial on configuration to make ehcache work with nosql like mongodb?
You might want to provide a link to those articles you're referring to, so we can read them too. Hard to comment on it otherwise.
As far as I know, the BigMemory product is a database in itself, rather than a cache framework for some other database or resource. I'm not completely sure about that though so it will be worth you to do some research of their documentation yourself. I'm sure they have usage tutorials too that will help you get started with your evaluation.