New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve SignalR Backplane for small number of servers #48624
Comments
That's an interesting idea! I'm not sure if it works with sharding though, which means it might need to be an opt-in feature so we don't regress sharding scenarios. |
Indeed, I don't think it works with sharidng, but anyway sharding is not implemented yet in Redis backplane and in Redis client (stackexchange) |
Oh right, I got that mixed up with clustering. |
As a footnote, Not massively hard, just: something we haven't yet done. |
This wouldn't work as proposed. Redis pattern matching is extremely limited in what it will do. See https://redis.io/commands/keys/ for the glob patterns it supports. |
Closing as I don't think there is anything actionable here. |
Summary
When using SignalR Backplane, in particular Redis Backplane, there is a cost in terms of bandwidth used and latency added by the backplane. The wasted bandwidth & latency is 1/N (N = Number of servers)
When the number of server is small, the cost is higher
Motivation and goals
This is my understanding of Redis SignalR Backplane. I'm 90% confident that I understood how it works, but I'm not 100% sure. Sorry if I got it totally wrong :)
PUBLISH
.The proposal is the following:
Benefits / Limits
Benefits are obvious in terms of wasted bandwidth & latency
However, it does not improve the "worst possible latency".
It only improves the average latency.
There is an added benefit that messages that needs to be broadcasted might benefit from the freed bandwidth
Design proposal
to exclude the sender from receiving the message, in a scenario where the server don't know the names of the other servers, we could use PSUBSCRIBE/PPUBLISH
Let's say you have a group named "TOY"
Servers could subscribe to this channel using
^TOY(?!MACHINENAME1).*$
where MACHINENAME1 is the name of the current machine (there is probably some escaping to do to)Fortunately, the current implementation of Redis backplane automatically switches to Pattern based PUB/SUB
See Add precision about wildcard (*) + Redis SignalR Backplane = Pattern based subscriptions AspNetCore.Docs#29435
So this part is already "possible"
Then we must publish each message both to the Redis AND to the users connected to the current server
This is done by adapting the publish code. Probably around here:
https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/server/StackExchangeRedis/src/RedisHubLifetimeManager.cs#L298
The text was updated successfully, but these errors were encountered: