Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I verify that my async/await is using I/O completion port?

I am currently converting a database stored procedure call to be asynchronous, leveraging async/await. Similar to the method described here.

Based on this answer, I'd like to verify that asynchronous call is actually using I/O completion ports. If it's ultimately waiting on another thread from the ThreadPool, then it is effectively defeating the purpose of converting the call.

What is the best way to verify that an I/O completion port is being used and it's not simply blocking on another thread?

like image 806
CodeNaked Avatar asked Sep 11 '13 11:09

CodeNaked


1 Answers

Invoke WAITFOR DELAY '1:00:00' 1000 times in parallel. If far less than 1000 threads are being used, you are getting threadless IO. You should see a few dozens (which includes lots of utility threads started by runtimes and frameworks).

You can also break with the debugger and make sure that no thread is currently waiting for IO. You can tell from the stack trace. This works with any existing application.

like image 167
usr Avatar answered Nov 07 '22 08:11

usr