AZ-204 – Question 93

​You are developing an Azure function that connects to an Azure SQL Database instance. The function is triggered by an Azure Storage queue.
You receive reports of numerous System.InvalidOperationExceptions with the following message:
`Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.`

You need to prevent the exception.What should you do?

A. In the host.json file, decrease the value of the batchSize option
B. Convert the trigger to Azure Event Hub
C. Convert the Azure Function to the Premium plan
D. In the function.json file, change the value of the type option to queueScaling
Correct Answer: A 

The error shown is a SQL Server error not an Azure functions error.
The actual issue appears to be that you have too many simultaneous functions running, the solution is to limit the batch size (# functions that can run in parallel)

We have to consider we are speaking about Azure Function with Azure Storage Queue Trigger. This is a case where execution could happens in parallel based on the queue batchSize property

I think this is the batchSize property referred in the question (and not that in the functions aggregator. That’s another thing).

Besides, we have to consider the origin of the error message: Azure Sql Database!! So upgrading the plan the problem could only get worse thing.