SQL Server Performance

  • Home
  • Articles
  • Forums
  • Tips
  • Training
  • FAQ's
  • Blogs
  • Software
  • Books
  • About Us
RSS Feeds
Sign in | Join


Article Topics

All Articles
Performance Tuning
Audit
Business Intelligence
Clustering
Reporting Services
SQL Azure
Developer
General DBA
ASP.NET / ADO.NET
SQL Azure

USEFUL SITES :

ASP.NET Tutorials
Windows and SQL Azure Tutorials
Cloud Hosting Magazine
SharePoint Tutorials
Windows Server Help

Write for Us

Share your SQL Server knowledge with others and raise your profile in the community More...
Latest Articles

A High Level Comparison Between Oracle and SQL Server - Part ...
A High Level Comparison Between Oracle and SQL Server - Part ...
A High Level Comparison Between Oracle and SQL Server - Part ...
A High Level Comparison Between Oracle and SQL Server

More     
 
Latest FAQ's

Add Node to A SQL Server failover Cluster failed with invalid ...
SQL Server Destination remote server error
Setting Up Data And Log Files For SQL Server
Will Check Constraints Improve Database Performance?

More     
   
Latest Software Reviews

dbForge Review
Spotlight on ApexSQL Diff - Server-based database comparison tool ...
Spotlight on ApexSQL Data Diff - Server-based database comparison tool ...
Spotlight on ApexSQL Doc 2008

More     

articles >> performance tuning >> Use the Correct ASP (ADO) Syntax to ...

Use the Correct ASP (ADO) Syntax to Enable Connection Pooling for Best SQL Server Performance

By : Brian Lockwood
Jun 10, 2003

Page 2 / 3

SubPerformance Monitor Results: A maximum of two connections are made, and the rest appear to be pooled. The connections are destroyed when the application is closed in both VB and ASP.


SQL Server Profiler Trace Results: Only two connections are made, they aren’t destroyed until the application is closed, or the connections time out after 60 seconds. 

Connect 
ExistingConnection 
Connect 
ExistingConnection 
Disconnect 
Disconnect

Total Time: 2.56 Seconds

If Connections are Closed and Set to Nothin

Private Sub Form_Load()
   Dim rs
   Dim n
  For n = 0 To 2
    Set rs = CreateObject("ADODB.Recordset")
    Set cn(n) = CreateObject("ADODB.Connection")
    cn(n).Open "DRIVER={SQL Server};SERVER=SQLSERVER;DATABASE=Pubs;UID=sa"
    rs.Open "select * from authors", cn(n)
    rs.Close
    Set rs = Nothing
    cn(n).Close
    Set cn(n) = Nothing
  NextEnd 

SubPerformance Monitor Results: Only one new connection is made – it doesn’t appear that pooling is working for VB, but Performance Monitor shows proper pooling behavior for ASP. 


SQL Server Profiler Trace Results: For VB, three connections and disconnections are made, unlike in the example where pooling was working in which starting with the 3rd connection no more new connections were created. For ASP, on the other hand, destroying the connections has no effect and pooling is still in effect. 

Note: this blip was induced by a slight delay so Performance Monitor could pick up the connection. Normally, no change is seen in Performance Monitor at all.

ASP Trace Results

Connect 
ExistingConnection 
Connect 
ExistingConnection 
[No more trace activity even though a 3rd connection is created!] 
(after 60 seconds) 
Disconnect 
Disconnect

Total Time: 2.62 seconds

If No Pooling is Attempted (Unique UID/PWD

Private Sub Form_Load()
  Dim rs
  Dim n
  Dim str
  For n = 0 To 2
    Set rs = CreateObject("ADODB.Recordset")
    Set cn(n) = CreateObject("ADODB.Connection")
    Select Case n
      Case Is = 0
        str = "DRIVER={SQL Server};SERVER=SQLSERVER;DATABASE=Pubs;UID=test1"
        cn(n).Open str
      Case Is = 1
        str = "DRIVER={SQL Server};SERVER=SQLSERVER;DATABASE=Pubs;UID=test2"
        cn(n).Open str
      Case Is = 2
        str = "DRIVER={SQL Server};SERVER=SQLSERVER;DATABASE=Pubs;UID=test3"
        cn(n).Open str
                End Select
        rs.Open "select * from authors", cn(n)
        rs.Close
        Set rs = Nothing
        cn(n).Close
        Set cn(n) = Nothing
      Next n


<< Prev Page     Next Page>>    








C# Help and Tutorials | PHP MySQL Tutorial | Sharepoint Tutorial | Azure Tutorial | Cloud Hosting Magazine | ASP.NET Tutorials | Windows Server Help | Windows Phone Pro | Silverlight Ace | Visual Studio Tutorials | Home | Peformance Articles | Audit Articles | Business Intelligence Articles | Clustering Articles | Developer Articles | Reporting Services Articles | DBA Articles | ASP.NET / ADO.NET Articles | SQL Server Training Videos | DBA FAQ's | Developer Peformance FAQ's | DBA Peformance FAQ's | Developer FAQ's | Clustering FAQ's | Error Messages | Audit Tool Reviews | Backup Tool Reviews | Coding Tool Reviews | Compare Tool Reviews | Documentation Tool Reviews | Design Tool Reviews | Monitoring Tool Reviews | Log Tool Reviews | Reporting Tool Reviews | Clustering Tool Reviews | Security Tool Reviews | Change Management Tool Reviews | Remote Access Tool Reviews | Book Reviews | Security Tool Reviews | ADO.NET / ASP.NET | Administration | Analysis/OLAP Services | Application Development | Configuration | Components | ETL | Hardware | High Availability | Hints | Index | Misc | Operating Systems | Performance Tuning | Replication | T-SQL | Views


              © 2010 Jude O'Kelly. All rights reserved