33

Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Embed Size (px)

Citation preview

Page 1: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)
Page 2: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Building reactive applications with Node.js and Red Hat JBoss Data Grid

Galder Zamarreño Arrizabalaga

Divya Mehra

Page 3: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Galder Zamarreño Arrizabalaga

• Senior Software Engineer @ Red Hat

• Infinispan / JBoss Data Grid co-founder

• JSR-107 expert group member

• Keen interest in functional programming

Page 4: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Divya Mehra

• Principal Product Manager @ Red Hat

• Responsible for Red Hat JBoss Data Grid roadmap

Page 5: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Agenda

• Introduction to Red Hat JBoss Data Grid

• Building a reactive application with Node.js and Red Hat JBoss Data Grid

Page 6: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Introduction to Red Hat JBoss Data Grid

Page 7: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Red Hat JBoss Data Grid

Page 8: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Why in-memory data management?

• Large volume, velocity, and variability of raw data

• Enterprises that can extract meaningful, actionable information faster have competitive advantage

• Increase revenues

• Reduce risks

Page 9: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

E-commerce website

Challenge: Maintain page load times, while computing relevant purchase recommendations from data from different sources:

• Mobile device → location

• Social graph →what friends are buying or recommending

• 3rd party sellers or partner sites -> current promotions

• User’s purchase or click-through history -> behavioral targeting

Relevant recommendation can increase conversion by 25%

However, each 1-second increase in page load time → up 10% drop in overall revenue

Can your data platform scale out to large volumes of often-changing data without affecting application performance?

Page 10: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

SaaS Application Provider

Challenge: Users of SaaS application should be unaffected by spikes in demand, node failure, and system upgrades of the data platform.

Loss of availability and performance will affect SaaS app provider’s SLA to its customers

• Revenue loss

• Reputation impact

Does your data platform support high availability, elasticity, and rolling upgrades, necessary for a cloud-native architecture?

Page 11: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Telecom service provider

Challenge: Real-time billing and usage information for thousands of concurrent users

• A customer sends a text, uses data, or makes a call

• Transaction is recorded in the data platform, and the customer’s total usage and bill is updated immediately triggered by creation of this new entry.

Can your business logic react to changes in the data in real-time and at scale?

Page 12: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

JBoss Data Grid - 4-IN-1 package

Page 13: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Leader in Forrester Wave™: In-Memory Data Grids, Q3 2015

Ahead in both evaluation dimensions vs. open source competitors

1.Current offering

2.Strategy and vision

Download free from: https://engage.redhat.com/forrester-data-grid-s-201509240128

Page 14: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Reactive apps with Node.js and JBoss Data Grid 7

Page 15: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Architecture

HTTP TCP/IP

Page 16: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Elm

• Functional language for Web

• Compiles to Javascript

• No runtime errors in practice

• Statically typed, friendly errors

• Help build well-architected code

• Easy to learn! Easy to use!

Page 17: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Event Manager Microservice

• Node.js middleware

• Based on Express.js

• Listens for HTTP on port 3000

• Uses JDG 7 Node.js client

• Requires Node 0.10 or higher

Page 18: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

JDG Persistence

• Runs a JDG 7 server domain

• Formed of 3 nodes

• Each element stored in 2 nodes

• Redundancy via partial replication

• Redundancy for failover

Page 19: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Event Iteration (1)

GET /events

Page 20: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Event Iteration (2)

GET /events

iterate

event 1

event 2

Page 21: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Event Iteration (3)

GET /events

iterate

event 1

event 2

…JSON event[]

Page 22: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Demo Event Iteration

Page 23: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Event Insert (1)

POST /events

Page 24: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Event Insert (2)

POST /events

putIfAbsent

Page 25: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Event Insert (3)

POST /events

putIfAbsent

true/false

createdevent

Page 26: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Event Insert (4)

POST /events

putIfAbsent

true/false

createdevent

JSON true/false

WS: JSON event

WS: JSON event

Page 27: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Demo Event Insert

Page 28: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Event Search (1)

GET /search?q=query

Page 29: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Event Search (2)

executeGET /search?q=query

Page 30: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Event Search (3)

execute

resultsJSON results

GET /search?q=query

Page 31: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Demo Event Search

Page 32: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

github.com/galderz/infinispan-events/tree/june16

Page 33: Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Galder Zamarreño & Divya Mehra)

Credits

Window by Oleg Frolov from the Noun Project

Server Error by Montu Yadav from the Noun Project

Databases by Oliviu Stoian from the Noun Project