Connections lost on slot swap

Viewed 657

I want to use deployment slots for my Blazor server side application, but it stops working for the current users during the swap and they have to refresh the page.

I'm using an Azure SignalR Service for performance reasons, so it kinda makes sense, I imagine it like this:

enter image description here

Connections are held in memory and when I swap, obviously that is gone. At least without a SignalR Service. But shouldn't my SignalR Service keep SignalR connections (see red)? Did I set it up incorrectly?

I found others having similar problems (without using Blazor), but I'm not sure if these are viable with Blazor, especially because I just want to mitigate that 1-2 minute downtime for an update...

Automated reconnect SignalR client disconnected on Azure slots swap

Storing connections in an external storage. But manually handling connections is absurd effort? https://docs.microsoft.com/en-us/aspnet/signalr/overview/guide-to-the-api/mapping-users-to-connections


Update: See: https://www.youtube.com/watch?v=Vvjdqq8MB44&t=12m10s

enter image description here

It seems there is "Web traffic" going directly to the Blazor app. My guess: After a swap the "Web traffic" still goes to the previous instance, while SignalR traffic goes to the newly swapped in instance. That sounds like a problem.

But once again, I have no clue what "Web traffic" actually is or if that is the problem and if Azure offers a way to solve the issue, so a definitive answer would still be appreciated.

1 Answers

I don't think you have it setup incorrectly. I looked into doing a similar thing and had the same results.

The azure signalr service is basically acting as a proxy, when you switch slot the azure signalr server is losing its connection to the blazor server hub which holds the current state.

I don't think there is anyway around it, when you want to update your blazor server site every connected client will lose its connection because it's not possible to move the client 'states' over to the new slot/site.

What would be nice is the ability for azure to switch the new slot in once all old connections have disconnected, but I don't think we'll ever get that as it's a very specific blazor server requirement.

Related