serverless in the java ecosystem - jfokus · 2019-09-11 · serverless in the java ecosystem pratik...

Post on 24-May-2020

5 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

@prpatel

Serverless in the Java ecosystem

Pratik Patel @prpatel

@prpatel

Pratik PateL — @prpatel

CTO TriplingoJava Champion

JavaScript Troublemaker Python Hacker

Founder, PERL recovery group

@prpatel

WHAT IS SERVERLESS?

ARCHITECTURE

ECOSYSTEM

@prpatel

SERVERLESS

@prpatel

#1

A VERY BAD NAME

@prpatel

@prpatel

IN A NUTSHELL

@prpatel

RESPONSES WERE EVEN BETTER!

@prpatel

RESPONSES WERE EVEN BETTER!

@prpatel

NOT GEOCITIES

@prpatelSERVERLESS

Yes, There Are Still Servers

@prpatelSERVERLESS

New way to pay for and work with servers

@prpatelWHAT’S THE POINT?

Cheaper

Easier

@prpatel

Aliases AKA

@prpatelAKA

Functions as a Service

Cloud Functions

@prpatel

definition

Run code without provisioning or managing

servers

@prpatel

All the DEV no

DevOps

@prpatelServerless takes care of it

Scalability

Availability

Ultra creative template

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

19

@prpatel

consumer computing

Microcomputer SAAS

@prpatel

ENTERPRISE computing?

Iaas Serverless

@prpatelInfrastructurePlatform

containersapps

@prpatelInfrastructurePlatform

containers

appsfaas

@prpatelInfrastructurePlatform

containers

appsfaas

INFRASTRUCTURE - someone else's job

@prpatelnew architecture

Focus on building apps

Docker? What’s that?

@prpatelnew architecture

Use existing FaaS’s

Write own FaaS

@prpatelnew architecture

Event-Driven

Events can be almost anything

@prpatel

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

INVOKE Function

@prpatel

@prpatel

WE (YOU?) Already DOING THIS

Google FaaSImage OCR

Our own FaaSTranslate

@prpatel

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

my app

@prpatel

ARCHITECTURAL SHIFT

Include lib in project

Call a FaaS

Include lib in project

Call a FaaS

@prpatelFaas

Small (a unit of work)

Single-purpose

@prpatelFaas

Short Running

Stateless

@prpatel

FaaS Implementations - Java

@prpatel

Invokation

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

Java)

@prpatelFaaS Implementations

Fn Project

https://github.com/fnproject/fn

@prpatelFaaS Implementations

OpenWhisk

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

@prpatelFaaS Implementations

Amazon Lambda

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

@prpatel

DEMO

Fn Project

Ultra creative template

(makesuredockerisrunning)

fnstart

fninit--runtimejavahello

fnrun//HelloWorld

41

Ultra creative template 42

Ultra creative template 43

@prpatel

fn run - just a local

execution

Ultra creative template

exportFN_REGISTRY=prpatel

fndeploy--appprojectfn

fnrouteslistprojectfn

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

45

@prpatelfn project

Database (persistent storage)

Message Queues (msg’ing between function calls)

@prpatelfn project

Orchestrate multiple function calls (Fn Flow)

asynchronous functions (consumed by long-running components)

@prpatel

Fn orchestration

@prpatel

DEMO

Open Whisk

@prpatelopenWhisk

public static JsonObject main(JsonObject args);

All OpenWhisk actions accept/return JSON objects

Ultra creative template 51

Ultra creative template

gradlejar

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

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

52

@prpatel

Comparison matrix

@prpatel

Framework Langs supported Deploymenttargets Ease of Use

OpenWhisk

Project Fn

Open FaaS

Kubeless

@prpatel

Framework Langs supported Deploymenttargets Ease of Use

OpenWhisk

Project Fn

Open FaaS

Kubeless

WHO THE HELL KNOWS?

Ultra creative template

DESTROY OUR SERVERS?

56

@prpatel

Ultra creative template

Not quite yet!

58

@prpatel

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

my app

@prpatel

Faas

As a developer, execution cost is my

*least important* concern

@prpatel

Faas

Time to market

@prpatel

Faas

Cost of development

@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

top related