In my ASP.NET application, I have a sqlclient connectionstring in my web.config file, What is the recommended timeout setting for production environment? Default is 15 seconds.
在我的ASP。NET应用程序,我的web中有一个sqlclient connectionstring。配置文件,生产环境的推荐超时设置是什么?默认是15秒。
My web farm and database cluster are on the same switch, so there should not be much latency.
我的web farm和数据库集群在同一个交换机上,所以不应该有太多的延迟。
3 个解决方案
#1
1
The default timeout will work for most scenarios. If it doesn't in yours and you encounter problems you could modify it. Lowering this timeout could be good in cases where you want to immediately throw an exception if there are problems connecting to avoid monopolizing worker threads.
默认超时将适用于大多数场景。如果它不在你的,你遇到问题,你可以修改它。如果您想要立即抛出异常,如果有一些问题需要连接,以避免垄断工作线程,那么降低这个超时可能会很好。
#2
2
The default of 15 seconds is a reasonable value, and there is rarely any reason to change it.
15秒的默认值是一个合理的值,几乎没有任何理由改变它。
A reason to have a longer timeout is for example if your database server is sometimes running heavy queries that makes it unresponsive for a few seconds.
出现较长超时的原因之一是,如果数据库服务器有时运行大量查询,使其在几秒钟内无法响应。
A reason to have a shorter timeout would be if you want an error early instead of waiting when the database is unresponsive, for example if you can use cached data as a backup.
出现更短超时的一个原因是,如果您希望在数据库没有响应时尽早出现错误,而不是等待,例如,如果您可以使用缓存的数据作为备份。
#3
0
Mostly that should be good. If you encounter problems you could experiment with tweaking it but the most important thing then, and always actually, is the measure the impact of your changes.
大多数情况下,这应该是好事。如果您遇到问题,您可以尝试对其进行调整,但是最重要的事情是度量您的更改的影响,而且实际上始终是如此。
Another thing to keep things from going more smoothly is to use caching. There are open source tools available like memcached. Microsoft also has its own distributed caching mechanism: AppFabric.
另一个阻止事情进展得更顺利的方法是使用缓存。有一些开源工具,如memcached。微软也有自己的分布式缓存机制:AppFabric。
#1
1
The default timeout will work for most scenarios. If it doesn't in yours and you encounter problems you could modify it. Lowering this timeout could be good in cases where you want to immediately throw an exception if there are problems connecting to avoid monopolizing worker threads.
默认超时将适用于大多数场景。如果它不在你的,你遇到问题,你可以修改它。如果您想要立即抛出异常,如果有一些问题需要连接,以避免垄断工作线程,那么降低这个超时可能会很好。
#2
2
The default of 15 seconds is a reasonable value, and there is rarely any reason to change it.
15秒的默认值是一个合理的值,几乎没有任何理由改变它。
A reason to have a longer timeout is for example if your database server is sometimes running heavy queries that makes it unresponsive for a few seconds.
出现较长超时的原因之一是,如果数据库服务器有时运行大量查询,使其在几秒钟内无法响应。
A reason to have a shorter timeout would be if you want an error early instead of waiting when the database is unresponsive, for example if you can use cached data as a backup.
出现更短超时的一个原因是,如果您希望在数据库没有响应时尽早出现错误,而不是等待,例如,如果您可以使用缓存的数据作为备份。
#3
0
Mostly that should be good. If you encounter problems you could experiment with tweaking it but the most important thing then, and always actually, is the measure the impact of your changes.
大多数情况下,这应该是好事。如果您遇到问题,您可以尝试对其进行调整,但是最重要的事情是度量您的更改的影响,而且实际上始终是如此。
Another thing to keep things from going more smoothly is to use caching. There are open source tools available like memcached. Microsoft also has its own distributed caching mechanism: AppFabric.
另一个阻止事情进展得更顺利的方法是使用缓存。有一些开源工具,如memcached。微软也有自己的分布式缓存机制:AppFabric。