Hello,
I am trying to create an ASP.NET Web Service which I can use to show the difference between implementing a Web Method asynchronously vs. synchronously. It is sort of a proof-of-concept that I can use to show how writing things asynchronously can make an app more scalable. To make the comparison, I implemented two methods, RunSqlSync and RunSqlAsync . Like this:
[WebMethod]
public int RunSqlSync(string sql)
{
// call SQL synchronously
}
[WebMethod]
public IAsyncResult BeginRunSqlAsync(string sql, AsyncCallback callback, object state)
{
// call SQL asynchronously
}
[WebMethod]
public int EndRunSqlAsync(IAsyncResult result)
{
}
I would expect that I would be able to process more concurrent requests by using the Async version of the methods, especially if the SQL call took a while to complete. Unfortunately, for both methods, it seems that I hit a request/sec limit (the limit depends on the latency of the SQL calls) and I am not even close to maxing out my CPU. When I increase the number of requests being sent to the web service (by increase the number of users using in my Ocracoke Load Test), the average response time just increases without changing the actual TPS throughput. I instrumented the Web Service internally to measure the time it takes for a request to complete, and within my code, each individual request is being processed in the same time, regardless of load. This makes me think that ASP.NET is somehow throttling. Does anyone know why this would happen?