spring meetup paris - getting distributed with hazelcast and spring

69
SPRING MEETUP PARIS #13 * les proportions ne sont pas respectées :) GETTING DISTRIBUTED WITH AND

Upload: emrah-kocaman

Post on 12-Apr-2017

504 views

Category:

Software


1 download

TRANSCRIPT

Page 1: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

SPRINGMEETUPPARIS

#13

* les proportions ne sont pas respectées :)

GETTING

DISTRIBUTED

WITH

AND

Page 2: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

“Who comes for the 1st time to Spring Meetup Paris?”

Spring Meetup Paris

Page 3: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

Spring Meetup ParisFOR

DUMMIES

Page 4: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

Spring Meetup Paris

Technical and Community-driven User

Group

Organized by an army of 3 people

spring-meetup-paris.github.io

Page 5: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

Spring Meetup Paris

“A meetup about a DI Framework?

Really?”

Page 6: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

Spring Meetup Paris

Welcome to 2015!

Page 7: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

Spring Meetup Paris

We also talk about

Page 8: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

Spring Meetup Paris

And even more...

...

Page 9: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

Spring Meetup Paris

And sometimes about alternatives

DAGGER 2

functional programming

Page 10: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

Spring Meetup Paris

WE WANT YOU

… to submit a talk !

❏ your usecases

❏ your library/framework

Format : EN/FR | 15/30/45 min.

Page 11: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

Spring Meetup Paris

Emrah Kocaman | @emrahkocaman

Page 12: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

What is Hazelcast?Hazelcast DemoHazelcast Data DistributionDistributed Caching with SpringAdditional UtilitiesQ/A Session

Agenda

Page 13: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

what is ?

Page 14: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

“Hazelcast is In-Memory Data Grid (IMDG) Solution”

010011010101010

In Memory Data Computing

In Memory Data Messaging + + In Memory

Data Storage

Page 15: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

an open-source project

Page 16: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

an open-source projectleading open-source in-memory

data grid.Apache 2 Licensedead simple distributed programminglightweight w/o any dependencybuilt with in Istanbul

Page 17: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

Hazelcast Inc.Hazelcast EnterpriseSupport ContractsTraining / ConsultingOffices in Istanbul & Ankara (Engineering) , Palo Alto(HQ+Sales) and London(Sales)

Page 18: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

What are the main features of Hazelcast?

Page 19: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

• Scalability

What are the main features of Hazelcast?

Page 20: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

• Scalability

• Speed

What are the main features of Hazelcast?

Page 21: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

Reference : https://gist.github.com/hellerbarde/2843375

Page 22: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

Reference : http://www.statisticbrain.com/average-historic-price-of-ram/

Page 23: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

• Scalability

• Speed

• Simplicity

What are the main features of Hazelcast?

Page 24: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

import java.util.Map; import java.util.HashMap;

Map map = new HashMap();map.put(“1”, “spring”); map.get(“1”);

java.util.Map

Page 25: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

import java.util.Map;import java.util.concurrent.*;

Map map = new ConcurrentHashMap();map.put(“1”, “spring”);map.get(“1”);

java.util.concurrent.ConcurrentMap

Page 26: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

// Creating a new Hazelcast nodeHazelcastInstance hz = Hazelcast.newHazelcastInstance();

// Getting a MapMap map = hz.getMap(“cities”);

// put a valuemap.put(“1”,”istanbul”);

Hazelcast Node 1

Page 27: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

// Creating a new Hazelcast nodeHazelcastInstance hz = Hazelcast.newHazelcastInstance();

// Getting a MapMap map = hz.getMap(“cities”);

// get a valuemap.get(“1”);

Hazelcast Node 2

Page 28: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

DEMO TIME

Page 29: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

<backup-count>1</backup-count>

max backup count is 6

Backups increase memory usage since they are also kept in memory.

Data Backup

Page 30: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

© 2015 Hazelcast Inc. Confidential & Proprietary

Rebalance Data on New Node

44

Page 31: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

© 2015 Hazelcast Inc. Confidential & Proprietary

Distributed Maps

Fixed number of partitions (default 271)Each key falls into a partitionpartitionId = hash(keyData)%PARTITION_COUNTPartition ownerships are reassigned upon membership change

A B C

Page 32: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

© 2015 Hazelcast Inc. Confidential & Proprietary

New Node Added

DA B C

Page 33: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

© 2015 Hazelcast Inc. Confidential & Proprietary

Migration

DA B C

Page 34: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

© 2015 Hazelcast Inc. Confidential & Proprietary

Migration

DA B C

Page 35: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

© 2015 Hazelcast Inc. Confidential & Proprietary

Migration

DA B C

Page 36: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

© 2015 Hazelcast Inc. Confidential & Proprietary

Migration

DA B C

Page 37: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

© 2015 Hazelcast Inc. Confidential & Proprietary

Migration

DA B C

Page 38: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

© 2015 Hazelcast Inc. Confidential & Proprietary

Migration

DA B C

Page 39: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

© 2015 Hazelcast Inc. Confidential & Proprietary

Migration Complete

DA B C

Page 40: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

© 2015 Hazelcast Inc. Confidential & Proprietary

Data Safety when Node Dies

54

Page 41: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

© 2015 Hazelcast Inc. Confidential & Proprietary

Node Crashes

DA B C

Crash

Page 42: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

© 2015 Hazelcast Inc. Confidential & Proprietary

Backups Are Restored

DA B C

Crash

Page 43: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

© 2015 Hazelcast Inc. Confidential & Proprietary

Backups Are Restored

DA B C

Crash

Page 44: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

© 2015 Hazelcast Inc. Confidential & Proprietary

Backups Are Restored

DA B C

Crash

Page 45: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

© 2015 Hazelcast Inc. Confidential & Proprietary

Backups Are Restored

DA B C

Crash

Page 46: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

© 2015 Hazelcast Inc. Confidential & Proprietary

Backups Are Restored

DA B C

Crash

Page 47: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

© 2015 Hazelcast Inc. Confidential & Proprietary

Backups Are Restored

DA B C

Crash

Page 48: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

© 2015 Hazelcast Inc. Confidential & Proprietary

Backups Are Restored

DA B C

Crash

Page 49: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

© 2015 Hazelcast Inc. Confidential & Proprietary

Backups Are Restored

DA B C

Crash

Page 50: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

© 2015 Hazelcast Inc. Confidential & Proprietary

Recovery Is Complete

DA C

Page 51: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

Client/Server Architecture

Embedded Architecture

Deployment Options

Page 52: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

Great for early stages of rapid application development and iteration

Necessary for scale up or scale out deployments – decouples upgrading of clients and cluster for long term TCO

Embedded Hazelcast

Hazelcast Node 1

Applications

Java API

Client-Server Mode

Hazelcast Node 3

Java API

Applications

Java API

Applications

Java API

Applications

Hazelcast Node 2

Hazelcast Node 1

Hazelcast Node 2

Applications

Java API

Hazelcast Node 3

Applications

Java API

Deployment Options

Page 53: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

DEMO TIME (AGAIN)

Page 54: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

Multicast (default)

TCP/IP

AWS

Networking Options

Page 55: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

Programmatic

XML Configuration

Configuration Options

Page 56: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

XML Configuration

Page 57: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

XML Configuration

Page 58: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

XML Configuration

Page 59: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

XML Configuration

Page 60: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

Distributed Caching Features

Spring Cache ProviderSpring JCache ProviderHibernate 2nd Level Cache

Page 61: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

Spring Cache ProviderDeclarative Way

Page 62: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

Spring Cache ProviderProgrammatic Way

Page 63: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

Spring JCache Provider

Page 64: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

DEMO TIME (AGAIN )2

Page 65: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

Hibernate 2nd Level Cache

Page 66: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

@SpringAware Annotation

Page 67: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

@SpringAware Annotation

Page 68: Spring Meetup Paris - Getting Distributed with Hazelcast and Spring

@SpringAware Annotation