Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
675 views
in Technique[技术] by (71.8m points)

performance - How does .NET make use of IO Threads or IO Completion Ports?

We have a .NET application that makes several concurrent calls to various web services, collects their responses and then makes a few calculations off those responses. In attempting to derive additional performance, I've been investigating the use of approaches that make use of .NET's IO threading via the use of IO completion ports. I've read through several resources including Joe Duffy's recent book Concurrent Programming on Windows and while I "get" their usefulness, I'm a little unclear as to their behavior within .NET and am looking for a concise explanation.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Chances are that you don't have to do anything if you are using the asynchronous methods already. Depending on the technology that you are using for the call to the web service, ultimately, it's going to drop down to the Win32 API to make the call to get bytes from the network, and to that end, it will use I/O Completion Ports in order to handle asynchronous calls.

The basic premise behind I/O completion ports is that when waiting on I/O operations, there is a thread pool that is kept waiting for when the I/O operations complete (assuming you registered to use I/O completion ports). When your registered operation completes, the thread from the I/O completion port thread pool is used to handle the callback.

Of course, after calling out to the I/O completion port, your thread can move on to do more work, or terminate, the choice is up to you.

The following should help describe it more:

I/O Completion Ports:

http://msdn.microsoft.com/en-us/library/aa365198(VS.85).aspx

Inside I/O Completion Ports (WayBack Machine):

https://web.archive.org/web/20101101112358/http://doc.sch130.nsc.ru/www.sysinternals.com/ntw2k/info/comport.shtml


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...