Slashdot Mirror


Boosting Socket Performance on Linux

Cop writes "The Sockets API lets you develop client and server applications that can communicate across a local network or across the world via the Internet. Like any API, you can use the Sockets API in ways that promote high performance -- or inhibit it. This article explores four ways to use the Sockets API to squeeze the greatest performance out your application and to tune the GNU/Linux® environment to achieve the best results."

6 of 138 comments (clear)

  1. No mention of alternatives to select? by complexmath · · Score: 4, Informative

    Tuning socket parameters is great and all, but the real performance problem with socket IO has to do with using select and poll. There are high-performance alternatives (which admittedly tend to vary from OS to OS) that are so far superior that I wouldn't even consider the default methods unless complete code portability were a crucial factor.

    1. Re:No mention of alternatives to select? by hackstraw · · Score: 4, Informative

      Try this:

      http://www.xmailserver.org/linux-patches/nio-impro ve.html /dev/epoll

      The website is hideous, but there used to be benchmarks against different polling/selecting methods. If I remember correctly, its kinda trial and error, YMMV, kind of stuff. Its worth a look.

  2. Re:I've always wanted to know if it is possible by pclminion · · Score: 4, Informative
    Netcat might be what you want. It has two modes, a "client" and "server" mode. In client mode, it connects to an IP/port that you specify, then reads data from stdin and sends it through that socket. In server mode, it listens on a port you specify, and prints any data it received to stdout.

    Is that what you're looking for?

  3. Re:Code Portability by complexmath · · Score: 5, Informative

    There was a Boost library in the works to encapsulate all of this rather nicely, but I'm not sure if it ever made it out of beta. ACE is another option, though that tends to be overkill for some projects. I rolled my own class wrapper around this stuff, but then I enjoy library programming.

  4. Re:Hello 1995 by pthisis · · Score: 4, Informative

    In the same line - where is the discussion of different FD table polling mechanisms? select() versus poll(), and wheres the writeup about Linux's epoll(). I would have been interested in an epoll() article, especially how it compares to FreeBSD's kqueue().

    For the overview, you want Dan Kegel's c10k page:

    http://www.kegel.com/c10k.html

    --
    rage, rage against the dying of the light
  5. Re:Be aware by jas0n · · Score: 4, Informative

    Looks like a rip off of an OnLamp article from a few months ago, and not a very good one at that! At least the OnLamp article explained how to tweak a few more OS's and the math was correct. And just to add insult to injury the article on OnLamp was written by one of those Berkeley guys ;-)