473,387 Members | 3,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

I/O Completion Ports vs. Asynchronous I/O

A while back I started a project to write a mail server. I was doing this
in c++ and found that I/O completion ports were the best solution for the
project. I've since decided to port my application to the .NET framework
and noticed that the concept of an I/O completion port doesn't exist
natively in the framework. It does have similar counterparts with
BeginRead, BeginSend, etc.

I see I have two options, I can write some unsafe code to import the IOCP
API calls into my application and continue to use them. This solution would
give me the presumed performance benefits of IOCP, while letting me code the
rest of the application in .NET. Alternately I could use .NET's
BeginRead/BeginSend/etc. which would let me have a completely managed
solution, while losing some of the performance benefits. I really don't
have any benchmarking data comparing the efficiency/scalability of the two
methods and wanted to know if anybody has such data. Alternately if you can
simply tell me which path would be better for writing something like a full
featured mail server, and your reasons behind that decision, that would be
great as well. Thanks!

Josh Carlson
Jul 19 '05 #1
3 10567

Hi,

I have done mailserver without asyncronous communication.
(Each session has it's own thread, which is created by control/listner
thread)
Speed is ok. I tried async and didn't get any prefrormace gain instead code
will be more messy.

See it yourself: www.lumisoft.ee .
(You may get some idea from there or you may suggest me improvements)

"Josh" <jo**@chegg.com> wrote in message
news:be********@library1.airnews.net...
A while back I started a project to write a mail server. I was doing this
in c++ and found that I/O completion ports were the best solution for the
project. I've since decided to port my application to the .NET framework
and noticed that the concept of an I/O completion port doesn't exist
natively in the framework. It does have similar counterparts with
BeginRead, BeginSend, etc.

I see I have two options, I can write some unsafe code to import the IOCP
API calls into my application and continue to use them. This solution would give me the presumed performance benefits of IOCP, while letting me code the rest of the application in .NET. Alternately I could use .NET's
BeginRead/BeginSend/etc. which would let me have a completely managed
solution, while losing some of the performance benefits. I really don't
have any benchmarking data comparing the efficiency/scalability of the two
methods and wanted to know if anybody has such data. Alternately if you can simply tell me which path would be better for writing something like a full featured mail server, and your reasons behind that decision, that would be
great as well. Thanks!

Josh Carlson

Jul 19 '05 #2

"Josh" <jo**@chegg.com> wrote in message
news:be********@library1.airnews.net...
A while back I started a project to write a mail server. I was doing this
in c++ and found that I/O completion ports were the best solution for the
project. I've since decided to port my application to the .NET framework
and noticed that the concept of an I/O completion port doesn't exist
natively in the framework. It does have similar counterparts with
BeginRead, BeginSend, etc.

I see I have two options, I can write some unsafe code to import the IOCP
API calls into my application and continue to use them. This solution would give me the presumed performance benefits of IOCP, while letting me code the rest of the application in .NET. Alternately I could use .NET's
BeginRead/BeginSend/etc. which would let me have a completely managed
solution, while losing some of the performance benefits. I really don't
have any benchmarking data comparing the efficiency/scalability of the two
methods and wanted to know if anybody has such data. Alternately if you can simply tell me which path would be better for writing something like a full featured mail server, and your reasons behind that decision, that would be
great as well. Thanks!

Josh Carlson


Josh,

On nt based systems, the Async IO functions use completion ports under the
hood. You don't have to do anything except use the BeginXXX methods.

Tom Shelton
Jul 19 '05 #3

Hi,

I have also implement a IOCP solution using WinAPI/C++ and a .NET C# using
BeginXXX.. calls.

I have done some performance testing between the two by running 50+ clients
sending the server 50K data and the server echoing
back the data to the client. Responses were in the order of <10ms in both
solutions and the CPU almost in idle state. The big difference was that the
..NET solution was using more threads and far more memory.

Hope this helps,
George.

"Tom Shelton" <ts****@yahoo.com> wrote in message
news:uL**************@TK2MSFTNGP10.phx.gbl...

"Josh" <jo**@chegg.com> wrote in message
news:be********@library1.airnews.net...
A while back I started a project to write a mail server. I was doing this in c++ and found that I/O completion ports were the best solution for the project. I've since decided to port my application to the .NET framework and noticed that the concept of an I/O completion port doesn't exist
natively in the framework. It does have similar counterparts with
BeginRead, BeginSend, etc.

I see I have two options, I can write some unsafe code to import the IOCP API calls into my application and continue to use them. This solution

would
give me the presumed performance benefits of IOCP, while letting me code

the
rest of the application in .NET. Alternately I could use .NET's
BeginRead/BeginSend/etc. which would let me have a completely managed
solution, while losing some of the performance benefits. I really don't
have any benchmarking data comparing the efficiency/scalability of the two methods and wanted to know if anybody has such data. Alternately if you

can
simply tell me which path would be better for writing something like a

full
featured mail server, and your reasons behind that decision, that would be great as well. Thanks!

Josh Carlson


Josh,

On nt based systems, the Async IO functions use completion ports under the
hood. You don't have to do anything except use the BeginXXX methods.

Tom Shelton

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: andy | last post by:
My Winsock app works fine when compiled using VC++ 6 compiler, however I get runtime exceptions under heavy load if I recompile using Visual Studio .NET, the exceptions point to "GetProcessHeap()"...
67
by: Steven T. Hatton | last post by:
Some people have suggested the desire for code completion and refined edit-time error detection are an indication of incompetence on the part of the programmer who wants such features. ...
3
by: Josh | last post by:
A while back I started a project to write a mail server. I was doing this in c++ and found that I/O completion ports were the best solution for the project. I've since decided to port my...
1
by: Nadav | last post by:
Hi, Introduction: ************************* I am developing communication infrastructure for a streaming video server, to achieve optimal performance I use IO Completion ports & a thread pool...
3
by: TCORDON | last post by:
How can I determine the moment a thread finishes? I start the thread this way: Dim x As New Threading.Thread(AddressOf (MySub)) x.Start
0
by: Bishoy George | last post by:
Hi, I have a asp.net 2.0 web application. I want to implement the asynchronous model through http handler in web.config ...
2
by: joaquimfpinto | last post by:
Dear All, I made an app in c# that uses several serial ports. For the serial ports I use a pnp Sunix board, some with 8 serial ports other with 4 or even 2 serial ports. Whenever I use the...
3
by: }{ | last post by:
I have an app that reads a character string on com 1, waits for a signal (any ascii char) on com 2, then outputs the string on com 2. I seem to have a problem with the timing. It just so happens...
5
by: rome ez | last post by:
I am trying to write a vb.net socket application which listens for clients on two ports simultaneously. Is it possible to do so and how can this be done. Please help.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.