问题描述
我正在创建一个带有 Sql Server 数据库引擎的 .net 应用程序.我希望每秒有成千上万的用户访问我的网站.连接数取决于什么?IIS可以保持多少连接,Sql Server?
I am creating a .net application, with a Sql Server db engine. I would like my site to be accessed by thousands of users per second. What does the number of connections rely on? How many connection can IIS hold, and Sql Server?
推荐答案
首先,连接和连接池是有区别的.调查一下是不是很好,因为它在性能上有很大的不同.如果您需要参考,我可以挖掘一个,但 google/bing 是您的朋友.关键要点是:将连接池的数量保持在最低限度.
First, there is a difference between connections and connection pools. Is it good to look into that, as it makes a huge difference in performance. If you need a reference, I can dig one up, but google/bing is your friend here. The key takeaway is: keep the number of connections pool to a minimum.
话虽如此,连接数取决于两件事.
With that said, the number of connection depends on two things.
您使用的是 Windows 身份验证吗?如果是这样,每个不同的用户都会导致不同的连接/连接池
Are you using Windows Auth? If so, every distinct user will cause a distinct connection/connection pool
如果您使用的是 SQL Auth,那么每个不同的连接字符串都会导致创建一个新池(即使是单个空格差异也会导致一个新池).
If you are using SQL Auth, then each different connection string will cause a new pool to be created (even a single space difference will cause a new pool).
关于扩展问题,IIS 和 SQL Server 都可以处理大量连接.如果您遇到连接限制,您可能应该看看应用程序设计.
In regards to the scaling question, both IIS and SQL Server can handle an very high number of connections. If you are running into connection limits, you should probably take a look at the application design.
埃里克
这篇关于并发 Sql Server 连接数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!