0
votes

I am using an Azure Service Bus (Topic/Subscription) using the premium tier. I ran a sizable stress test that sends a topics to the bus that is sent to one of 5 subscriptions. This stress test was successful where it sent about 20000 messages in about a 20 minute period. Good enough for what I need at this point.

I am following the message send process outlines by Microsoft at message-transfers-locks-settlement

My C# application (which is an Azure function triggered by an http request) is essentially doing this pattern to post:

var tasks = new List<Task>();
for (int i = 0; i < 100; i++)
{
  tasks.Add(client.SendAsync(…));
}
await Task.WhenAll(tasks);

I have another Azure Function triggering off of the subscription to process the message. According to documentation, when the Azure Function finishes it completes and removes the message off the bus.

The issue I am having is that in the Azure portal I see that after my test ran the Service Bus has not completely release all the memory that it utilized during the test: Azure Portal Message Bus Memory

For the last couple days, there has been no active messages on the queue or deadlettered messages. Not sure what is using the memory or how to clear it. Not sure if Azure Message Bus has its own garbale collection or not either which may help.

Any thoughts would be very much appreciated as to how to clean up the memory via the portal or programmatically.

1
"For the last couple days, there has been no active messages on the queue or deadlettered messages" Azure Functions is terminated after a short period of time of inactivity. Are you sure there's nothing happening to keep that Function active?Sean Feldman
I did check the Azure Function Resource and I had gone ahead and stopped it just to be sure it is not leaving anything active. After stopping, I did see the connections to the Message Bus decrease, but the memory usage of the message bus is still steady at 25%.Steven Dwyer
I'm assuming it's a consumption plan, right? If so, there could be something specific to how Functions are running. Have you tried checking with Microsoft why the memory is shown as not released?Sean Feldman
I have not opened a ticket yet with Microsoft. That's probably my next step...I was hoping to find something quicker on this forum. The Azure Function resource is part of a service plan and the Service Bus is a premium plan flat rate. I just ran a smaller stress test and the memory on the service bus just creeped up 2% without releasing. BTW, thanks for your responses.Steven Dwyer

1 Answers

0
votes

After working with Microsoft they had indicated that the Service Bus does use memory for caching purposes. The memory used for caching will be freed when additional memory is needed. The memory that is used maybe waiting for garbage collection t run. Garbage collection is not predictable when it will run. It is also not possible to trigger the memory cleanup to start.