>> Which protocol ?
>
> Well, I'm basically using TCP. My client inherits from tWSocket and uses
> it's own XML-based protocol to deliver data blocks of around 256kB to
> the server (which is also a self-written Delphi ICS application).
>
> When connecting to the server app over a 1Gbps network cable with 2ms
> RTT I get only around 3-5MB/s. Processing each data block takes <5ms and
> I expected to gain at least 20MB/s of throughput.

Using the same client or server, at the same time in the day, are you able 
to check for network thruput using other tools ? For example, send a 500MB 
file from client to server using windows file copy or FTP and measure what 
it the thruput. You'll have an idea of the basic network thruput. Many 1Gbps 
networks actually doesn't work at that speed at all.

You may also write two very simple client and server applications. The 
client sending 256KB of data comming from memory (to avoid disk I/O 
slowness) and the server just reading the data and throwing it away (do not 
write to disk or allocate memory to store data). You'll have an idea abour 
the maximum thruput you can have.

Here are a few ideas to get high performances:
1) Use a separate thread to run your sockets
2) Do not write to the screen or to files synchronously: use a memory queue 
and have a separate thread empty the queue either for display (main thread) 
or to disk or DB.
3) If your hardware enables it, use jumbo frames at both client and server 
side
4) Enlarge winsock buffers
5) Enlarge TWSocket send buffer (BufSize property) to mach actual network 
packet size. By default BufSize is the size of a standard ethernet packet.
6) Avoid dynamic memory allocation as much as possible, including long 
strings and dynamic arrays.
7) Call TWSocket.Send and TWSocket.Receive with the largest possible buffer.
8) Make sure you are not disk I/O bound : if your data comes from disk or go 
to disk, it may happend that your are limited by disk thruptu which maybe 
quite slower than 1Gbps once the cache has been overflown.
9) Make sure your CPU is fast enough. Usually you need qui CPU power to 
process data at a sustained rate of 1Gbps.
10) Avoid anything blocking, allow the message pump to run as fast as 
possible, at least in the thread handling your sockets
11) Use multithreading with a multicore CPU: separate actual network I/O and 
data processing. Design your code to avoid Synchronize as much as possible. 
Avoid critical sections number and range as much as possible (this will 
maximize parallelism).
12)....


--
[EMAIL PROTECTED]
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to