I/O Completion Ports vs. Asynchronous I/O

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Josh

    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


  • Ivar

    #2
    Re: I/O Completion Ports vs. Asynchronous I/O


    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" <josh@chegg.com > wrote in message
    news:behaqs$l99 @library1.airne ws.net...[color=blue]
    > 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[/color]
    would[color=blue]
    > give me the presumed performance benefits of IOCP, while letting me code[/color]
    the[color=blue]
    > 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[/color]
    can[color=blue]
    > simply tell me which path would be better for writing something like a[/color]
    full[color=blue]
    > featured mail server, and your reasons behind that decision, that would be
    > great as well. Thanks!
    >
    > Josh Carlson
    >
    >[/color]


    Comment

    • Tom Shelton

      #3
      Re: I/O Completion Ports vs. Asynchronous I/O


      "Josh" <josh@chegg.com > wrote in message
      news:behaqs$l99 @library1.airne ws.net...[color=blue]
      > 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[/color]
      would[color=blue]
      > give me the presumed performance benefits of IOCP, while letting me code[/color]
      the[color=blue]
      > 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[/color]
      can[color=blue]
      > simply tell me which path would be better for writing something like a[/color]
      full[color=blue]
      > featured mail server, and your reasons behind that decision, that would be
      > great as well. Thanks!
      >
      > Josh Carlson[/color]

      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


      Comment

      • George Gre

        #4
        Re: I/O Completion Ports vs. Asynchronous I/O


        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" <tshelt@yahoo.c om> wrote in message
        news:uL$KUOkRDH A.2432@TK2MSFTN GP10.phx.gbl...[color=blue]
        >
        > "Josh" <josh@chegg.com > wrote in message
        > news:behaqs$l99 @library1.airne ws.net...[color=green]
        > > A while back I started a project to write a mail server. I was doing[/color][/color]
        this[color=blue][color=green]
        > > in c++ and found that I/O completion ports were the best solution for[/color][/color]
        the[color=blue][color=green]
        > > project. I've since decided to port my application to the .NET[/color][/color]
        framework[color=blue][color=green]
        > > 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[/color][/color]
        IOCP[color=blue][color=green]
        > > API calls into my application and continue to use them. This solution[/color]
        > would[color=green]
        > > give me the presumed performance benefits of IOCP, while letting me code[/color]
        > the[color=green]
        > > 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[/color][/color]
        two[color=blue][color=green]
        > > methods and wanted to know if anybody has such data. Alternately if you[/color]
        > can[color=green]
        > > simply tell me which path would be better for writing something like a[/color]
        > full[color=green]
        > > featured mail server, and your reasons behind that decision, that would[/color][/color]
        be[color=blue][color=green]
        > > great as well. Thanks!
        > >
        > > Josh Carlson[/color]
        >
        > 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
        >
        >[/color]


        Comment

        Working...