Find the answer to your Linux question:
Results 1 to 2 of 2
I am developing an intermediate server application, which will serve around 10000 clients. The server is supposed to receive real time data feed from another source and provide it to ...
  1. #1
    Just Joined!
    Join Date
    May 2009
    Posts
    1

    Optimization of TCP/IP

    I am developing an intermediate server application, which will serve around 10000 clients. The server is supposed to receive real time data feed from another source and provide it to each client. Each client will receive same data.

    Now, every time send() is called, the data will be copied from application buffer to kernel buffer. But since its the same data thats being sent, I would like to know whether, it is possible to tell kernel to copy it just once and then directly transfer it from kernel buffer to NIC buffer without switching to user space mode.
    I have heard abt Zero-copy techniques.
    But the sendfile() function which implements this technique is not suitable in my case, as the data is not being read from a disk file. Rather, the intermediate sever application will be receiving this data from another source.
    Other functions implementing zero-copy such as splice() only work with pipes.

    Is there any way to achieve this???
    Thanx in advance !!

    Regards,
    Vihang

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    I don't know about the buffering issue, but your bigger problem is going to be getting that data to each of 10,000 clients. I hope you are able to multicast or broadcast this data, otherwise your buffering issues are going to pale in comparison with the resulting network traffic and overhead. Can the clients afford to miss any messages? If they do, are the messages serialized such that if they discover they are missing one they can ask for it to be resent to them?

    Remember my philosophy - it is much easier to get well-written application to a specific level performance, than to fix or enhance an application that was poorly written in order to get a specified level of performance in the first place. So, concentrate on writing a solid, well-architected, modular piece of code. Each operation should only occur once in your code - you should not have instances of that operation scattered throughout, but should have a function or class to handle it which can be invoked where needed. Then, you can profile the system and determine where you need to deal with performance problems, and have only a few places in your code to change accordingly.

    Finally, you might want to consider some sort of message bus or message queuing product (proprietary or open source) that supports a publish-subscribe model instead of trying to do this yourself. Trust me, this is very difficult code to get right. I personally have 30 years of experience in message-passing and message-bus software usage and development. I have programmed extensively with AMAT's MBX/DMBX message bus, DEC Message-Q, IBM's MQ-Series, TIB/RV, and Microsofts MSMQ products, as well as Posix queues and JMS. I was also involved as an engineer on the MBX/DMBX when I was principal engineer at FASTech Integration and Brooks Automation before AMAT bought out Brooks' software division a couple of years ago, so I know something of what I speak in this domain.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...