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

Pragmatic Serverless Microservices with Azure F...

Pragmatic Serverless Microservices with Azure Functions & Co. - more than FaaS

FaaS is hip, Serverless is cool, Microservices are all the hype. What about building Microservices with Serverless? Based on some well-accepted principles we can use Serverless architectures and technologies to build highly focused Microservices (which we might call Nanoservices, for now). Christian Weyer will show you a pragmatic approach on how to build Nanoservices with Azure Functions, Azure Service Bus & friends. Join him to see Serverless Azure in action, with .NET Core, JavaScript and Java.

Christian Weyer

April 04, 2019
Tweet

More Decks by Christian Weyer

Other Decks in Programming

Transcript

  1. 2 § Founder & CTO at Thinktecture AG § Personal

    focus on § Mobile & web-based application architectures § Interoperability, cross-device § Pragmatic end-to-end solutions § Cloud-native & serverless architectures § Independent Microsoft Regional Director § Microsoft MVP for ASP.NET (Architecture) ASPInsider, AzureInsider § Google GDE for Web Technologies [email protected] @christianweyer https://www.thinktecture.com Christian Weyer More than FaaS Pragmatic Serverless Microservices with Azure Functions & Co.
  2. 3 § Microservices, Nanoservices § Serverless in Azure § Serverless

    Compute: Azure Functions § Serverless Messaging: Azure Service Bus § Summary Pragmatic Serverless Microservices with Azure Functions & Co. More than FaaS Our Journey Today
  3. Single Responsibility § Focused around business domain § ‘Small’ Isolation

    § Well-defined technology-agnostic APIs § Mobility § Choice of technology Autonomy § Exclusive state (data storage) Decoupling § Asynchronous communication § Really, always? Pragmatic Serverless Microservices with Azure Functions & Co. More than FaaS (Some) Principles of Microservices 5
  4. Pragmatic Serverless Microservices with Azure Functions & Co. More than

    FaaS Sample Architecture – Shopping Order Monitoring 6 Orders Service Products Service Shipping Service AuthN Service Order Monitoring SPA Shopping Web Site (simulated by Postman) 1 - authenticate 2 - register for push 3 - send new order 5 - new order created push 6 - get updated orders 4 - processing order…
  5. 8 § We can choose from a continuum § VM

    ➔ § Containers ➔ § Orchestrators ➔ § PaaS ➔ § Serverless Pragmatic Serverless Microservices with Azure Functions & Co. More than FaaS Evolution to Cloud Compute Continuum PaaS IaaS On-Premises Serverless
  6. 9 Serverless Sweet Spot Programming Model (FaaS) § Event-driven §

    Stateless § Service-full Operational Model § Fully managed § Automatically scaling § Usage priced More than FaaS Pragmatic Serverless Microservices with Azure Functions & Co.
  7. 10 § Serverless Compute → Azure Functions § Serverless Database

    → Azure Cosmos DB § Serverless Storage → Azure Storage § Serverless Realtime → Azure SignalR Service § Serverless Events → Azure Event Grid § Serverless Messaging → Azure Service Bus § Serverless Workflows → Azure Logic Apps Azure Durable Functions § Serverless IoT → Azure IoT Hub § Serverless Analytics → Azure Application Insights § Serverless Containers → Azure Container Instances Pragmatic Serverless Microservices with Azure Functions & Co. More than FaaS Serverless in Azure (personal view)
  8. Pragmatic Serverless Microservices with Azure Functions & Co. More than

    FaaS Sample Architecture – Shopping Order Monitoring: Serverless 11 Orders Service Products Service Shipping Service AuthN Service Order Monitoring SPA Shopping Web Site (simulated by Postman) Azure Function App – C# Azure Function App - C# Azure Function App - JS Azure Function App - Java Azure Service Bus Azure Blob Storage Azure SignalR Service Azure Table Storage Azure Cosmos DB Identity Server
  9. 13 § Azure Functions: code being triggered by an event

    § Use Façade pattern for your business logic § Basic principles enable powerful use cases § Events ➔ Triggers & Bindings § Two ways of operation § Cost-optimized, automatic scale (Consumption plan) § Always-on (App Service plan) § V2 Runtime built on .NET Core § Available for self-hosting § Local tooling & runtime § Multiple language bindings supported Pragmatic Serverless Microservices with Azure Functions & Co. More than FaaS Azure Functions: Functions-as-a-Service
  10. 14 § Incoming event triggers function § Input bindings enable

    easy access to data from various data sources § Output bindings offer easy access to outbound data sinks Pragmatic Serverless Microservices with Azure Functions & Co. More than FaaS Functions Triggers & Bindings Your code logic Runtime Azure Function HTTP Trigger Storage Input Binding Push Notification Output Binding Database Output Binding Email Output Binding Example
  11. 16 § Queues & Topics § Reliable asynchronous communication §

    Rich features for temporal control § Routing and filtering § Transactions § Convoys & Sessions (related messages with state) § Bindings for Azure Functions available Pragmatic Serverless Microservices with Azure Functions & Co. More than FaaS Service Bus: Messaging-as-a-Service
  12. 17 Sender § Sender sends message to queue § Queue

    ACKs receipt § Receiver connects to queue & retrieves message § Receiver ACKs complete (or other action) Pragmatic Serverless Microservices with Azure Functions & Co. More than FaaS Service Bus Queues Receiver
  13. 18 § Sender only knows about Topic § Receivers only

    know about Subscriptions § Filters and Actions exist on Subscriptions Pragmatic Serverless Microservices with Azure Functions & Co. More than FaaS Service Bus Topics & Subscriptions Type == ‘order‘ Sender type=quote type=order Topic Type == ‘quote‘ Filter Filter Subscrip- tion 1 Subscrip- tion 2
  14. Single Responsibility § Focused around business domain § ‘Small’ unit

    ➡ Dedicated Azure Functions App Isolation § Choice of technology ➡ .NET, Java, node.js, Python supported § Well-defined technology-agnostic APIs ➡ HTTPS, AMQP, MQTT, custom § Mobility ➡ Portable runtime ➡ Can use Docker, k8s with Functions ➡ Easily deploy & run in Cloud Autonomy § Exclusive state (data storage) ➡ Use separate Azure Storage, Azure SQL, Azure CosmosDB instances Decoupling § Asynchronous communication ➡ Azure Service Bus with queues or topics & subscriptions Pragmatic Serverless Microservices with Azure Functions & Co. More than FaaS (Some) Principles of Microservices – with Serverless Azure 20
  15. 21 § Serverless as FaaS is just one option in

    the Cloud Continuum § Always think about the use cases and requirements § Serverless operational model will be pre-dominant on the ‘server’ § E.g. automatic scaling under load § Serverless Azure offers various solutions in the Serverless space § Functions § Service Bus § SignalR Service & more (also more to come) § Call-to-Action: Azure Functions is more than a Web API framework – preferred for async decoupled processing as distinct (micro?) services. Go figure ! Pragmatic Serverless Microservices with Azure Functions & Co. More than FaaS Summary