SlideShare a Scribd company logo
Serverless Spring@david_syer, 2018
Serverless Spring http://localhost:4000/decks/serverless-spring.html
1 of 30 30/01/2019, 10:04
Agenda
Serverless and functions
Servless platforms, including Riff
Spring Cloud Function
http://github.com/spring-cloud/spring-cloud-function
http://projectreactor.io/
Serverless Spring http://localhost:4000/decks/serverless-spring.html
2 of 30 30/01/2019, 10:04
Serverless
Event driven
Dynamic resource utilization, "scale to zero"
Billing per message
Focus on business logic
Easy integration with platform services
Serverless Spring http://localhost:4000/decks/serverless-spring.html
3 of 30 30/01/2019, 10:04
Serverless Use Cases
Web hooks
Background jobs
Glue code (hands-free integration)
CNCF WG Whitepaper
Serverless Spring http://localhost:4000/decks/serverless-spring.html
4 of 30 30/01/2019, 10:04
No Code is an Island
Credit: Yan Cui, https://theburningmonk.com
Serverless Spring http://localhost:4000/decks/serverless-spring.html
5 of 30 30/01/2019, 10:04
Service Block
Serverless Spring http://localhost:4000/decks/serverless-spring.html
6 of 30 30/01/2019, 10:04
Amazon Lambda
Serverless Spring http://localhost:4000/decks/serverless-spring.html
7 of 30 30/01/2019, 10:04
Serverless Spring http://localhost:4000/decks/serverless-spring.html
8 of 30 30/01/2019, 10:04
Google Cloud Function
Serverless Spring http://localhost:4000/decks/serverless-spring.html
9 of 30 30/01/2019, 10:04
Serverless Spring http://localhost:4000/decks/serverless-spring.html
10 of 30 30/01/2019, 10:04
Microsoft Azure Functions
Serverless Spring http://localhost:4000/decks/serverless-spring.html
11 of 30 30/01/2019, 10:04
Serverless Spring http://localhost:4000/decks/serverless-spring.html
12 of 30 30/01/2019, 10:04
Alibaba Function Compute
Serverless Spring http://localhost:4000/decks/serverless-spring.html
13 of 30 30/01/2019, 10:04
Serverless Spring http://localhost:4000/decks/serverless-spring.html
14 of 30 30/01/2019, 10:04
Riff
Serverless Spring http://localhost:4000/decks/serverless-spring.html
15 of 30 30/01/2019, 10:04
Serverless Spring http://localhost:4000/decks/serverless-spring.html
16 of 30 30/01/2019, 10:04
Serverless Providers
(J) Amazon Lambda
Google Cloud Functions
(J) Azure Function
(J) Alibaba
(J) Riff https://projectriff.io and PFS
(J) IBM OpenWhisk
(J) Oracle Fn
OpenFaaS
Fission
Kubeless
…
(J) = native Java support
Others can run Java, e.g. via custom container or node JRE launcher.
Serverless Spring http://localhost:4000/decks/serverless-spring.html
17 of 30 30/01/2019, 10:04
Java Util Function
public interface Function<T, R> {
R apply(T t);
}
public interface Consumer<T> {
void accept(T t);
}
public interface Supplier<T> {
T get();
}
Serverless Spring http://localhost:4000/decks/serverless-spring.html
18 of 30 30/01/2019, 10:04
Spring Cloud Function
@SpringBootApplication
public class Application {
@Bean
public Function<String, String> uppercase() {
return value -> value.toUpperCase();
}
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Serverless Spring http://localhost:4000/decks/serverless-spring.html
19 of 30 30/01/2019, 10:04
Plain Old Functions
package functions;
public class Uppercase implements Function<String, String> {
String apply(String input) {
return input.toUpperCase();
}
}
Serverless Spring http://localhost:4000/decks/serverless-spring.html
20 of 30 30/01/2019, 10:04
AWS Cold Starts
Lambda throttles CPU resources when memory is constrained
… also billing is proportional to memory usage
… it’s not that simple
Serverless Spring http://localhost:4000/decks/serverless-spring.html
21 of 30 30/01/2019, 10:04
Spring Cloud Function
All the benefits of serverless, but with full access to Spring (dependency injection, integrations,
autoconfiguration) and build tools (testing, continuous delivery, run locally)
For Spring devs: a smaller, more familiar step than using FaaS APIs and UIs natively
For Functionistas: no need to know anything about Spring
Decouple lifecycle of business logic from runtime platform. Run the same code as a web endpoint,
a stream processor, or a task
Uniform programming model across serverless providers, and also able to run standalone
(locally or in a PaaS)
Serverless Spring http://localhost:4000/decks/serverless-spring.html
22 of 30 30/01/2019, 10:04
Project Reactor
public abstract class Flux<T> implements Publisher<T> {
...
}
public abstract class Mono<T> implements Publisher<T> {
...
}
Serverless Spring http://localhost:4000/decks/serverless-spring.html
23 of 30 30/01/2019, 10:04
Spring Cloud Function
@SpringBootApplication
public class Application {
@Bean
public Function<Flux<String>, Flux<String>> uppercase() {
return flux -> flux
.filter(this::isNotRude)
.map(String::toUpperCase);
}
boolean isNotRude(String word) {
...
}
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Serverless Spring http://localhost:4000/decks/serverless-spring.html
24 of 30 30/01/2019, 10:04
Spring Cloud Function Adapter
Serverless Spring http://localhost:4000/decks/serverless-spring.html
25 of 30 30/01/2019, 10:04
Serverless Spring http://localhost:4000/decks/serverless-spring.html
26 of 30 30/01/2019, 10:04
Spring Cloud Function
Programming model: @Beans of type Function, Consumer and Supplier, with Flux,
Mono, Publisher
1.
Component scan for functions (e.g. execute jar with no dependency on Spring at all)2.
Compile strings which are Java function bodies3.
Bind and invoke from an isolated classloader (JVM packing, platform)4.
Adapters for Spring MVC, Spring Cloud Stream, AWS Lambda, Azure, Riff and other
"serverless" service providers
5.
Serverless Spring http://localhost:4000/decks/serverless-spring.html
27 of 30 30/01/2019, 10:04
Learnings
Spring is not slow or "heavy" on its own, classes loaded is important1.
AWS Lambda containers are slow, Azure even more so2.
Functional bean definitions rule for fast startup3.
Functions are glue code anyway - not latency sensitive4.
Scale to Zero5.
Platform services and integration spaghetti6.
Serverless Spring http://localhost:4000/decks/serverless-spring.html
28 of 30 30/01/2019, 10:04
Links
Spring Cloud Function: https://github.com/spring-cloud/spring-cloud-function
Riff: https://github.com/projectriff/riff
Spring Boot Thin Launcher: https://github.com/dsyer/spring-boot-thin-launcher
Spring Initializr: http://start.spring.io
Spring Cloud: http://cloud.spring.io
Reactor: http://projectreactor.io
Serverless Spring http://localhost:4000/decks/serverless-spring.html
29 of 30 30/01/2019, 10:04
← →
1 / 23
Go to Slide: Go
Serverless Spring http://localhost:4000/decks/serverless-spring.html
30 of 30 30/01/2019, 10:04

More Related Content

PDF
Esna Cloudlink for Cisco TelePresence + IBM Notes Presentation
PDF
Esna Cloudlink for Cisco TelePresence + Google Apps Presentation
PDF
"AWS Fargate: Containerization meets Serverless" at AWS User Group Cologne 20...
PDF
Awesome Tools to Level Up Your Spring Cloud Architecture - Spring I/O 2017
PPTX
Leveraging AWS Cloudfront & S3 Services to Deliver Static Assets of a SPA
PDF
Serverless Spring by Stephane Maldini
PDF
Serverless Spring - Sabby Anandan
PPTX
Spring, Functions, Serverless and You- Michael Minella
Esna Cloudlink for Cisco TelePresence + IBM Notes Presentation
Esna Cloudlink for Cisco TelePresence + Google Apps Presentation
"AWS Fargate: Containerization meets Serverless" at AWS User Group Cologne 20...
Awesome Tools to Level Up Your Spring Cloud Architecture - Spring I/O 2017
Leveraging AWS Cloudfront & S3 Services to Deliver Static Assets of a SPA
Serverless Spring by Stephane Maldini
Serverless Spring - Sabby Anandan
Spring, Functions, Serverless and You- Michael Minella

Similar to Serverless Spring - Dave Syer (20)

PDF
Spring, Functions, Serverless and You
PDF
SpringOne Tour St. Louis - Serverless Spring
PDF
Serverless
PDF
Why Serverless?
PDF
Serverless Comparison: AWS vs Azure vs Google vs IBM
PDF
Serverless Node.js
PPTX
What is Serverless Computing?
PDF
Čtvrtkon #64 - AWS Serverless - Michal Haták
PDF
AWS Lambda and serverless Java | DevNation Live
PPTX
Spring Cloud Function — Going Serverless
PDF
Spring I/O Barcelona '19 Recap
PPTX
Understanding serverless architecture
PDF
2018 10-19-jc conf-embrace-legacy-java-ee-by-aws-serverless
PDF
Skillenza Build with Serverless Challenge - Advanced Serverless Concepts
PDF
Serverless Spring
PDF
Automated Serverless Pipelines with #GitOps on Codefresh
PDF
2019 10-21 Java in the Age of Serverless
PDF
«Что такое serverless-архитектура и как с ней жить?» Николай Марков, Aligned ...
PDF
Introduction to Serverless through Architectural Patterns
PDF
Introduction to Serverless
Spring, Functions, Serverless and You
SpringOne Tour St. Louis - Serverless Spring
Serverless
Why Serverless?
Serverless Comparison: AWS vs Azure vs Google vs IBM
Serverless Node.js
What is Serverless Computing?
Čtvrtkon #64 - AWS Serverless - Michal Haták
AWS Lambda and serverless Java | DevNation Live
Spring Cloud Function — Going Serverless
Spring I/O Barcelona '19 Recap
Understanding serverless architecture
2018 10-19-jc conf-embrace-legacy-java-ee-by-aws-serverless
Skillenza Build with Serverless Challenge - Advanced Serverless Concepts
Serverless Spring
Automated Serverless Pipelines with #GitOps on Codefresh
2019 10-21 Java in the Age of Serverless
«Что такое serverless-архитектура и как с ней жить?» Николай Марков, Aligned ...
Introduction to Serverless through Architectural Patterns
Introduction to Serverless
Ad

More from VMware Tanzu (20)

PDF
Spring into AI presented by Dan Vega 5/14
PDF
What AI Means For Your Product Strategy And What To Do About It
PDF
Make the Right Thing the Obvious Thing at Cardinal Health 2023
PPTX
Enhancing DevEx and Simplifying Operations at Scale
PDF
Spring Update | July 2023
PPTX
Platforms, Platform Engineering, & Platform as a Product
PPTX
Building Cloud Ready Apps
PDF
Spring Boot 3 And Beyond
PDF
Spring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdf
PDF
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
PDF
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
PPTX
tanzu_developer_connect.pptx
PDF
Tanzu Virtual Developer Connect Workshop - French
PDF
Tanzu Developer Connect Workshop - English
PDF
Virtual Developer Connect Workshop - English
PDF
Tanzu Developer Connect - French
PDF
Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023
PDF
SpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring Boot
PDF
SpringOne Tour: The Influential Software Engineer
PDF
SpringOne Tour: Domain-Driven Design: Theory vs Practice
Spring into AI presented by Dan Vega 5/14
What AI Means For Your Product Strategy And What To Do About It
Make the Right Thing the Obvious Thing at Cardinal Health 2023
Enhancing DevEx and Simplifying Operations at Scale
Spring Update | July 2023
Platforms, Platform Engineering, & Platform as a Product
Building Cloud Ready Apps
Spring Boot 3 And Beyond
Spring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdf
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
tanzu_developer_connect.pptx
Tanzu Virtual Developer Connect Workshop - French
Tanzu Developer Connect Workshop - English
Virtual Developer Connect Workshop - English
Tanzu Developer Connect - French
Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023
SpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring Boot
SpringOne Tour: The Influential Software Engineer
SpringOne Tour: Domain-Driven Design: Theory vs Practice
Ad

Recently uploaded (20)

PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
System and Network Administration Chapter 2
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Nekopoi APK 2025 free lastest update
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
Introduction to Artificial Intelligence
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
Transform Your Business with a Software ERP System
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
System and Network Administraation Chapter 3
How to Migrate SBCGlobal Email to Yahoo Easily
System and Network Administration Chapter 2
Softaken Excel to vCard Converter Software.pdf
Nekopoi APK 2025 free lastest update
Which alternative to Crystal Reports is best for small or large businesses.pdf
Introduction to Artificial Intelligence
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
CHAPTER 2 - PM Management and IT Context
Computer Software and OS of computer science of grade 11.pptx
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Design an Analysis of Algorithms I-SECS-1021-03
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Odoo Companies in India – Driving Business Transformation.pdf
How to Choose the Right IT Partner for Your Business in Malaysia
2025 Textile ERP Trends: SAP, Odoo & Oracle
Transform Your Business with a Software ERP System
Internet Downloader Manager (IDM) Crack 6.42 Build 41
wealthsignaloriginal-com-DS-text-... (1).pdf
VVF-Customer-Presentation2025-Ver1.9.pptx
System and Network Administraation Chapter 3

Serverless Spring - Dave Syer

  • 1. Serverless Spring@david_syer, 2018 Serverless Spring http://localhost:4000/decks/serverless-spring.html 1 of 30 30/01/2019, 10:04
  • 2. Agenda Serverless and functions Servless platforms, including Riff Spring Cloud Function http://github.com/spring-cloud/spring-cloud-function http://projectreactor.io/ Serverless Spring http://localhost:4000/decks/serverless-spring.html 2 of 30 30/01/2019, 10:04
  • 3. Serverless Event driven Dynamic resource utilization, "scale to zero" Billing per message Focus on business logic Easy integration with platform services Serverless Spring http://localhost:4000/decks/serverless-spring.html 3 of 30 30/01/2019, 10:04
  • 4. Serverless Use Cases Web hooks Background jobs Glue code (hands-free integration) CNCF WG Whitepaper Serverless Spring http://localhost:4000/decks/serverless-spring.html 4 of 30 30/01/2019, 10:04
  • 5. No Code is an Island Credit: Yan Cui, https://theburningmonk.com Serverless Spring http://localhost:4000/decks/serverless-spring.html 5 of 30 30/01/2019, 10:04
  • 6. Service Block Serverless Spring http://localhost:4000/decks/serverless-spring.html 6 of 30 30/01/2019, 10:04
  • 7. Amazon Lambda Serverless Spring http://localhost:4000/decks/serverless-spring.html 7 of 30 30/01/2019, 10:04
  • 9. Google Cloud Function Serverless Spring http://localhost:4000/decks/serverless-spring.html 9 of 30 30/01/2019, 10:04
  • 11. Microsoft Azure Functions Serverless Spring http://localhost:4000/decks/serverless-spring.html 11 of 30 30/01/2019, 10:04
  • 13. Alibaba Function Compute Serverless Spring http://localhost:4000/decks/serverless-spring.html 13 of 30 30/01/2019, 10:04
  • 17. Serverless Providers (J) Amazon Lambda Google Cloud Functions (J) Azure Function (J) Alibaba (J) Riff https://projectriff.io and PFS (J) IBM OpenWhisk (J) Oracle Fn OpenFaaS Fission Kubeless … (J) = native Java support Others can run Java, e.g. via custom container or node JRE launcher. Serverless Spring http://localhost:4000/decks/serverless-spring.html 17 of 30 30/01/2019, 10:04
  • 18. Java Util Function public interface Function<T, R> { R apply(T t); } public interface Consumer<T> { void accept(T t); } public interface Supplier<T> { T get(); } Serverless Spring http://localhost:4000/decks/serverless-spring.html 18 of 30 30/01/2019, 10:04
  • 19. Spring Cloud Function @SpringBootApplication public class Application { @Bean public Function<String, String> uppercase() { return value -> value.toUpperCase(); } public static void main(String[] args) { SpringApplication.run(Application.class, args); } } Serverless Spring http://localhost:4000/decks/serverless-spring.html 19 of 30 30/01/2019, 10:04
  • 20. Plain Old Functions package functions; public class Uppercase implements Function<String, String> { String apply(String input) { return input.toUpperCase(); } } Serverless Spring http://localhost:4000/decks/serverless-spring.html 20 of 30 30/01/2019, 10:04
  • 21. AWS Cold Starts Lambda throttles CPU resources when memory is constrained … also billing is proportional to memory usage … it’s not that simple Serverless Spring http://localhost:4000/decks/serverless-spring.html 21 of 30 30/01/2019, 10:04
  • 22. Spring Cloud Function All the benefits of serverless, but with full access to Spring (dependency injection, integrations, autoconfiguration) and build tools (testing, continuous delivery, run locally) For Spring devs: a smaller, more familiar step than using FaaS APIs and UIs natively For Functionistas: no need to know anything about Spring Decouple lifecycle of business logic from runtime platform. Run the same code as a web endpoint, a stream processor, or a task Uniform programming model across serverless providers, and also able to run standalone (locally or in a PaaS) Serverless Spring http://localhost:4000/decks/serverless-spring.html 22 of 30 30/01/2019, 10:04
  • 23. Project Reactor public abstract class Flux<T> implements Publisher<T> { ... } public abstract class Mono<T> implements Publisher<T> { ... } Serverless Spring http://localhost:4000/decks/serverless-spring.html 23 of 30 30/01/2019, 10:04
  • 24. Spring Cloud Function @SpringBootApplication public class Application { @Bean public Function<Flux<String>, Flux<String>> uppercase() { return flux -> flux .filter(this::isNotRude) .map(String::toUpperCase); } boolean isNotRude(String word) { ... } public static void main(String[] args) { SpringApplication.run(Application.class, args); } } Serverless Spring http://localhost:4000/decks/serverless-spring.html 24 of 30 30/01/2019, 10:04
  • 25. Spring Cloud Function Adapter Serverless Spring http://localhost:4000/decks/serverless-spring.html 25 of 30 30/01/2019, 10:04
  • 27. Spring Cloud Function Programming model: @Beans of type Function, Consumer and Supplier, with Flux, Mono, Publisher 1. Component scan for functions (e.g. execute jar with no dependency on Spring at all)2. Compile strings which are Java function bodies3. Bind and invoke from an isolated classloader (JVM packing, platform)4. Adapters for Spring MVC, Spring Cloud Stream, AWS Lambda, Azure, Riff and other "serverless" service providers 5. Serverless Spring http://localhost:4000/decks/serverless-spring.html 27 of 30 30/01/2019, 10:04
  • 28. Learnings Spring is not slow or "heavy" on its own, classes loaded is important1. AWS Lambda containers are slow, Azure even more so2. Functional bean definitions rule for fast startup3. Functions are glue code anyway - not latency sensitive4. Scale to Zero5. Platform services and integration spaghetti6. Serverless Spring http://localhost:4000/decks/serverless-spring.html 28 of 30 30/01/2019, 10:04
  • 29. Links Spring Cloud Function: https://github.com/spring-cloud/spring-cloud-function Riff: https://github.com/projectriff/riff Spring Boot Thin Launcher: https://github.com/dsyer/spring-boot-thin-launcher Spring Initializr: http://start.spring.io Spring Cloud: http://cloud.spring.io Reactor: http://projectreactor.io Serverless Spring http://localhost:4000/decks/serverless-spring.html 29 of 30 30/01/2019, 10:04
  • 30. ← → 1 / 23 Go to Slide: Go Serverless Spring http://localhost:4000/decks/serverless-spring.html 30 of 30 30/01/2019, 10:04