Need help on blocking problems!

  • Thread starter Thread starter Mauricio
  • Start date Start date
M

Mauricio

Hello,

Currently we have an ASP.NET 2003 app running, on one function the app
calls to a stored procedure to SQLServerONE, that stored procedure
creates some TEMP tables with the results of a stored procedure that
is remotely called con SQLServerTWO that generates TEMP tables that
are used to return results.

When we begin stress-testing the app issuing the same function from
many clients at the same time and check the open connections with
sp_who on both the local server SQLServerONE and the remote server
SQLServerTWO, we see that connections remain open on the remote server
SQLServerTWO: at first, the function runs ok, but when we repeat the
operation with the other clients we notice that connections are not
terminated and in most cases stay blocking the table that will be used
later by another client, causing a blocking issue and increasing the
number of opened connections on the remote server SQLServerTWO.

We already tried turning on pooling for the ADO.NET connection that
connects to the local server SQLServerONE and the same happens.

Any help or guidance will be greatly appreciated!

Thanks,

Mauricio
 
Mauricio said:
Hello,

Currently we have an ASP.NET 2003 app running, on one function the app
calls to a stored procedure to SQLServerONE, that stored procedure
creates some TEMP tables with the results of a stored procedure that
is remotely called con SQLServerTWO that generates TEMP tables that
are used to return results.

When we begin stress-testing the app issuing the same function from
many clients at the same time and check the open connections with
sp_who on both the local server SQLServerONE and the remote server
SQLServerTWO, we see that connections remain open on the remote server
SQLServerTWO: at first, the function runs ok, but when we repeat the
operation with the other clients we notice that connections are not
terminated and in most cases stay blocking the table that will be used
later by another client, causing a blocking issue and increasing the
number of opened connections on the remote server SQLServerTWO.

We already tried turning on pooling for the ADO.NET connection that
connects to the local server SQLServerONE and the same happens.

Any help or guidance will be greatly appreciated!

Thanks,

Mauricio

Hum, first thing: Pooling will keep the connection open. If you want to
make sure the logical connection (and not the actual network connection)
is properly closed after executing something from your .net code, you
have to call the Close method explicitely as soon as you're finished.
You can also use the *using* keyword to do that automatically (C# only):

using (SqlConnection connection = new SqlConnection(whateverparam))
{
// execute your code here
} <- at this point the connection will be closed no matter what

If I didn't get the full problem, could you post more details about what
is calling what, who access which database, in which order and using
what code?
 
By any chance are you using BEGIN TRANSACTION inside the stored
procedures and not properly closing out the transaction?
 
linked servers are cool, but don't hold up under stress, and have very poor
error recovery.

-- bruce (sqlwork.com)
 
Thanks for your responses.

To answer some questions:

- We are closing the connections explicitly after executing the query.
- We are not using transactions on SQLServer, in fact the commands are
only SELECTs with some complex joins.

To give you more information:

SQLServerONE is SQLServer 2000.
SQLServerONE is SQLServer 7.0.

SQLServerONE has one stored procedure that is called from ADO.NET with
connection pooling, that stored procedure generates some TEMP tables on
SQLServerONE, between the creation of those tables, a stored procedure
on SQLServerTWO is remotely called, this stored procedure gererates some
TEMP tables on SQLServerTWO and returns the results to SQLServerONE that
are used to populate a TEMP table on SQLServerONE and finally returning
the data to ADO.NET and then the app.

The problem we have is that after performing stress tests on the
application, the number of opened connections on SQLServerTWO increases
gradually because of blockings on the TEMP tables created on
SQLServerTWO, there is a moment when there are so many connections
opened that the server stops responding and timeouts are generated on
the application.

I hope this can clear out more our problem and let you give us some
recommendations / best practices.

Thanks!
 
Back
Top