我如何验证我的异步/等待是使用I / O完成端口? [英] How can I verify that my async/await is using I/O completion port?

查看:137
本文介绍了我如何验证我的异步/等待是使用I / O完成端口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在转换数据库存储过程调用是异步的,利用异步/等待。基于该方法类似描述这里

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

这个答案,我想验证异步调用实际使用I / O完成端口。如果它最终等待另一个线程的线程池,那么它有效地击败转换通话的目的。

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.

什么是验证的最佳方法,一个I / O正在使用完成端口,它不是简单地阻止另一个线程?

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?

推荐答案

调用 WAITFOR DELAY'1 :00:00 并行1000倍。如果使用远低于1000线程,你得到螺纹IO。你应该可以看到几十家(其中包括大量的通过运行时和框架启动程序的线程)。

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).

您也可以用调试器打破,并确保没有线程当前等待IO。您可以从堆栈跟踪告诉。这适用于任何现有的应用程序。

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.

这篇关于我如何验证我的异步/等待是使用I / O完成端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆