Building a Real-Time Forecasting Engine with Scala and Akka

26
Kijk vooruit! Steven Laan Building a real-time forecasting engine with Scala and Akka Lightbend CTO Roundtable 24-01-2017

Transcript of Building a Real-Time Forecasting Engine with Scala and Akka

Page 1: Building a Real-Time Forecasting Engine with Scala and Akka

Kijk vooruit!

Steven Laan

Building a real-time forecasting engine with Scala and Akka

Lightbend CTO Roundtable 24-01-2017

Page 2: Building a Real-Time Forecasting Engine with Scala and Akka

Product Owner at ING Analytics

Academic background: Artificial Intelligence

Working as Dev Engineer since 2014

[email protected] https://nl.linkedin.com/in/steven-laan-64222b48

Steven Laan

Page 3: Building a Real-Time Forecasting Engine with Scala and Akka

Agenda

3

Why ING is a data-driven enterprise1. Strategy

How RAF is build3. Architecture and Technology

How we implement the tools4. Way of Working

The coolest feature in ING’s mobile app2. Use case: RAF

Lessons learned and the road ahead5. Conclusions

Page 4: Building a Real-Time Forecasting Engine with Scala and Akka

WHY: Strategy

Page 5: Building a Real-Time Forecasting Engine with Scala and Akka

ING’s Think Forward strategy was launched in March 2014

5

Page 6: Building a Real-Time Forecasting Engine with Scala and Akka

We are committed to helping our customers stay a step ahead by making their data work harder for them

6

Compliant

OmnichannelPredictive

Secure & reliable

Personal

Page 7: Building a Real-Time Forecasting Engine with Scala and Akka

How do we want to use data at ING?

7

the right messageat the right time

in the right channelto the right customer

Message

Time Channel

What does ‘right’ mean?• We want to be as relevant as possible• ‘right’ = interesting enough to react positively (i.e. to click)

Page 8: Building a Real-Time Forecasting Engine with Scala and Akka

WHAT: Forecasting

8

Page 9: Building a Real-Time Forecasting Engine with Scala and Akka

What?

• Provide customers insight in their future transactions

How?

• Mobile app feature

• Start small: MVP

• Agile: Keep improving

Real-time Account Forecasting

9

Page 10: Building a Real-Time Forecasting Engine with Scala and Akka

Mobile interface

10

Main screen Transaction detailsTerms & conditions Info page

Page 11: Building a Real-Time Forecasting Engine with Scala and Akka

Architecture and Technologies

11

Page 12: Building a Real-Time Forecasting Engine with Scala and Akka

Forecasting chain

12

Mobile PlatformBackend Services

Forecasting API

iOS

iOS

Page 13: Building a Real-Time Forecasting Engine with Scala and Akka

• Called by Mobile Platform (REST)

• Calls backend services (multiple protocols)

• Returns future transactions (JSON)

• Certain transactions

• Predicted transactions

Forecasting API

13

Page 14: Building a Real-Time Forecasting Engine with Scala and Akka

• Scala

• Akka

• Git

• Sbt

• Nolio

• Jenkins

• Graphite / Grafana

• Spark

Used Technologies

14

Page 15: Building a Real-Time Forecasting Engine with Scala and Akka

• Scala

• Interop with JVM

• Functional

• Akka

• Scalability

• Domain

Why Scala / Akka

15

Page 16: Building a Real-Time Forecasting Engine with Scala and Akka

Flow of a request

16

Spray HTTP Service

RequestActor

FutureActors

HistoryActorsHistoric

transactions services

Plannedtransactions

services

ForecastActorForecasting

Library

Page 17: Building a Real-Time Forecasting Engine with Scala and Akka

Flow of a request

17

Spray HTTP Service

RequestActor

FutureActors

HistoryActorsHistoric

transactions services

Plannedtransactions

services

ForecastActorForecasting

Library

Page 18: Building a Real-Time Forecasting Engine with Scala and Akka

Flow of a request

18

Spray HTTP Service

RequestActor

FutureActors

HistoryActorsHistoric

transactions services

Plannedtransactions

services

ForecastActorForecasting

Library

Page 19: Building a Real-Time Forecasting Engine with Scala and Akka

• RequestActor per request

• Scalable

• Asynchronous

• Dedicated service actors

• Configurability

• Error handling

• Separate forecasting library

• Separation of concern

• Reusable

• Parallel development

Actor System Architecture

19

Page 20: Building a Real-Time Forecasting Engine with Scala and Akka

Dealing with slower processes

20

Real time transactions

service

Slow (legacy)system

ForecastingLibrary

Forecasting APIFront End DB Preprocessing

Page 21: Building a Real-Time Forecasting Engine with Scala and Akka

• Move towards streaming solutions

• Fast data

• Kafka / Flume / Flink

• Improve forecasting library

Road ahead

21

Page 22: Building a Real-Time Forecasting Engine with Scala and Akka

HOW: Way of working

Page 23: Building a Real-Time Forecasting Engine with Scala and Akka

ING is an Experimental Enterprise

Source: Edd Dumbill, Forbes, 2014

Page 24: Building a Real-Time Forecasting Engine with Scala and Akka

Squad

Tribes, squads, chapters, guilds, …

SquadSquad

Chapter

Guild

DS

DA

OpsOps

CJE

DS

DA

DS

CJE

DS

Ops

DS

CJE

Dev DevDevDevDev

Page 25: Building a Real-Time Forecasting Engine with Scala and Akka

A fun place to work!

25

Page 26: Building a Real-Time Forecasting Engine with Scala and Akka

26

Follow us to stay a step ahead

ING.com

YouTube.com/ING

SlideShare.net/ING@ING_News LinkedIn.com/company/ING

Flickr.com/INGGroupFacebook.com/ING