Skip to content
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

ISessionAffinityPolicy should be async #1974

Closed
Tratcher opened this issue Dec 21, 2022 · 2 comments · Fixed by #1990
Closed

ISessionAffinityPolicy should be async #1974

Tratcher opened this issue Dec 21, 2022 · 2 comments · Fixed by #1990
Assignees
Labels
Type: Idea This issue is a high-level idea for discussion.

Comments

@Tratcher
Copy link
Member

Tratcher commented Dec 21, 2022

What should we add or change to make your life better?

FindAffinitizedDestinations and AffinitizeResponse could use async overloads to allow for external data store affinity lookups, or other operations like checking the body. These could be added in a non-breaking way as Default Interface Methods that call the sync APIs.

Why is this important to you?

Example: David had to read the response body to get an identifier. He was also unable to use IDistributedCache.
https://github.com/davidfowl/SmartLoadBalancer/blob/1d43229daf09f836aabf7a78ce31658a207cf53b/Yarp.Ingress/SignalRSessionAffinity.cs

@Tratcher Tratcher added the Type: Idea This issue is a high-level idea for discussion. label Dec 21, 2022
@karelz
Copy link
Member

karelz commented Jan 3, 2023

Triage: Reasonable thing to do, given it can be done in non-breaking way.

@karelz karelz added this to the YARP 2.0.0 milestone Jan 3, 2023
@MihaZupan MihaZupan self-assigned this Jan 5, 2023
@karelz karelz modified the milestones: YARP 2.0.0, Backlog Jan 9, 2023
@MihaZupan MihaZupan modified the milestones: Backlog, YARP 2.0.0 Jan 12, 2023
@davidfowl
Copy link
Contributor

davidfowl commented Feb 11, 2023

So I was finally able to try this out and hit a problem. It seems like I need to use the SuppressBody on the ResponseTransformContext, but that isn't accessible in AffinitizeResponseAsync (I'm trying to write a response to affinitize the signalr connection).

This is what I ended up with https://github.com/davidfowl/SmartLoadBalancer/blob/f96f74efa0191b359e3366be0e537da35e8fdf74/Microsoft.AspNetCore.SignalR.LoadBalancing/SignalRSessionAffinity.cs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Idea This issue is a high-level idea for discussion.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants