How to enhance Azure Event Grid Tutorial to accommodate App Service Auto Scaler?

Siegfried Heintze 1,861 Reputation points
2023-02-07T21:24:47.61+00:00

I've been studying https://learn.microsoft.com/en-us/training/modules/azure-event-grid/8-event-grid-custom-events and https://github.com/Azure-Samples/azure-event-grid-viewer and I'm wondering if this sample razor app would run in an App Service Scale Set (or auto scaler).

Do you think it would run correctly? Tell me why!

I'm thinking it would not run correctly because the when the event grid makes the HTTP/REST call to the razor app, the load balancer would route it to a single instance of the razor app (instead of all the instances of the razor app) and only those users being routed to the same instance would see the dynamically changing display.

So how would you fix this so all the users would see the updated display regardless of which instance of the web app they get routed to?

The reason I'm asking is because I want to implement an Azure Cosmos DB sql change feed that would call the event grid to (indirectly) dynamically update the HTML table (or better yet, quick grid) display (in real time) of my blazor server web app as other users enter data.

In response to VenkateshDodda-MSFT's Feb 9 comment:

The links point to a tutorial containing a razor app that includes a simple web page and a simple API. For the tutorial one sends an event to the event grid (containing some JSON) using bash and CURL and the event grid forwards this to the razor app's REST API which uses signalR (websockets, I think) to forward the event to the browser resident javascript which displays the resulting data without requiring the user to refresh the page.

How would this work with a load balancer and several instances of the razor app (randomly being created and destroyed by the auto scaler) inside an app service scale set with a load balancer randomly selecting an instance of the razor app web server for each client's browsers HTTP request?

Does this help explain my question?

Thanks

Siegfried

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,449 questions
Azure Event Grid
Azure Event Grid
An Azure event routing service designed for high availability, consistent performance, and dynamic scale.
319 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,916 questions
{count} votes