SlideShare a Scribd company logo
SPRING
SERVERLESS
@smaldini
AGENDA
▸ Serverless and functions
▸ Serverless platforms
▸ Spring Cloud Functions
http://github.com/spring-cloud/spring-cloud-function
http://projectreactor.io/
SERVERLESS
▸ Event Driven
▸ Dynamic resource utilization, “scale to zero”
▸ Billing per Message
▸ Focus on Business Logic
▸ Easy Integration with Platform Services
CNCF https://github.com/cncf/wg-serverless/tree/master/whitepaper
AMAZON LAMBDA
GOOGLE CLOUD FUNCTION
MICROSOFT AZURE FUNCTIONS
SERVERLESS PROVIDERS
▸ (J) Amazon Lambda
▸ Google Cloud Functions
▸ (J) Azure Functions
▸ (J) Riff https://github.com/projectriff
▸ (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.
JAVA UTIL FUNCTIONS
public interface Function<T, R> {
R apply(T t);
}
public interface Consumer<T> {
void accept(T t);
}
public interface Supplier<T> {
T get();
}
SPRING CLOUD FUNCTIONS
@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);
}
}
PLAIN OLD FUNCTIONS
package functions;
public class Uppercase implements Function<String, String> {
String apply(String input) {
return input.toUpperCase();
}
}
AWS COLD START
• Lambda throttles CPU resources when memory is constrained
• … also billing is proportional to memory usage
• … it’s not that simple
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)
PROJECT REACTOR
public abstract class Flux<T> implements Publisher<T> {
...
}
public abstract class Mono<T> implements Publisher<T> {
...
}
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);
}
}
SPRING CLOUD FUNCTION
SERVERLESS PROVIDER
ADAPTER
USER FUNCTION
SPRING BOOT
HTTP MESSAGE
SPRING CLOUD FUNCTION
1.Programming model: @Beans of type Function, Consumer and Supplier,
with Flux, Mono, Publisher
2.Component scan for functions (e.g. execute jar with no dependency on Spring at all)
3.Compile strings which are Java function bodies
4.Bind and invoke from an isolated classloader (JVM packing, platform)
5.Adapters for Spring MVC, Spring Cloud Stream, AWS Lambda, Azure, Riff and other
"serverless" service providers
LEARNINGS
1.Spring is not slow or "heavy" on its own, classes loaded is important
2.AWS Lambda containers are slow
3.Warm JVM starts app much faster (10x) → class loader isolation
4.Functions are glue code anyway - not latency sensitive
5.Scale to Zero
6.Platform services and integration spaghetti
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
THANKS!

More Related Content

PPT
OpenStack Dashboard - Diablo
PDF
Serverless Spring - Sabby Anandan
PDF
[Kotlin Serverless 工作坊] 單元 4 - 實作 RSS Aggregator
PPTX
Kube cfg-mgmt
PDF
Full-Stack Reactive with Spring WebFlux + Angular - Oracle Code One 2018
PDF
Full-Stack Reactive with Spring WebFlux + Angular - JConf Colombia 2019
PPTX
Airflow 101
PDF
Time to-live: How to Perform Automatic State Cleanup in Apache Flink - Andrey...
OpenStack Dashboard - Diablo
Serverless Spring - Sabby Anandan
[Kotlin Serverless 工作坊] 單元 4 - 實作 RSS Aggregator
Kube cfg-mgmt
Full-Stack Reactive with Spring WebFlux + Angular - Oracle Code One 2018
Full-Stack Reactive with Spring WebFlux + Angular - JConf Colombia 2019
Airflow 101
Time to-live: How to Perform Automatic State Cleanup in Apache Flink - Andrey...

What's hot (20)

PPTX
Top 10 RxJs Operators in Angular
PDF
How (not) to use reactive streams in java 9+
PPTX
Monitoring on Kubernetes using prometheus
PDF
Full-Stack Reativo com Spring WebFlux + Angular - FiqueEmCasaConf
PPTX
Grails Plugin
PPTX
Secret Deployment Events API features for mabl
PDF
Event Bus: Android Simplificado
PDF
Building a Data Pipeline using Apache Airflow (on AWS / GCP)
PPTX
Highload JavaScript Framework without Inheritance
PDF
OASGraph LoopBack 4 Integration
PDF
Flink on Kubernetes operator
PPTX
Unity3D With Meteor
PDF
Essential parts to implement own Ozone backend
PDF
React meets o OCalm
PDF
Docker + Tenserflow + GOlang - Golang singapore Meetup
PPTX
Python component in mule
PDF
Data architectures in Angular & NGRX Introduction
PDF
Flink Forward Berlin 2017: Maciek Próchniak - TouK Nussknacker - creating Fli...
PDF
Building your first aplication using Apache Apex
PDF
Intro to os-faults library
Top 10 RxJs Operators in Angular
How (not) to use reactive streams in java 9+
Monitoring on Kubernetes using prometheus
Full-Stack Reativo com Spring WebFlux + Angular - FiqueEmCasaConf
Grails Plugin
Secret Deployment Events API features for mabl
Event Bus: Android Simplificado
Building a Data Pipeline using Apache Airflow (on AWS / GCP)
Highload JavaScript Framework without Inheritance
OASGraph LoopBack 4 Integration
Flink on Kubernetes operator
Unity3D With Meteor
Essential parts to implement own Ozone backend
React meets o OCalm
Docker + Tenserflow + GOlang - Golang singapore Meetup
Python component in mule
Data architectures in Angular & NGRX Introduction
Flink Forward Berlin 2017: Maciek Próchniak - TouK Nussknacker - creating Fli...
Building your first aplication using Apache Apex
Intro to os-faults library
Ad

Similar to Serverless Spring by Stephane Maldini (20)

PDF
Serverless Spring - Dave Syer
PPTX
Spring, Functions, Serverless and You- Michael Minella
PPTX
Spring Cloud Function — Going Serverless
PPTX
What is Serverless Computing?
PDF
Spring I/O Barcelona '19 Recap
PDF
Serverless
PDF
AWS Lambda and serverless Java | DevNation Live
PDF
State of serverless
PDF
Spring Cloud Function: Where We Were, Where We Are, and Where We’re Going
PDF
Microservices with AWS Lambda and the Serverless Framework
PDF
SpringOne Tour St. Louis - Serverless Spring
PPTX
Building Serverless Microservices Using Serverless Framework on the Cloud
PDF
Run Code, Not Servers: AWS Lambda
PPTX
Building Cross-Cloud Platform Cognitive Microservices Using Serverless Archit...
PPTX
Building cloud native data microservice
PDF
Serverless: A love hate relationship
PPTX
Demistifying serverless on aws
PDF
Serverless Architecture - A Gentle Overview
PDF
Serverless with Spring Cloud Function, Knative and riff #SpringOneTour #s1t
PPTX
Spring Test Framework
Serverless Spring - Dave Syer
Spring, Functions, Serverless and You- Michael Minella
Spring Cloud Function — Going Serverless
What is Serverless Computing?
Spring I/O Barcelona '19 Recap
Serverless
AWS Lambda and serverless Java | DevNation Live
State of serverless
Spring Cloud Function: Where We Were, Where We Are, and Where We’re Going
Microservices with AWS Lambda and the Serverless Framework
SpringOne Tour St. Louis - Serverless Spring
Building Serverless Microservices Using Serverless Framework on the Cloud
Run Code, Not Servers: AWS Lambda
Building Cross-Cloud Platform Cognitive Microservices Using Serverless Archit...
Building cloud native data microservice
Serverless: A love hate relationship
Demistifying serverless on aws
Serverless Architecture - A Gentle Overview
Serverless with Spring Cloud Function, Knative and riff #SpringOneTour #s1t
Spring Test Framework
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

Recently uploaded (20)

PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
1 - Historical Antecedents, Social Consideration.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PPTX
Chapter 5: Probability Theory and Statistics
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PPTX
cloud_computing_Infrastucture_as_cloud_p
Building Integrated photovoltaic BIPV_UPV.pdf
Approach and Philosophy of On baking technology
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Zenith AI: Advanced Artificial Intelligence
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
1 - Historical Antecedents, Social Consideration.pdf
Programs and apps: productivity, graphics, security and other tools
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
A Presentation on Artificial Intelligence
Hindi spoken digit analysis for native and non-native speakers
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Assigned Numbers - 2025 - Bluetooth® Document
Unlocking AI with Model Context Protocol (MCP)
Enhancing emotion recognition model for a student engagement use case through...
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
Chapter 5: Probability Theory and Statistics
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Heart disease approach using modified random forest and particle swarm optimi...
cloud_computing_Infrastucture_as_cloud_p

Serverless Spring by Stephane Maldini

  • 2. AGENDA ▸ Serverless and functions ▸ Serverless platforms ▸ Spring Cloud Functions http://github.com/spring-cloud/spring-cloud-function http://projectreactor.io/
  • 3. SERVERLESS ▸ Event Driven ▸ Dynamic resource utilization, “scale to zero” ▸ Billing per Message ▸ Focus on Business Logic ▸ Easy Integration with Platform Services CNCF https://github.com/cncf/wg-serverless/tree/master/whitepaper
  • 7. SERVERLESS PROVIDERS ▸ (J) Amazon Lambda ▸ Google Cloud Functions ▸ (J) Azure Functions ▸ (J) Riff https://github.com/projectriff ▸ (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.
  • 8. JAVA UTIL FUNCTIONS public interface Function<T, R> { R apply(T t); } public interface Consumer<T> { void accept(T t); } public interface Supplier<T> { T get(); }
  • 9. SPRING CLOUD FUNCTIONS @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); } }
  • 10. PLAIN OLD FUNCTIONS package functions; public class Uppercase implements Function<String, String> { String apply(String input) { return input.toUpperCase(); } }
  • 11. AWS COLD START • Lambda throttles CPU resources when memory is constrained • … also billing is proportional to memory usage • … it’s not that simple
  • 12. 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)
  • 13. PROJECT REACTOR public abstract class Flux<T> implements Publisher<T> { ... } public abstract class Mono<T> implements Publisher<T> { ... }
  • 14. 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); } }
  • 15. SPRING CLOUD FUNCTION SERVERLESS PROVIDER ADAPTER USER FUNCTION SPRING BOOT HTTP MESSAGE
  • 16. SPRING CLOUD FUNCTION 1.Programming model: @Beans of type Function, Consumer and Supplier, with Flux, Mono, Publisher 2.Component scan for functions (e.g. execute jar with no dependency on Spring at all) 3.Compile strings which are Java function bodies 4.Bind and invoke from an isolated classloader (JVM packing, platform) 5.Adapters for Spring MVC, Spring Cloud Stream, AWS Lambda, Azure, Riff and other "serverless" service providers
  • 17. LEARNINGS 1.Spring is not slow or "heavy" on its own, classes loaded is important 2.AWS Lambda containers are slow 3.Warm JVM starts app much faster (10x) → class loader isolation 4.Functions are glue code anyway - not latency sensitive 5.Scale to Zero 6.Platform services and integration spaghetti
  • 18. 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