question

PrashantJain-6358 avatar image
0 Votes"
PrashantJain-6358 asked PrashantJain-6358 published

.NET 4.8 | SignalR connection to server behind Load balancer | On Premise

Hi,

I am trying to connect my angular-12 client to SignalR service on a server which is behind load balancer.
After successful SignalR negotiation
a) (/signalr/negotiate?clientProtocol=2.1&connectionData=d&_=xtz -[200-OK] ),
next request which can be seen on the client is of ABORT
b) (/signalr/abort?transport=longPolling&clientProtocol=2.11&connectionToken=t&_=abc [200-OK]* )

Stack being used

  1. Dotnet Framework: 4.8

  2. SignalR nuget package: 2.4.0

  3. Angular client using Signalr: "^2.4.2",

  4. Two nodes application server behind load balancer.

  5. Web socket support configured on IIS. (IIS latest version on Windows Server 2016)

  6. Web socket is the only transport protocol present in the client side code

  7. ASP.NET Web API application hosted on IIS

  8. SQL Server-2016 as broker to pass notification on Datachange

  9. Passing notification to requesting client using connectionId

  10. System works well for a single node environment. Chrome's network tab shows client has following endpoint communication

We are facing an issue of client connection to the app server
I've a feeling of LoadBalancer causing this issue. I am not in favour of using stick session.
Can someone please tell what needs to be done to address this issue.

Regards
Prashant


azure-load-balancerazure-signalr-service
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

TakahitoIwasa avatar image
0 Votes"
TakahitoIwasa answered TakahitoIwasa commented

Hi, @PrashantJain-6358

I am not in favour of using stick session.

Are you fixing the session now?
You need to fix the session according to:
https://docs.microsoft.com/en-us/aspnet/core/signalr/scale?view=aspnetcore-6.0

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you @TakahitoIwasa for taking time out to answer my question.

You have provided a link for ASPNET core 6.0, Is it valid for ASP.NET framework 4.8 as well ?

All applications in our suite are managed by one load balancer (LB)
I am not sure if any change in LB would be accepted by any other app owners.

As mentioned in the linked document-
Sticky sessions, also known as client affinity, is required, except when both of the following are true:

  1. All clients are configured to only use WebSockets [I can configure transport as websocket for particular transaction]

  2. The SkipNegotiation setting is enabled in the client configuration.
    Once a connection is initiated on a server, the connection has to stay on that server.

If I follow the above two advices, Will I able to avoid sticky session ?

I did a read about sticky session and I have a feeling that during the load test of application,
there could be an imbalance in the resource consumption if sticky session is enabled.





0 Votes 0 ·
TakahitoIwasa avatar image TakahitoIwasa PrashantJain-6358 ·

Yes. It is also valid for .NET 4.8.

You need to communicate to the same session in order to use WebSocket. The easy way to do this is to enable sticky sessions.

As you are concerned, there are certainly disadvantages to sticky sessions.
In that case, you have the option to scale out by adopting the session database (here Redis) as shown in the following link.
https://docs.microsoft.com/en-us/aspnet/signalr/overview/performance/scaleout-with-redis

0 Votes 0 ·
Bruce-SqlWork avatar image
0 Votes"
Bruce-SqlWork answered Bruce-SqlWork commented

You need to use sticky sessions to support reconnects and non websocket connections. Be sure your load balancer supports persistent websocket connections.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


Thank you @Bruce-SqlWork for your reply.
We are using A-10 load balancer for our in-premise virtual machines.

Our application has lot of transactions and I can make sure that the particular transaction in our app uses
'web-socket' only and with 'skipNegotiation' settings. Will that not help me out to avoid sticky sessions ?

While common load balancer (LB) is used for all applications in the suite,
I am not sure if change in LB settings would be supported in the workplace for one transaction in an app only.




0 Votes 0 ·
Bruce-SqlWork avatar image Bruce-SqlWork PrashantJain-6358 ·

Thats the requirements for not using sticky sessions.

But remember, it’s a persistent connection, so unless there is connection loss, it’s just like a sticky session, the client is attached to the same server for the life of the connection.

0 Votes 0 ·
HeeraHemanthBylla-2102 avatar image
0 Votes"
HeeraHemanthBylla-2102 answered

Hi @TakahitoIwasa , @Bruce-SqlWork , @PrashantJain-6358



Trying to build a SignalR web app, using .Net framework [4.8] server and Angular client [12]

Don't see the option skipNegotiation in the Signalr node package.

So, can I use the @aspnet/signalr package and implement the option with the same app setup?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

PrashantJain-6358 avatar image
0 Votes"
PrashantJain-6358 answered PrashantJain-6358 published

same issue @HeeraHemanthBylla-2102

Hi
@TakahitoIwasa , @Bruce-SqlWork


Trying to build a SignalR web app, using .Net framework [4.8] server and Angular client [12]
I don't see the option skipNegotiation in the Signalr node package.
So, can I use the @aspnet/signalr package and implement the option with the same app setup?

Regards
Prashant



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.