Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Camel K and Serverless in Action

Camel K and Serverless in Action

When to use them As organizations move workloads to containers and the cloud the need to utilize resources optimally is ever important. Serverless technology allows dynamic allocation of resources as needed ensuring no under or over provisioning. This is particularly useful for workloads that run periodically or see spikes. Apache Camel is a widely used Java integration framework that in the latest major version begins to utilize serverless technology. In this session, attendees will get an introduction to serverless technology and Apache Camel. They will learn how Camel K utilizes it to run natively on Kubernetes platforms as well as how to get started with the technologies. Attendees will also see a live demo of Camel K and serverless in action.

YouTube: https://youtu.be/6BlLPUP0eJE

Red Hat Livestreaming

April 20, 2021
Tweet

More Decks by Red Hat Livestreaming

Other Decks in Technology

Transcript

  1. Mary Cochran
    Camel K and
    Serverless
    Senior App Dev Solutions Architect

    View Slide

  2. Camel
    OpenShift Commons

    View Slide

  3. 3
    PATTERN BASED INTEGRATION
    300
    COMPONENTS
    Batch, messaging,
    web services, cloud,
    APIs, and more ...
    BUILT-IN DATA
    TRANSFORMATION
    JSON, XML, HL7,
    YAML, SOAP, Java,
    CSV, and more ...
    INTUITIVE
    ROUTING
    Develop
    integrations quickly
    in Java or XML.
    ENTERPRISE
    INTEGRATION
    PATTERNS
    Build integrations
    using enterprise best
    practices.
    Create, connect,
    and compose APIs
    with ease.
    NATIVE REST
    SUPPORT
    Apache Camel, a powerful pattern-based integration engine with a comprehensive
    set of connectors and data formats to tackle any integration problem.

    View Slide

  4. View Slide

  5. Integration Patterns
    Split
    orders
    Send
    each order
    to it’s
    process service
    Electronics
    Others
    Aggregator
    Normalizer
    Content Enricher
    Resequencer

    View Slide

  6. Camel Routes
    from("file:data/inbox")
    .to("jms:queue:order");




    Java DSL
    XML DSL

    View Slide

  7. 7
    from("file:inbox")
    .split(body().tokenize("\n"))
    .marshal(customToXml)
    .to("activemq:queue:line");

    View Slide

  8. Quarkus
    OpenShift Commons

    View Slide

  9. Differentiators
    9
    Live coding
    Unified configuration
    Developer joy
    Over 90 extensions
    “Powered by Quarkus” applications
    Best of breed libraries and standards
    Tailors your app for HotSpot & GraalVM
    Fast boot time and low RSS memory
    Serverless fit
    Container first
    Combines blocking and non-blocking
    Built-in event bus
    Unifies imperative and reactive
    “Quarkus has introduced a new paradigm that puts things upside down on the way things are run under the covers - supporting native, all
    reflection done at compile time and not runtime is just amazing!” - Talkdesk
    Compared to traditional Java stack
    ● 1/10 RAM usage
    ● 300x faster startup time

    View Slide

  10. 10
    A cohesive platform for optimized developer joy:
    ● Based on standards and more
    ● Unified configuration
    ● Live coding
    ● Streamlined code for the 80% common usages,
    flexible for the 20%
    ● No hassle native executable generation
    Developer Joy
    “Our developers used to wait 2 to 3 mins to see their changes. Live coding does away with this.”

    View Slide

  11. 11
    Container First
    REST + CRUD
    Quarkus + GraalVM 0.055 Seconds
    Quarkus + OpenJDK 2.5 Seconds
    Traditional Cloud-Native Stack 9.5 Seconds
    Time to first response
    REST + CRUD
    Quarkus +
    GraalVM
    35 MB
    Quarkus +
    OpenJDK
    130 MB
    Traditional
    Cloud-Native Stack
    218 MB
    “We went from 1-min startup times to 400 milliseconds”

    View Slide

  12. Camel K
    OpenShift Commons

    View Slide

  13. 13
    What is Apache Camel K?
    A lightweight integration platform based on Apache Camel,
    born on Kubernetes, with serverless superpowers.
    Based on operator-sdk
    A community-driven project
    A subproject of Apache Camel started on August 31st, 2018
    https://github.com/apache/camel-k
    http://camel.apache.org

    View Slide

  14. 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.

    View Slide

  15. 15
    Source:https://camel.apache.org/projects/
    Apache Camel 3 Projects
    APACHE CAMEL KAFKA CONNECTORS
    Camel Quarkus
    Optimized JVM & Native
    compiled Java (GraalVM)
    Camel K
    Camel on
    Kubernetes & Knative
    Camel
    Swiss knife of integration
    Camel Spring Boot
    Camel on
    Spring Boot
    Camel Karaf
    Camel on
    Apache Karaf / OSGi
    Camel Kafka
    Connector
    Kafka Connector with Camel

    View Slide

  16. 16
    Performance
    Lower is better :)

    View Slide

  17. 17
    What?
    1. Create an integration file (Java, Groovy, Kotlin, JS, XML, …)
    $ kamel run integration.groovy
    2. Run it
    3. It runs on
    Kubernetes /
    OpenShift
    // Lookup every second the 'www.google.com' domain
    name and log the output
    from('timer:dns?period=1s')
    .routeId('dns')
    .setHeader('dns.domain')
    .constant('www.google.com')
    .to('dns:ip')
    .log('log:dns');
    Camel DSL, based on
    EIPs...
    Camel K CLI
    (optional)

    View Slide

  18. 18
    Architecture
    Dev Environment 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

    View Slide

  19. INTERNAL ONLY
    QUARKUS BOOTCAMP
    Service Microservice Serverless
    > Single Purpose
    > Stateless
    > Independently Scalable
    > Automated
    > Single Action
    > Ephemeral
    > Autonomous
    > Loosely-coupled
    Architectural Evolution to Serverless
    f( )
    19

    View Slide

  20. kind: Integration
    apiVersion: camel.apache.org/v1alpha1
    metadata:
    name: my-integration
    spec:
    sources:
    - name: source.groovy
    content: |-
    from("knative:channel/a")
    .to("http:my-host/api/path")
    from("knative:channel/a")
    .to("http:my-host/api/path");
    Camel K Operator
    Knative
    profile?
    kind: Service
    apiVersion: serving.knative.dev/v1alpha1
    ...
    yes
    kind: Deployment
    # regular one
    ...
    no
    Camel K Knative Profile
    20

    View Slide

  21. 21
    Use Cases For Camel K
    Integration on demand Reusable modules
    Stream processing Filter, converts and aggregates data
    Dynamic resizing capabilities
    Scale up for fluctuations, and 0 to none
    usage
    On Demand
    IoT sensor input
    Bots
    Batch Job

    View Slide

  22. Demo Camel K
    OpenShift Commons

    View Slide

  23. Serverless and Knative
    OpenShift Commons

    View Slide

  24. 24
    ● Serverless is an execution model where the code is
    executed by dynamically allocated resources.
    ● Serverless removes the need for a traditional always-on
    server component from the perspective of the
    developer.
    ● Knative is an open-source Kubernetes-based platform
    to deploy and manage serverless workloads.
    ● Knative is the primary component in Red Hat’s
    OpenShift Functions product (currently in tech preview).
    What is Serverless and
    Knative?
    https://knative.dev

    View Slide

  25. 25
    Knative
    Serving Eventing
    Knative defines building blocks for “Serverless” applications
    <>
    Service
    Scale-to-zero and request-driven
    compute
    <>
    Service
    <>
    Service
    Event binding and delivery for
    messaging style integration
    <>
    Channel
    <>
    Channel
    <>
    Channel
    A building block is a CRD with a controller (or “operator”) that manages its lifecycle

    View Slide

  26. Install the Operators and
    Deploy
    OpenShift Commons

    View Slide

  27. 27
    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
    Knative Serving

    View Slide

  28. 28
    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
    Knative Serving

    View Slide

  29. 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
    Knative Serving
    29

    View Slide

  30. 30
    Serverless Benefits
    Avoid random,
    arbitrary
    prediction
    Lower operational
    cost
    Faster time to
    market
    Reduced
    packaging and
    deployment
    complexity
    Flexible Scalability
    on-demand
    Serverless Camel K

    View Slide

  31. 31
    Serverless Operational Benefits
    With Serverless
    Over provisioning
    Time in capacity planning
    IT cost of idle resources
    Under provisioning
    Lost business revenue
    Poor quality of service
    More applications
    Direct line between IT
    costs & business revenue
    NOT Serverless with Serverless

    View Slide

  32. Event Driven + Serverless
    Serverless
    f( )
    Microservice
    OpenShift
    KNative
    Streams, AMQ Broker
    Camel K
    Quarkus
    Event Driven

    View Slide

  33. Serverless in Action
    OpenShift Commons

    View Slide

  34. linkedin.com/company/red-hat
    youtube.com/user/RedHatVideos
    facebook.com/redhatinc
    twitter.com/RedHat
    34
    Red Hat is the world’s leading provider of enterprise
    open source software solutions. Award-winning
    support, training, and consulting services make Red
    Hat a trusted adviser to the Fortune 500.
    Thank you

    View Slide