[jcifs] speed writing to a file?

Michael B.Allen mballen at erols.com
Sat Nov 17 07:10:13 EST 2001


On Fri, 16 Nov 2001 12:31:12 -0500
Frank Xia <FXia at esri.com> wrote:

> All, 
> I just downloaded the jCIFS 0.51 and felt it's really easy to use but I got
> some questions about its speed. I tested with my own application running in
> one desktop and write a file to another desktop. The speed to write a 16K
> JPEG file (smb://desktop2/public/test.jpeg) comparing with direct writing
> through mapping such as \\desktop2\public\test.jpeg is at least 5 times
> slower. Is this about right? 
> My second question is that why the speed to write a file to a local disk
> (smb://desktop1/public/test.jpeg) even worse than to a disk in another
> machine. Did I miss something? 
> Any idea? 
> Thanks a lot
> Frank

Wow. That's pretty awful. What operating system is that? Here's what
I'm seeing on Linux talking to NT 4.0 sp3:

Wrote a 2.2 MB file in 33 seconds.

$ java -Djcifs.properties=../miallen.prp Put smb://angus/temp/mb22.bin
22577838 bytes transfered in 33 seconds at 684Kbytes/sec

The smbfs kernel smb client wrote the same file in 38 seconds.

# time /bin/cp mb22.bin /mnt
real	0m38.676s
user	0m0.050s
sys	0m2.320s

Writing it to the local machine to Samba took 5 seconds.

$ java -Djcifs.properties=../miallen.prp Put smb://nano/tmp/mb22.bin
22577838 bytes transfered in 5 seconds at 4515Kbytes/sec

Reading the file is admittedly faster. Took 22 seconds instead of 33.

$ java -Djcifs.properties=../miallen.prp Get smb://angus/temp/mb22.bin
22577838 bytes transfered in 22 seconds at 1026Kbytes/sec

Reading the file from the local machine is a snap.

$ java -Djcifs.properties=../miallen.prp Get smb://nano/tmp/mb22.bin
22577838 bytes transfered in 2 seconds at 11288Kbytes/sec

Now, admittedly there is an issue with writing because of a buffer
copy going on in the client whereas when reading there are no buffer
copies. One thing I'm not quite sure about is what the optimal
snd_buf_siz should be. I have played with this value in the past with
mixed results. You would think making it really large like 64K would be
wise. The default is 1300 bytes (below MTU to prevent fragmentation). Here
are some numbers:

snd_buf_size        time to write a 22mb file
1300                33
4096                28
16384               27
65536               27

Perhaps you should try a larger file? How are you timing this stuff?

Mike




More information about the jcifs mailing list