Hazelcast 101

Post on 02-Dec-2014

209 views 2 download

description

Introduction to the leading in-memory data grid solution Hazelcast

transcript

H A Z E L C A S T 1 0 1T H E L E A D I N G I M D G S O L U T I O N E X P L A I N E D

E M R A H K O C A M A N @emrahkocaman

https://github.com/emrahkocaman emrahkocaman@gmail.com

About Me

!

• Oracle Certified Professional Java Programmer • 6+ years of Professional Java development • Was working on enterprise Java technologies • Software Developer at Hazelcast (since July 2014)

Before we begin

Agenda

• What is IMDG? • What is Hazelcast? • Configuring Hazelcast • Distributed World of Hazelcast • Hazelcast - Spring Framework Integration • Management Center

I N - M E M O R Y D ATA G R I D S

What’s IMDG?

Provide virtually unlimited processing power and memory as additional cluster members are added

Expand in real time and dynamically to meet increasing requirements

Increase capacity in a linear and predictable manner

Leverage commodity or integrated systems that are easily added without complexity

What is Hazelcast?

• The leading In Memory Data Grid • Highly Available Elastic Cache • 4.2 MBytes JAR • Distributed Execution Platform • Embedded or Client Server • Cloud Ready • Open Source - Apache License 2.0

Distributed Data-structures

• IAtomicLong • IdGenerator • Lock • CountDownLatch • Semaphore • Queue • Map • MultiMap

• Set • List • Topic • Executor • Write your own!

Who uses Hazelcast?

Use Cases

Raspberry Pi Cluster

Use Cases

• Scale your application • Data sharing • Distributed Caching • HTTP Session Replication • Hibernate 2nd Level Cache • Parallel Execution • Map-Reduce • Spring Cache Provider

Features

• Java Collection API • MultiMap • Topic • Java Concurrency API

• Lock, Semaphore, CountDownLatch, ExecutorService • Transactions • Custom Serialization • Off-Heap Support • Native Clients: C#, C++, Java, REST, memcached

C O N F I G U R I N G & F O R M I N G A C L U S T E R

Forming A Cluster

• Hazelcast Clusters run on JVM

• Hazelcast discovers other instances via Multicast (Default)

• Use TCP/IP lists when Multicast not possible

• Segregate Clusters on same network via configuration

• Hazelcast can form clusters on Amazon EC2.

Configuration

• Hazelcast searches for hazelcast.xml on class path

• Will use hazelcast-default.xml for everything else.

• Hazelcast can be configured via XML,API or Spring

• Configure Networks, Data Structures, Indexes, EC2

• Config is locked at start-up, cannot dynamically change (feature coming soon)

Start Your First Nodes

1 / 2

How Hazelcast Works

• Multiple Partitions Per Node • Consistent Hashing: hash(key) % partition count • Option to control partitioning • Possibility to find key owner for every key • Support for Near-Caching and executions on key

owner • Automatic Fault-Tolerance • Sync / Async Backups • Configurable Backup Counts

2 / 3

How Hazelcast Works

New Node

Re-balance

3 / 3

How Hazelcast Works

A node crashes Backups restored

Recover from backupBackup for recovered data

Distributed Map

Distributed Queue

Distributed Topic

Distributed Events

Distributed Lock

1 / 2

Executor Service

2 / 2

Executor Service

Spring Integration

• Supports Spring 2.5+ • Hazelcast Namespace • Spring Cache Provider • Spring Data Integration (on the way)

B A S I C B E A N D E C L A R AT I O N

Spring Integration

H A Z E L C A S T N A M E S PA C E

Spring Integration

H A Z E L C A S T N A M E S PA C E

Spring Integration

D E C L A R AT I V E C O N F I G U R AT I O N

Spring Cache

A N N O TAT I O N B A S E D C O N F I G U R AT I O N

Spring Cache

– H E N R Y M I N T Z B E R G

“Management is, above all, a practice where art, science, and craft meet”

T H A N K Y O U

Q & A

@emrahkocaman, @hazelcast emrah@hazelcast.com hazelcast@googlegroups.com http://www.hazelcast.com http://github.com/hazelcast/hazelcast