SPRINGMEETUPPARIS
#13
* les proportions ne sont pas respectées :)
GETTING
DISTRIBUTED
WITH
AND
“Who comes for the 1st time to Spring Meetup Paris?”
Spring Meetup Paris
Spring Meetup ParisFOR
DUMMIES
Spring Meetup Paris
Technical and Community-driven User
Group
Organized by an army of 3 people
spring-meetup-paris.github.io
Spring Meetup Paris
“A meetup about a DI Framework?
Really?”
Spring Meetup Paris
Welcome to 2015!
Spring Meetup Paris
We also talk about
Spring Meetup Paris
And even more...
...
Spring Meetup Paris
And sometimes about alternatives
DAGGER 2
functional programming
Spring Meetup Paris
WE WANT YOU
… to submit a talk !
❏ your usecases
❏ your library/framework
Format : EN/FR | 15/30/45 min.
Spring Meetup Paris
Emrah Kocaman | @emrahkocaman
What is Hazelcast?Hazelcast DemoHazelcast Data DistributionDistributed Caching with SpringAdditional UtilitiesQ/A Session
Agenda
what is ?
“Hazelcast is In-Memory Data Grid (IMDG) Solution”
010011010101010
In Memory Data Computing
In Memory Data Messaging + + In Memory
Data Storage
an open-source project
an open-source projectleading open-source in-memory
data grid.Apache 2 Licensedead simple distributed programminglightweight w/o any dependencybuilt with in Istanbul
Hazelcast Inc.Hazelcast EnterpriseSupport ContractsTraining / ConsultingOffices in Istanbul & Ankara (Engineering) , Palo Alto(HQ+Sales) and London(Sales)
What are the main features of Hazelcast?
• Scalability
What are the main features of Hazelcast?
• Scalability
• Speed
What are the main features of Hazelcast?
Reference : https://gist.github.com/hellerbarde/2843375
Reference : http://www.statisticbrain.com/average-historic-price-of-ram/
• Scalability
• Speed
• Simplicity
What are the main features of Hazelcast?
import java.util.Map; import java.util.HashMap;
Map map = new HashMap();map.put(“1”, “spring”); map.get(“1”);
java.util.Map
import java.util.Map;import java.util.concurrent.*;
Map map = new ConcurrentHashMap();map.put(“1”, “spring”);map.get(“1”);
java.util.concurrent.ConcurrentMap
// Creating a new Hazelcast nodeHazelcastInstance hz = Hazelcast.newHazelcastInstance();
// Getting a MapMap map = hz.getMap(“cities”);
// put a valuemap.put(“1”,”istanbul”);
Hazelcast Node 1
// Creating a new Hazelcast nodeHazelcastInstance hz = Hazelcast.newHazelcastInstance();
// Getting a MapMap map = hz.getMap(“cities”);
// get a valuemap.get(“1”);
Hazelcast Node 2
DEMO TIME
<backup-count>1</backup-count>
max backup count is 6
Backups increase memory usage since they are also kept in memory.
Data Backup
© 2015 Hazelcast Inc. Confidential & Proprietary
Rebalance Data on New Node
44
© 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
© 2015 Hazelcast Inc. Confidential & Proprietary
New Node Added
DA B C
© 2015 Hazelcast Inc. Confidential & Proprietary
Migration
DA B C
© 2015 Hazelcast Inc. Confidential & Proprietary
Migration
DA B C
© 2015 Hazelcast Inc. Confidential & Proprietary
Migration
DA B C
© 2015 Hazelcast Inc. Confidential & Proprietary
Migration
DA B C
© 2015 Hazelcast Inc. Confidential & Proprietary
Migration
DA B C
© 2015 Hazelcast Inc. Confidential & Proprietary
Migration
DA B C
© 2015 Hazelcast Inc. Confidential & Proprietary
Migration Complete
DA B C
© 2015 Hazelcast Inc. Confidential & Proprietary
Data Safety when Node Dies
54
© 2015 Hazelcast Inc. Confidential & Proprietary
Node Crashes
DA B C
Crash
© 2015 Hazelcast Inc. Confidential & Proprietary
Backups Are Restored
DA B C
Crash
© 2015 Hazelcast Inc. Confidential & Proprietary
Backups Are Restored
DA B C
Crash
© 2015 Hazelcast Inc. Confidential & Proprietary
Backups Are Restored
DA B C
Crash
© 2015 Hazelcast Inc. Confidential & Proprietary
Backups Are Restored
DA B C
Crash
© 2015 Hazelcast Inc. Confidential & Proprietary
Backups Are Restored
DA B C
Crash
© 2015 Hazelcast Inc. Confidential & Proprietary
Backups Are Restored
DA B C
Crash
© 2015 Hazelcast Inc. Confidential & Proprietary
Backups Are Restored
DA B C
Crash
© 2015 Hazelcast Inc. Confidential & Proprietary
Backups Are Restored
DA B C
Crash
© 2015 Hazelcast Inc. Confidential & Proprietary
Recovery Is Complete
DA C
Client/Server Architecture
Embedded Architecture
Deployment Options
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
DEMO TIME (AGAIN)
Multicast (default)
TCP/IP
AWS
Networking Options
Programmatic
XML Configuration
Configuration Options
XML Configuration
XML Configuration
XML Configuration
XML Configuration
Distributed Caching Features
Spring Cache ProviderSpring JCache ProviderHibernate 2nd Level Cache
Spring Cache ProviderDeclarative Way
Spring Cache ProviderProgrammatic Way
Spring JCache Provider
DEMO TIME (AGAIN )2
Hibernate 2nd Level Cache
@SpringAware Annotation
@SpringAware Annotation
@SpringAware Annotation