Developing low latency applications with Hazelcast
Sharath Sahadevan June 11, 2020
© HAZELCAST | 1 Our Mission: Distributed Computing. Simplified. Two In-Memory Products
HAZELCAST IMDG is an operational, HAZELCAST JET is the ultra fast, in-memory, distributed computing application embeddable, 3rd platform that manages data using generation stream processing engine in-memory storage, and performs for low latency batch and stream parallel execution for breakthrough processing. application speed and scale.
© HAZELCAST | 2 An In-Memory Data Grid Is…
A data model distributed across many servers in a single or across multiple data centers and/or clouds • All data is stored in the RAM of the servers • Servers can be added or removed to increase RAM • Data model is non-relational and is object-based • Applications written in Java, C++, C#/.NET, Node.js, Python, Golang and Scala can receive benefits of distributed data store • Resilient, allowing non-disruptive detection and recovery of a single or multiple servers
© HAZELCAST | 3 Why Hazelcast IMDG?
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
Simple 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, featuring support for Intel Optane DC Persistent Memory
© HAZELCAST | 4 Hazelcast IMDG Key Differentiators
Comprehensive Productive
• Very rich APIs and features driven by our huge user base • Legendary ease of use • Features for simple caching use cases at scale • Uses standard interfaces to make learning easy • Features for rich IMDG use cases for Financial Services and OEM • Very wide usage means more developers know Hazelcast • Quick response to new feature requests • Embedded mode has no operational management overhead • Hazelcast IMDG has a solution to meet your needs • Scaling, failure handling and recovery are all automated for ease of operational management • A wide selection of client languages: Java, C++, C#, Python, Scala, and Node.js
Performant Enterprise-grade
• Fully in-memory store transforms and ingests data in • Stable at vertical and horizontal scale microseconds, providing throughput and query • No maintenance windows required for upgrade or new application • Both a distributed computation system and a data store in the deployment same footprint — eliminates network transit latency penalties from • Cloud and container ready: Pivotal Cloud Foundry, OpenShift, Docker, data movements Azure, AWS, Kubernetes, … • Fastest distributed cache • Industry-leading security • Most widely deployed IMDG, with tens of thousands of deployments in production worldwide © HAZELCAST | 5 Hazelcast IMDG Product Overview
© HAZELCAST | 6 Hazelcast In-Memory Computing Platform
Java Scala C++ C#/.NET Python Node.js Go Near Cache Near Cache OperationsOperations Clients REST Memcached Clojure Open Client Network Protocol (Backward & Forward Compatibility, Binary Protocol) Management Center Serialization
(Serializable, Externalizable, DataSerializable, IdentifiedDataSerializable, Portable, Custom)
Hibernate FencedLock/ Enterprise PaaS Deployment java.util.concurrent Web Sessions JCache (Tomcat/Jetty/Generic) 2nd Level Cache Semaphore Environments (Pivotal Cloud Foundry, Map MultiMap Replicated Map Set List Queue ReliableTopic AtomicLong Red Hat OpenShift Container Platform, IBM Cloud Private) APIs Continuous Topic Ringbuffer HyperLogLog Flake ID Gen. CRDT PN Counter CountDownLatch Query Security Suite Predicate & Executor (Connection, Encryption, Authentication, SQL Query Entry Processor Aggregation AtomicReference Partition Predicate Services Authorization, JAAS LoginModule, SocketInterceptor, TLS, OpenSSL, CP Subsystem Mutual Auth, FIPS140-2 Mode) AP Subsystem (+ Persistence) WAN Replication Node Engine (Socket, Solace Systems, One-way, (Threads, Instances, Eventing, Wait/Notify, Invocation) Multiway, Init New Data Center, Partition Management DR Data Center Recovery, Engine (Members, Lite Members, Master Partition, Replicas, Migrations, Partition Groups, Partition Aware) Discovery SPI, Delta Synchronization) Cluster Management with Cloud Discovery SPI Rolling Upgrades (AWS, Azure, Consul, Eureka, etcd, Heroku, IP List, Apache jclouds, Kubernetes, Multicast, Zookeeper) (Rolling Client Upgrades, Rolling Member Upgrades, No Downtime, Compatibility Networking Test Suite) (IPv4, IPv6) Blue/Green Deployments On-Heap Store High-Density Memory Store (Intel, Sparc) Storage Hot Restart Store Automatic Disaster Recovery (SSD, HDD) Fail-Over JVM (JDK: 8, 9, 10, 11 Vendors: Oracle JDK, OpenJDK, IBM JDK, Azul Zing & Zulu) Clustered JMX / REST Operating Operating System Env (Linux, Oracle Solaris, Windows, AIX, Unix) Hazelcast Striim Hot Cache (Sync Updates from Oracle DB, MS SQL On-Premises GCP AWS Azure Kubernetes Docker VMware Server, MySQL and NonStop DB) © HAZELCAST | 7 Pro Edition Enterprise Edition Hazelcast Solution Integrates with Jet EE PS Hazelcast IMDG Subscriptions? What Is the Right Feature Set? Feature Comparison Enterprise Edition Pro Edition For mission-critical, For service-level guaranteed high-performance scale-out and operation of your application scale-up of your applications Management Center ✓ ✓ MC Packs: Notification, Security, ✓ ✓ Support, Integration MC Packs: Config ✓ Enterprise PaaS Deployments ✓ ✓ (OpenShift, Pivotal Cloud Foundry) Hot Restart Store ✓ ✓
CP Subsystem Persistence ✓ ✓
24/7 Support 1-hour SLA 4-hour SLA
Security Suite ✓
WAN Replication ✓
High-Density Memory Store ✓ Rolling Upgrades – ✓ No Service Interruption Blue/Green Deployments ✓ Automatic Disaster Recovery ✓ © HAZELCAST | 8 Fail-Over Technical Use Cases
© HAZELCAST | 9 Technical Use Cases
Caching In-Memory Microservices Web Session Data Grid Infrastructure Clustering
•High-Density Memory •Simple, modern APIs •Isolation of Services with many, small •Seamless failover between user sessions Store, client and member clusters for easier troubleshooting & •Distributed data structures maintenance •High performance •Full JCache support •Distributed compute •Service registry •No application alteration •Elastic scalability •Distributed clustering •Multiple network discovery •Easy scale-out •Super fast mechanisms •Object-oriented and •Fast session access •High availability non-relational •Inter-process messaging •Offload to existing cluster •Fault tolerant •Elastic and scalable •Fully embeddable •Tomcat, Jetty + any Web Container •Cloud ready •Transparent database •Resilient and flexible integration •Works efficiently with large session objects using delta updates •Client-server and/or embedded architecture © HAZELCAST | 10 Technical Use Cases: Caching
• High-Density Memory Store, client and member High-Density Caching
• Full JCache support Cache-as-a-Service (CaaS)
• Elastic scalability JCache Provider
• Super fast Database Caching Hibernate Second Level Cache • High availability Software AG Terracotta Replacement • Fault tolerance Application Scaling • Cloud readiness Elastic Memcached • In-memory access to frequently used data across an Spring Cache elastically-scalable grid
• Provide 100’s of GB of near cached data to applications for massive scalability
• Dynamically cluster/pool memory and processors © HAZELCAST | 11 Technical Use Cases: Cache in Front of a Data Store
Business Systems
A B C
Scale Hazelcast IMDG
MongoDB
RDBMS Mainframe NoSQL DB
© HAZELCAST | 12 Technical Use Cases: In-Memory Data Grid Compute
Hazelcast IMDG Servers
Hazelcast Server JVM [Memory] CE = Compute Engine
Data Data Data
A B C
Business Logic Business / Processing Logic
Result Result
TCP / IP
Client Client © HAZELCAST | 13 Technical Use Cases: In-Memory Data Grid Messaging
Client 1 Client 2 Client 3
MSG MSG MSG Delivers Delivers Publishers Subscribes Subscribes
Topic Bus
Node 1 Node 2 Node 3 Node 4
Hazelcast Distributed Topic Bus
© HAZELCAST | 14 Technical Use Cases: Microservices Infrastructure
Network Discovery • Reduce restoration time after failure
• Ease of adding new functionality without affecting users Service Registry
• Ease-of-use on a developer machine Service Discovery
• Modular structure for larger dev teams Inter-process Communication
• Ease-of-deployment, simple services Storage & Isolation • Flexibility of diverse technological landscape
• Library structure simple to use, more efficient development process than frameworks • Standard JDK Collections such as Lists, Sets, Queues and constructs such as Topics and Ringbuffers facilitate inter-process messaging • Clients for several languages (currently Java, C#, C/C++, Python, Node.js and Scala) and support for a wide variety of serialization choices • Shared or distributed data store intermediated via service requests to the data grid • Elastically-scalable memory for each independent service
© HAZELCAST | 15 Technical Use Cases: Microservices Infrastructure Easier, More Scalable Path to Microservices
Simple and configurable backbone that Library that is simpler to use and understand, makes moving an application to a distributed making the development process more efficient environment a lot easier
Hazelcast IMDG is a…
Highly scalable In-Memory Data Grid (e.g. IMap and JCache), and supports other standard JDK Collections such as Lists, Sets, Queues and some other constructs such as Topics and Ringbuffers that can be easily leveraged for inter-process messaging
© HAZELCAST | 16 EE PS Hazelcast IMDG Deployment Options
Embedded Mode Client-Server Mode
Application IMDG
Java API
IMDG IMDG IMDG
Application Application Application Application Application Application Java API Java API Application Application Application Application Application Application Application Application Java API .Net API C++ API Node.js API Application Application Application IMDG IMDG Java API .Net API C++ API Node.js API Java Client .Net API C++ API Node.js API .Net Client C++ Client Node.js Client
Great for microservices, Great for scale-up or scale-out deployments with cluster lifecycle decoupled from app servers OEM and ops simplification Clients available in Java, Node.js, C#/.NET, C++, Scala, Python, Clojure and Golang
© HAZELCAST | 17 Technical Use Cases: Web Session Clustering
Tomcat Web Session • High performance Replication • No application alteration Jetty Web Session Replication • Easy scale-out Generic Web Session • Fast session access Replication
• Off load to existing cluster
• Tomcat, Jetty and Generic
• No lost user sessions with even distribution across Hazelcast IMDG structure
• Automatic session failover
© HAZELCAST | 18 Technical Use Cases: Web Session Clustering
User Requests
Load Balancer When one server goes down sessions are not lost
Server 1 Server 2 Server 3
Application 1 Application 1 Application 1
Application 2 Application 2 Application 2
Hazelcast IMDG Hazelcast IMDG Hazelcast IMDG
Sessions are stored in Hazelcast
© HAZELCAST | 19 Blue/Green Deployments & Automatic Disaster Recovery Fail-Over
© HAZELCAST | 20 EE Blue/Green Deployments IMDG
Blue/Green Deployments reduce downtime and IMDG IMDG risk by running two identical Hazelcast® Enterprise IMDG clusters called Blue and Enterprise Cluster A Green. One of the clusters provides production services to clients allow/ label-b label-a label-b whilst the other cluster can be Deny Lists Hazelcast Hazelcast Hazelcast upgraded with new application Management via Client 1 Client 2 Client 3 Center code. Hazelcast Blue/Green client { Deployment functionality allows labels clients to be migrated from one cluster to another without client interaction or Enterprise Cluster B cluster downtime. All clients of a cluster may be
migrated or groups of clients can be moved
with the use of label filtering and allow/deny IMDG lists.
IMDG IMDG
© HAZELCAST | 21 EE
Automatic Disaster Recovery Failover IMDG
IMDG IMDG
Primary Production Cluster
Automatic disaster recovery fail-over provides clients connected to Hazelcast Hazelcast® Enterprise IMDG clusters with the ability to automatically Client fail-over to a Disaster Recovery cluster should there be an unplanned outage of the primary production Hazelcast cluster.
Disaster Recovery Cluster
IMDG
IMDG IMDG
© HAZELCAST | 22 EE WAN Replication: Deployment Options
Applications Applications API API
Applications
IMDG IMDG API IMDG
IMDG IMDG IMDG IMDG
Independent clusters, sharing selected data to maintain One-way keep DR site populated and ready-to-go alignment Two-way worldwide operations, access your nearest data One-way or two-way copy Choose which data to share, select by type, can de-select records by attributes
© HAZELCAST | 23 Hazelcast Jet Product Overview
© HAZELCAST | 24 Source Output
Kafka Kafka
loT Alerts
Custom Ingest Combine Stream Compute Connector Transform Publish Enterprise Applications
Enterprise Interactive Applications Join, Analytics In-Memory Enrich, Windowing, Distributed Filter, In-memory, Operational Group, Event-Time and Parallel Clean, Subscriber Hazelcast Hazelcast Storage Aggregate Processing Computations Convert Notifications IMDG IMDG Maps, Caches, Lists
File Watcher Database
Socket HDFS Enrichment Database Events File © HAZELCAST | 25 Databases Maps, Caches, and Lists Hazelcast Cloud ( Managed Service )
© HAZELCAST | 26 Hazelcast Cloud
Sign up here - https://hazelcast.com/products/cloud/
© HAZELCAST | 27 Your contributions are welcome!
● https://github.com/hazelcast/hazelcast ● https://github.com/hazelcast/hazelcast-jet
© HAZELCAST | 28 Resources
Downloads:
● https://hazelcast.org/ ● https://hazelcast.org/imdg/ ● https://jet-start.sh/
Demos
● https://github.com/hazelcast/hazelcast-jet-demos/tree/master/flight-telemetry ● Cloud demo
Free Training:
https://training.hazelcast.com
Join the Discussion:
Google Group: https://groups.google.com/forum/#!forum/hazelcast Stack Overflow: http://stackoverflow.com/questions/tagged/hazelcast © HAZELCAST | 29Gitter: https://gitter.im/hazelcast/hazelcast Thank You
© HAZELCAST | 30 High-Density Memory Store
© HAZELCAST | 31 EE High-Density Memory Store
On-Heap Off-Heap Managed by GC Managed by Hazelcast
Java Process
• Maximizes use of available machine memory
• Eliminates exhausting black art of GC-tuning and ineffective workarounds
• Delivers improved performance and predictability for SLAs
• Support for Intel Optane as fast, lower cost, higher density volatile memory
© HAZELCAST | 32 3 2 EE High-Density Memory Store: Scale UP
IMDG HD IMDG IMDG IMDG
300 GB IMDG HD HD HD 300 GB IMDG IMDG IMDG IMDG IMDG IMDG IMDG IMDG IMDG
30 GB
IMDG IMDG
33
© HAZELCAST | 33 EE High-Density Memory Store: Before and After
On-Heap Memory With HD Memory Store
0 MB Native Storage 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)
Home Home Offheap-test
Memory Utilization Memory Utilization
Node Used Total Max. Heap Usage Used Heap: 3.9 GB Node Used Total Max. Heap Usage Used Heap: 0.2 GB Heap Heap Heap Percentage Heap Heap Heap Percentage
192.168.1.10:5701 3933 MB 4658MB 4653MB 84.45% 192.168.1.10:5701 57 MB 229 MB 910 MB 6.28%
© HAZELCAST | 34 3 4 Hot Restart Store
© HAZELCAST | 35 EE PS Hot Restart Store Restart your cluster without having to reload your data
• Solves the most important operational problem with huge SSD or caches – need to reload data if you restart the cluster HDD • Purpose-designed, ultra high-performance persistence store, IMDG optimized for SSD • Using Intel Optane DC Persistent Memory instead of SSDs enables significantly faster restart times
SSD or IMDG IMDG SSD or HDD HDD • Each node has its own store. Scales linearly across the Single Node Reading Writing cluster Restart Read Write Storage Data Size Time Throughput Throughput • Data entirely loaded into RAM on start-up so Hazelcast IMDG always operates at in-memory speed SSD 100 GB 82 sec 1.4 GB/s 425,000 ops/sec • Persistence configurable per data structure for JCache, Map, SSD 50 GB 49 sec 1.2 GB/s 400,000 ops/sec Web Sessions and Hibernate SSD 25 GB 39 sec 0.8 GB/s 502,254 ops/sec • Partial recovery supported where some nodes are lost Intel 87 GB 18 sec 4.83 GB/s - Optane before restart
© HAZELCAST | 36 • Snapshotting for taking backups • Copy HRS files to new clusters for testing initialization Management Center
© HAZELCAST | 37 EE PS Management Center
Other products integrated via Management Center APIs: • MBean Tool Data Structure • JConsole Statistics • VisualVM • Hawtio
Execute Scripts
Thread Dumps
© HAZELCAST | 38 Data Rebalancing: How Back-ups Replicate across Nodes
© HAZELCAST | 39 Data Rebalancing:Rebalancing: NewMigrationDistributed Migration Node Added MapsComplete
Fixed number of partitions (default 271) Each key falls into partition
Primary A B C D
Back-up
Partitionid = hash(keyData)%PARTITION_COUNT Partition ownerships are reassigned upon membership change
© HAZELCAST | 40 Back-Up Recovery: Data Safety When Nodes Die
© HAZELCAST | 41 Back-up Recovery:Recovery: Back-ups NodeRecovery Crashes Are Is Restored Complete
Primary A A B C C D D
Back-up
© HAZELCAST | 42 APPENDIX
© HAZELCAST | 43 Analyst Reports
Hazelcast IMDG reviewed in Gartner “Market Guide for In-Memory Data Grids” [subscription required] https://www.gartner.com/doc/3420617/market-guide-inmemory-data- grids
“On the Radar: An open-source in-memory data grid platform for Java” [subscription required] https://www.ovumkc.com/Products/IT/Infrastructure-Solutions/On-the- Radar-Hazelcast/Summary
Hazelcast Inc. cited as Leader by Independent Research Firm Forrester Wave In-Memory Data Grids September 2015
© HAZELCAST | 44