Is Terracotta a distributed cache?

前端 未结 4 1638
予麋鹿
予麋鹿 2021-01-12 04:25

Is Terracotta a distributed cache?

4条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-12 04:50

    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.

提交回复
热议问题