Why do we need to set Min pool size in ConnectionString(为什么我们需要在 ConnectionString 中设置 Min pool size)
问题描述
对于 SQL 连接池,为什么我们需要设置最小池大小?由于连接将保存在连接池中并重复使用,为什么我们需要保持最小池大小指定的活动连接?谢谢.
For SQL connection pool, why do we need to set up a min pool size? As connections will be saved in the connection pool and reused, why do we need to keep live connections specified by the min pool size? Thanks.
推荐答案
打开和维护连接很昂贵,所以如果你知道你需要多个连接(总是)最好指定 MinPoolSize
因为然后确保这些连接可用.
Opening and maintaining connections is expensive, so if you know that you need multiple connections (always) it's better to specify the MinPoolSize
because then it's ensured that these connections are available.
另外,来自 MSDN:
如果 MinPoolSize
未在连接字符串中指定或指定为零,池中的连接将在一个不活动的时期.但是,如果指定的 MinPoolSize
更大大于零,连接池 直到 AppDomain 被销毁卸载并且进程结束.维护非活动或空池涉及最小的系统开销.
If
MinPoolSize
is either not specified in the connection string or is specified as zero, the connections in the pool will be closed after a period of inactivity. However, if the specifiedMinPoolSize
is greater than zero, the connection pool is not destroyed until the AppDomain is unloaded and the process ends. Maintenance of inactive or empty pools involves minimal system overhead.
这篇关于为什么我们需要在 ConnectionString 中设置 Min pool size的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:为什么我们需要在 ConnectionString 中设置 Min pool size


基础教程推荐
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01