Thread: fast AIO that supports sockets

  1. #1
    Registered User
    Join Date
    Aug 2012
    Posts
    20

    fast AIO that supports sockets

    Hi everyone!
    I would like to create SCGI server library, that would be completely based on asynchronous IO. I have been wandering around the internet for a few weeks now, but have not found suitable solution. I need asynchronous io implementation, that would be fast and be able to work with sockets at the same time.
    Currently, i have read the following:
    - Posix aio is slow, because glibc implements it by putting every request to a separate thread and it doesn't support sockets by specification anyway, only "seekable file desciptors".
    - Linux native aio doesn't support sockets too.
    - There are some options on C10K problem's page The C10K problem, but that info is 10 years old and most of the links are dead.
    Please correct me if I'm wrong in any of these statements.
    Portability is not an issue for me - i target only linux.
    Anyone can suggest anything suitable?
    Thanks in advance!

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    I don't see evidence that Posix-aio and the native Linux libaio (io_xxx(), etc...) don't support sockets.
    aio(7) - Linux manual page

    Either way, why wouldn't and epoll() loop serve you just as well?

    You could even offload all the I/O details to another library: http://zeromq.org/

    gg

  3. #3
    Registered User
    Join Date
    Aug 2012
    Posts
    20
    Quote Originally Posted by Codeplug View Post
    I don't see evidence that Posix-aio and the native Linux libaio (io_xxx(), etc...) don't support sockets.
    aio(7) - Linux manual page

    Either way, why wouldn't and epoll() loop serve you just as well?

    You could even offload all the I/O details to another library: Distributed Computing made Simple - zeromq

    gg
    https://code.google.com/p/kernel/wiki/AIOUserGuide - in the performance considerations section it says, that socket, pipes, etc are not supported, and will block if one attempts to do something with them through io_submit. I have been reading that POSIX implementation "doesnt have to support sockets" somewhere on stack overflow. Undoubtly, with damn load of blocking threads executing a good ol' read(), it will accept sockets and pipes. But all of the faster implementations of POSIX aio known to me are based on linux libaio and, correspondingly, will block sockets.
    Last edited by wirmius; 10-11-2013 at 11:34 AM.

  4. #4
    Registered User
    Join Date
    Aug 2012
    Posts
    20
    zeromq, that you have suggested seems to me like an overkill, all i need is asynchronous io, that supports network. For example, lighttpd claim to be asynchronous, how do they achieve it?
    Last edited by wirmius; 10-11-2013 at 12:14 PM.

  5. #5
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    >> ... how do they achieve it?
    Source code is there: download - Lighttpd - fly light

    >> zeromq, ... seems to me like an overkill
    So it has way more functionality than your require - why should that prevent your from using it? It's all about "high performance" coupled with an easy-to-use interface. (Disclaimer: I've read the full guide, but haven't yet coded with it.)

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 19
    Last Post: 10-12-2012, 03:22 PM
  2. Linux Version that supports SMP
    By abachler in forum Tech Board
    Replies: 3
    Last Post: 07-19-2007, 10:46 AM
  3. OpenGL only supports BMP?
    By the dead tree in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 08-30-2004, 09:15 PM
  4. ASP.net forum that supports Access
    By Grayson_Peddie in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 12-18-2003, 01:44 AM
  5. Denmark supports the US on IRAQ
    By OneStiffRod in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 02-02-2003, 11:01 PM