This question is an follow-up of an previous asked question.
I've written an simple program who looks like this.
string s;
do
{
using (SqlConnection conn = new SqlConnection("POOLEDCONN"))
{
using (SqlCommand cmd = new SqlCommand("", conn))
{
s = (string) cmd.ExecuteScalar();
Code2IncrementPerfomanceCounter
}
}
} while (!string.IsNullOrEmpty(s))
The query returns an string(nvarchar(max), current maximum size 9k), there is a lot of latency between SQL Server and .NET. The SQL Profiler says that the query has an duration of 0 ms, so I think it isn't the database. The network is responding in less than 1 ms so it shouldn't be the network.
If I run this code on our testserver(VMWare, SQL isn't virtualized) there will be a max of 600 loops per second. The application doesn't consume more than 5 % cpu. Why isn't it going faster? Must I use streaming to get the data from SQL or something else?
Thanx in advance