Mar 16, 2010 at 2:59 AM
Edited Mar 16, 2010 at 3:09 AM
I hope someone can help me with this. We are using EntLib Data Access Application Block 4 for the database connection in our web services. Our web services will call specific stored procedures such as shown in the code snippet below. We need to make each
web services as fast as it can because a separate application will call multiple concurrent web services given a certain time. When we profile our application for performance, it seems that the GetNewOpenConnection is taking time more than executing the actual
Test Results with concurrent web services being called:
*DatabaseFactory::CreateDatabase shows around 1-5ms (lowest) in some web services while others shows 400-500ms. Why is this so?
*Database:GetNewOpenConnection (inside Execute) shows also around the same results (lowest at 250ms) and can even reach up to 600ms at times.
This is our connection string in the config file. We are using SQL Server 2008.
<add name="Connection String" connectionString="Data Source=xxx.xxx.xxx.xx;Initial Catalog=MyDB;Integrated Security=SSPI" providerName="System.Data.SqlClient" />
In our C# codes:
Database db = DatabaseFactory.CreateDatabase();
using (DbCommand command = db.GetStoredProcCommand("asp_MySP"))
<some codes here: db.AddInParameter, db.AddOutParameter>
db.ExecuteNonQuery(command); (or ExecuteScalar, etc..)
<some codes here: db.GetParameterValue>
We don't have any other problem except the performance.
1. Anyone with any suggestions on how we can trim down these times?
2. Are we doing the right thing in our configuration? Or is there something that we should specify such as pooling, etc?
Any idea will be appreciated.
Thank you very much,