[jcifs] speed writing to a file?

Frank Xia FXia at esri.com
Sat Nov 17 07:17:58 EST 2001


Thanks for your response. I cut and paste my testing results here for your

jCIFS time (ms)		File system time (ms) (\\desktop2\public)
501			60
511			50
481			90
500			60
500			90
461			80
491			50
491			100
491			60
451		      60	

To local disk

jICFS time (ms)

Please note that I was running the testing in a laptop that writes to a
desktop in the same network segment. Both machines are running Windows 2000.
Of course, I didn't change any default settings since I just started to play
with it and not aware of how to do it yet. My part of the application will
mostly generate small JEPG/PNG etc image files (we do have other part of the
application will read much bigger files from disk). I am using
System.currentTimeMIllis() method to get the time before and after the
method call to generateJPEGSmb(). 



-----Original Message-----
From: Michael B. Allen [mailto:mballen at erols.com]
Sent: Friday, November 16, 2001 3:10 PM
To: Frank Xia
Cc: jcifs at lists.samba.org
Subject: Re: [jcifs] speed writing to a file?

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
> some questions about its speed. I tested with my own application running
> 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?


More information about the jcifs mailing list