How can I verify that my asynchronous / standby uses an I / O completion port?

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

Based on this answer , I would like to make sure that the asynchronous call actually uses the I / O completion ports. If it ultimately waits for another thread from ThreadPool, then it effectively violates the call conversion purpose.

What is the best way to verify that the I / O completion port is being used and it is not just blocking another thread?

+6
source share
2 answers

Call WAITFOR DELAY '1:00:00' 1000 times in parallel. If at least 1000 threads are used, you get a stream without input. You should see a few dozen (which include many useful threads running at runtime and frameworks).

You can also break with the debugger and make sure that no thread is currently waiting for I / O. You can find out from the stack trace. This works with any existing application.

+3
source

I would create some perfmon counters and update them in thread pool threads. Then you can see how the application is used, and see how many threads are used at any given time, which, in turn, can help you configure the number. You can also log the time that was spent in each thread and count it so you can see the average wait time, this will help you determine if they were blocked, although I think the number of threads will also show it - d see a few completed right away if they are waiting for each other. Depends on the work you do.

I did this a few years ago for a web application, it was very informative for tuning application performance.

0
source

Source: https://habr.com/ru/post/953621/


All Articles