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

Support message sessions in Azure Service Bus Scaler #1479

Open
1 task
worldspawn opened this issue Jan 6, 2021 · 33 comments
Open
1 task

Support message sessions in Azure Service Bus Scaler #1479

worldspawn opened this issue Jan 6, 2021 · 33 comments
Labels
azure All issues concerning integration with Azure feature All issues for new features that have been committed to help wanted Looking for support from community needs-discussion scaler-azure-service-bus

Comments

@worldspawn
Copy link

worldspawn commented Jan 6, 2021

Use-Case

I have a large workload that is bound to a single session id. As a session can only be processed from a single listener (because it locks the session) scaling according to the number of messages in the queue is not... useful.

I've just added 620 messages to a queue all with the same session id and keda has scaled up the service to whopping 16 instances. But unfortunately 15 instances are doing nothing and 1 is working hard.

I'm not sure if you can interrogate the number of active sessions but if you can then...

Specification

  • Allow to specify the desired number of desired active sessions and scale based on that instead of the number of messages in a queue.
@worldspawn worldspawn added feature-request All issues for new features that have not been committed to needs-discussion labels Jan 6, 2021
@tomkerkhove
Copy link
Member

That's a good scenario to cover. Are you using a specific scaler or more in general?

With Azure Service Bus you'd use sessions indeed, I'm just wondering how KEDA could know when to scale and when not?

@worldspawn
Copy link
Author

I'm using the azure-servicebus trigger currently. I can't see any appropriate method on the REST api that would do this but "Service Bus Explorer" has the ability to produce a list of sessions for a queue (somehow).

@tomkerkhove
Copy link
Member

Reasonable ask. So if there would be a useSessions: true opt-in which would scale based on metrics and sessions that would help you?

@tomkerkhove tomkerkhove changed the title Scaling service according to number of active sessions Support message sessions in Azure Service Bus Scaler Jan 8, 2021
@tomkerkhove tomkerkhove added azure All issues concerning integration with Azure scaler-azure-service-bus labels Jan 8, 2021
@worldspawn
Copy link
Author

worldspawn commented Jan 9, 2021

Yeah that would be great. In this particular case I wouldn't be interested in scaling based on the number of messages at all, only the number of sessions. Because of how the .net client manages concurrency I cannot imagine ever needing to scale based on both queue length and session count at the same time. I think its as simple as - if its a session enabled queue i want to scale based on sessions, otherwise queue count.

@tomkerkhove
Copy link
Member

Makes sense, thanks for bringing this up!

@davidallyoung
Copy link

Hi everyone, just to chime in, we also have a similar use case for sessions. Some context on how we use them:

We utilize the sessions to break up workloads per tenant and help facilitate "fast lanes". It's set up in such a way that some tenants could have more sessions than others, etc. If KEDA could scale based on sessions, it would definitely simplify and make more reliable our scaling strategy.

@MCGPPeters
Copy link

Somewhat connected to this issue.... When downscaling, are receiver instances that are locked taken into account? E.g. are these instances kept alive until the session has completed and the lock has been removed?

@tomkerkhove
Copy link
Member

No because KEDA is not aware of what instances are doing. It just tells Kubernetes to scale from x to y, and the scheduler will kill the required amount of pods.

@MCGPPeters
Copy link

That would be really nice to have, since long running sessions could theoretically span days / months ... Any way you could work around this?

@tomkerkhove
Copy link
Member

The only way to achieve this is to change the application that's running so that when a shutdown is initiated it gracefully abandons the session for somebody else to continue later on.

@MCGPPeters
Copy link

Thanks. That is the strategy I am following atm indeed. Was hoping I could remove some code :)

@tomkerkhove
Copy link
Member

WDYT @ahmelsayed?

@stale
Copy link

stale bot commented Oct 14, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale All issues that are marked as stale due to inactivity label Oct 14, 2021
@tomkerkhove tomkerkhove removed the feature-request All issues for new features that have not been committed to label Oct 14, 2021
@stale stale bot removed the stale All issues that are marked as stale due to inactivity label Oct 14, 2021
@tomkerkhove tomkerkhove added feature All issues for new features that have been committed to stale All issues that are marked as stale due to inactivity labels Oct 14, 2021
@stale stale bot removed the stale All issues that are marked as stale due to inactivity label Oct 14, 2021
@purijatin
Copy link

We have a similar use case. It would be great to have a working solution on this.

@tomkerkhove
Copy link
Member

Are you willing to contribute this?

@raorugan
Copy link

raorugan commented Feb 24, 2023 via email

@tomkerkhove
Copy link
Member

Oh no need to @raorugan

@Krishnadas-KP
Copy link

@tomkerkhove Will this be implemented soon ?

@tomkerkhove
Copy link
Member

It's looking for a contributor so if you are interested, let me know.

@tomkerkhove tomkerkhove added the help wanted Looking for support from community label May 9, 2023
@b-dines
Copy link

b-dines commented Aug 23, 2023

We are also interested in this capability. I am not sure we have the skills/bandwidth to contribute unfortunately.

@christopherlombardiconfluence

We also have an interest in this capability.

@miqm
Copy link

miqm commented Oct 11, 2023

We're also interested in this feature.

@miqm
Copy link

miqm commented Nov 10, 2023

@tomkerkhove Is this feature even possible to implement currently? I think that the Service Bus SDK for go doesn't provide option to get count of active sessions. There's option in C# and Java SDK (GetMessageSessions on SB client) but I don't see this in GO.

@tomkerkhove
Copy link
Member

We have not looked in to it yet given nobody has proposed to implement it yet. If this is a known limitation, then it would be nice if you could file an issue with them!

@petemessina
Copy link

@tomkerkhove I can take a look at the change and see if I can move it forward

@aionic
Copy link

aionic commented Dec 13, 2023

@petemessina / @tomkerkhove - I would be interested in helping as well

@tomkerkhove
Copy link
Member

That would be wonderful! @petemessina / @aionic who wants to pick this up?

@petemessina
Copy link

I can pick it up

@sujesharukil
Copy link

Any movement on this feature?

@Mortana89
Copy link

Following here, we use sessions to guarantee FIFO so queue based scaling as is is indeed not useful, would love to have this!

@miqm
Copy link

miqm commented Feb 11, 2024

@tomkerkhove - I found a ticket from last year where .NET SDK team discussed on Service Bus sessions. It seems that this feature needs to have not only SDK for GO support but also the Service Bus API: Azure/azure-sdk-for-net#20569 (comment)

For scaling scenarios this feature on service bus API is kind of crucial. Do you think you could influence Service Bus team to bring this on their roadmap and provide such data?

@miqm
Copy link

miqm commented Mar 17, 2024

Hello,

For those who are still waiting for the native support and want to try something different - I have started an open-source project with external scaler that leverages AMQP command to get count of sessions: https://github.com/miqm/session-scaler. Feel free to try it out. I will gradually try to improve it i.e. add workload identity support. All feedback (even the negative, as long as is constructive ) is appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
azure All issues concerning integration with Azure feature All issues for new features that have been committed to help wanted Looking for support from community needs-discussion scaler-azure-service-bus
Projects
Status: To Do
Development

No branches or pull requests