31
CLUSTERING JAVA APPLICATIONS WITH TERRACOTTA AND HAZELCAST Boris Trofimov @ Sigma Ukraine

Clustering Java applications with Terracotta and Hazelcast

  • Upload
    b0ris1

  • View
    4.436

  • Download
    3

Embed Size (px)

DESCRIPTION

Presentation prepared for JavaBreese in Odessa, Ukraine (18 May 2013)

Citation preview

Page 1: Clustering Java applications with Terracotta and Hazelcast

CLUSTERING JAVA APPLICATIONS

WITH TERRACOTTA AND HAZELCAST

Boris Trofimov @ Sigma Ukraine

Page 2: Clustering Java applications with Terracotta and Hazelcast

Why clasterization

Terracotta

Hazelcast

Summary

Sigma Ukraine 2

AGENDA

Page 3: Clustering Java applications with Terracotta and Hazelcast

Sigma Ukraine 3

WHY CLASTERIZATION?

Moore's law is broken

Era of Big Data

Page 4: Clustering Java applications with Terracotta and Hazelcast

Application clusterization Horizontal scaling, vertical scaling, MapReduce, MPI,...

Data Claterization Distributed Data Exchanging Distributed Coordination Distributed Heap

Sigma Ukraine 4

KINDS OF CLASTERIZATION

Page 5: Clustering Java applications with Terracotta and Hazelcast

SOMETIMES IT'S HARD TO CHOOSE...

Sigma Ukraine 5

Page 6: Clustering Java applications with Terracotta and Hazelcast

Sigma Ukraine 6

Page 7: Clustering Java applications with Terracotta and Hazelcast

Maintained by private company

Supports Quartz and Ehcache

Terracota modes

Sigma Ukraine 7

ABOUT TERRACOTTA

Page 8: Clustering Java applications with Terracotta and Hazelcast

Sigma Ukraine 8

Page 9: Clustering Java applications with Terracotta and Hazelcast

BigMemory uses Ehcache as its main programming interface

Off-Heap without Garbage Collection Pauses

3 major bricks: CacheManager, Cache and Element

Serializable data classes

Sigma Ukraine 9

DISTRIBUTED CACHE MODE

Page 10: Clustering Java applications with Terracotta and Hazelcast

Sigma Ukraine 10

EXAMPLE — CONFIGURATION

Page 11: Clustering Java applications with Terracotta and Hazelcast

11

EXAMPLE CRUD

Page 12: Clustering Java applications with Terracotta and Hazelcast

12

EXAMPLE — IN-MEMORY SEARCH

Page 13: Clustering Java applications with Terracotta and Hazelcast

BigMemory GO vs BigMemory MAX

Might use Server Array

Respecting CA (CAP theorem)

Linear grouth

Sigma Ukraine 13

CLUSTERIZATION

Page 14: Clustering Java applications with Terracotta and Hazelcast

Sigma Ukraine 14

Page 15: Clustering Java applications with Terracotta and Hazelcast

Sigma Ukraine 15

HOW IT WORKS

Specify root objects

Launch terracotta server

Launch app instances

Page 16: Clustering Java applications with Terracotta and Hazelcast

Terracotta uses aspect-oriented technologies to adapt the application at class load time.

Terracotta does not use serialization.

DSO uses object identity, instrumented classes (byte-code instrumentation), object-graph roots, and cluster-wide locks to maintain data coherence

Distributed GC

Sigma Ukraine 16

DSO INTERNALS

Page 17: Clustering Java applications with Terracotta and Hazelcast

All Standard non-value types like maps, lists

POJO Objects

Synchronization Java objects like locks, semaphores

Sigma Ukraine 17

OBJECTS TO SYNC

Page 18: Clustering Java applications with Terracotta and Hazelcast

Sigma Ukraine 18

EXAMPLE — DEFINE CONFIGURATION

Page 19: Clustering Java applications with Terracotta and Hazelcast

Sigma Ukraine 19

EXAMPLE — CODE

Page 20: Clustering Java applications with Terracotta and Hazelcast

Start Terracotta Server (local or cluster)

Launch two Java application instances through terracotta script launcher.

Sigma Ukraine 20

EXAMPLE — LAUNCH

Page 21: Clustering Java applications with Terracotta and Hazelcast

Sharing ordinary objects

Legacy clastering

Distributed Cache

Hibernate 2nd Cache (through DSO)

Web Session clustering (through DSO)

Clastering read/write data with fast update

Sigma Ukraine 21

USE CASES

Page 22: Clustering Java applications with Terracotta and Hazelcast

Internal ACID Transactions

Only data changes are broadcast

Local caches

DSO- POJO transparent clasterizations

Monitoring Control tools

Sigma Ukraine 22

BENEFITS

Page 23: Clustering Java applications with Terracotta and Hazelcast

Sigma Ukraine 23

Page 24: Clustering Java applications with Terracotta and Hazelcast

InMemory Distributed Cache

Open Source solution

Supports own special distributed data structures

Supports locks and events

Might be slcaled out

Easy to use and integrate

All objects must be serializable

Supports standard collection interfaces

Sigma Ukraine 24

WHAT IS HAZELCAST

Page 25: Clustering Java applications with Terracotta and Hazelcast

Distributed Queue

Distributed Topic

Distributed Map

Distributed MultiMap

Distributed Set

Distributed List

Distributed Locks

Distribured Event (Listeners)

Distributed Topic (Hello JMS)

Distributed Semaphore

Distributed Executor Service

Sigma Ukraine 25

SUPPORTED DATA

Page 26: Clustering Java applications with Terracotta and Hazelcast

26

EXAMPLE — DISTRIBUTED MAP

Page 27: Clustering Java applications with Terracotta and Hazelcast

Partitioning with replicas

Scalable Peer-toPeer architecture

Availability over Consistency

Failover cluster

Native Client support

Sigma Ukraine 27

CLUSTERIZATION

Page 28: Clustering Java applications with Terracotta and Hazelcast

User ASID Transactions over several operations

It is free, unlimited community license *

Persistence

Search enhanced by user-defined indexes

Spring support (beans, cachable)

Simple interfaces in comparison to Terracotta BigMemory

Sigma Ukraine 28

BENEFITS

Page 29: Clustering Java applications with Terracotta and Hazelcast

Share data across cluster

Send/receive messages

Distributed Coordination (locks)

Hibernate 2nd Cache

Http Session Clustering with HazelcastWM (based on Servlet specification)

Sigma Ukraine 29

USE CASES

Page 30: Clustering Java applications with Terracotta and Hazelcast

Sigma Ukraine 30

SUMMARY

Page 31: Clustering Java applications with Terracotta and Hazelcast

Thank you for your attention!