INTEGRATION PATTERNS IN A
SERVERLESS WORLD: THE GOOD PARTS
Bilgin Ibryam
Principal Architect
Claus Ibsen
Senior Principal Software Engineer
May 7th 2019
About us
Claus Ibsen
● Senior Principal Software Engineer at
Red Hat
● ASF Member & Java Champion
● Camel tech lead
● Author of Camel in Action books
● Based in Denmark
Bilgin Ibryam
● Principal Architect at Red Hat
● ASF Member
● Camel committer
● Author of Camel Design Patterns &
Kubernetes Patterns books
● Based in the UK
Agenda
● Integration Evolution
● Workload Types
● What is Serverless
● What is Camel K
● Camel K & Knative
● Quarkus
● Summary
● Q & A
Integration Evolution
Integration architectures
Integration architectures
Integration architectures
Service management unit - Pod
Deployment guarantees Lifecycle guarantees
Stateful applications
StatefulSet guarantees:
● Dedicated storage
● Stable networking identity
● Persistent instance identity
● Instance ordinality
Singleton behaviour
In-application locking Out-of-application locking
“At least” or “At most” semantics
Batch and recurring jobs
Characteristics
● Run until completion
● Idempotent operations
● Resource intensive
● Run as background tasks
● Typically executed on schedule
Stateless services
Characteristics
● The classic 12-factor applications
● Long running processes
● Horizontally (auto) scalable
● Healthcheck and recovery
Istio service mesh
High level capabilities
● Traffic routing: A/B tests, staged rollouts
● Resilience: retries, circuit breakers,
connection limits, health checks
● Security: authentication, authorization,
encryption (mTLS)
● Observability: metrics, tracing
● Testing: fault Injection, traffic mirroring
● Platform-independent, polyglot, allows
runtime configuration
Service mesh & Integration
Service mesh & API manager
Serverless
What is serverless?
“Serverless computing refers to the concept of building and running applications
that don’t require server management. It describes a finer-grained deployment
model where applications, bundled as one or more functions, are uploaded to a
platform and executed, scaled, billed in response to the exact demand needed”
https://github.com/cncf/wg-serverless
Serverless personas:
● Developer: writes code for, and benefits from the serverless platform.
● Provider: manages the serverless platform.
What is serverless?
“Serverless computing refers to the concept of building and running applications that
don’t require server management. It describes a finer-grained deployment model
where applications, bundled as one or more functions, are uploaded to a platform and
executed, scaled, billed in response to the exact demand needed”
https://github.com/cncf/wg-serverless
Serverless personas:
● Developer: writes code for, and benefits from the serverless platform.
● Provider: manages the serverless platform.
Serverless use cases
● On-demand functionality: batch processing, stream processing,
extract-transform-load (ETL).
● Task scheduling: divisible work performed for a short time, such as batch jobs.
● Event-driven architecture: executing logic in response to data source changes.
● Handling non-uniform traffic: occasional inconsistent traffic that doesn’t happen
often, traffic with unpredictable load.
● General purpose “glue” code in operations.
● Continuous integration pipelines: provision on-demand resources for build jobs.
● Automate operational tasks: when a known incident happens actions will be
triggered to fix the problem or notify a person on call.
Serverless requirements
For the platform
● Scaling to zero
● Rapid scaling up and down
● Routing and networking
● Eventing mechanism
For the application runtime
● Fast startup
● Fast first response
● Low on memory and CPU
● Small size on disk
Serverless requirements
For the platform
● Scaling to zero
● Rapid scaling up and down
● Eventing mechanism
● Routing and networking
For the application runtime
● Fast startup
● Fast first response
● Low on memory and CPU
● Small size on disk
K
Camel K
A lightweight integration platform, based on Apache Camel,
born on Kubernetes, with serverless superpowers.
What is Apache Camel K ?
Runs on “vanilla” Kubernetes (1), Openshift (2) and gives its best on a Knative-powered cluster (3)!
K
1.
K
2.
K
3.
How?
from(“telegram:bots/bot-id”)
.transform()...
.to(“kafka:topic”);
from(“kafka:topic”)
.to(“http:my-host/api/path”);
1. Create a integration file (Java, Groovy, Kotlin, JS, XML…)
Camel DSL, based on
EIPs...
3. Runs on Openshift or
Kubernetes
$ kamel run integration.groovy
2. Run it
Architecture of Camel K
Dev Environment Remote Cloud
kamel CLI
Camel K
Operator
“Integration”
Custom
Resource
Running Pod
Live updates!
Fast redeploy!
Less than 1 second!
Tailored for cloud-native development experience
Fast Deployment of Camel K
Time to run a integration using different strategies (in seconds)
Lower is better
😃
F-m-p is the “fabric8-maven-plugin”
(http://maven.fabric8.io/) deploying a
average spring-boot based
integration on Minishift vs. a remote
OpenShift cluster (accounting time to
upload the fat Jar). Source S2I build
has been measured in Red Hat Fuse
Online.
Quick Camel K Demo
Camel K
&
Knative
What is Knative ?
Build
A pluggable model for
building artifacts, like jar
files, zips or containers
from source code.
Knative Overview - Components
Serving
An event-driven model
that serves the container
with your application and
can "scale to zero".
Eventing
Common infrastructure for
consuming and producing
events that will stimulate
applications.
Kubernetes-based platform to build, deploy, and manage modern serverless workloads
What about Camel K & Knative ?
K
Camel K and Knative
<<custom-resource>>
Build
Knative components relevance to Camel
<<custom-resource>>
...<<custom-resource>>
...<<custom-resource>>
...
Knative Build
<<custom-resource>>
Service
<<custom-resource>>
...<<custom-resource>>
...<<custom-resource>>
...
Knative Serving
<<custom-resource>>
...<<custom-resource>>
...<<custom-resource>>
...
Knative Eventing
Standardize building
container images
Auto-scaling and scale-to-zero Messaging for event-based
applications
<<custom-resource>>
Channel
Camel K and Knative
<<custom-resource>>
Build
Knative components relevance to Camel
<<custom-resource>>
...<<custom-resource>>
...<<custom-resource>>
...
Knative Build
<<custom-resource>>
Service
<<custom-resource>>
...<<custom-resource>>
...<<custom-resource>>
...
Knative Serving
<<custom-resource>>
...<<custom-resource>>
...<<custom-resource>>
...
Knative Eventing
Standardize building
container images
Auto-scaling and scale-to-zero Messaging for event-based
applications
<<custom-resource>>
Channel
Camel K and Knative Serving
Kubernetes Namespace
There’s no container if no one needs it!
rest().post(“/path”)
.to(“xx:system1”)
.to(“xx:system2”)
300+ components!
System 1
System 2
Knative
Service
Camel K and Knative Serving
Kubernetes Namespace
A container is created only when needed!
rest().post(“/path”)
.to(“xx:system1”)
.to(“xx:system2”)
300+ components!
System 1
System 2
Knative
Service
Request Pod
Camel K and Knative Serving
Kubernetes Namespace
rest().post(“/path”)
.to(“xx:system1”)
.to(“xx:system2”)
300+ components!
System 1
System 2
Knative
Service
Multiple containers under high load!
Request Pod
Request
Request
Pod
Pod
Camel K and Knative
<<custom-resource>>
Build
Knative components relevance to Camel
<<custom-resource>>
...<<custom-resource>>
...<<custom-resource>>
...
Knative Build
<<custom-resource>>
Service
<<custom-resource>>
...<<custom-resource>>
...<<custom-resource>>
...
Knative Serving
<<custom-resource>>
...<<custom-resource>>
...<<custom-resource>>
...
Knative Eventing
Standardize building
container images
Auto-scaling and scale-to-zero Messaging for event-based
applications
<<custom-resource>>
Channel
Kubernetes Namespace
Camel K and Knative Eventing
from(“knative:channel/a”)
.to(“xx:system1”)
.to(“xx:system2”)
300+ components!
System 1
System 2
Knative
Service
Knative
Subscription
PodCloud Event
https://cloudevents.io/
Channel a
Persisted by
Kafka, in-memory
(pluggable)
Camel K: same model for different purposes
Camel K and Knative Eventing
Channel
Channel
Channel
Ext
System
Event
Source
(Sink)
Enterprise
Integration
Patterns
(Routing)
Function
(Integration)
300+ components!
300+ components!
65+ patterns
Knative Eventing includes Camel
Quarkus
Java Density Problem
CONTAINER ORCHESTRATION
Node Node Node
Traditional Cloud-Native
Java Stack
Traditional Cloud-Native
Java Stack
Traditional Cloud-Native
Java Stack
Traditional Cloud-Native
Java Stack
NodeJS
NodeJS
NodeJS
NodeJS
NodeJS
NodeJS
NodeJS
Go Go Go
Go Go Go
Go Go Go
Go Go Go
Go Go Go
Go Go Go
Go Go Go
https://developers.redhat.com/blog/2017/03/14/java-inside-docker/
SCALE-UP SCALE-DOWN SCALE-TO-
ZERO
Java Fast Scaling Problem
What is Quarkus ?
A Kubernetes Native Java stack tailored for
GraalVM & OpenJDK HotSpot, crafted from the
best of breed Java libraries and standards
https://quarkus.io
Minimal Footprint
● Minimal footprint Java applications
○ Native vs Quarkus+OpenJDK JVM vs Traditional JVM
Apache Camel and Quarkus runs blazingly fast 🚀 with native compiled binaries.
Startup is 7 msec, 28mb binary file, and 15mb RSS memory used.
Summary
Application trends (Java)
Characteristic Monolithic/SOA Microservies/CNA Functions/Serverless
Packaging Ear/War/Jar Fat-jar Native executable
Startup procedure XML scanning Annotation scanning Instant (AOT compilation)
Memory/binary size 1000s MBs 100s MBs 10s of MBs
Startup/first response Minutes Seconds Milliseconds
Process lifecycle Long Running Managed (w/ restarts) Executes when invoked
Data ownership Shared data Owns data Does not own data
Operations Multiple unrelated operations Domain related operations Single operation
Focus area Multiple business domains Single business domain Single task
Platform trends (Kubernetes)
Platform trends (Kubernetes)
Platform trends (Kubernetes)
Book Signing
Red Hat Dev Zone
Thursday May 9th
1:30pm - 2:30pm
Thursday May 9th
11:30am - 12:30pm
https://www.manning.com/books/camel-in-action-second-edition
https://k8spatterns.io
More Material
● Apache Camel K
https://github.com/apache/camel-k
● Quick Camel K demo
https://www.youtube.com/watch?v=I-g2xt-Qcb8
● Camel K Introduction Blog
https://www.nicolaferraro.me/2018/10/15/introducing-camel-k
● Kubernetes enterprise integration patterns with Camel K video
https://www.youtube.com/watch?v=51x9BewGCYA
● Camel K and Knative video
https://www.youtube.com/watch?v=btf_e2GniXM
● Quarkus Camel Demo
https://github.com/quarkusio/quarkus-quickstarts/tree/master/camel-java
Any Questions ?
Follow us on Twitter
@bibryam
@davsclaus
@ApacheCamelhttps://github.com/apache/camel-k
A ⭐ star on github is appreciated
Integration patterns in the serverless world

Integration patterns in the serverless world

  • 1.
    INTEGRATION PATTERNS INA SERVERLESS WORLD: THE GOOD PARTS Bilgin Ibryam Principal Architect Claus Ibsen Senior Principal Software Engineer May 7th 2019
  • 2.
    About us Claus Ibsen ●Senior Principal Software Engineer at Red Hat ● ASF Member & Java Champion ● Camel tech lead ● Author of Camel in Action books ● Based in Denmark Bilgin Ibryam ● Principal Architect at Red Hat ● ASF Member ● Camel committer ● Author of Camel Design Patterns & Kubernetes Patterns books ● Based in the UK
  • 3.
    Agenda ● Integration Evolution ●Workload Types ● What is Serverless ● What is Camel K ● Camel K & Knative ● Quarkus ● Summary ● Q & A
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
    Service management unit- Pod Deployment guarantees Lifecycle guarantees
  • 9.
    Stateful applications StatefulSet guarantees: ●Dedicated storage ● Stable networking identity ● Persistent instance identity ● Instance ordinality
  • 10.
    Singleton behaviour In-application lockingOut-of-application locking “At least” or “At most” semantics
  • 11.
    Batch and recurringjobs Characteristics ● Run until completion ● Idempotent operations ● Resource intensive ● Run as background tasks ● Typically executed on schedule
  • 12.
    Stateless services Characteristics ● Theclassic 12-factor applications ● Long running processes ● Horizontally (auto) scalable ● Healthcheck and recovery
  • 13.
    Istio service mesh Highlevel capabilities ● Traffic routing: A/B tests, staged rollouts ● Resilience: retries, circuit breakers, connection limits, health checks ● Security: authentication, authorization, encryption (mTLS) ● Observability: metrics, tracing ● Testing: fault Injection, traffic mirroring ● Platform-independent, polyglot, allows runtime configuration
  • 14.
    Service mesh &Integration
  • 15.
    Service mesh &API manager
  • 16.
  • 17.
    What is serverless? “Serverlesscomputing refers to the concept of building and running applications that don’t require server management. It describes a finer-grained deployment model where applications, bundled as one or more functions, are uploaded to a platform and executed, scaled, billed in response to the exact demand needed” https://github.com/cncf/wg-serverless Serverless personas: ● Developer: writes code for, and benefits from the serverless platform. ● Provider: manages the serverless platform.
  • 18.
    What is serverless? “Serverlesscomputing refers to the concept of building and running applications that don’t require server management. It describes a finer-grained deployment model where applications, bundled as one or more functions, are uploaded to a platform and executed, scaled, billed in response to the exact demand needed” https://github.com/cncf/wg-serverless Serverless personas: ● Developer: writes code for, and benefits from the serverless platform. ● Provider: manages the serverless platform.
  • 19.
    Serverless use cases ●On-demand functionality: batch processing, stream processing, extract-transform-load (ETL). ● Task scheduling: divisible work performed for a short time, such as batch jobs. ● Event-driven architecture: executing logic in response to data source changes. ● Handling non-uniform traffic: occasional inconsistent traffic that doesn’t happen often, traffic with unpredictable load. ● General purpose “glue” code in operations. ● Continuous integration pipelines: provision on-demand resources for build jobs. ● Automate operational tasks: when a known incident happens actions will be triggered to fix the problem or notify a person on call.
  • 20.
    Serverless requirements For theplatform ● Scaling to zero ● Rapid scaling up and down ● Routing and networking ● Eventing mechanism For the application runtime ● Fast startup ● Fast first response ● Low on memory and CPU ● Small size on disk
  • 21.
    Serverless requirements For theplatform ● Scaling to zero ● Rapid scaling up and down ● Eventing mechanism ● Routing and networking For the application runtime ● Fast startup ● Fast first response ● Low on memory and CPU ● Small size on disk K
  • 22.
  • 23.
    A lightweight integrationplatform, based on Apache Camel, born on Kubernetes, with serverless superpowers. What is Apache Camel K ? Runs on “vanilla” Kubernetes (1), Openshift (2) and gives its best on a Knative-powered cluster (3)! K 1. K 2. K 3.
  • 24.
    How? from(“telegram:bots/bot-id”) .transform()... .to(“kafka:topic”); from(“kafka:topic”) .to(“http:my-host/api/path”); 1. Create aintegration file (Java, Groovy, Kotlin, JS, XML…) Camel DSL, based on EIPs... 3. Runs on Openshift or Kubernetes $ kamel run integration.groovy 2. Run it
  • 25.
    Architecture of CamelK Dev Environment Remote Cloud kamel CLI Camel K Operator “Integration” Custom Resource Running Pod Live updates! Fast redeploy! Less than 1 second! Tailored for cloud-native development experience
  • 26.
    Fast Deployment ofCamel K Time to run a integration using different strategies (in seconds) Lower is better 😃 F-m-p is the “fabric8-maven-plugin” (http://maven.fabric8.io/) deploying a average spring-boot based integration on Minishift vs. a remote OpenShift cluster (accounting time to upload the fat Jar). Source S2I build has been measured in Red Hat Fuse Online.
  • 27.
  • 29.
  • 30.
  • 31.
    Build A pluggable modelfor building artifacts, like jar files, zips or containers from source code. Knative Overview - Components Serving An event-driven model that serves the container with your application and can "scale to zero". Eventing Common infrastructure for consuming and producing events that will stimulate applications. Kubernetes-based platform to build, deploy, and manage modern serverless workloads
  • 32.
    What about CamelK & Knative ? K
  • 33.
    Camel K andKnative <<custom-resource>> Build Knative components relevance to Camel <<custom-resource>> ...<<custom-resource>> ...<<custom-resource>> ... Knative Build <<custom-resource>> Service <<custom-resource>> ...<<custom-resource>> ...<<custom-resource>> ... Knative Serving <<custom-resource>> ...<<custom-resource>> ...<<custom-resource>> ... Knative Eventing Standardize building container images Auto-scaling and scale-to-zero Messaging for event-based applications <<custom-resource>> Channel
  • 34.
    Camel K andKnative <<custom-resource>> Build Knative components relevance to Camel <<custom-resource>> ...<<custom-resource>> ...<<custom-resource>> ... Knative Build <<custom-resource>> Service <<custom-resource>> ...<<custom-resource>> ...<<custom-resource>> ... Knative Serving <<custom-resource>> ...<<custom-resource>> ...<<custom-resource>> ... Knative Eventing Standardize building container images Auto-scaling and scale-to-zero Messaging for event-based applications <<custom-resource>> Channel
  • 35.
    Camel K andKnative Serving Kubernetes Namespace There’s no container if no one needs it! rest().post(“/path”) .to(“xx:system1”) .to(“xx:system2”) 300+ components! System 1 System 2 Knative Service
  • 36.
    Camel K andKnative Serving Kubernetes Namespace A container is created only when needed! rest().post(“/path”) .to(“xx:system1”) .to(“xx:system2”) 300+ components! System 1 System 2 Knative Service Request Pod
  • 37.
    Camel K andKnative Serving Kubernetes Namespace rest().post(“/path”) .to(“xx:system1”) .to(“xx:system2”) 300+ components! System 1 System 2 Knative Service Multiple containers under high load! Request Pod Request Request Pod Pod
  • 38.
    Camel K andKnative <<custom-resource>> Build Knative components relevance to Camel <<custom-resource>> ...<<custom-resource>> ...<<custom-resource>> ... Knative Build <<custom-resource>> Service <<custom-resource>> ...<<custom-resource>> ...<<custom-resource>> ... Knative Serving <<custom-resource>> ...<<custom-resource>> ...<<custom-resource>> ... Knative Eventing Standardize building container images Auto-scaling and scale-to-zero Messaging for event-based applications <<custom-resource>> Channel
  • 39.
    Kubernetes Namespace Camel Kand Knative Eventing from(“knative:channel/a”) .to(“xx:system1”) .to(“xx:system2”) 300+ components! System 1 System 2 Knative Service Knative Subscription PodCloud Event https://cloudevents.io/ Channel a Persisted by Kafka, in-memory (pluggable)
  • 40.
    Camel K: samemodel for different purposes Camel K and Knative Eventing Channel Channel Channel Ext System Event Source (Sink) Enterprise Integration Patterns (Routing) Function (Integration) 300+ components! 300+ components! 65+ patterns
  • 41.
  • 42.
  • 44.
    Java Density Problem CONTAINERORCHESTRATION Node Node Node Traditional Cloud-Native Java Stack Traditional Cloud-Native Java Stack Traditional Cloud-Native Java Stack Traditional Cloud-Native Java Stack NodeJS NodeJS NodeJS NodeJS NodeJS NodeJS NodeJS Go Go Go Go Go Go Go Go Go Go Go Go Go Go Go Go Go Go Go Go Go https://developers.redhat.com/blog/2017/03/14/java-inside-docker/
  • 45.
  • 46.
    What is Quarkus? A Kubernetes Native Java stack tailored for GraalVM & OpenJDK HotSpot, crafted from the best of breed Java libraries and standards https://quarkus.io
  • 47.
    Minimal Footprint ● Minimalfootprint Java applications ○ Native vs Quarkus+OpenJDK JVM vs Traditional JVM
  • 48.
    Apache Camel andQuarkus runs blazingly fast 🚀 with native compiled binaries. Startup is 7 msec, 28mb binary file, and 15mb RSS memory used.
  • 49.
  • 50.
    Application trends (Java) CharacteristicMonolithic/SOA Microservies/CNA Functions/Serverless Packaging Ear/War/Jar Fat-jar Native executable Startup procedure XML scanning Annotation scanning Instant (AOT compilation) Memory/binary size 1000s MBs 100s MBs 10s of MBs Startup/first response Minutes Seconds Milliseconds Process lifecycle Long Running Managed (w/ restarts) Executes when invoked Data ownership Shared data Owns data Does not own data Operations Multiple unrelated operations Domain related operations Single operation Focus area Multiple business domains Single business domain Single task
  • 51.
  • 52.
  • 53.
  • 54.
    Book Signing Red HatDev Zone Thursday May 9th 1:30pm - 2:30pm Thursday May 9th 11:30am - 12:30pm https://www.manning.com/books/camel-in-action-second-edition https://k8spatterns.io
  • 55.
    More Material ● ApacheCamel K https://github.com/apache/camel-k ● Quick Camel K demo https://www.youtube.com/watch?v=I-g2xt-Qcb8 ● Camel K Introduction Blog https://www.nicolaferraro.me/2018/10/15/introducing-camel-k ● Kubernetes enterprise integration patterns with Camel K video https://www.youtube.com/watch?v=51x9BewGCYA ● Camel K and Knative video https://www.youtube.com/watch?v=btf_e2GniXM ● Quarkus Camel Demo https://github.com/quarkusio/quarkus-quickstarts/tree/master/camel-java
  • 56.
    Any Questions ? Followus on Twitter @bibryam @davsclaus @ApacheCamelhttps://github.com/apache/camel-k A ⭐ star on github is appreciated