SlideShare una empresa de Scribd logo
1 de 54
Descargar para leer sin conexión
© 2015 Hazelcast Inc. Confidential & Proprietary 1
FUAD MALIKOV
CO-FOUNDER
Building Scalable Applications with
Hazelcast
© 2015 Hazelcast Inc. Confidential & Proprietary 2
What Is Hazelcast?
Hazelcast is a distributed,
highly available and scalable
Open Source In-Memory Data Grid
© 2015 Hazelcast Inc. Confidential & Proprietary 3
In Memory Data Grid
01001
10101
01010
In Memory
Data Computing
In Memory
Data Messaging ++In Memory
Data Storage
© 2015 Hazelcast Inc. Confidential & Proprietary 4
java.util.Map
import java.util.HashMap;
import java.util.Map;
public static void main(String[] args) {
Map<Integer, String> map = new HashMap<>();
map.put(1, "Paris");
map.put(2, "London");
map.put(3, "San Francisco");
String oldValue = map.remove(2);
}
© 2015 Hazelcast Inc. Confidential & Proprietary 5
java.util.concurrent.ConcurrentMap
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
public static void main(String[] args) {
ConcurrentMap<Integer, String> map = new ConcurrentHashMap<>();
map.put(1, "Paris");
map.put(2, "London");
map.put(3, "San Francisco");
String oldValue = map.remove(2);
}
© 2015 Hazelcast Inc. Confidential & Proprietary 6
Distributed Map
import java.util.concurrent.ConcurrentMap;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
public static void main(String[] args) {
HazelcastInstance h = Hazelcast.newHazelcastInstance();
ConcurrentMap<Integer, String> map = h.getMap("myMap");
map.put(1, "Paris");
map.put(2, "London");
map.put(3, "San Francisco");
String oldValue = map.remove(2);
}
© 2015 Hazelcast Inc. Confidential & Proprietary 7
Ecosystem Traction
Dozens of Commercial and Open Source Projects Embed Hazelcast
© 2015 Hazelcast Inc. Confidential & Proprietary 8
Demo
© 2015 Hazelcast Inc. Confidential & Proprietary 9
Why Hazelcast?
Scale-out Computing enables cluster capacity to be
increased or decreased on-demand
Resilience with automatic recovery from member failures
without losing data while minimizing performance impact on
running applications
Programming Model provides a way for developers to easily
program a cluster application as if it is a single process
Fast Application Performance enables very large data sets
to be held in main memory for real-time performance
© 2015 Hazelcast Inc. Confidential & Proprietary 10
Rebalance Data on New Node
10	
  
© 2015 Hazelcast Inc. Confidential & Proprietary 11
Distributed Maps
Fixed number of partitions (default 271)
Each key falls into a partition
partitionId = hash(keyData)%PARTITION_COUNT
Partition ownerships are reassigned upon membership change
A B C
© 2015 Hazelcast Inc. Confidential & Proprietary 12
New Node Added
DA B C
© 2015 Hazelcast Inc. Confidential & Proprietary 13
Migration
DA B C
© 2015 Hazelcast Inc. Confidential & Proprietary 14
Migration
DA B C
© 2015 Hazelcast Inc. Confidential & Proprietary 15
Migration
DA B C
© 2015 Hazelcast Inc. Confidential & Proprietary 16
Migration
DA B C
© 2015 Hazelcast Inc. Confidential & Proprietary 17
Migration
DA B C
© 2015 Hazelcast Inc. Confidential & Proprietary 18
Migration
DA B C
© 2015 Hazelcast Inc. Confidential & Proprietary 19
Migration Complete
DA B C
© 2015 Hazelcast Inc. Confidential & Proprietary 20
Data Safety when Node Dies
20	
  
© 2015 Hazelcast Inc. Confidential & Proprietary 21
Node Crashes
DA B C
Crash
© 2015 Hazelcast Inc. Confidential & Proprietary 22
Backups Are Restored
DA B C
Crash
© 2015 Hazelcast Inc. Confidential & Proprietary 23
Backups Are Restored
DA B C
Crash
© 2015 Hazelcast Inc. Confidential & Proprietary 24
Backups Are Restored
DA B C
Crash
© 2015 Hazelcast Inc. Confidential & Proprietary 25
Backups Are Restored
DA B C
Crash
© 2015 Hazelcast Inc. Confidential & Proprietary 26
Backups Are Restored
DA B C
Crash
© 2015 Hazelcast Inc. Confidential & Proprietary 27
Backups Are Restored
DA B C
Crash
© 2015 Hazelcast Inc. Confidential & Proprietary 28
Backups Are Restored
DA B C
Crash
© 2015 Hazelcast Inc. Confidential & Proprietary 29
Backups Are Restored
DA B C
Crash
© 2015 Hazelcast Inc. Confidential & Proprietary 30
Recovery Is Complete
DA C
© 2015 Hazelcast Inc. Confidential & Proprietary 31
Deployment Strategies
© 2015 Hazelcast Inc. Confidential & Proprietary 32
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
© 2015 Hazelcast Inc. Confidential & Proprietary 33
Easy API
// Creating a new Hazelcast node
HazelcastInstance hz = Hazelcast.newHazelcastInstance();
// Getting a Map, Queue, Topic, ...
Map map = hz.getMap("my-map");
Queue queue = hz.getQueue("my-queue");
ITopic topic = hz.getTopic("my-topic");
//Creating a Hazelcast Client
HazelcastInstance client = HazelcastClient.newHazelcastClient();
// Shutting down the node
hz.shutdown();
© 2015 Hazelcast Inc. Confidential & Proprietary 34
Feature Overview
© 2015 Hazelcast Inc. Confidential & Proprietary 35
Easy to Unit Test
public class SomeTestCase {
private HazelcastInstance[] instances;
@Before
public void before() throws Exception {
// Multiple instances on the same JVM
instances = new HazelcastInstance[2];
instances[0] = Hazelcast.newHazelcastInstance();
instances[1] = Hazelcast.newHazelcastInstance();
}
@After
public void after() throws Exception {
Hazelcast.shutdownAll();
}
}
© 2015 Hazelcast Inc. Confidential & Proprietary 36
IM Data Store (Caching) Use Case
Database Caching Use-Case
Business Systems
A B C
RDBMS Mainframe
MongoDB
NoSQL
REST
Scale
Hazelcast
HD
Cache
Dist.
Compute
Dist.
Message
© 2015 Hazelcast Inc. Confidential & Proprietary 37
Java Collection API: Map, List, Set, Queue
JCache
High Density Memory Store
Hibernate 2nd Level Cache
Web Session Replication: Tomcat, Jetty
Predicate API: Indexes, SQL Query
Persistence: Map/Queue Store & Loader. Write Behind/Through
Eviction
Near Cache
Transactions: Local & XA
WAN & DR Replication
Memcached Interface
IM Data Store (Caching) Features
HD
Cache
Dist.
Compute
Dist.
Message
© 2015 Hazelcast Inc. Confidential & Proprietary 38
Map API
interface com.hazelcast.core.IMap<K, V>
extends java.util.Map, java.util.ConcurrentMap
HazelcastInstance hz = getHazelcastInstance();
//java.util.concurrent.ConcurrentMap implementation
IMap<String, User> hzMap = hz.getMap("users");
hzMap.put("Peter", new User("Peter", "Veentjer"));
hzMap.putIfAbsent("Peter", new User("Peter", "Veentjer"));
//Distributed Lock
hzMap.lock("Peter");
User peter = map.get("Peter");
© 2015 Hazelcast Inc. Confidential & Proprietary 39
Persistence API
public class MapStorage
implements MapStore<String, User>, MapLoader<String, User> {
// Some methods missing ...
@Override public User load(String key) { return loadValueDB(key); }
@Override public Set<String> loadAllKeys() { return loadKeysDB(); }
@Override public void delete(String key) { deleteDB(key); }
@Override public void store(String key, User value) {
storeToDatabase(key, value);
}
}
<map name="users">
<map-store enabled="true">
<class-name>com.hazelcast.example.MapStorage</class-name>
<write-delay-seconds>0</write-delay-seconds>
</map-store>
</map>
© 2015 Hazelcast Inc. Confidential & Proprietary 40
JCache API
// Retrieve the CachingProvider which is automatically baced by
// the chosen Hazelcast server or client provider
CachingProvider cachingProvider = Caching.getCachingProvider();
// Create a CacheManager
CacheManager cacheManager = cachingProvider.getCacheManager();
// Cache<String, String> cache = cacheManager
// .getCache( name, String.class, String.class );
// Create a simple but typesafe configuration for the cache
CompleteConfiguration<String, String> config =
new MutableConfiguration<String, String>()
.setTypes( String.class, String.class );
© 2015 Hazelcast Inc. Confidential & Proprietary 41
JCache API
// Create and get the cache
Cache<String, String> cache = cacheManager
.createCache( "example", config );
// Alternatively to request an already existing cache
Cache<String, String> cache = cacheManager
.getCache( name, String.class, String.class );
// Put a value into the cache
cache.put( "world", "Hello World" );
// Retrieve the value again from the cache
String value = cache.get( "world" );
System.out.println( value );
© 2015 Hazelcast Inc. Confidential & Proprietary 42
High Density Caching
On-Heap Memory Store
(Objects Stored as Objects)
High-Density Memory Store
(Objects Serialized and Stored as
Bytes)
On-Heap SLAB
Allocator*
On-Heap SLAB
Allocator*
2-4GB
(Limited by
Garbage
Collection)
0-1TB
(Limited by
Machine RAM)
* coming in 3.6
Memory Stores
• Member
• Client
(Near Cache)
RAM in JVM Process
APIs JCache
(ICache)
Map
(IMap)
HD
Cache
Dist.
Compute
Dist.
Message
© 2015 Hazelcast Inc. Confidential & Proprietary 43
On Heap Vs. High-Density
Memory Management
On Heap Memory HD Memory v2
0 MB Native 3.3 GB
3.9 GB Heap Storage 0.6 GB
9 (4900 ms) Major GC 0 (0 ms)
31 (4200 ms) Minor GC 356 (349 ms)
Node Used
Heap
Total
Heap
Max.
Heap
Heap Usage
Percentage
Used Heap: 0.2 GB
192.168.1.10:5701 57 MB 229 MB 910 MB 6.28%
Memory Utilization
Home Offheap-test
Node Used Heap: 3.9 GB
192.168.1.10:5701 3933 MB 4658MB 4653MB 84.45%
Memory Utilization
Home
Used
Heap
Total
Heap
Max.
Heap
Heap Usage
Percentage
HD
Cache
Dist.
Compute
Dist.
Message
Example: On Heap Memory Example: HD Memory v2
© 2015 Hazelcast Inc. Confidential & Proprietary 44
Hazelcast Servers
Hazelcast Server
JVM [Memory]
IM Distributed Computing Use Case
A B C
Business Logic
Data Data Data
CE = Compute Engine
Result
Business / Processing Logic
Result
TCP / IP
Client Client
HD
Cache
Dist.
Compute
Dist.
Message
© 2015 Hazelcast Inc. Confidential & Proprietary 45
IM Distributed Computing Feature
HD
Cache
Dist.
Compute
Dist.
Message
Java Concurrency API
(Lock, Semaphore, AtomicLong, AtomicReference, Executor Service, Blocking Queue)
Entry and Item Listeners
Entry Processor
Aggregators
Map/Reduce
Data Affinity
Continues Query
Map Interceptors
Delta Update
© 2015 Hazelcast Inc. Confidential & Proprietary 46
Lock API
HazelcastInstance hz = getHazelcastInstance();
// Distributed Reentrant
L​ock l​ock = hz.getLock("myLock");
l​ock.lock();
try {
// Do something
} finally {
l​ock.unlock();
}
© 2015 Hazelcast Inc. Confidential & Proprietary 47
Executor Service API
public interface com.hazelcast.core.IExecutorService
extends java.util.concurrent.ExecutorService
HazelcastInstance hz = getHazelcastInstance();
//java.util.concurrent.ExecutorService implementation
IExecutorService es = hz.getExecutorService("name");
es.executeOnAllMembers(buildRunnable());
es.executeOnKeyOwner(buildRunnable(), "Peter");
es.execute(buildRunnable());
Map<..> futures = es.submitToAllMembers(buildCallable());
Future<..> future = es.submitToKeyOwner(buildCallable(), "Peter");
es.submitToAllMembers(buildCallable(), buildCallback());
es.submitToKeyOwner(buildCallable(), "Peter", buildCallback());
© 2015 Hazelcast Inc. Confidential & Proprietary 48
Map/Reduce API
HazelcastInstance hz = getHazelcastInstance();
Map users = hz.getMap("users");
JobTracker tracker = hz.getJobTracker("default");
KeyValueSource source = KeyValueSource.fromMap(users);
Job job = tracker.newJob(source);
ICompleteFuture future = job.mapper(new MyMapper())
.reducer(new MyReducer())
.submit();
Map result = future.get();
© 2015 Hazelcast Inc. Confidential & Proprietary 49
Aggregations API
HazelcastInstance hz = getHazelcastInstance();
Map users = hz.getMap("users");
int sum = users.aggregate(
Supplier.all((user) -> user.getSalary()),
Aggregations.longSum()
);
© 2015 Hazelcast Inc. Confidential & Proprietary 50
IM Distributed Messaging Use Case
Hazelcast Distributed
Topic Bus
Hazelcast
Topic
Hazelcast
Node 1
Hazelcast
Node 2
Hazelcast
Node 3
MSG
Subscribes
Delivers
Subscribes
Delivers
HD
Cache
Dist.
Compute
Dist.
Message
© 2015 Hazelcast Inc. Confidential & Proprietary 51
Queue
Topic (Pub/Sub)
Event Listeners
Ring Buffers
IM Distributed Messaging Features
HD
Cache
Dist.
Compute
Dist.
Message
© 2015 Hazelcast Inc. Confidential & Proprietary 52
Queue API
interface com.hazelcast.core.IQueue<E>
extends java.util.concurrent.BlockingQueue
HazelcastInstance hz = getHazelcastInstance();
//java.util.concurrent.BlockingQueue implementation
IQueue<Task> queue = hz.getQueue("tasks");
queue.offer(newTask());
queue.offer(newTask(), 500, TimeUnit.MILLISECONDS);
Task task = queue.poll();
Task task = queue.poll(100, TimeUnit.MILLISECONDS);
Task task = queue.take();
© 2015 Hazelcast Inc. Confidential & Proprietary 53
Topic API
public class Example implements MessageListener<String> {
public void sendMessage {
HazelcastInstance hz = getHazelcastInstance();
ITopic<String> topic = hz.getTopic("topic");
topic.addMessageListener(this);
topic.publish("Hello World");
}
@Override
public void onMessage(Message<String> message) {
System.out.println("Got message: " + message.getMessageObject());
}
}
Thank you
@fuadm, @hazelcast
hazelcast@googlegroups.com
http://www.hazelcast.com
http://github.com/hazelcast/hazelcast

Más contenido relacionado

La actualidad más candente

Enterprise Guice 20090217 Bejug
Enterprise Guice 20090217 BejugEnterprise Guice 20090217 Bejug
Enterprise Guice 20090217 Bejug
robbiev
 
Drools 6.0 (JudCon 2013)
Drools 6.0 (JudCon 2013)Drools 6.0 (JudCon 2013)
Drools 6.0 (JudCon 2013)
Mark Proctor
 

La actualidad más candente (20)

Spring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in HeavenSpring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in Heaven
 
Sbt baby steps
Sbt baby stepsSbt baby steps
Sbt baby steps
 
Spring4 whats up doc?
Spring4 whats up doc?Spring4 whats up doc?
Spring4 whats up doc?
 
Enrique lima azure-it-pro-ps
Enrique lima azure-it-pro-psEnrique lima azure-it-pro-ps
Enrique lima azure-it-pro-ps
 
Vertx - Reactive & Distributed
Vertx - Reactive & DistributedVertx - Reactive & Distributed
Vertx - Reactive & Distributed
 
Enterprise Guice 20090217 Bejug
Enterprise Guice 20090217 BejugEnterprise Guice 20090217 Bejug
Enterprise Guice 20090217 Bejug
 
Spring 4 - A&BP CC
Spring 4 - A&BP CCSpring 4 - A&BP CC
Spring 4 - A&BP CC
 
In the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: GradleIn the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: Gradle
 
Knot.x: when Vert.x and RxJava meet
Knot.x: when Vert.x and RxJava meetKnot.x: when Vert.x and RxJava meet
Knot.x: when Vert.x and RxJava meet
 
Springを用いた社内ライブラリ開発
Springを用いた社内ライブラリ開発Springを用いた社内ライブラリ開発
Springを用いた社内ライブラリ開発
 
Provisioning with OSGi Subsystems and Repository using Apache Aries and Felix
Provisioning with OSGi Subsystems and Repository using Apache Aries and FelixProvisioning with OSGi Subsystems and Repository using Apache Aries and Felix
Provisioning with OSGi Subsystems and Repository using Apache Aries and Felix
 
Hazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMSHazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMS
 
Maximize the power of OSGi
Maximize the power of OSGiMaximize the power of OSGi
Maximize the power of OSGi
 
WWHF 2018 - Using PowerUpSQL and goddi for Active Directory Information Gathe...
WWHF 2018 - Using PowerUpSQL and goddi for Active Directory Information Gathe...WWHF 2018 - Using PowerUpSQL and goddi for Active Directory Information Gathe...
WWHF 2018 - Using PowerUpSQL and goddi for Active Directory Information Gathe...
 
Modern Android app library stack
Modern Android app library stackModern Android app library stack
Modern Android app library stack
 
Building Your Own IoT Platform using FIWARE GEis
Building Your Own IoT Platform using FIWARE GEisBuilding Your Own IoT Platform using FIWARE GEis
Building Your Own IoT Platform using FIWARE GEis
 
What is the ServiceStack?
What is the ServiceStack?What is the ServiceStack?
What is the ServiceStack?
 
[Hands-on] Kubernetes | Nov 18, 2017
[Hands-on] Kubernetes | Nov 18, 2017[Hands-on] Kubernetes | Nov 18, 2017
[Hands-on] Kubernetes | Nov 18, 2017
 
BeJUG Meetup - What's coming in the OSGi R7 Specification
BeJUG Meetup - What's coming in the OSGi R7 SpecificationBeJUG Meetup - What's coming in the OSGi R7 Specification
BeJUG Meetup - What's coming in the OSGi R7 Specification
 
Drools 6.0 (JudCon 2013)
Drools 6.0 (JudCon 2013)Drools 6.0 (JudCon 2013)
Drools 6.0 (JudCon 2013)
 

Destacado

Aproximación de Binomial a Normal (Bi~no) en intervalos
Aproximación de Binomial a Normal (Bi~no) en intervalosAproximación de Binomial a Normal (Bi~no) en intervalos
Aproximación de Binomial a Normal (Bi~no) en intervalos
MaruSach
 
ModuleDescriptions_MPO_IMIS
ModuleDescriptions_MPO_IMISModuleDescriptions_MPO_IMIS
ModuleDescriptions_MPO_IMIS
Bilal Aziz
 

Destacado (9)

Hazelcast - In-Memory DataGrid
Hazelcast - In-Memory DataGridHazelcast - In-Memory DataGrid
Hazelcast - In-Memory DataGrid
 
Think Distributed: The Hazelcast Way
Think Distributed: The Hazelcast WayThink Distributed: The Hazelcast Way
Think Distributed: The Hazelcast Way
 
Distributed applications using Hazelcast
Distributed applications using HazelcastDistributed applications using Hazelcast
Distributed applications using Hazelcast
 
Hazelcast Essentials
Hazelcast EssentialsHazelcast Essentials
Hazelcast Essentials
 
Busqueda de información con Google
Busqueda de información con GoogleBusqueda de información con Google
Busqueda de información con Google
 
CVKronckeApril2016LI
CVKronckeApril2016LICVKronckeApril2016LI
CVKronckeApril2016LI
 
Aproximación de Binomial a Normal (Bi~no) en intervalos
Aproximación de Binomial a Normal (Bi~no) en intervalosAproximación de Binomial a Normal (Bi~no) en intervalos
Aproximación de Binomial a Normal (Bi~no) en intervalos
 
Common Bite Problems
Common Bite ProblemsCommon Bite Problems
Common Bite Problems
 
ModuleDescriptions_MPO_IMIS
ModuleDescriptions_MPO_IMISModuleDescriptions_MPO_IMIS
ModuleDescriptions_MPO_IMIS
 

Similar a Building scalable applications with hazelcast

Networking and Data Access with Eqela
Networking and Data Access with EqelaNetworking and Data Access with Eqela
Networking and Data Access with Eqela
jobandesther
 
Storage Plug-ins
Storage Plug-ins Storage Plug-ins
Storage Plug-ins
buildacloud
 
Cloud Application Blueprints with Apache Brooklyn by Alex Henevald
Cloud Application Blueprints with Apache Brooklyn by Alex HenevaldCloud Application Blueprints with Apache Brooklyn by Alex Henevald
Cloud Application Blueprints with Apache Brooklyn by Alex Henevald
buildacloud
 
Hazelcast for Terracotta Users
Hazelcast for Terracotta UsersHazelcast for Terracotta Users
Hazelcast for Terracotta Users
Hazelcast
 

Similar a Building scalable applications with hazelcast (20)

Spring Meetup Paris - Getting Distributed with Hazelcast and Spring
Spring Meetup Paris - Getting Distributed with Hazelcast and SpringSpring Meetup Paris - Getting Distributed with Hazelcast and Spring
Spring Meetup Paris - Getting Distributed with Hazelcast and Spring
 
Paul Angus (ShapeBlue) - Push infrastructure with Ansible #DOXLON
Paul Angus (ShapeBlue) - Push infrastructure with Ansible #DOXLONPaul Angus (ShapeBlue) - Push infrastructure with Ansible #DOXLON
Paul Angus (ShapeBlue) - Push infrastructure with Ansible #DOXLON
 
Multi Client Development with Spring
Multi Client Development with SpringMulti Client Development with Spring
Multi Client Development with Spring
 
Arquitecturas de microservicios - Medianet Software
Arquitecturas de microservicios   -  Medianet SoftwareArquitecturas de microservicios   -  Medianet Software
Arquitecturas de microservicios - Medianet Software
 
JavaOne 2017 - TestContainers: integration testing without the hassle
JavaOne 2017 - TestContainers: integration testing without the hassleJavaOne 2017 - TestContainers: integration testing without the hassle
JavaOne 2017 - TestContainers: integration testing without the hassle
 
Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...
Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...
Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...
 
Camel one v3-6
Camel one v3-6Camel one v3-6
Camel one v3-6
 
Where is my cache architectural patterns for caching microservices by example
Where is my cache architectural patterns for caching microservices by exampleWhere is my cache architectural patterns for caching microservices by example
Where is my cache architectural patterns for caching microservices by example
 
OSGi Enterprise R6 specs are out! - David Bosschaert & Carsten Ziegeler
OSGi Enterprise R6 specs are out! - David Bosschaert & Carsten ZiegelerOSGi Enterprise R6 specs are out! - David Bosschaert & Carsten Ziegeler
OSGi Enterprise R6 specs are out! - David Bosschaert & Carsten Ziegeler
 
Networking and Data Access with Eqela
Networking and Data Access with EqelaNetworking and Data Access with Eqela
Networking and Data Access with Eqela
 
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 202010 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
 
Storage Plug-ins
Storage Plug-ins Storage Plug-ins
Storage Plug-ins
 
twMVC#46 一探 C# 11 與 .NET 7 的神奇
twMVC#46 一探 C# 11 與 .NET 7 的神奇twMVC#46 一探 C# 11 與 .NET 7 的神奇
twMVC#46 一探 C# 11 與 .NET 7 的神奇
 
Cloud Application Blueprints with Apache Brooklyn by Alex Henevald
Cloud Application Blueprints with Apache Brooklyn by Alex HenevaldCloud Application Blueprints with Apache Brooklyn by Alex Henevald
Cloud Application Blueprints with Apache Brooklyn by Alex Henevald
 
Hazelcast for Terracotta Users
Hazelcast for Terracotta UsersHazelcast for Terracotta Users
Hazelcast for Terracotta Users
 
Build Your Own HiveMQ Extension
Build Your Own HiveMQ ExtensionBuild Your Own HiveMQ Extension
Build Your Own HiveMQ Extension
 
Solid fire cloudstack storage overview - CloudStack European User Group
Solid fire cloudstack storage overview - CloudStack European User GroupSolid fire cloudstack storage overview - CloudStack European User Group
Solid fire cloudstack storage overview - CloudStack European User Group
 
CloudStack Meetup London - Primary Storage Presentation by SolidFire
CloudStack Meetup London - Primary Storage Presentation by SolidFire CloudStack Meetup London - Primary Storage Presentation by SolidFire
CloudStack Meetup London - Primary Storage Presentation by SolidFire
 
Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021
 
CloudStack Meetup Santa Clara
CloudStack Meetup Santa Clara CloudStack Meetup Santa Clara
CloudStack Meetup Santa Clara
 

Último

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 

Building scalable applications with hazelcast

  • 1. © 2015 Hazelcast Inc. Confidential & Proprietary 1 FUAD MALIKOV CO-FOUNDER Building Scalable Applications with Hazelcast
  • 2. © 2015 Hazelcast Inc. Confidential & Proprietary 2 What Is Hazelcast? Hazelcast is a distributed, highly available and scalable Open Source In-Memory Data Grid
  • 3. © 2015 Hazelcast Inc. Confidential & Proprietary 3 In Memory Data Grid 01001 10101 01010 In Memory Data Computing In Memory Data Messaging ++In Memory Data Storage
  • 4. © 2015 Hazelcast Inc. Confidential & Proprietary 4 java.util.Map import java.util.HashMap; import java.util.Map; public static void main(String[] args) { Map<Integer, String> map = new HashMap<>(); map.put(1, "Paris"); map.put(2, "London"); map.put(3, "San Francisco"); String oldValue = map.remove(2); }
  • 5. © 2015 Hazelcast Inc. Confidential & Proprietary 5 java.util.concurrent.ConcurrentMap import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; public static void main(String[] args) { ConcurrentMap<Integer, String> map = new ConcurrentHashMap<>(); map.put(1, "Paris"); map.put(2, "London"); map.put(3, "San Francisco"); String oldValue = map.remove(2); }
  • 6. © 2015 Hazelcast Inc. Confidential & Proprietary 6 Distributed Map import java.util.concurrent.ConcurrentMap; import com.hazelcast.core.Hazelcast; import com.hazelcast.core.HazelcastInstance; public static void main(String[] args) { HazelcastInstance h = Hazelcast.newHazelcastInstance(); ConcurrentMap<Integer, String> map = h.getMap("myMap"); map.put(1, "Paris"); map.put(2, "London"); map.put(3, "San Francisco"); String oldValue = map.remove(2); }
  • 7. © 2015 Hazelcast Inc. Confidential & Proprietary 7 Ecosystem Traction Dozens of Commercial and Open Source Projects Embed Hazelcast
  • 8. © 2015 Hazelcast Inc. Confidential & Proprietary 8 Demo
  • 9. © 2015 Hazelcast Inc. Confidential & Proprietary 9 Why Hazelcast? Scale-out Computing enables cluster capacity to be increased or decreased on-demand Resilience with automatic recovery from member failures without losing data while minimizing performance impact on running applications Programming Model provides a way for developers to easily program a cluster application as if it is a single process Fast Application Performance enables very large data sets to be held in main memory for real-time performance
  • 10. © 2015 Hazelcast Inc. Confidential & Proprietary 10 Rebalance Data on New Node 10  
  • 11. © 2015 Hazelcast Inc. Confidential & Proprietary 11 Distributed Maps Fixed number of partitions (default 271) Each key falls into a partition partitionId = hash(keyData)%PARTITION_COUNT Partition ownerships are reassigned upon membership change A B C
  • 12. © 2015 Hazelcast Inc. Confidential & Proprietary 12 New Node Added DA B C
  • 13. © 2015 Hazelcast Inc. Confidential & Proprietary 13 Migration DA B C
  • 14. © 2015 Hazelcast Inc. Confidential & Proprietary 14 Migration DA B C
  • 15. © 2015 Hazelcast Inc. Confidential & Proprietary 15 Migration DA B C
  • 16. © 2015 Hazelcast Inc. Confidential & Proprietary 16 Migration DA B C
  • 17. © 2015 Hazelcast Inc. Confidential & Proprietary 17 Migration DA B C
  • 18. © 2015 Hazelcast Inc. Confidential & Proprietary 18 Migration DA B C
  • 19. © 2015 Hazelcast Inc. Confidential & Proprietary 19 Migration Complete DA B C
  • 20. © 2015 Hazelcast Inc. Confidential & Proprietary 20 Data Safety when Node Dies 20  
  • 21. © 2015 Hazelcast Inc. Confidential & Proprietary 21 Node Crashes DA B C Crash
  • 22. © 2015 Hazelcast Inc. Confidential & Proprietary 22 Backups Are Restored DA B C Crash
  • 23. © 2015 Hazelcast Inc. Confidential & Proprietary 23 Backups Are Restored DA B C Crash
  • 24. © 2015 Hazelcast Inc. Confidential & Proprietary 24 Backups Are Restored DA B C Crash
  • 25. © 2015 Hazelcast Inc. Confidential & Proprietary 25 Backups Are Restored DA B C Crash
  • 26. © 2015 Hazelcast Inc. Confidential & Proprietary 26 Backups Are Restored DA B C Crash
  • 27. © 2015 Hazelcast Inc. Confidential & Proprietary 27 Backups Are Restored DA B C Crash
  • 28. © 2015 Hazelcast Inc. Confidential & Proprietary 28 Backups Are Restored DA B C Crash
  • 29. © 2015 Hazelcast Inc. Confidential & Proprietary 29 Backups Are Restored DA B C Crash
  • 30. © 2015 Hazelcast Inc. Confidential & Proprietary 30 Recovery Is Complete DA C
  • 31. © 2015 Hazelcast Inc. Confidential & Proprietary 31 Deployment Strategies
  • 32. © 2015 Hazelcast Inc. Confidential & Proprietary 32 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
  • 33. © 2015 Hazelcast Inc. Confidential & Proprietary 33 Easy API // Creating a new Hazelcast node HazelcastInstance hz = Hazelcast.newHazelcastInstance(); // Getting a Map, Queue, Topic, ... Map map = hz.getMap("my-map"); Queue queue = hz.getQueue("my-queue"); ITopic topic = hz.getTopic("my-topic"); //Creating a Hazelcast Client HazelcastInstance client = HazelcastClient.newHazelcastClient(); // Shutting down the node hz.shutdown();
  • 34. © 2015 Hazelcast Inc. Confidential & Proprietary 34 Feature Overview
  • 35. © 2015 Hazelcast Inc. Confidential & Proprietary 35 Easy to Unit Test public class SomeTestCase { private HazelcastInstance[] instances; @Before public void before() throws Exception { // Multiple instances on the same JVM instances = new HazelcastInstance[2]; instances[0] = Hazelcast.newHazelcastInstance(); instances[1] = Hazelcast.newHazelcastInstance(); } @After public void after() throws Exception { Hazelcast.shutdownAll(); } }
  • 36. © 2015 Hazelcast Inc. Confidential & Proprietary 36 IM Data Store (Caching) Use Case Database Caching Use-Case Business Systems A B C RDBMS Mainframe MongoDB NoSQL REST Scale Hazelcast HD Cache Dist. Compute Dist. Message
  • 37. © 2015 Hazelcast Inc. Confidential & Proprietary 37 Java Collection API: Map, List, Set, Queue JCache High Density Memory Store Hibernate 2nd Level Cache Web Session Replication: Tomcat, Jetty Predicate API: Indexes, SQL Query Persistence: Map/Queue Store & Loader. Write Behind/Through Eviction Near Cache Transactions: Local & XA WAN & DR Replication Memcached Interface IM Data Store (Caching) Features HD Cache Dist. Compute Dist. Message
  • 38. © 2015 Hazelcast Inc. Confidential & Proprietary 38 Map API interface com.hazelcast.core.IMap<K, V> extends java.util.Map, java.util.ConcurrentMap HazelcastInstance hz = getHazelcastInstance(); //java.util.concurrent.ConcurrentMap implementation IMap<String, User> hzMap = hz.getMap("users"); hzMap.put("Peter", new User("Peter", "Veentjer")); hzMap.putIfAbsent("Peter", new User("Peter", "Veentjer")); //Distributed Lock hzMap.lock("Peter"); User peter = map.get("Peter");
  • 39. © 2015 Hazelcast Inc. Confidential & Proprietary 39 Persistence API public class MapStorage implements MapStore<String, User>, MapLoader<String, User> { // Some methods missing ... @Override public User load(String key) { return loadValueDB(key); } @Override public Set<String> loadAllKeys() { return loadKeysDB(); } @Override public void delete(String key) { deleteDB(key); } @Override public void store(String key, User value) { storeToDatabase(key, value); } } <map name="users"> <map-store enabled="true"> <class-name>com.hazelcast.example.MapStorage</class-name> <write-delay-seconds>0</write-delay-seconds> </map-store> </map>
  • 40. © 2015 Hazelcast Inc. Confidential & Proprietary 40 JCache API // Retrieve the CachingProvider which is automatically baced by // the chosen Hazelcast server or client provider CachingProvider cachingProvider = Caching.getCachingProvider(); // Create a CacheManager CacheManager cacheManager = cachingProvider.getCacheManager(); // Cache<String, String> cache = cacheManager // .getCache( name, String.class, String.class ); // Create a simple but typesafe configuration for the cache CompleteConfiguration<String, String> config = new MutableConfiguration<String, String>() .setTypes( String.class, String.class );
  • 41. © 2015 Hazelcast Inc. Confidential & Proprietary 41 JCache API // Create and get the cache Cache<String, String> cache = cacheManager .createCache( "example", config ); // Alternatively to request an already existing cache Cache<String, String> cache = cacheManager .getCache( name, String.class, String.class ); // Put a value into the cache cache.put( "world", "Hello World" ); // Retrieve the value again from the cache String value = cache.get( "world" ); System.out.println( value );
  • 42. © 2015 Hazelcast Inc. Confidential & Proprietary 42 High Density Caching On-Heap Memory Store (Objects Stored as Objects) High-Density Memory Store (Objects Serialized and Stored as Bytes) On-Heap SLAB Allocator* On-Heap SLAB Allocator* 2-4GB (Limited by Garbage Collection) 0-1TB (Limited by Machine RAM) * coming in 3.6 Memory Stores • Member • Client (Near Cache) RAM in JVM Process APIs JCache (ICache) Map (IMap) HD Cache Dist. Compute Dist. Message
  • 43. © 2015 Hazelcast Inc. Confidential & Proprietary 43 On Heap Vs. High-Density Memory Management On Heap Memory HD Memory v2 0 MB Native 3.3 GB 3.9 GB Heap Storage 0.6 GB 9 (4900 ms) Major GC 0 (0 ms) 31 (4200 ms) Minor GC 356 (349 ms) Node Used Heap Total Heap Max. Heap Heap Usage Percentage Used Heap: 0.2 GB 192.168.1.10:5701 57 MB 229 MB 910 MB 6.28% Memory Utilization Home Offheap-test Node Used Heap: 3.9 GB 192.168.1.10:5701 3933 MB 4658MB 4653MB 84.45% Memory Utilization Home Used Heap Total Heap Max. Heap Heap Usage Percentage HD Cache Dist. Compute Dist. Message Example: On Heap Memory Example: HD Memory v2
  • 44. © 2015 Hazelcast Inc. Confidential & Proprietary 44 Hazelcast Servers Hazelcast Server JVM [Memory] IM Distributed Computing Use Case A B C Business Logic Data Data Data CE = Compute Engine Result Business / Processing Logic Result TCP / IP Client Client HD Cache Dist. Compute Dist. Message
  • 45. © 2015 Hazelcast Inc. Confidential & Proprietary 45 IM Distributed Computing Feature HD Cache Dist. Compute Dist. Message Java Concurrency API (Lock, Semaphore, AtomicLong, AtomicReference, Executor Service, Blocking Queue) Entry and Item Listeners Entry Processor Aggregators Map/Reduce Data Affinity Continues Query Map Interceptors Delta Update
  • 46. © 2015 Hazelcast Inc. Confidential & Proprietary 46 Lock API HazelcastInstance hz = getHazelcastInstance(); // Distributed Reentrant L​ock l​ock = hz.getLock("myLock"); l​ock.lock(); try { // Do something } finally { l​ock.unlock(); }
  • 47. © 2015 Hazelcast Inc. Confidential & Proprietary 47 Executor Service API public interface com.hazelcast.core.IExecutorService extends java.util.concurrent.ExecutorService HazelcastInstance hz = getHazelcastInstance(); //java.util.concurrent.ExecutorService implementation IExecutorService es = hz.getExecutorService("name"); es.executeOnAllMembers(buildRunnable()); es.executeOnKeyOwner(buildRunnable(), "Peter"); es.execute(buildRunnable()); Map<..> futures = es.submitToAllMembers(buildCallable()); Future<..> future = es.submitToKeyOwner(buildCallable(), "Peter"); es.submitToAllMembers(buildCallable(), buildCallback()); es.submitToKeyOwner(buildCallable(), "Peter", buildCallback());
  • 48. © 2015 Hazelcast Inc. Confidential & Proprietary 48 Map/Reduce API HazelcastInstance hz = getHazelcastInstance(); Map users = hz.getMap("users"); JobTracker tracker = hz.getJobTracker("default"); KeyValueSource source = KeyValueSource.fromMap(users); Job job = tracker.newJob(source); ICompleteFuture future = job.mapper(new MyMapper()) .reducer(new MyReducer()) .submit(); Map result = future.get();
  • 49. © 2015 Hazelcast Inc. Confidential & Proprietary 49 Aggregations API HazelcastInstance hz = getHazelcastInstance(); Map users = hz.getMap("users"); int sum = users.aggregate( Supplier.all((user) -> user.getSalary()), Aggregations.longSum() );
  • 50. © 2015 Hazelcast Inc. Confidential & Proprietary 50 IM Distributed Messaging Use Case Hazelcast Distributed Topic Bus Hazelcast Topic Hazelcast Node 1 Hazelcast Node 2 Hazelcast Node 3 MSG Subscribes Delivers Subscribes Delivers HD Cache Dist. Compute Dist. Message
  • 51. © 2015 Hazelcast Inc. Confidential & Proprietary 51 Queue Topic (Pub/Sub) Event Listeners Ring Buffers IM Distributed Messaging Features HD Cache Dist. Compute Dist. Message
  • 52. © 2015 Hazelcast Inc. Confidential & Proprietary 52 Queue API interface com.hazelcast.core.IQueue<E> extends java.util.concurrent.BlockingQueue HazelcastInstance hz = getHazelcastInstance(); //java.util.concurrent.BlockingQueue implementation IQueue<Task> queue = hz.getQueue("tasks"); queue.offer(newTask()); queue.offer(newTask(), 500, TimeUnit.MILLISECONDS); Task task = queue.poll(); Task task = queue.poll(100, TimeUnit.MILLISECONDS); Task task = queue.take();
  • 53. © 2015 Hazelcast Inc. Confidential & Proprietary 53 Topic API public class Example implements MessageListener<String> { public void sendMessage { HazelcastInstance hz = getHazelcastInstance(); ITopic<String> topic = hz.getTopic("topic"); topic.addMessageListener(this); topic.publish("Hello World"); } @Override public void onMessage(Message<String> message) { System.out.println("Got message: " + message.getMessageObject()); } }