Data-driven serverless apps with Azure functions Anton Boyko Microsoft Azure MVP boyko.ant@live.com
Serverless?
Developer maturity level Junior How can I do it? Middle How can I do it more elegantly? Senior How can I NOT do it?
Traditional server Fixed reserved CPU Fixed reserved RAM Pay for reserved resourced
Serverless On-demand CPU (per second) On-demand RAM (per Mb) Pay for number of executions and on- demand resources consumed
Abstraction of servers Serverless Abstraction of servers Sub-second billing Event-driven scale Abstraction of servers, infrastructure and configuration of operating system Event-driven scale Sub-second billing Stateless
Azure functions?
I have a “code” I have an “event data”
I have a “code” I have an “event data” BOOM!
Stateless Small Single unit of work C# F# HTTP(S) Java Timer NodeJS Python PowerShell … HTTP(S) Timer Queue Storage … Azure Functions Stateless Small Single unit of work
function.json
run.csx
Applications
Example: Timer based processing Every 15 minutes Clean table Find and clean invalid data
Example: Azure service event processing File added to Blob Storage Transform CSV to data rows CSV Power BI Chart
Example: SaaS event processing Excel file saved to OneDrive Microsoft Graph API analyzes content Creates new sheet With Charts
Example: Serverless Web Applications architectures Loaded web page calls WebHook Completed page Create ad based on user profile
Example: Serverless Mobile back ends Photo taken and WebHook called Stores in blob storage Produces scaled images
Example: Real-time stream processing Millions of devices feed into Stream Analytics Store data in SQL Database Transform to structured data
Example: Real-time bot messaging ? ... Cortana Analytics answers questions Message sent to Chatbot Chatbot sends response
Toolset
Azure Storage Emulator https://docs. microsoft Azure Storage Emulator https://docs.microsoft.com/en-us/azure/storage/storage- use-emulator Azure Storage Explorer http://storageexplorer.com/ Azure Functions CLI https://www.npmjs.com/package/azure-functions-cli Azure Functions Tools for Visual Studio 2015 https://blogs.msdn.microsoft.com/webdev/2016/12/01/vis ual-studio-tools-for-azure-functions/ Azure Functions Tools for Visual Studio 2017 https://blogs.msdn.microsoft.com/webdev/2017/05/10/azu re-function-tools-for-visual-studio-2017/ Azure Functions Docs https://docs.microsoft.com/en-us/azure/azure- functions/functions-overview
Demo
Azure Functions Приступаем к работе с Azure Functions используя утилиты командной строки https://youtu.be/6QNa131hrtI Разбор структуры проекта Azure Functions Queue Trigger https://youtu.be/-XozOeyTSBA Разбор структуры проекта Azure Functions Blob Trigger https://youtu.be/UMVlWNAwgcs Запускаем Azure Functions локально используя эмулятор https://youtu.be/bRimWjQb26E
Precompiled Azure Functions Concept https://blogs.msdn.microsoft.com/appserviceteam/2017/03 /16/publishing-a-net-class-library-as-a-function-app/ Demo https://youtu.be/zF3IzpaEHls