简体   繁体   English

SQL Azure 180并发连接

[英]SQL Azure 180 concurrent connections

SQL Azure (Web and Business) allows 180 concurrent connections at most as indicated here: SQL Azure(Web和Business)最多允许180个并发连接,如下所示:

http://blogs.technet.com/b/dataplatforminsider/archive/2013/07/23/premium-preview-for-windows-azure-sql-database-now-live.aspx http://blogs.technet.com/b/dataplatforminsider/archive/2013/07/23/premium-preview-for-windows-azure-sql-database-now-live.aspx

I'm trying to understand what's meant by concurrent connections . 我试图了解并发连接的含义。

Assume there is an aspx page Test.aspx that uses a SqlConnection object to Select Top 1 * from TestTable . 假设有一个aspx页面Test.aspx,它使用SqlConnection对象Select Top 1 * from TestTable After SqlReader returns, the connection is closed. SqlReader返回后,连接将关闭。 (I believe ASP.NET will still be using connection pooling). (我相信ASP.NET仍将使用连接池)。 Assume this page is simultaneously hit by 500 users. 假设此页面同时被500个用户点击。

Does this mean 500 concurrent connections or 1 connection because I'll be using a pooled connection? 这是否意味着500个并发连接或1个连接,因为我将使用池连接?

PS I'm also looking at SQL Federations to scale out the database layer, but if each DB allows up to 180 concurrent connections and I query each DB and fan out results for every simultaneous user on the application layer, then I don't see how I'm scaling out. PS我也在考虑SQL Federations来扩展数据库层,但是如果每个数据库允许最多180个并发连接,并且我查询每个数据库并为应用层上的每个同时用户扇出结果,那么我看不到我是如何扩展的。

A concurrent connection is from the standpoint of the database server. 并发连接是从数据库服务器的角度出发的。 In .NET, when your data table is returned, the connection is logically closed, meaning that the connection is marked as available in the connection pool, but the actual database connection is not closed; 在.NET中,当返回数据表时,连接将在逻辑上关闭,这意味着连接在连接池中标记为可用,但实际的数据库连接未关闭; it remains open for a period of time. 它会保持开放一段时间。 When a connection is reused from the pool, .NET issues an sp_reset_connetion command to the available connection so that it can be reused. 从池中重用连接时,.NET会向可用连接发出sp_reset_connetion命令,以便可以重用它。

A new connection to the database is created when there are not enough connections available in the pool to satisfy the demand. 当池中没有足够的可用连接来满足需求时,将创建与数据库的新连接。 So to reach 180 concurrent connections you would need to issue 180 simultaneous requests to the database, because the pool would need to create that many connections. 因此,要达到180个并发连接,您需要向数据库发出180个并发请求,因为池需要创建那么多连接。

Regarding your Federations note, It is now deprecated. 关于您的联盟注释,现在已弃用。 You would need to use new Elastic Scale Utility to Create Shards, there are plenty of post about it on SO. 您需要使用新的Elastic Sc​​ale Utility来创建碎片,在SO上有很多关于它的帖子。

Assume this page is simultaneously hit by 500 users. 假设此页面同时被500个用户点击。 Does this mean 500 concurrent connections or 1 connection because I'll be using a pooled connection? 这是否意味着500个并发连接或1个连接,因为我将使用池连接?

That depends on what your Page is doing. 这取决于您的Page正在做什么。 Lets say a First request hits the page and page is doing a long running query say which runs for 20Sec (Hypothetically), in that 20Sec if another 100 Request hits and in turn each of those 100 request is doing long running query, then you are indeed using 101 (including the first one) actual connections to the DB and not re-using anything from the Connection Pool. 让我们说第一个请求命中页面,页面正在进行一个长时间运行的查询,说哪个运行20Sec(假设),在20Sec中,如果另外100个请求命中,反过来这100个请求中的每一个都在进行长时间运行的查询,那么你是确实使用101(包括第一个)与DB的实际连接,而不是重新使用连接池中的任何内容。

Practically it is very unlikely that a web page would be doing something like above. 实际上,网页不太可能像上面那样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM