• Post Reply Bookmark Topic Watch Topic
  • New Topic

where does ehcache store data  RSS feed

 
David Spades
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

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?

thanks
 
Tim Cooke
Marshal
Posts: 3568
173
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
David Spades
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Tim Cooke
Marshal
Posts: 3568
173
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
David Spades
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, I have identified that DB access is the problem, so does that mean ehcache keeps the data in RAM?
and I assume it has its own gc?
thanks
 
Tim Cooke
Marshal
Posts: 3568
173
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. 'In memory' means the data is stored in your system memory, which is RAM.

EhCache manages the memory completely. How it does it I don't know, nor does it matter. It does matter that the JVM's GC isn't involved.
 
David Spades
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
thanks
 
Tim Cooke
Marshal
Posts: 3568
173
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!