63
@prpatel Serverless in the Java ecosystem Pratik Patel @prpatel

Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

Serverless in the Java ecosystem

Pratik Patel @prpatel

Page 2: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

Pratik PateL — @prpatel

CTO TriplingoJava Champion

JavaScript Troublemaker Python Hacker

Founder, PERL recovery group

Page 3: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

WHAT IS SERVERLESS?

ARCHITECTURE

ECOSYSTEM

Page 4: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

SERVERLESS

Page 5: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

#1

A VERY BAD NAME

Page 6: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

Page 7: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

IN A NUTSHELL

Page 8: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

RESPONSES WERE EVEN BETTER!

Page 9: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

RESPONSES WERE EVEN BETTER!

Page 10: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

NOT GEOCITIES

Page 11: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatelSERVERLESS

Yes, There Are Still Servers

Page 12: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatelSERVERLESS

New way to pay for and work with servers

Page 13: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatelWHAT’S THE POINT?

Cheaper

Easier

Page 14: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

Aliases AKA

Page 15: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatelAKA

Functions as a Service

Cloud Functions

Page 16: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

definition

Run code without provisioning or managing

servers

Page 17: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

All the DEV no

DevOps

Page 18: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatelServerless takes care of it

Scalability

Availability

Page 19: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

Ultra creative template

?But is it also a (new) architectural model?

19

Page 20: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

consumer computing

Microcomputer SAAS

Page 21: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

ENTERPRISE computing?

Iaas Serverless

Page 22: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatelInfrastructurePlatform

containersapps

Page 23: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatelInfrastructurePlatform

containers

appsfaas

Page 24: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatelInfrastructurePlatform

containers

appsfaas

INFRASTRUCTURE - someone else's job

Page 25: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatelnew architecture

Focus on building apps

Docker? What’s that?

Page 26: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatelnew architecture

Use existing FaaS’s

Write own FaaS

Page 27: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatelnew architecture

Event-Driven

Events can be almost anything

Page 28: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

Faas eventsMessage (queue) HTTP call FS or DB monitor Inbound Email Alexa

INVOKE Function

Page 29: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

Page 30: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

WE (YOU?) Already DOING THIS

Google FaaSImage OCR

Our own FaaSTranslate

Page 31: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

WE (YOU?) Already DOING THIS•Twilio for SMS •Stripe (payments) •Image resize •Send/format email •Auth with Okta •… lots more!

my app

Page 32: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

ARCHITECTURAL SHIFT

Include lib in project

Call a FaaS

Include lib in project

Call a FaaS

Page 33: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatelFaas

Small (a unit of work)

Single-purpose

Page 34: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatelFaas

Short Running

Stateless

Page 35: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

FaaS Implementations - Java

Page 36: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

Invokation

Can be invoked by any platform (doesn’t have to be

Java)

Page 37: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatelFaaS Implementations

Fn Project

https://github.com/fnproject/fn

Page 38: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatelFaaS Implementations

OpenWhisk

http://openwhisk.incubator.apache.org/

Page 39: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatelFaaS Implementations

Amazon Lambda

https://aws.amazon.com/lambda/

Page 40: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

DEMO

Fn Project

Page 41: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

Ultra creative template

(makesuredockerisrunning)

fnstart

fninit--runtimejavahello

fnrun//HelloWorld

41

Page 42: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

Ultra creative template 42

Page 43: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

Ultra creative template 43

Page 44: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

fn run - just a local

execution

Page 45: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

Ultra creative template

exportFN_REGISTRY=prpatel

fndeploy--appprojectfn

fnrouteslistprojectfn

pathimageendpoint/helloprpatel/hello:0.0.4localhost:8080/r/projectfn/hello

45

Page 46: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatelfn project

Database (persistent storage)

Message Queues (msg’ing between function calls)

Page 47: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatelfn project

Orchestrate multiple function calls (Fn Flow)

asynchronous functions (consumed by long-running components)

Page 48: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

Fn orchestration

Page 49: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

DEMO

Open Whisk

Page 50: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatelopenWhisk

public static JsonObject main(JsonObject args);

All OpenWhisk actions accept/return JSON objects

Page 51: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

Ultra creative template 51

Page 52: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

Ultra creative template

gradlejar

wsk-iactioncreatehello-javabuild/libs/hello-1.0.jar--mainexample.Hello

wsk-iactioninvoke/guest/hello-java--paramnamePratik—blocking

52

Page 53: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

Comparison matrix

Page 54: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

Framework Langs supported Deploymenttargets Ease of Use

OpenWhisk

Project Fn

Open FaaS

Kubeless

Page 55: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

Framework Langs supported Deploymenttargets Ease of Use

OpenWhisk

Project Fn

Open FaaS

Kubeless

WHO THE HELL KNOWS?

Page 56: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

Ultra creative template

DESTROY OUR SERVERS?

56

Page 57: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

Page 58: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

Ultra creative template

Not quite yet!

58

Page 59: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

WE (YOU?) Already DOING THIS•Twilio for SMS •Stripe (payments) •Image resize •Send/format email •Auth with Okta •… lots more!

my app

Page 60: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

Faas

As a developer, execution cost is my

*least important* concern

Page 61: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

Faas

Time to market

Page 62: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

Faas

Cost of development

Page 63: Serverless in the Java ecosystem - Jfokus · 2019-09-11 · Serverless in the Java ecosystem Pratik Patel @prpatel. @prpatel Pratik PateL — @prpatel CTO Triplingo Java Champion

@prpatel

THANK YOU

References:http://www.theregister.co.uk/2018/01/23/

serverless_exhilarating_terrifying_ridiculous_name/https://www.theregister.co.uk/2017/12/12/serverless/https://martinfowler.com/articles/serverless.html

https://medium.com/fnproject/serverless-sagas-with-fn-flow-d8199b608b12https://medium.com/oracledevs/containers-vs-functions-51c879216b97

follow me on twitter: @prpatel