How to ignore signalr from balancing in HAProxy?

83 views Asked by At

We need to make HAProxy ignore SignalR request, when counting connections to server.

Problem is that sometimes we send a lot of messages over SignalR. HAProxy see these messages, and make solution, that server is very busy, so redirect users to another server. But these messages are very lighweight, and server is not busy to process them. So, we want count business of the server only by usual http requests, excluding signalr requests. How can we configure this?

P.S. We use sticky sessions.

1

There are 1 answers

0
Ricardo Gellman On

Did you try create an Access Control List and identify if it's an Signal or regular HTTP request ?

# ACL to identify SignalR requests
  acl is_signalr path_beg -i /signalr

  # Use the is_signalr ACL to bypass connection counting for SignalR requests
  stick on src if !is_signalr
  stick store-response src if !is_signalr

  server server1 192.168.1.1:80 check
  server server2 192.168.1.2:80 check

The acl is_signalr path_beg -i /signalr line creates an ACL named is_signalr that matches requests whose path begins with "/signalr". Adjust this path according to your SignalR endpoint. The stick on src if !is_signalr line configures HAProxy to use the client's source IP address for stickiness, but only if the request is not a SignalR request.

The stick store-response src if !is_signalr line makes sure that the stickiness information is stored based on the source IP address for responses of non-SignalR requests.