数据库连接池会影响性能怎么样? [英] how database connection pool impacts performance?

查看:229
本文介绍了数据库连接池会影响性能怎么样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的.Net 2.0 + SQL Server 2005企业+ VSTS 2008 + C#+ ADO.Net来开发ASP.Net Web应用程序。在ASP.Net Web应用程序的数据库中心/驱动。我想知道有没有什么是性能差异,当我们开启/关闭线程池设置在ADO.Net连接字符串设定任何性能基准数据?性能我的意思是这两者可以支持的并发连接和一个特定的SQL命令的执行时间从ADO.Net客户端执行?

I am using .Net 2.0 + SQL Server 2005 Enterprise + VSTS 2008 + C# + ADO.Net to develop ASP.Net Web application. The ASP.Net Web application is database centric/driven. I want to know whether there are any performance reference data about what are the differences of performance when we turn on/off thread pool setting in ADO.Net connecting string setting? Performance I mean both the concurrent connection which could be supported and the execution time of a specific SQL Command executed from ADO.Net client side?

在avdance感谢, 乔治

thanks in avdance, George

推荐答案

我没有任何性能统计在手,但也许使用连接池时,提醒一句:你可能最终得到太多的小水池,而不是一个大的。

I don't have any performance stats at hand, but maybe a word of warning when using connection pooling: you might end up with too many small pools, instead of one large one.

ADO.NET将创建一个新的连接池

ADO.NET will create a new connection pool for

  • 每个连接字符串;这是非常挑剔这个,太 - 如果你是用甚至只是一个单一的空间,或者一些不同的两个连接字符串,这被认为是两个不同的连接字符串,并会导致不同的连接池是创建

  • each connection string; it is very picky about this, too - if you have two connection strings that are different by even just a single space or something, those are considered two separate connection strings, and will lead to separate connection pools being created

对于每个Windows凭据,如果使用了综合安全(受信任的连接)设置

for each Windows credentials if using the "integrated security" (trusted connection) setting

所以,如果你有一个连接字符串类似于

So if you have a connection string something like

server=MyDBServer;database=MyDatabase;integrated security=SSPI;

对于每个用户区分一个连接池将被创建 - 这是相当反直觉的,但是这事情是这样的(并不能影响/关闭)

one connection pool for each distinguishable user will be created - that's rather counter-intuitive, but that's the way it is (and it cannot be influenced / turned off).

查看 MSDN文档对ADO.NET连接池详细信息:

Check out the MSDN docs on ADO.NET connection pooling for details:

当第一次打开一个连接,   基于一个连接池创建   精确匹配算法   与相关联的池   在连接的连接字符串。   每个连接池相关联   具有鲜明的连接字符串。   当打开一个新的连接,如果   连接字符串是不是一个确切的   匹配现有池,一个新池   被创建。连接是每汇集   过程中,每个应用程序域,每   连接字符串和集成时,   * 安全性时,每个的Windows 的*   标识。连接字符串还必须   精确匹配;关键字提供   以不同的顺序对同一   连接将分别合并。

When a connection is first opened, a connection pool is created based on an exact matching algorithm that associates the pool with the connection string in the connection. Each connection pool is associated with a distinct connection string. When a new connection is opened, if the connection string is not an exact match to an existing pool, a new pool is created. Connections are pooled per process, per application domain, per connection string and when integrated *security is used, per Windows* identity. Connection strings must also be an exact match; keywords supplied in a different order for the same connection will be pooled separately.

另外,如果你有这两个连接字符串:

Also, if you have these two connection strings:

server=MyDBServer;database=MyDatabase;user id=tom;pwd=top$secret

server=MyDBServer;database=MyDatabase;user id=tom; pwd=top$secret;

这些被认为是不同的连接字符串,因此两个单独的连接池将被创建。

those are considered different connection strings, and thus two separate connection pools will be created.

当试图测量连接池的作用,这是一个需要注意的!

When attempting to measure the effect of connection pooling, this is something to be aware of!

马克·

这篇关于数据库连接池会影响性能怎么样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆