Solved

Fastest components for high-load TCP server

Posted on 2004-10-28
345 Views
Last Modified: 2010-05-18
Dear Experts,

Please share your opinion about fastest TCP/IP components/libraries to write high-load TCP server. Indy? PowerTCP? ... ?
Also, what stress tools could you recommend?

TIA,
dumb
0
Question by:iam_dumb
    3 Comments
     
    LVL 17

    Expert Comment

    by:Wim ten Brink
    To keep it simple... I think the most important thing to keep an eye on is the speed of your network connection and the ease that those components allow you to create whatever you need. And since most TCP/IP components are just plain wrappers around the WinSock library, you could get a huge performance increase by keeping your own code as optimized for speed as possible.
    0
     

    Author Comment

    by:iam_dumb
    Yes, I've noticed that they mostly wrappers, but some of them uses some unusual things like fibers and IOCP (Indy10), but I was unable to test it since it still under heavy development. I'm not sure if these technologies will have any advantage for my server. What guru says?
    0
     
    LVL 17

    Accepted Solution

    by:
    In general, TCP/IP is best used in an asynchronous way, meaning that you send a command and just keep running without waiting for a response. Sooner or later you will get a response and this needs to be handled, of course. The reason for this is of course the slowness of the network. The system can process data much faster than the network can send it. Thus, the first preference would be a component set that works asynchronous.

    The use of IOCTL, fibers and threads is one good way to deal with these things. I still prefer to use Indy 9 at the moment but the generic setup I use is that I use one idTCPClient for client-side applications but I will have two threads dealing with it. One thread that continuously waits for a message and a second one that will send the commands to the server. For the server-side, you'd be using an idTCPServer component and basically, all this component will be doing is waiting for a command, do some processing and then send a response back. This is best done with a single thread for every connection and basically, you're not going to send data without the client asking for any. Indy is offering multi-threading support for these server-components, which basically means that one connection doesn't interfere with another connection, as long as you remember that you're dealing with a multi-threaded environment.

    A thread pool like Indy offers could be useful since it sometimes will reuse a thread instead of destroying it. Not too useful if you have a huge amount of different connections at the same time because it will be somewhat limiting in those situations, but when you have a large amount of connections coming one after the other, a pool would be pretty useful.

    But most important of all is not the choice of the component but becoming very familiar with the technique and knowing where to gain the performance increase you need. Sometimes it just helps to add more RAM or a faster disk. Other times, you have to go deep in your code and alter some string-handling routines just to squeeze a bit of performance out of them. It's not easy...
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: From Zero to Hero with Nodejs & MongoDB

    Interested in Node.js, but don't know where to start or how to learn it properly? Confused about how the MEAN stack pieces of MongoDB, Expressjs, Angularjs, and Nodejs fit together? Or how it's even possible to run JavaScript outside of the browser?

    Suggested Solutions

    In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
    Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
    This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    913 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now