Clustering Java applications with Terracotta and Hazelcast

Preview:

DESCRIPTION

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

Citation preview

CLUSTERING JAVA APPLICATIONS

WITH TERRACOTTA AND HAZELCAST

Boris Trofimov @ Sigma Ukraine

Why clasterization

Terracotta

Hazelcast

Summary

Sigma Ukraine 2

AGENDA

Sigma Ukraine 3

WHY CLASTERIZATION?

Moore's law is broken

Era of Big Data

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

Data Claterization Distributed Data Exchanging Distributed Coordination Distributed Heap

Sigma Ukraine 4

KINDS OF CLASTERIZATION

SOMETIMES IT'S HARD TO CHOOSE...

Sigma Ukraine 5

Sigma Ukraine 6

Maintained by private company

Supports Quartz and Ehcache

Terracota modes

Sigma Ukraine 7

ABOUT TERRACOTTA

Sigma Ukraine 8

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

Sigma Ukraine 10

EXAMPLE — CONFIGURATION

11

EXAMPLE CRUD

12

EXAMPLE — IN-MEMORY SEARCH

BigMemory GO vs BigMemory MAX

Might use Server Array

Respecting CA (CAP theorem)

Linear grouth

Sigma Ukraine 13

CLUSTERIZATION

Sigma Ukraine 14

Sigma Ukraine 15

HOW IT WORKS

Specify root objects

Launch terracotta server

Launch app instances

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

All Standard non-value types like maps, lists

POJO Objects

Synchronization Java objects like locks, semaphores

Sigma Ukraine 17

OBJECTS TO SYNC

Sigma Ukraine 18

EXAMPLE — DEFINE CONFIGURATION

Sigma Ukraine 19

EXAMPLE — CODE

Start Terracotta Server (local or cluster)

Launch two Java application instances through terracotta script launcher.

Sigma Ukraine 20

EXAMPLE — LAUNCH

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

Internal ACID Transactions

Only data changes are broadcast

Local caches

DSO- POJO transparent clasterizations

Monitoring Control tools

Sigma Ukraine 22

BENEFITS

Sigma Ukraine 23

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

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

26

EXAMPLE — DISTRIBUTED MAP

Partitioning with replicas

Scalable Peer-toPeer architecture

Availability over Consistency

Failover cluster

Native Client support

Sigma Ukraine 27

CLUSTERIZATION

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

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

Sigma Ukraine 30

SUMMARY

Thank you for your attention!

Recommended