Fastest components for high-load TCP server

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?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Wim ten BrinkSelf-employed developerCommented:
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.
iam_dumbAuthor Commented:
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?
Wim ten BrinkSelf-employed developerCommented:
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...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.