Use "session affinity" terminology (#33487)

pull/33469/head
Luke Latham 2024-08-29 11:31:23 -04:00 committed by GitHub
parent 7aa9dea4a8
commit 7a2e1e58da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 9 deletions

View File

@ -179,20 +179,19 @@ To resolve the problem, use ***either*** of the following approaches:
* <xref:signalr/configuration>
* [Blazor samples GitHub repository (`dotnet/blazor-samples`)](https://github.com/dotnet/blazor-samples) ([how to download](xref:blazor/fundamentals/index#sample-apps))
## Use sticky sessions for server-side webfarm hosting
## Use session affinity (sticky sessions) for server-side webfarm hosting
A Blazor app prerenders in response to the first client request, which creates UI state on the server. When the client attempts to create a SignalR connection, **the client must reconnect to the same server**. When more than one backend server is in use, the app should implement *sticky sessions* for SignalR connections.
A Blazor app prerenders in response to the first client request, which creates UI state on the server. When the client attempts to create a SignalR connection, **the client must reconnect to the same server**. When more than one backend server is in use, the app should implement session affinity, also called *sticky sessions*, for SignalR connections.
> [!NOTE]
> The following error is thrown by an app that hasn't enabled sticky sessions in a webfarm:
>
> > blazor.server.js:1 Uncaught (in promise) Error: Invocation canceled due to the underlying connection being closed.
The following error is thrown by an app that hasn't enabled session affinity in a webfarm:
> :::no-loc text="blazor.server.js:1 Uncaught (in promise) Error: Invocation canceled due to the underlying connection being closed.":::
## Server-side Azure SignalR Service
We recommend using the [Azure SignalR Service](xref:signalr/scale#azure-signalr-service) for server-side development hosted in Microsoft Azure. The service works in conjunction with the app's Blazor Hub for scaling up a server-side app to a large number of concurrent SignalR connections. In addition, the SignalR Service's global reach and high-performance data centers significantly aid in reducing latency due to geography.
Sticky sessions are enabled for the Azure SignalR Service by setting the service's `ServerStickyMode` option or configuration value to `Required`. For more information, see <xref:blazor/host-and-deploy/server#azure-signalr-service>.
[Session affinity](#use-session-affinity-sticky-sessions-for-server-side-webfarm-hosting) is enabled for the Azure SignalR Service by setting the service's `ServerStickyMode` option or configuration value to `Required`. For more information, see <xref:blazor/host-and-deploy/server#azure-signalr-service>.
## Server-side circuit handler options

View File

@ -195,13 +195,13 @@ For a deeper exploration of scaling server-side Blazor apps on the Azure Contain
When using IIS, enable:
* [WebSockets on IIS](xref:fundamentals/websockets#enabling-websockets-on-iis).
* [Sticky sessions with Application Request Routing](/iis/extensions/configuring-application-request-routing-arr/http-load-balancing-using-application-request-routing).
* [Session affinity with Application Request Routing](/iis/extensions/configuring-application-request-routing-arr/http-load-balancing-using-application-request-routing).
For more information, see the guidance and external IIS resource cross-links in <xref:tutorials/publish-to-iis>.
## Kubernetes
Create an ingress definition with the following [Kubernetes annotations for sticky sessions](https://kubernetes.github.io/ingress-nginx/examples/affinity/cookie/):
Create an ingress definition with the following [Kubernetes annotations for session affinity](https://kubernetes.github.io/ingress-nginx/examples/affinity/cookie/):
```yaml
apiVersion: extensions/v1beta1