473,804 Members | 3,320 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 10599

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.airne ws.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.airne ws.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.c om> wrote in message
news:uL******** ******@TK2MSFTN GP10.phx.gbl...

"Josh" <jo**@chegg.com > wrote in message
news:be******** @library1.airne ws.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
323
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()" function. Is there any such VS .NET C++ known issue? Also, is it possible to write Winsock IO Completion Ports in C#? could not find any info on MSDN. please advise, many thanks,
67
4288
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. Unfortunately these ad hominem rhetorts are frequently introduced into purely technical discussions on the feasibility of supporting such functionality in C++. That usually serves to divert the discussion from the technical subject to a discussion of the...
3
414
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 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...
1
1699
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 in combination with winsock MsAPI ( e.g. ConnectEx, AcceptEx, … ), sending data through sockets is done with Read/WriteFile. The problem:
3
1288
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
1760
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 ------------------------------------------------------------------------------------------------------------------------- My web.config file: ---------------------
2
3962
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 development computer I don't have ay problem with my application.
3
1393
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 that the signal from com2 arrives at the same time as the next string for com1. Do the com ports run in sepaerate threads by default, or should I be doing something in code to make this happen. Thanks.
5
4424
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
9569
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10558
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10318
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10069
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9130
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7608
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6844
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2975
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.