Slide 1

Slide 1 text

Serverless Spring Sabby Anandan [@sabbyanandan]

Slide 2

Slide 2 text

Plot Woah, Serverless! Role of Spring in the Serverless Landscape Spring and Serverless Platforms Putting it all together 2

Slide 3

Slide 3 text

Compute 3

Slide 4

Slide 4 text

Containers Virtual Machines Compute 4

Slide 5

Slide 5 text

Containers Virtual Machines Compute Serverless 5

Slide 6

Slide 6 text

Should Developers Care? Containers Virtual Machines Compute Serverless 6

Slide 7

Slide 7 text

Developer Focus Ideation Implementation Production 7

Slide 8

Slide 8 text

Production Focus Happy Customers Containers Virtual Machines Compute Serverless Ideation Implementation Production 8

Slide 9

Slide 9 text

Serverless: The Promise 0 X Scale to Zero $ Billed by Use Ideation Implementation Production Focus on Business Logic Event Driven 9

Slide 10

Slide 10 text

Functions in Spring

Slide 11

Slide 11 text

Package: java.util.function public interface Supplier { T get(); } public interface Function { R apply(T t); } public interface Consumer { void accept(T t); } // source // processor // sink 11

Slide 12

Slide 12 text

Spring Cloud Function @SpringBootApplication public class Application { @Bean public Function upper() { return value -> value.toUpperCase(); } public static void main(String[] args) { SpringApplication.run(Application, args); } } 12

Slide 13

Slide 13 text

Plain Old Functions (Imperative Style) package functions; public class Upper implements Function { String apply(String name) { return name.toUpperCase(); } } 13

Slide 14

Slide 14 text

Functional Style @SpringBootApplication public class Application { @Bean public Function, Flux> toUpper() { return flux -> flux .filter(this::isValid) .map(String::toUpperCase); } boolean isValid(String input) { ... } public static void main(String[] args) { SpringApplication.run(Application.class, args); } } 14

Slide 15

Slide 15 text

Serverless -or- Function as a Service

Slide 16

Slide 16 text

FaaS Providers Amazon Lambda [native-Java] Microsoft Azure Functions [native-Java] Google Cloud Functions riff [native-Java] IBM OpenWhisk [native-Java] OpenFaaS Fission Kubeless Oracle Fn [native-Java] … Spring Boot FaaS Provider Adapters Function Microsoft Azure Spring MVC Spring Cloud Stream AWS Lambda IBM OpenWhisk Spring Cloud Task Spring Cloud Function - Pluggable Adapters 16

Slide 17

Slide 17 text

riff is for functions

Slide 18

Slide 18 text

riff is for functions Developers can execute functions in response to events. - Event-streaming as first-class design principle - Polyglot - Kubernetes native 18

Slide 19

Slide 19 text

Knative Developers can use familiar idioms, languages, and frameworks to deploy any workload: functions, applications, or containers. 19

Slide 20

Slide 20 text

A Simple Java Function e38dblsskjlk88o de322sss0909k Function Function Invoker Base Image Layers Upper $ riff function create java upper Function Layer package functions; public class Upper implements Function { String apply(String name) { return name.toUpperCase(); } } 20

Slide 21

Slide 21 text

Loosely Coupled Functions Upper Logger 21

Slide 22

Slide 22 text

Loosely Coupled Functions Upper Logger bigtext T R I G G E R S U B S C R I B E R E P L Y T O S U B S C R I B E text 22 channel channel

Slide 23

Slide 23 text

Look Familiar? 23

Slide 24

Slide 24 text

● Spring Developers: a smaller, more familiar step with access to Spring (dependency injection, integrations, and autoconfiguration) and build tools (testing, continuous delivery, and run locally) ● Functionistas: no need to know anything about Spring SCFn Narrative Mark Fisher Dave Syer

Slide 25

Slide 25 text

Q+A