web.config中poolsize与mssql中的connection


Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58

web.config中的 max poolsize指的是保存的与数据库连接的个数,由.net维护,常报的“超时时间已到,但是尚未从池中获取连接。出现这种情况可能是因为所有池连接均在使用,并且达到了最大池大小。 ”指的是连接数超出了max pool size引起。
连接池中的连接与mssql中的sys.dm_exec_connections中是对应的,不过sys.dm_exec_connections的连接也包含其他连接,故总数是>=pool size中的连接数量的。
可以在sys.dm_exec_connections中通过web.config连接的用户名来查询目前web.config连接了多少个:
SELECT a.most_recent_sql_handle,COUNT(1) d FROM
sys.dm_exec_connections a
JOIN sys.dm_exec_sessions b ON a.session_id = b.session_id AND b.login_name=’brm’
GROUP BY a.most_recent_sql_handle
ORDER BY d DESC