Do I expect too much scalability from azure functions?

I have an azure function that works in terms of consumption, which runs on a service bus topic, and then just adds another message to the queue (so itโ€™s basically not processed, but only IO). The trigger subject fills at a speed of ~ 1000 / s. I naively thought that the function could easily keep up, but in fact it is hopelessly overloaded, and the subscription to the topic fills up very quickly. It works for me for several hours, so I suspect that it is completely decrypted.

How much should I expect from features? Is bandwidth of the order of thousands per second impossible?

edit: I regularly see this error in the logs:

The connection attempt lasted for 00:00:00. TCP error code 10013: An attempt was made to access the socket in a prohibited way by its access permissions.

Functions seem to not work well with the service bus on a scale?

change 2 to solve Replace this binding:

public static async Task Run(BrokeredMessage msgin, Binder binder, TraceWriter log) { var collector = await binder.BindAsync<IAsyncCollector<BrokeredMessage>>( new ServiceBusAttribute("my-queue")); ... } 

with this:

 public static IAsyncCollector<BrokeredMessage> collector; public static async Task Run(BrokeredMessage msgin, Binder binder, TraceWriter log) { collector = collector ?? await binder.BindAsync<IAsyncCollector<BrokeredMessage>>( new ServiceBusAttribute("my-queue")); ... } 

exhaustion of the socket was prevented, and the function could not keep up with the manufacturer, not a problem.

+5
source share
2 answers

I had the same issue in my Azure Function. The main reason was that I was running out of ports because I was creating a TCP connection inside the Run method.

So, when there were many parallel executions on one computer, they all made a connection, eventually exhausting all the ports.

In this situation, the connection was created as part of creating the ServiceBus client, and moving it to a static variable resolved the problem.

+3
source

Some questions:

  • Does your service bus connection string support rights? Currently, rights management is required for effective scaling.
  • Do you use I / O bindings or do you manage the service bus client yourself?
  • Have you changed the concurrency service bus settings in host.json ?

The error you see is related to the exhaustion of the connection, so somehow your function instance ends the available connections.

If you want to get telemetry about function scaling and bandwidth, you can do this: https://github.com/Azure/Azure-Functions/wiki/App-Insights-Early-Preview

+3
source

Source: https://habr.com/ru/post/1266698/


All Articles