Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Building serverless applications with Apache OpenWhisk and IBM Cloud Functions

614 views

Published on

Presentation at Functions17 in Toronto, Canada on August 25, 2017.
https://functions.world

Video, code, links: https://github.com/krook/functions17

Apache OpenWhisk on IBM Bluemix provides a powerful and flexible environment for deploying cloud-native applications driven by data, message, and API call events. Daniel Krook explains why serverless architectures are attractive for many emerging cloud workloads and when you should consider OpenWhisk for your next project. Daniel then shows you how to get started with OpenWhisk on IBM Cloud Functions right away, using several samples on GitHub.

Daniel Krook, Software Architect & Developer Advocate, IBM

Published in: Software
  • Be the first to comment

Building serverless applications with Apache OpenWhisk and IBM Cloud Functions

  1. 1. © 2017 IBM Corporation l Interconnect 2017 Building serverless applications with Apache OpenWhisk and IBM Cloud Functions @DanielKrook Daniel Krook Software Engineer & Developer Advocate github.com/krook/functions17
  2. 2. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 Increasingfocusonbusinesslogic Decreasing concern (and control) over stack implementation Bare Metal VM VM VM Virtual machines Functions Containers Serverless developers focus more on code, less on infrastructure
  3. 3. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 Monolithic Application Break-down into microservices Make each microservice HA Protect against regional outage Region A Region B Microservices can be hard to manage at scale
  4. 4. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 Emerging workloads are a good fit for event-driven programming Execute logic in response to database change Perform analytics on sensor input messages Provide cognitive computing via chatbots Schedule tasks performed for a short time Invoke autoscaled APIs and mobile backends
  5. 5. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 Memory allocated (MB) Time executing (milliseconds) Instances executing simultaneously (count) Cloud resource cost better matches business value gained Not a silver bullet, but this can result in substantial savings for many workloads New cost models more accurately charge for usage
  6. 6. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 OpenWhisk is a cloud platform that executes code in response to events OpenWhisk enables these serverless, event-driven workloads Provides serverless deployment and operations model Runs code only on-demand on a per-request basis Optimized utilization, fine-grained metering at any scale Flexible, extensible, polyglot programming model Open source and open ecosystem (Apache Incubator) Ability to run in public, private, and hybrid models
  7. 7. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 Developers work with triggers, actions, rules, and packages Data sources define events they emit as Triggers. Developers map Actions to Triggers via Rules. Packages provide integration with external services. T A P R
  8. 8. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 Apache Incubator OpenWhisk is built on solid open source foundations
  9. 9. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 Apache Incubator The OpenWhisk ecosystem is growing
  10. 10. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 Use Apache OpenWhisk via IBM Cloud Functions: bluemix.net/openwhisk wsk CLI
  11. 11. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 IBM Cloud Functions provides management, tooling, and monitoring
  12. 12. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 IBM Cloud Functions provides management, tooling, and monitoring
  13. 13. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 IBM Cloud Functions provides management, tooling, and monitoring
  14. 14. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 IBM Cloud Functions also provides included API gateway integration
  15. 15. © 2017 IBM Corporation l Interconnect 2017 Apache OpenWhisk programming model
  16. 16. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 Results Developers work with packages, triggers, actions, and rules Package (feed) Packages provide integration with external event sources P Trigger (event) T Data sources define events they emit as Triggers Rule (map)R Action (function) A Developers map Actions to Triggers via Rules Data sources define events they emit as Triggers. Developers map Actions to Triggers via Rules. T A R
  17. 17. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 Triggers A class of events that can occurT Social events Data changes Device readings Location updates User input
  18. 18. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 Actions Code that runs in response to an event (that is, an event handler) A
  19. 19. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 Actions Can be written in a variety of languages, such as JavaScript, Python, Java, PHP, and Swift A function main(params) { return { message: 'Hello, ' + params.name + ' from ' + params.place }; };
  20. 20. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 Actions Or any other language by packaging with DockerA
  21. 21. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 Actions Can be composed to create sequences that increase flexibility and foster reuse A AA := A1 + A2 + A3 AB := A2 + A1 + A3 AC := A3 + A1 + A2
  22. 22. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 Rules An association of a trigger to an action in a many to many mapping. R R := T A
  23. 23. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 Packages A shared collection of triggers and actionsP A A read write T changes A translate A forecast A post T topic Open Source A myAction T myFeed Yours T commit Third Party
  24. 24. © 2017 IBM Corporation l Interconnect 2017 Apache OpenWhisk in action
  25. 25. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 OpenWhisk awaits events, fetches mapped code, runs it in a container Pool of actions Swift DockerJS Trigger 1 Running action Running action Running action 3 OpenWhisk Engine 2 A T AAA
  26. 26. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 Demo 1: Your first trigger, action, and rule $ wsk action create handler handler.js $ wsk action invoke --blocking handler $ wsk trigger create every-20-seconds --feed /whisk.system/alarms/alarm --param cron "*/20 * * * * *" --param maxTriggers 15 $ wsk rule create invoke-periodically every-20-seconds handler Trigger 1 Running action 2 T A 1. Cron syntax alarm 2. Log the current time $ wsk activation poll
  27. 27. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 Demo 2: Database change triggered action
  28. 28. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 Demo 3: HTTP API request triggered action
  29. 29. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 Other simple apps, working solutions, more complex uses
  30. 30. IBM Cloud Functions powered by Apache OpenWhisk@DanielKrook github.com/krook/functions17 Managed OpenWhisk with IBM Cloud Functions bluemix.net/openwhisk Delivered as
 Open source via Apache openwhisk.org Get started with Cloud Functions, or explore the open source project github.com/openwhisk slack.openwhisk.org twitter.com/openwhisk medium.com/openwhisk

×