Maximum number of connections to the pro-test SQL Server

Source: Internet
Author: User
Tags connection pooling

Many friends who do architecture design, program development, operations, technical management may have such confusion more or less:

    1. How many connections does SQL Server support for concurrency?
    2. Can SQL Server meet existing applications?
    3. How many connections are supported by the existing technology architecture?
    4. How many concurrent connections can theoretically be supported in the case of hardware performance and network performance?
    5. What is the current concurrency of a database in a production environment?
    6. How do I monitor the number of concurrent existing databases?
    7. What is the amount of concurrency in a production environment that is theoretically the maximum amount of concurrent reimbursement?

To do this, I specifically wrote the program to do the next test, using the loop to open the connection and keep the connection open not closed, the test code is as follows:

1 using System;
2 using System.Collections.Generic;
3
4 namespace Sqlservermaxconnectiontest
5 {
6 Class Program
7 {
8 static void Main (string[] args)
9 {
Ten int maxCount = 40000;
One list(int i = 0; i < MaxCount; i++)
13 {
Console.WriteLine (String. Format ("Successfully created Connection object {0}", i));
var db = new Hotspotentities ();
Db. Connection.Open ();
Collection. ADD (DB);
18}
19}
20}
21}

I was surprised by the results of the first round of tests.

When you create a 101 connection, you cannot create a new connection. That is, if the connection string does not do any processing, our program can only establish 101 connections with SQL Server. The test results are as follows:

Second round test, enable connection pooling.

Add code to the connection string:

Pooling=true; Max Pool size=40000; Min Pool size=0;

Several times in a row the memory was exhausted, but the results were very gratifying.

The highest record is 29299, which is obviously not the highest record, just because my notebook memory is limited, so it is difficult to break through.

Microsoft's definition of the maximum number of connections


Microsoft defines the maximum number of connections on MSDN as: "The default is 0, which means no limit, but the maximum number of connections is 32767". As shown in the following:

Interested friends can write their own code to test, share a bit.

How to monitor the number of SQL Server connections

sp_who ' LoginName '
LoginName is of course the user name of the login SQL, the general program will use a username to log in to the SQL so that the user name can be seen after the login of the connection.
If you do not write loginname, then all connections are returned.

Since the number of connections is predictable and measurable, then it is measurable, so we can evaluate or test the program and distribute it according to the actual situation.

With these, I believe that the above confusion should be able to untie it.

Transferred from: http://www.cnblogs.com/wlb/archive/2012/04/08/2437617.html

Maximum number of connections to the pro-test SQL Server

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.