Azure SQL server max pool size was reached error

狂风中的少年 提交于 2019-12-07 05:19:50

问题


We have azure sql server, while connecting more than 40 concurrent users we getting below error.

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.

While doing the load test we getting the error.we directly executing a stored procedure using a tool([http://www.datamanipulation.net/sqlquerystress/][1]). For a single user stored procedure will return the result in 1 sec.

Hardware details for azure is Standard SERVICE TIERS and s2(50DTU) PERFORMANCE LEVEL. Database size is 705 MB.

We are restore the same database in local pc. Locally we are using SQL Server 2014 express edition. Using this tool we have connect 200 users successfully.

How to we achieve 200 concurrent users in azure? I would appreciate for your valuable comments.


回答1:


  1. These queries must be running long enough in SQL DB so that the connections are exhausted. Look at the sys.dm_exeC_requests and / or sys.dm_exec_connections to see how many are opened for 40 users test. The slow queries could also be because of the resource limits you are hitting on S2 tier. Look at the sys.resource_stats view to see if you are hitting any resource limits. If that is the case scaling up may help your problem.

  2. Make sure you explicitly open and close your connections so that .Net can manage your connections

  3. Set Max Pool Size in connection string to larger value




回答2:


Do your users connect directly do the database (from some desktop client app perhaps)? Because if we are talking about web application backing 200 concurrent users, that does NOT mean you need 200 concurrent connections to database to serve them - it is quite possible to serve 200 users with 1-2 connections. Reaching connection pool limit almost always mean, that you just dont close your connections (they are not physically closed, they are returned to connection pool and mark as available, when you call Close() on SqlConnection. I am not familiar with the stress testing tool you are using, but this can be the case.



来源:https://stackoverflow.com/questions/31162597/azure-sql-server-max-pool-size-was-reached-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!