.Net BeginInvoke simply defers execution to another thread. It will always be slower than a synchronous call and consume additional resources. The only reason this will be used is to free the callerโs context for other operations (for example, return the result of an HTTP request to the client).
SqlClient asynchronous methods, when the AsynchronousProcessing property in the connection is set to true and the BeginExecute methods for SqlCommand are used, are truly asynchronous. An SQL command is sent to the network communication channel, and termination is triggered when the result is returned by the server.
In terms of reliability, though none of these methods are useful. They both rely on the client process to stay around until the call is completed, otherwise SQL Server will see the client disconnect and refuse processing, rolling back any intermediate work. Consider an ASP application that has accepted an HTTP request, sent "asynchronous" payment processing, and returned a response. There is no way to guarantee that the work presented will actually happen.
In situations where processing requires reliability, the solution guarantees a queue for work on the server, fixes it and then continues, relying on SQL Server's own asynchronous processing capabilities. This is a method that guarantees processing even when there are client disconnections, processing ASP processes, mirroring SQL Server or failover clusters, hardware disaster recovery, pretty much anything that you can pounce on it, because it is a transactional, robust way to send asynchronous requests processing. For an example, see Executing an Asynchronous Procedure .
Remus Rusanu
source share