> I have test several modes(have/not have I/O Buffere) and the size of
> the buffer
> and get rid of the writing file in recever when test
> now the speed is avg. 10.2MB/s (my LAN is 100Mbps)
That's reasonable (but see below). Once you allow for the overheads of TCP,
and IP, you are not going to get very much closer to the theoretical bandwidth
of 12.5 MB/s (or 11.9 if you use binary megabytes).
> I also change the size of the buffer
> when 1KB,the speed is 5.4MB/s
> 10KB is 7.7 MB/s
> but after 100KB(500KB,1MB,2MB,5MB,10MB)
> the speed is standing in 10.2MB/s
That's a bit odd. In a test on my LAN I don't have to use nearly that big a
buffer to get reasonable speeds. Using a 1024 byte[] read/write buffer (and no
BuifferedXxxputStreams) I see speeds of 11.7 MB/s reading and 11.4 writing.
Increasing the buffer size to (8*1024) bytes results in 11.7 MB/s reading and
writing. Increasing it again to (64*1024) made no significant difference. (My
MBs here are one million bytes, not 1024*1024).
The buffer size made a bigger difference to the CPU load when writing. The CPU
load was about 75% when reading using any of the three buffer sizes; but when
writing it was at about 85% for the smaller buffer, around 50% with the 8K
buffer, and about 45% with the largest buffer.
I don't know why this machine/network is getting better figures than you from a
smaller buffer. FWIW, the test machine is a 1.5GHz Celeron laptop running
WinXP Pro (sp1, not sp2). The other machine in the test is a faster Win2K
machine with a better network card and using huge buffers (so it shouldn't
affect the tests at all). The test machine was using the JDK 1.5.0_6 client
JVM. (-server gives essentially the same numbers). The LAN itself is an
unloaded 100Mbps Ethernet; there are two switched hubs between the two machines
(but I know from previous testing that they don't affect bandwidth tests
measurably).
One thing that /might/ be relevant is that neither of my test machines use
Window's built-in firewall/packet filtering, and have no other internal
fire-wall. I don't /think/ that either machines' virus checkers actively
monitor the contents of arbitrary TCP streams (I was using ports 3344 and 4433
for the tests) but it's impossible to be sure.
-- chris
JTL.zheng - 21 Dec 2006 07:48 GMT
Thank you very much for your particular explanation Chris Uppal.
As it has almost get the limit of the LAN's bandwidth and I have some
examinations to prepare, I have not modified it these weeks.
but it is used to transfer files in our LAN now, and it works well.
Thanks again for all of your help.
: )