i am working on a applicaiton that will running 24/7.application life cycle is so simple. when ever new request come.its just update the record in database. aplicaiton update record in different servers and in different database. there is millions of request application entertain in an hour for each request it open and close connecition as per below code.
internal int ExecuteNonQuery(string Query)
{
using (SqlConnection SqlConn = new SqlConnection(this.ConnectionString))
{
using (SqlCommand sqlComm = new SqlCommand(Query, SqlConn))
{
SqlConn.Open();
sqlComm.CommandTimeout = 60;
sqlComm.ExecuteNonQuery();
return 0;
}
}
}
i want to optimize my code i dont want every time request come it will create a new connection for this i have read connection pooling mechanism in ado.net. remember that i have different sql connection (maximum 10). can i use connection pooling? or can i make my own logic to create sqlconection for each connection and opened them for all day. also my application oftenly generate hand shake exception.