Serverless patterns with Azure Functions JoTechies www.jotechies.com TaiseerJoudeh-Microsoft APRIL2017
JoTechies is a Tech community that provides education, help and social events for IT professional in Jordan and helps you network with local IT peers. @JoTechies JoTechies www.JoTechies.com JoTechies JoTechies
Taiseer Joudeh Modern Apps Consultant – Microsoft Enterprise Services taiseer.joudeh@microsoft.com - @tjoudeh http://bitoftech.net
Event-driven scale Sub-second billing Abstraction of servers
Manage less Micro-pricingEase of scale
Azure Functions Process events with code Develop Functions in C#, Node.js, F# and more Easily schedule event-driven tasks across services Expose Functions as HTTP endpoints Scale Functions based on customer demand
• Powerful developer portal • Develop locally
Every 15 minutes Clean tableFind and clean invalid data Example: Timer based processing
File added to Blob Storage Transform CSV to data rows CSV Power BI Chart graphic Example: Azure service event processing
Millions of devices feed into Stream Analytics Store data in SQL Azure Transform to structured data Example: Real-time stream processing
Loaded web page calls WebHook Completed pageLoad data based on user profile Example: Serverless Web Applications architectures
? ... Run bot business logic Message sent to Azure Bot Service Example: Real-time bot messaging Azure Bot Service sends response
Photo taken and uploaded Produces scaled images Example: Async background processing
• Deploy to 18 different regions around the globe • The Function App is the unit of deployment • Function App deployment works just like App Service deployments • Deploy continuously from VSTS/GitHub/etc • Deploy locally from Visual Studio
• Consumption Plan • Pay for what you use (execution time, memory) • Platform responsible for scale • App Service Plan • Pay based on # of reserved VMs • Basic, Standard, Premium • You’re responsible for scale (can use autoscale)
Azure Functions will: • Monitor incoming events/traffic • Monitor how much resources/work each of your functions is taking • Horizontally scale your app onto additional VMs as required
Pay per execution model - two meters • Executions = Number of executions • GB-sec = Duration of execution x memory usage Free grant • 1,000,000 free executions • 400,000 free GB-sec
• Functions should “do one thing” • Functions should finish as quickly as possible • Functions should be idempotent 1
Avoid going sync in async code
Avoid going sync in async code
Avoid unbounded concurrency
• E2E perf testing is still crucial • Reduce, reuse, recycle (resources)
Try Functions – https://functions.azure.com Try App Service – https://tryappservice.azure.com
JoTechies www.jotechies.com Q&A
Thank You JoTechies www.jotechies.com

JoTechies - Azure Functions Using c#

  • 1.
    Serverless patterns with AzureFunctions JoTechies www.jotechies.com TaiseerJoudeh-Microsoft APRIL2017
  • 2.
    JoTechies is aTech community that provides education, help and social events for IT professional in Jordan and helps you network with local IT peers. @JoTechies JoTechies www.JoTechies.com JoTechies JoTechies
  • 3.
    Taiseer Joudeh Modern AppsConsultant – Microsoft Enterprise Services taiseer.joudeh@microsoft.com - @tjoudeh http://bitoftech.net
  • 9.
  • 10.
  • 11.
    Azure Functions Process eventswith code Develop Functions in C#, Node.js, F# and more Easily schedule event-driven tasks across services Expose Functions as HTTP endpoints Scale Functions based on customer demand
  • 15.
    • Powerful developerportal • Develop locally
  • 17.
    Every 15 minutesClean tableFind and clean invalid data Example: Timer based processing
  • 18.
    File added to BlobStorage Transform CSV to data rows CSV Power BI Chart graphic Example: Azure service event processing
  • 19.
    Millions of devicesfeed into Stream Analytics Store data in SQL Azure Transform to structured data Example: Real-time stream processing
  • 20.
    Loaded web page callsWebHook Completed pageLoad data based on user profile Example: Serverless Web Applications architectures
  • 21.
    ? ... Run botbusiness logic Message sent to Azure Bot Service Example: Real-time bot messaging Azure Bot Service sends response
  • 22.
    Photo taken anduploaded Produces scaled images Example: Async background processing
  • 25.
    • Deploy to18 different regions around the globe • The Function App is the unit of deployment • Function App deployment works just like App Service deployments • Deploy continuously from VSTS/GitHub/etc • Deploy locally from Visual Studio
  • 26.
    • Consumption Plan •Pay for what you use (execution time, memory) • Platform responsible for scale • App Service Plan • Pay based on # of reserved VMs • Basic, Standard, Premium • You’re responsible for scale (can use autoscale)
  • 27.
    Azure Functions will: •Monitor incoming events/traffic • Monitor how much resources/work each of your functions is taking • Horizontally scale your app onto additional VMs as required
  • 28.
    Pay per executionmodel - two meters • Executions = Number of executions • GB-sec = Duration of execution x memory usage Free grant • 1,000,000 free executions • 400,000 free GB-sec
  • 30.
    • Functions should“do one thing” • Functions should finish as quickly as possible • Functions should be idempotent 1
  • 31.
    Avoid going syncin async code
  • 32.
    Avoid going syncin async code
  • 33.
  • 34.
    • E2E perftesting is still crucial • Reduce, reuse, recycle (resources)
  • 36.
    Try Functions –https://functions.azure.com Try App Service – https://tryappservice.azure.com
  • 37.
  • 38.

Editor's Notes

  • #7 IaaS offers the lowest level of abstraction provided by the cloud No buying for hardware, renting is easier Still Admins needs to manage VMs, apply patches, configure LB More flexible so if there is more work load I rent more VMs As an application developer we didn’t notice much difference between buying a servers or using IaaS
  • #8 Azure App Services, we started to feel the abstraction, Still you need to: Provision the service Configure it Tell how many VMs needed or enable Auto scale based on certain thresholds Still you are paying for the hosting plan even your app didn’t receive a single request a day. We need to reach to a point where the cloud apps is just a bits of code running in the cloud, not thinking about the services running the code.
  • #9 Serverless means you are abstracted from the services and platform is doing more for you.
  • #10 Serveless Patterns: No need to manage servers No need to think about servers Event based oriented (Higher workloads  my code should run on multiple machines) Pay for what you use only Deploy functions (FaaS) not apps
  • #11 Higher abstraction so you manage less Platform will scale based on the work load You will be priced by seconds not even minutes or hours
  • #12 Azure functions is MS offering for Serverless patterns or architecture Write code which response to events Scale based on the workloads Opened sourced Supports many languages (C#, F#, Node, Batch, Bash, PS, PHO, and Python)
  • #14 Function App is the unit of deployment
  • #15 HTTP Trigger Timers Trigger which right on a queue, pass the variable “out string outputQueueItem” Queue Trigger which reads from the same queue
  • #18 DB Clean up
  • #19 Reacting to a blob upload on storage (CSV processing or image processing)
  • #20 IoT or Event Hub stream
  • #22 Customers tend to intract with bots during certain periods in the day, Bots is a great example to be deployed on AF
  • #23 Very common scenario, we will see a demo which integrates with Computer Vision API
  • #28 App Service Plan is better used when: Memory hungry apps, limits is 1.5 GB Want to interact with on-prem resources so you can use Vnets