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

Get rid of your servers - use functions!

manu rink
November 22, 2016

Get rid of your servers - use functions!

Serverless Computing for the WIN. With a lot of links to example code and how-to-start tutorials :)

manu rink

November 22, 2016
Tweet

More Decks by manu rink

Other Decks in Programming

Transcript

  1. Get rid of your servers! Use functions ☁ + </>

    = Manuela Rink Technical Evangelist @
  2. Serverless or Jeff* or “just the next pig which is

    chased through the village?” * Serverless is just a name, Paul Johnston
  3. “[…] is a cloud computing code execution model in which

    the cloud provider fully manages starting and stopping virtual machines as necessary to serve requests, and requests are billed by an abstract measure of the resources required to satisfy the request, rather than per virtual machine, per hour.” -- Wikipedia https://en.wikipedia.org/wiki/Serverless_computing
  4. “Quick and easy run your code*, in the cloud, without

    worrying about infrastructure, maintenance or scaling.” *of various size -- Manu Rink, 2016
  5. AWS Lambda GA since April 2015 Google Cloud Functions Public

    Alpha Late 2015 IBM Cloud Functions Public Beta Early 2016 “Äscha” Functions GA since November 2016
  6. Inherit from / Build on top of App Services Full

    control of dependencies and connectors Choose your fav language and coding environment Powerful integration into your existing Azure apps Choose from a wide variety of triggers 100% operated Open sourced
  7. App Service Features and Capabilities Enterprise Grade Apps Designed for

    secure mission-critical applications Fully Managed Platform Optimized for Availability and Automatic scale High Productivity Development Agility through Continuous Deployment Hybrid Connections / VPN / VLAN Scheduled Backup Azure Active Directory Integration Site Resiliency, HA, and DR Web Jobs Role Base Access Control Audit / Compliance Enterprise Migration Client Certs Cache IP Restrictions/ SSL Web Sockets SQL, MySQL, DocDB, & Mongo Sticky Sessions Authorization/ Authentication Automated Deployment AutoScale Built-in Load Balancing Worldwide Datacenter Coverage End Point Monitoring & Alerts App Gallery DR Site Support WildCard Support Dedicated IP address HTTP Compression CDN Support for Websites Premium WordPress App Services Environments Remote Debugging w/ Visual Studio Site Staging Slots Testing in Production Continuous Integration/Deployment Git, Visual Studio Online and GitHub App & Site Diagnostics OS & Framework Patching Site Extensions Gallery NET, PHP , Python, Node, Java Framework Installer Browser-based editing Auto-Healing Logging and Auditing Admin-Site Support Site Extension Inspired by Matthew Henderson @ Microsoft
  8. Templates • Azure Internal Service Triggers • Blob • EventHub

    • Storage Queue • Service Bus Queue • Service Bus Topic • Generic Triggers • Generic WebHook • GitHub WebHook • Http • Timer Languages • Core • C# • JS/Node • Experimental • PowerShell • TypeScript • Python • PHP • F# • Bash
  9. Scenario 0 The Easy Cake use HTTP trigger to provide

    HTTP endpoints to build a Hello Cake endpoint
  10. Scenario 0 – Easy cake deployment! All together in a

    bash script Single Azure CLI statements
  11. Scenario 1 Connect all the things! use web hooks for

    wiring up heterogeneous services to connect Slack with your mobile backend
  12. Scenario 1 - Connect all the things! – Slack &

    mobile backend The Serverless Connector - Use Functions to write Slack posts in your mobile backend
  13. Scenario 2 Like a pro! use Blob Trigger to let

    function react on storage I/O of other function to build an image resizing service
  14. Scenario 2 - Like a pro! – Image Resizing Service

    https://github.com/codePrincess/resizingService
  15. Scenario 3 The Fun Stuff! use OCR of CS Computer

    Vision API and text detection logic in a function to build an identification card validation service
  16. Scenario 3 – The fun stuff! – ID card validation

    service https://github.com/codePrincess/funkyVerfication
  17. Function executes 2.000.000 times with a duration of 1 second

    using 1536MB RAM Resource consumption costs 2 million exec * 1 second = 2 million seconds 1536 MB / 1024 MB = 1.5 GB 1.5 GB * 2 million seconds = 3 million GBs 3 million GBs – 400000 GBs = 2.6 million GBs 2.6 million GBs * 0.000014 $/GBs = 41.60 $ Execution costs 2 million exec - 1 million exec = 1 million exec 1 million exec * 0.20$ = 0.20$ 41.60$ + 0.20$ = 41.80$ Pricing Overview Pricing Calculator Same example – just with 128MB RAM 0 $ + 0.20$ = 0.20$ Resource consumption costs 2 million exec * 1 second = 2 million seconds 128 MB / 1024 MB = 0.125 GB 0.125 GB * 2 million seconds = 0.25 million GBs 0.25 million GBs – 400000 GBs = 0 GBs 0 million GBs * 0.000016 $/GBs = 0 $ Execution costs 2 million exec - 1 million exec = 1 million exec 1 million exec * 0.20$ = 0.20$
  18. App Service Plan Scaling depending on plan Cost are fixed

    with the plan’s tier Basic Standard Premium ~55€ ~75€ ~225€
  19. Easy to build & deploy – 100% operated Various languages

    supported Lot of triggers available Inter-connectable in- & outside of Azure Cost effective
  20. Serverless on Azure https://azure.microsoft.com/en-us/overview/serverless-computing/ Azure Functions documentation https://docs.microsoft.com/en-us/azure/azure-functions/ Blogposts with

    How-Tos and source code to all examples in this deck https://medium.com/royallyserverless Nice and neat link and learning material https://blogs.msdn.microsoft.com/appserviceteam/2016/12/01/running-azure-functions-locally-with-the-cli/ https://www.npmjs.com/package/azure-functions-cli https://contos.io/azure-functions-cli-quick-start-ee843dfbe72c#.v90g0n77d Brandnew – Azure Functions now part of the Serverless Framework https://serverless.com/framework/docs/providers/azure/ It’s dangerous to go alone - take this!