Web session replication with Hazelcast

Post on 06-Apr-2017

821 views 3 download

transcript

Hazelcast Web Session Replication

About me

E M R A H K O C A M A N @emrahkocaman

emrah@hazelcast.com

What Is Hazelcast?

Hazelcast is a distributed, highly available and scalable

Open Source In-Memory Data Grid

In Memory Data Grid

010011010101010

In Memory Data Computing

In Memory Data Messaging + + In Memory

Data Storage

IM Data Store (Caching) Use CaseDatabase Caching Use-Case

Business Systems

A B C

RDBMS Mainframe MongoDBNoSQL REST

ScaleHazelcast

HD Cache

Dist. Compute

Dist. Message

Hazelcast Servers

Hazelcast ServerJVM [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

IM Distributed Messaging Use Case

Hazelcast Distributed Topic Bus

HazelcastTopic

HazelcastNode 1

HazelcastNode 2

HazelcastNode 3

MSG

Subscribes

Delivers

Subscribes

Delivers

HD Cache

Dist. Compute

Dist. Message

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

World-Class Customers

TELECOMMUNICATIONS

BANKING & FINANCIAL SERVICES

HIGH-TECH

LOGISTICS

INSURANCE

GAMING & ENTERTAINMENT

CONSUMER & ECOMMERCE

Ecosystem TractionDozens of Commercial and Open Source Projects Embed Hazelcast

Feature Overview

Map Set Queue Lock/ Sem. Atomics Topic User

DefinedMultiMap RingBuffer

Hazelcast In-memory Computing Platform

Java

C++ .NET

Portable Serialization / Pluggable Serialization

Memcached REST Internal Client Network Protocol

java.util.concurrent.*javax.cache.*Hibernate 2nd Level Cache

Executor ServiceSQL Query Map / Reduce Aggregation

Low-level Services API

Node Engine (Threads, Instances, Eventing, Wait/Notify, Invocation)

Partition Management(Master Partition, Data Affinity, Replicas, Migrations, Partition Groups)

Cluster Management(Multicast, IP List, AWS/OpenStack)

Networking(IPv4, IPv6)

On-heap Storage

Managem

ent Center

(AP

I, JMX

)

Security(C

onnection, Encryption, A

uthentication, Authorization)

WA

N(Topology Aw

are Partition M

anagement, W

AN

Replication)

Hazelcast Open Source Hazelcast Enterprise

Hazelcast Architecture

Predicate Entry Processor

High-Density (HD) Memory Store

Continuous Query

HD Near Cache

Open Client Network Protocol

Hot Restart Store*

* Coming in 3.6

Web Sessions

Web Session Replication

Web Session Replication

• Web Session Replication is replicating web session to other members of the cluster each time there is a change in the session data.

Use Case

Use Case

Use Case

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

Generic Web Session Replication

• Filter Based • Servlet Container Agnostic • Runs on any container that supports Servlet 3.0 • Configured in “web.xml” • Spring Security Support • Client/P2P Mode • Deferred write • Sticky/Non-Sticky session support

Configuration

<filter> <filter-name>hazelcast-filter</filter-name> <filter-class>com.hazelcast.web.WebFilter</filter-class> <init-param> <param-name>map-name</param-name> <param-value>my-sessions</param-value> </init-param> <init-param> <param-name>sticky-session</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>hazelcast-filter</filter-name> <url-pattern>/*</url-pattern> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> <dispatcher>REQUEST</dispatcher> </filter-mapping> <listener> <listener-class>com.hazelcast.web.SessionListener</listener-class> </listener>

Tomcat Session Replication

• Tomcat 6, 7 & 8 • Easy to set up • No need to modify applications • Put a <Listener> element into the file $CATALINA_HOME$/conf/

server.xml

• Put a <Manager> element into the file $CATALINA_HOME$/conf/context.xml

Jetty Session Replication

• Jetty 7,8 & 9

Demo

Thank you