Introduction to Serverless Computing Upkar Lidder Developer Advocate, IBM > ulidder@us.ibm.com > @lidderupk > blog.upkarlidder.com
What is Serverless? 2
What is Serverless? 3 Serverless computing refers to the concept of building and running applications that do not require server management. It describes a finer-grained deployment model where applications, bundled as one or more functions, are uploaded to a platform and then executed, scaled, and billed in response to the exact demand needed at the moment. It refers to the idea that consumers of serverless computing no longer need to spend time and resources on server provisioning, maintenance, updates, scaling, and capacity planning. Instead, all of these tasks and capabilities are handled by a serverless platform and are completely abstracted away from the developers - Cloud Native Computing Foundation https://github.com/cncf/wg-serverless/tree/master/whitepapers/serverless-overview
What is Serverless? 4 Increasingfocusonbusinesslogic Decreasing concern (and control) over stack implementation Bare Metal Virtual machines Functions Containers
Use cases Use Cases 5 Small, focused, asynchronous, concurrent, easy to parallelize into independent units of work Infrequent or has sporadic demand, with large, unpredictable variance in scaling requirements Stateless, ephemeral, without a major need for instantaneous cold start time Highly dynamic in terms of changing business requirements that drive a need for accelerated developer velocity
Why Serverless? 9 Active users curve for a new mobile game has a predictable shape, but an unpredictable volume
Why Serverless? 10 Active users curve for a mobile conference app has no demand before and after the conference, and huge intraweek swings in demand
Why Serverless? 11 Mobile banking apps often have peaks in demand on payday, once every two weeks
Use cases 12DOC ID / September 13, 2018 / © 2018 IBM Corporation Serverless Backends Mobile Backend Data Processing Cognitive Data Processing IoT Ready Event Stream Processing Conversational Scenarios Scheduled Tasks
Server Landscape (Cloud Native Computing Foundation) 14DOC ID / Month XX, 2018 / © 2018 IBM Corporation
Server Landscape – feature matrix 15 Amazon Lambda • Node.js, Python, Java, C# and Go IBM Cloud Functions • Node.js 8, Node.js 6, Python 3.6.4, Python 3.6.1, PHP 7.1, PHP 7.2, and Swift 4, Swift 3.1.1, Ruby 2.5 • Other languages can be added via Docker container (for example Java) • Based on open source OpenWhisk serverless platform. Can create your own serverless platform based on OpenWhisk Microsoft Azure • C#, F#, Node.js (in GA) • Java, Python, PHP, TypeScript, Bash, PowerShell (experimental mode) Google Cloud Function • Node.js, Python • Many many more
Apache OpenWhisk 16 Source (events) Results Triggers (response) Actions (code) Rules
Apache OpenWhisk 17 JS/NodeJS 8 Java Python 3 Swift 4 Docker PHP 7 Go Rust Ruby … bash C
Apache OpenWhisk Serverless is an architecture, a way of thinking that abstracts away the underlying hardware and infrastructure from the developer completely. Entering the system: nginx “an HTTP and reverse proxy server”. Entering the system: Controller serves as the interface for everything a user can do Authentication and Authorization: CouchDB check that the user exists in OpenWhisk’s database and that it has the privilege to invoke the action myAction Getting the action: CouchDB… again Load the action from the whisks database in CouchDB. Who’s there to invoke the action: Load Balancer has a global view of the executors available in the system by checking their health status continuously. Those executors are called Invokers. The Load Balancer, knowing which Invokers are available, chooses one of them to invoke the action requested. Please form a line: Kafka a high-throughput, distributed, publish-subscribe messaging system Actually invoking the code already: Invoker execute actions in an isolated and safe way using Docker. Storing the results: CouchDB again Store the returned result, logs written, start and end time of the action.
Apache OpenWhisk 19
Apache OpenWhisk – create an action Entry point Parameters Return Object
Apache OpenWhisk – create an action
Apache OpenWhisk – create an action Controller Invoker CouchDB POST STATUS PUT STATUS wsk action create hello hello.js -i
Apache OpenWhisk – invoke an action
Apache OpenWhisk – invoke an action Controller Invoker CouchDB POST STATUS INVOKE {params} STATUS wsk action invoke hello -i -r -p name "Upkar Lidder @pubnub" POST /init POST /run PUTRESULT GETACTION { "message": "hello Upkar Lidder @pubnub" }
Apache OpenWhisk - wsk 25
IBM Cloud Functions 30 Open source Hosted service Serverless engine Apache OpenWhisk IBM Cloud Functions API Gateway LoopBack IBM API Gateway Databases Apache CouchDB MySQL IBM Cloudant IBM Compose Message streams Apache Kafka IBM Message Hub
Things to consider 32 • Functions are stateless. Need some sort of persistence between runs. • Are you able to test and develop locally ? Does provider have CLI ? • Can you easily version your functions ? Source control ? • Can you easily monitor your functions ? • Security and API gateway • Avoid long-running loops / mini-monoliths ? • Latency (cold, warm and hot loads) • How do you track dependencies ?
System Limitations 33
Resources 34 Lists • https://github.com/anaibol/awesome-serverless • https://github.com/pmuens/awesome-serverless • https://twitter.com/tmclaughbos/lists/serverless Email newsletter • https://serverless.email/ Code Patterns • https://developer.ibm.com/patterns/category/serverless/ Serverless architecture • https://martinfowler.com/articles/serverless.html
Future of Serverless ? 35https://github.com/kelseyhightower/nocode
Code Patterns ! 36https://developer.ibm.com/patterns/
Thank you! Upkar Lidder Developer Advocate, IBM > ulidder@us.ibm.com > @lidderupk > blog.upkarlidder.com

Apache OpenWhisk Serverless Computing

  • 1.
    Introduction to Serverless Computing UpkarLidder Developer Advocate, IBM > ulidder@us.ibm.com > @lidderupk > blog.upkarlidder.com
  • 2.
  • 3.
    What is Serverless? 3 Serverlesscomputing refers to the concept of building and running applications that do not require server management. It describes a finer-grained deployment model where applications, bundled as one or more functions, are uploaded to a platform and then executed, scaled, and billed in response to the exact demand needed at the moment. It refers to the idea that consumers of serverless computing no longer need to spend time and resources on server provisioning, maintenance, updates, scaling, and capacity planning. Instead, all of these tasks and capabilities are handled by a serverless platform and are completely abstracted away from the developers - Cloud Native Computing Foundation https://github.com/cncf/wg-serverless/tree/master/whitepapers/serverless-overview
  • 4.
    What is Serverless? 4 Increasingfocusonbusinesslogic Decreasingconcern (and control) over stack implementation Bare Metal Virtual machines Functions Containers
  • 5.
    Use cases Use Cases 5 Small,focused, asynchronous, concurrent, easy to parallelize into independent units of work Infrequent or has sporadic demand, with large, unpredictable variance in scaling requirements Stateless, ephemeral, without a major need for instantaneous cold start time Highly dynamic in terms of changing business requirements that drive a need for accelerated developer velocity
  • 6.
    Why Serverless? 9 Active userscurve for a new mobile game has a predictable shape, but an unpredictable volume
  • 7.
    Why Serverless? 10 Active userscurve for a mobile conference app has no demand before and after the conference, and huge intraweek swings in demand
  • 8.
    Why Serverless? 11 Mobile bankingapps often have peaks in demand on payday, once every two weeks
  • 9.
    Use cases 12DOC ID/ September 13, 2018 / © 2018 IBM Corporation Serverless Backends Mobile Backend Data Processing Cognitive Data Processing IoT Ready Event Stream Processing Conversational Scenarios Scheduled Tasks
  • 10.
    Server Landscape (CloudNative Computing Foundation) 14DOC ID / Month XX, 2018 / © 2018 IBM Corporation
  • 11.
    Server Landscape –feature matrix 15 Amazon Lambda • Node.js, Python, Java, C# and Go IBM Cloud Functions • Node.js 8, Node.js 6, Python 3.6.4, Python 3.6.1, PHP 7.1, PHP 7.2, and Swift 4, Swift 3.1.1, Ruby 2.5 • Other languages can be added via Docker container (for example Java) • Based on open source OpenWhisk serverless platform. Can create your own serverless platform based on OpenWhisk Microsoft Azure • C#, F#, Node.js (in GA) • Java, Python, PHP, TypeScript, Bash, PowerShell (experimental mode) Google Cloud Function • Node.js, Python • Many many more
  • 12.
  • 13.
    Apache OpenWhisk 17 JS/NodeJS 8 Java Python3 Swift 4 Docker PHP 7 Go Rust Ruby … bash C
  • 14.
    Apache OpenWhisk Serverless isan architecture, a way of thinking that abstracts away the underlying hardware and infrastructure from the developer completely. Entering the system: nginx “an HTTP and reverse proxy server”. Entering the system: Controller serves as the interface for everything a user can do Authentication and Authorization: CouchDB check that the user exists in OpenWhisk’s database and that it has the privilege to invoke the action myAction Getting the action: CouchDB… again Load the action from the whisks database in CouchDB. Who’s there to invoke the action: Load Balancer has a global view of the executors available in the system by checking their health status continuously. Those executors are called Invokers. The Load Balancer, knowing which Invokers are available, chooses one of them to invoke the action requested. Please form a line: Kafka a high-throughput, distributed, publish-subscribe messaging system Actually invoking the code already: Invoker execute actions in an isolated and safe way using Docker. Storing the results: CouchDB again Store the returned result, logs written, start and end time of the action.
  • 15.
  • 16.
    Apache OpenWhisk –create an action Entry point Parameters Return Object
  • 17.
    Apache OpenWhisk –create an action
  • 18.
    Apache OpenWhisk –create an action Controller Invoker CouchDB POST STATUS PUT STATUS wsk action create hello hello.js -i
  • 19.
    Apache OpenWhisk –invoke an action
  • 20.
    Apache OpenWhisk –invoke an action Controller Invoker CouchDB POST STATUS INVOKE {params} STATUS wsk action invoke hello -i -r -p name "Upkar Lidder @pubnub" POST /init POST /run PUTRESULT GETACTION { "message": "hello Upkar Lidder @pubnub" }
  • 21.
  • 22.
    IBM Cloud Functions 30 Opensource Hosted service Serverless engine Apache OpenWhisk IBM Cloud Functions API Gateway LoopBack IBM API Gateway Databases Apache CouchDB MySQL IBM Cloudant IBM Compose Message streams Apache Kafka IBM Message Hub
  • 23.
    Things to consider 32 •Functions are stateless. Need some sort of persistence between runs. • Are you able to test and develop locally ? Does provider have CLI ? • Can you easily version your functions ? Source control ? • Can you easily monitor your functions ? • Security and API gateway • Avoid long-running loops / mini-monoliths ? • Latency (cold, warm and hot loads) • How do you track dependencies ?
  • 24.
  • 25.
    Resources 34 Lists • https://github.com/anaibol/awesome-serverless • https://github.com/pmuens/awesome-serverless •https://twitter.com/tmclaughbos/lists/serverless Email newsletter • https://serverless.email/ Code Patterns • https://developer.ibm.com/patterns/category/serverless/ Serverless architecture • https://martinfowler.com/articles/serverless.html
  • 26.
    Future of Serverless? 35https://github.com/kelseyhightower/nocode
  • 27.
  • 28.
    Thank you! Upkar Lidder DeveloperAdvocate, IBM > ulidder@us.ibm.com > @lidderupk > blog.upkarlidder.com