Azure / azure-webjobs-sdk

Azure WebJobs SDK
MIT License
737 stars 358 forks source link

EventHub output binding in Azure Function opening lots of connections #2008

Open felipecruz91 opened 5 years ago

felipecruz91 commented 5 years ago

Hi,

We are experiencing the same issue when running an Azure Function of type ChangeFeedTrigger. This function simply listens to changes in a Cosmos DB collection using a [CosmosDbTrigger] input binding, performs data transformation, and sends the data to an EventHub.

So far we have tried the following three different options to send data to the EventHub which, unfortunately, ended up having the same result; a lot of connections opened and not being closed.

Having specified the [EventHub] output binding to write multiple messages using the IAsyncCollector<string> parameter.

Having a single, static EventHubClient that lives across the whole Azure Function lifecycle, hoping only one connection is created and reusable.

Creating a new EventHubClient and closing the connection explicitly just before the function execution ends.

First, we tried them running under the Consumption plan (whose limit is 300 connections). Then Microsoft support suggested switching to an App Service Plan that allows having more open connections. However, the number of connections kept increasing anyway and we are currently reaching the connection limit of the App Service Plan (we burn around 4K connections). This is how we are monitoring the number of connections.

We haven't found a solution yet and, focusing on the first option we tried, we would like to know how is possible that using the [EventHub] output binding the number of connections is always increasing.

himanshukumar-ayla commented 4 years ago

Is there any Update regarding this Issue . Have you solved this issue ?