Top Banner
Hazelcast Abhinav Prashant Shweta Amla Yagna Namburi Venkata Rama Krishn Pandi Ryan Wolf
55

HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Jun 22, 2018

Download

Documents

vuongdang
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Hazelcast

Abhinav Prashant

Shweta Amla

Yagna Namburi

Venkata Rama Krishn Pandi

Ryan Wolf

Page 2: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Contents

1• Introduction

2• Architecture/Data Model

3• Features

4.• Query Mechanisms

5• Market Comparison

Page 3: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Introduction

Hazelcast is a leading

Open Source In-Memory Data Grid

Written in JAVA

Startup founded in 2008

by- Talip Ozturk, Fuad Malikov

Page 4: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Data Grid

• Ability to access, modify and transfer humongous data

• Security concerns

• Data access using middleware applications

Page 5: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

CAP Theorem

• Also called Brewer’s theorem

• Distributed systems simultaneously cannot provide:

o Consistency

o Availability

o Partition tolerance

• Hazelcast chooses availability over consistency

Page 6: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

In-Memory Database

• Lies in main-memory for data storage

• Faster as compared to disk-optimized database

• Improved response time - critical applications

Page 7: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Hazelcast - In-memory data Grid

• Data stored in RAM of Servers

• Redundancy - multiple copies of data exists on different servers

• Scalability - servers can be dynamically added or removed

• Peer to peer communication – No Master Slave

• Data persistence done using Relational or other NoSQL database

Page 8: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Hazelcast Topology

Hazelcast can be deployed in Two ways:

• Embedded

• Client-Server

Page 9: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Embedded Deployment

• Applications requiring o High performance

o Lots of task execution

• Members include o Application

o Hazelcast data and Services

• Low-latency data access

Page 10: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Client-Server Deployment

• Centralized - accessed by applications through clients

• Server members -independently created and scaled

• Predictable and reliable Hazelcastperformance

• Scalability handled independently.

Page 11: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Contents

1• Introduction

2• Architecture/Data Model

3• Features

4.• Query Mechanisms

5• Market Comparison

Page 12: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Architecture

Page 13: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Cluster Management

• Cluster auto detects new node

• Discovery mechanisms available:o Multicast

o TCP

o EC2 Cloud

• Oldest node is the cluster leader

• Oldest node listens to join requests

Page 14: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Data Partitioning

Why?

Fast data operations across cluster

• Number of partitions fixed across cluster

• Partitions are equally divided across active nodes

• Partition table is used to keep track of partitions

• Leader node periodically send updated partition table to peer nodes

Page 15: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Hazelcast Partition

2 Nodes 4 NodesSingle Node

Page 16: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Data Model

• Data stored as Key-Value pairs

• To store key, hashing is used to find the partition:Keys are serialized

Byte array hashed using hashing algorithms

Hash result is mod by number of partitions

hash(key) mod partition count

Page 17: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

In Memory Format

• By default, data stored in serialized format

• Option to store data as objects in de-serialized format

Page 18: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Indexing

• Applied to frequently queried fields

• Implemented using Maps of map

• Two types:Ordered

Unordered

• Costly for write intensive application

• Backup data not indexed

Page 19: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Implementing Indexing

Two methods:

a. Using API

b. Using Hazelcast config file

Page 20: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Eviction

• Unless explicitly deleted, entries remain in the memory

• Eviction prevents the JVM from running out of memory

• Hazelcast supports two eviction policies o LFU (least frequently used)

o LRU (least recently used)

Page 21: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Eviction Contd.

• Eviction can be triggered based on:○ Heap used (percentage or absolute value)

○ Maximum entry count (in an entire member or partition)

• Eviction percentage parameter - fraction of entry set to be removed

• Eviction can also be triggered based on the following parameters:○ Time to live

○ Maximum idle time

Page 22: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Contents

1• Introduction

2• Architecture/Data Model

3• Features

4.• Query Mechanism

5• Market Comparison

Page 23: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Key Features

• Distributed Computing

• High Density Memory Store

• Database Caching/Persistence

• Distributed Messaging

• Web Session Clustering

• Distributed Caching

• Distributed Data Structures

Page 24: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Distributed Computing

• In-memory computations over

distributed datasets

• Asynchronous task execution

Page 25: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

High Density Memory Store

• High Density Memory Store

• Jcache provider

• Hazelcast High Density caching

Page 26: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Database Caching/Persistence

• Caching solution foro NoSQL databases

o RDBMS databases

• Performs hit/miss mechanism

• Improves performance

Page 27: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Distributed Messaging

• Publish and subscribe are cluster wide

• Ordered messaging

Page 28: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Web Session Clustering

• Maintains session for user

• Balances load across sessions at failover

Page 29: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Distributed Support

• Hibernate Second Level Cacheo Stale data problem!!!! Hazelcast to the rescue

• Spring Supporto hazelcast-all.jar or hazelcast-spring.jar

Page 30: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Distributed Caching

Page 31: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Get in Distributed Cache Map

Page 32: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Put in Distributed Map

Page 33: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Put in Distributed Map

Page 34: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Failover in Distributed Cache

Page 35: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Failover in Distributed Cache

Page 36: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Failover in Distributed Cache

Page 37: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Failover in Distributed Cache

Page 38: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Distributed Data Structures

• Map

• Queue

• Multimap

• Set

• List

Page 39: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Contents

1• Introduction

2• Architecture/Data Model

3• Features

4• Query Mechanisms

5• Market Comparison

Page 40: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Query Mechanisms

• Queries are distributed

• Predicate filters accordingly

• Merge all results

• Fast and Concurrent

Page 41: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Criteria API

Predicate Class provides operators like:

Equal, notEqual, greaterThan, greaterEqual

Example

Page 42: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Querying with SQL

• SqlPredicate takes regular Where clause

• And/Or: <expression> AND <expression>

• Equality: =,!=,<,<=,>,>=

• Between:<attribute> [NOT] Between <values1> AND <values2>

• Indexing

Page 43: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Aggregators

• Supplier

• Average

• Sum

Page 44: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

• Minimum

• Maximum

• Count

Aggregator’s Contd.

Page 45: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

MapReduce

Summary of main steps:1. Read the source data.

2. Map the data to one or multiple key-value pairs.

3. Reduce all pairs with the same key.

Page 46: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008
Page 47: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Contents

1• Introduction

2• Architecture/Data Model

3• Features

4.• Query Language

5• Market Comparison

Page 48: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Hazelcast as NoSQL Database

Young, but popular• Speed

• Memory

• Caching

Page 49: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Hazelcast as In-Memory Store

• Popular for:• Licensing

• Support

• Languages

• Competition:• Oracle Coherence,

• VmWare Gemfire

• Terracotta

• Persistence• Mapping

• No Single Point of Failure

• Avoids Garbage Collection delays

Page 50: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Hazelcast vs Redis

• Architecture• Language

• Threading

• Scaling • Adding/Removing Nodes

• Failover• Node Relationship

• Clustering• Type

• Addresses

• Discovery

• Persistence

• Querying

Page 51: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Hazelcast vs Oracle Coherence

• Per-core pricing model• Cost• Flexibility

• Aging Technology• Features• 10 year old Java

• De-prioritization of Coherence• 12c• Support and Attention

• Complex Deployment• Time and Consulting

Page 52: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Hazelcast vs Couchbase

• Consistency• Backups and Replicas

• Serialization• Data types

Page 53: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Hazelcast vs Apache Cassandra

• Why is Cassandra used?• Time

• Data

• License

• Querying

• Flexible

• But…

Page 54: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

Industry use of Hazelcast

Page 55: HazelCast - University of Floridamschneid/Teaching/CIS4930+CIS6930_Fall...Introduction Hazelcast is a leading Open Source In-Memory Data Grid Written in JAVA Startup founded in 2008

References

http://docs.hazelcast.org/docs/3.5/manual/html/

https://hazelcast.org/getting-started/

https://hazelcast.org/features/

https://hazelcast.com/use-cases/caching/

http://www.slideshare.net/tmatyashovsky/distributed-applications-using-hazelcast