-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[FEATURE REQ] Get quick overview of available sessions #7380
Comments
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jfggdl |
Thanks for sharing your feedback. I wanted to check if you just care about the number of message sessions (that aren't currently locked and hence available to be processed) or do you actually need a list of session ids. The former could perhaps be surfaced as a metric in Azure Monitor (we don't have it now). You could scale up your receiver applications by driving off this metric. Let us know what you think. Also, the code sample you have shared - did you consider using a SessionHandler? It avoids having to poll the queue for sessions. |
For my minimum needs I just need a count. I run a cronjob that then scales ACI or AKS (China doesn't have ACI yet, if it was a metric I would probably have to wait a long time for it to appear in China also?). SessionHandler doesn't really help me for this scenario. A metric would definitivly be nice though, but I am not consuming this service in a normal way I think. For my full use case I would definitely also like the id's, because I would like to build my own locking system on top of service bus using redis. (I want the ability to clear a session queue at any time without having to find a worker to break the lock, so I don't use service bus to lock the message). So actually I want a quick way to get all the ids, so that I can compare them to the id's I'm storing in redis as 'locked'. All the sessions will be unlocked 99% of the time in my case because I never accept them unless I want to peek/complete a message. |
@CoenraadS - not sure if the mechanics line up that well. Perhaps I'm not fully grokking your use-case, do you have some pseudocode to share? Specifically - what is meant by 'clearing a session queue'. Sessions are locked on the service side, even to process a single message. The idea is to simplify your model by taking the responsibility off your plate. Perhaps the worker threads that lock the session can register the lock (insert an entry) on a redis instance if that is something you want to drive your logic on and then unregister the lock (remove the entry) when it gives it up. |
@CoenraadS, do you have a pseudocode you can share? Are you ok with the approach that Axisc is suggesting ? |
Yes, this is what we implemented on .Net Framework. We 'lock' the session using Redis, however I'm still missing a way to simply iterate sessions simply using .net core. In Framework I use:
But I don't see this functionality in the .net core packages. |
Moving to the backlog milestone to sync with the backlog tag for the issue. |
Hi, I wanted to bump this and see if the ASB team has had further consideration around exposing a Sessions metric, or exposing the ability to retrieve this through a client? I think as more workloads move to picking up event driven scalers like KEDA, this is going to become a more prevalent need. For our case specifically, we utilize sessions in some scenarios for tenancy prioritization and workload distribution. Our current scale-out is really clunky, but if we could tap how many sessions were currently on the queue we could greatly simplify it and increase it's reliability. This could be via a metric or exposed on a client as the OP indicated. |
Hello all, Thanks for your patience Please note that a newer package #20569 is the issue tracking this same feature request for the new package |
Hello
I would like to build a worker/consumer using session queues. However my consumers are ACI containers that I would like to scale out based on the amount of sessions.
To do this I would like an option to either quickly get an overview of all sessions, or all non-locked sessions (without having to accept/lock/iterate all sessions), I just want a list of id's)
Basic scenario
cronjob checks how many unlocked sessions there are and based on this makes N aci consumers
the acis will then request an unlocked session from the service bus
Describe the solution you'd like
Something like
QueueClient.GetMessageSessionsAsync(queueName) // This exists in the WebJobs package, why not in the Microsoft.Azure.ServiceBus; package?
OR
QueueClient.GetUnlockedSessionIds(queueName)
Describe alternatives you've considered
while (true)
sessionClient.AcceptMessageSessionAsync()
This is very ugly/inefficient and inaccurate. I create 10 sessions and this method returns
2 6 8 9 4 1 7 0 Duplicate Duplicate Duplicate Duplicate Duplicate Duplicate Duplicate Duplicate Duplicate Duplicate Duplicate 5 Duplicate Duplicate 3
To remove the duplicates I can hold a lock on every session until I get no more response. This may break a consumer trying to retrieve a work item..
Not a great way of doing things.
The text was updated successfully, but these errors were encountered: