1

I have tried to make async calls to my SQL Server instance as you may see on my SO post:

ASP.NET MVC 4 asyncronous database call: never returns the HTTP response

I did a benchmarking and the sync version is better than async one when there is even lots of concurrent loads. I am not sure if I got this right and opened the connection as async to my SQL Server instance.

The query does not take too much time and considering the fact that asynchronous code has much more overhead than the sync one, this might be the issue here as well. On the other hand, honest to say, I am not sure how to check if I opened the connection successfully as async or not.

Is there any chance I could check if the query is successfully completed as asynchronously?

4

As far as I can tell, SQL Server doesn't know a query is asynchronous. It's always synchronous to SQL Server. The connection string change appears to affect the client only.

sys.dm_exec_connections etc don't have anything to show whether a query is asynchronous or not

  • thanks! Do you have any idea about what my problem would be here? Do you think that the query time is short and async call is pointless in this case? – tugberk Apr 3 '12 at 8:49
  • In this case, my gut feeling is "KISS". Do you need asnyc processing? If not, don't add complexity – gbn Apr 3 '12 at 8:52
  • Actually, the sample I have referred is just a try-out. I have some complex and long running queries which can benefit from running async with .NET client. – tugberk Apr 3 '12 at 8:54
1

SQL Server only supports synchronous calls. If you are doing async via .NET as far as the database knows they are sync. Any performance problems would be from the .NET side.

1

I would use the Profiler to monitor connections and determine if a query completed - it can give you a complete information about what connects and what runs.

However, could you solve your problem using a more mainstream approach, such as starting a new thread, opening a normal SqlConnection in it, and executing a SqlCommand?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.