Real-time in no time (and costs) – with Azure Functions, Cosmos DB & SignalR

Real-time in no time (and costs) – with Azure Functions, Cosmos DB & SignalR

Let’s try to sort out some of the real strengths of Serverless and see where it can be a productive tool in your Cloud arsenal: real-time architectures & communication. Join Christian Weyer while discussing Azure Functions, Cosmos DB, and SignalR Service in a holistic scenario – by illustrating an end-to-end solution for a scalable real-time application built in almost no time, with almost no runtime costs. And action!

7e0087a19318ded4ba2203187694740f?s=128

Christian Weyer

October 13, 2020
Tweet

Transcript

  1. Real-time in no time (and costs?) with Azure Functions, Cosmos

    DB & SignalR Christian Weyer @christianweyer https://www.thinktecture.com/en/christian-weyer CTO, Thinktecture AG
  2. 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 Azure, Developer Tools ASPInsider, AzureInsider § Google GDE for Web Technologies christian.weyer@thinktecture.com @christianweyer https://www.thinktecture.com Christian Weyer Real-time in no time (and costs?) With Azure Functions, Cosmos DB & SignalR
  3. 3 § Serverless Compute: Azure Functions § Serverless Messaging: Azure

    Service Bus § Serverless Database: Azure CosmosDB § Serverless Real-time: Azure SignalR Service With Azure Functions, Cosmos DB & SignalR Real-time in no time (and costs?) Serverless-all-the-things™ - Today: Greenfield
  4. With Azure Functions, Cosmos DB & SignalR Real-time in no

    time (and costs?) Sample Architecture – Shopping Order Monitoring 4
  5. With Azure Functions, Cosmos DB & SignalR Real-time in no

    time (and costs?) Sample Architecture – Shopping Order Monitoring 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
  6. With Azure Functions, Cosmos DB & SignalR Real-time in no

    time (and costs?) Sample Architecture – Shopping Order Monitoring: Serverless Azure 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 6
  7. Azure Functions Serverless Compute Real-time in no time (and costs?)

    With Azure Functions, Cosmos DB & SignalR 7
  8. 8 § 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 § Cost-optimized, automatic scale (Consumption plan) § V2/V3 Runtime built on .NET Core § Available for self-hosting § Local tooling & runtime § Multiple language bindings supported With Azure Functions, Cosmos DB & SignalR Real-time in no time (and costs?) Azure Functions: Functions-as-a-Service
  9. 9 § Incoming event triggers function § Input bindings enable

    easy access to data from various data sources § Output bindings offer easy access to outbound data sinks With Azure Functions, Cosmos DB & SignalR Real-time in no time (and costs?) 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
  10. 10 Functions Triggers & Bindings in Code Real-time in no

    time (and costs?) With Azure Functions, Cosmos DB & SignalR
  11. With Azure Functions, Cosmos DB & SignalR Real-time in no

    time (and costs?) Sample Architecture – Shopping Order Monitoring: Azure Functions 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 11
  12. 12 Azure Cosmos DB Serverless Database Real-time in no time

    (and costs?) With Azure Functions, Cosmos DB & SignalR
  13. 13 § Globally distributed, elastically scalable § Fully managed by

    Azure § Serverless mode in preview § Multi-model database § Key-value, document, graph § Multiple APIs § DocumentDB, with SQL & JS APIs § MongoDB API § Cassandra API § Table Storage API § Graph Database with Gremlin API Real-time in no time (and costs?) Cosmos DB: NoSQL Database with Many Faces With Azure Functions, Cosmos DB & SignalR
  14. With Azure Functions, Cosmos DB & SignalR Real-time in no

    time (and costs?) Sample Architecture – Shopping Order Monitoring: Azure Cosmos DB 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 14
  15. 15 § Building event-driven architectures with Cosmos DB § Listening

    to Azure Cosmos DB collection for any changes § Inserts, updates, soft-deletes § Subscribe to collection changes Real-time in no time (and costs?) Cosmos DB Change Feed With Azure Functions, Cosmos DB & SignalR
  16. Azure Service Bus Serverless Messaging Real-time in no time (and

    costs?) With Azure Functions, Cosmos DB & SignalR 16
  17. 17 § 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 With Azure Functions, Cosmos DB & SignalR Real-time in no time (and costs?) Service Bus: Messaging-as-a-Service
  18. 18 Sender § Sender sends message to queue § Queue

    ACKs receipt § Receiver connects to queue & retrieves message § Receiver ACKs complete (or other action) With Azure Functions, Cosmos DB & SignalR Real-time in no time (and costs?) Service Bus Queues Receiver
  19. With Azure Functions, Cosmos DB & SignalR Real-time in no

    time (and costs?) Sample Architecture – Shopping Order Monitoring: Azure Service Bus 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 19
  20. 20 Azure SignalR Service Serverless Real-time Real-time in no time

    (and costs?) With Azure Functions, Cosmos DB & SignalR
  21. 21 § Real-time messaging is a wanted feature nowadays §

    Dashboards and monitoring apps § Collaborative apps § Apps that require notifications § ASP.NET Core SignalR provides programming model for bi-directional ‘method invocation’ § Via WebSockets, SSE or Long Polling § Various client libs available § Wanted: “SignalR messaging & scale-out”-as-a-Service ➔ Azure SignalR Service § Azure Functions bindings available for accessing SignalR Service With Azure Functions, Cosmos DB & SignalR Real-time in no time (and costs?) Azure SignalR Service
  22. With Azure Functions, Cosmos DB & SignalR Real-time in no

    time (and costs?) Sample Architecture – Shopping Order Monitoring: Azure SignalR 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 22
  23. Wrapping up Real-time in no time (and costs?) With Azure

    Functions, Cosmos DB & SignalR 23
  24. 24 § Completely scriptable with e.g. Terraform § No need

    to touch servers, or portals § You need check and measure early § Serverless pricing can bite you… § Check out pricing – and do the math § https://azure.microsoft.com/en-us/pricing/details/functions/ § https://azure.microsoft.com/en-us/pricing/details/cosmos-db/ § https://azure.microsoft.com/en-us/pricing/details/service-bus/ § https://azure.microsoft.com/en-us/pricing/details/signalr-service/ With Azure Functions, Cosmos DB & SignalR Real-time in no time (and costs?) Serverless! At “no cost”?
  25. Christian Weyer, Thinktecture AG @christianweyer christian.weyer@thinktecture.com https://github.com/thinktecture/serverless-microservices