Answered by:
Blazor in load balanced environment?

Question
-
User981372473 posted
Hello all,
My team is evaluating Blazor as an alternative to Angular for some upcoming front end work, and have been thoroughly impressed with it. At this stage of its development we think it will serve our needs nicely, but we still are in need of some guidance.
Our remaining questions have to do with how the server side version of Blazor would behave in a load balanced environment. The State Management section of the Blazor docs (https://docs.microsoft.com/en-us/aspnet/core/blazor/state-management?view=aspnetcore-3.0) does a great job of answering most of the questions we’ve had, and we plan on following that article’s recommendations. Here is what we are still wondering:
- Are there any changes necessary to the load balancer itself for this to work? We use sticky sessions for our current apps. I will need to explain any such changes to our infrastructure team.
- Aside from the changes necessary for .NET Core apps in general, are there any configuration changes necessary on the servers for Blazor to work in a load balanced environment? We are using Windows Server 2012, and will upgrade to 2016 at some point.
- Are there any other pitfalls we should be aware of? We have no experience with SignalR or other Websockets-based frameworks.
Thank you in advance to anyone who can weigh in on this.
-Craig
Tuesday, August 13, 2019 5:53 PM
Answers
-
User1289604957 posted
Hi Craig,
Blazor server-side is a stateful app framework. Most of the time, the app maintains an ongoing connection to the server. The user's state is held in the server's memory in a circuit.
In multiserver, load-balanced deployment environments, any server processing requests may become unavailable at any given time. Individual servers may fail or be automatically removed when no longer required to handle the overall volume of requests. The original server may not be available when the user attempts to reconnect.
Best regards,
Maher
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, August 13, 2019 8:27 PM -
User711641945 posted
Hi cmacivor,
Are there any changes necessary to the load balancer itself for this to work?You need to configure the middleware with ForwardedHeadersOptions like below:
services.Configure<ForwardedHeadersOptions>(options => { options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto; });
are there any configuration changes necessary on the servers for Blazor to work in a load balanced environment?No,you don't need to configure any changes.
Are there any other pitfalls we should be aware of?You could refer to what maherjendoubi said and the official document could refer to:
Best Regards,
Rena
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, August 14, 2019 7:02 AM
All replies
-
User1289604957 posted
Hi Craig,
Blazor server-side is a stateful app framework. Most of the time, the app maintains an ongoing connection to the server. The user's state is held in the server's memory in a circuit.
In multiserver, load-balanced deployment environments, any server processing requests may become unavailable at any given time. Individual servers may fail or be automatically removed when no longer required to handle the overall volume of requests. The original server may not be available when the user attempts to reconnect.
Best regards,
Maher
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, August 13, 2019 8:27 PM -
User711641945 posted
Hi cmacivor,
Are there any changes necessary to the load balancer itself for this to work?You need to configure the middleware with ForwardedHeadersOptions like below:
services.Configure<ForwardedHeadersOptions>(options => { options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto; });
are there any configuration changes necessary on the servers for Blazor to work in a load balanced environment?No,you don't need to configure any changes.
Are there any other pitfalls we should be aware of?You could refer to what maherjendoubi said and the official document could refer to:
Best Regards,
Rena
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, August 14, 2019 7:02 AM