Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL connection pooling in Azure Functions

In traditional webservers you would have a SQL connection pool and persistent connection to the database.

But I am thinking of creating my entire application as Azure Functions. Will the functions create a new connection the SQL server everytime its called upon?

like image 556
NoWhereToBeSeen Avatar asked Oct 29 '22 15:10

NoWhereToBeSeen


1 Answers

Azure Functions doesn't currently have SQL as an option for an input or output binding, so you'd need to use the SqlClient classes directly to make your connections and issue your queries.

As long as you follow best practices of disposing your SQL connections (see this for example: C# SQLConnection pooling), you should get pooling by default.

Here's a full example of inserting records into SQL from a function: https://www.codeproject.com/articles/1110663/azure-functions-tutorial-sql-database

like image 148
brettsam Avatar answered Nov 18 '22 18:11

brettsam