问题
Is Terracotta a distributed cache?
回答1:
Although you don't specify which product you are talking about, I'm going to assume you mean the open source platform itself. The short answer is no, but it can be used to write a distributed cache, and it has been in one of their own products (Ehcache).
You can see an overview of what the core engine is about here (it seems that they are hiding the information on their open source platform behind a registration wall now). It is a clustering engine that does not use J2EE technology, and its main purpose is to simplify distributed computing development. Besides caching, obvious use cases involve high availability and scalability needs. Think of it as enabling relatively plain java code to run "in the cloud" without having to worry about a lot of the details that that might involve.
回答2:
Terracotta has nothing to do with 'caching' although most implementations use it for caching purpose. Terracotta is about clustering and the terracotta itself is implemented using java (to my knowledge).
How Terracotta achieves clustering:
1) JVM1 running APP 2) JVM2 running APP (same) 3) JVM3 running APP (same)
Without Terracotta all JVMs are running independently with out knowing about each other performing some redundant tasks and maintaining their independent heaps
When you enable Terracotta (a Terracotta server running) across these 3 JVMs (configured to use Terracotta server)
Terracotta gives a logical view of all 3 JVMs as a single JVM. Any object graph that you designate to be stored at Server(Root ) is available to all 3 JVMs just like any local object but each JVM can can read/write to that object, whose changes are immediately(~) available to the other JVMs.
For this very reason Terracotta is used mainly for caching and distributed computing as idle JVMs with no work can process the work of the heavily loaded lagging JVM if the unit of work object is designated to be shareable.
回答3:
Your question is unclear (Terracotta has several products) but yes, the Terracotta Platform does offer a solution for Distributed Caching.
回答4:
L2 cache is the one that is external to a processor (a JVM, in our case) and shared among them. Serving as a transparent L2 cache, Terracotta combines your multicomputer into a multiporcessor. Thus, it is a distributed cache. But, you seem not to get it because you are SW guys who have never imagined that it can be transparent. You expect that a cache is a thing that has get/set methods and coherence problem that you need to resolve at application level.
Read the "Definite Guide to Terracotta". The authors are literal saying that Terracotta is a distributed cache. I think they understand this better than anybody who says "no" replying here.
来源:https://stackoverflow.com/questions/2761177/is-terracotta-a-distributed-cache