[jcifs] SmbFileInputStream performance issue

andy chernow achernow at yahoo.com
Mon Aug 12 08:28:56 EST 2002


I have a problem with the SmbFileInputStream and how
well it is performing.  I am only able to to grab a
file from the server, using jCIFS, at ~25-35
kilobytes/sec.  Here is my setup and then I will list
my extremly simple code example.  

I have a RedHat 7.3 server running Samba2.2.5.  The
server is on a T1 connection which is currently only
used by me.  I have one user and one share setup for
accessing the samba server.  Let's say the username is
'foo', password is 'bar' and share is 'testshare'.  

Simple test code.  All tests performed on win2k
accessing the same samba server!

import java.io.*;
import jcifs.smb.*;

class test
{
  static String url =
"smb://foo:bar@hostname/testshare/file1.75MB.zip";

   public static void main(String[] args) throws
Exception
   {
      FileOutputStream out = new
FileOutputStream("file1.75MB.zip");
      SmbFileInputStream in = new
SmbFileInputStream(url);

      // this is copied from jcifs site
      int n;
      byte[] buf = new byte[8192];
      while((n = in.read(buf)) != -1)
         out.write(buf, 0, n);
      out.close();
      in.close();
   }
}

For some reason, the above is always very slow.  
Cable Modem: ~36 kilobytes/second
DSL Modem:   ~30 kilobytes/second

Now, if I map the share 'sharetest' on my Win2k
machine as a Drive and then do a drag-n-drop of
file1.75MB through standard windows mechanisms, it
transfers at:
Cable Modem: ~140 kilobytes/second
DSL Modem:   ~130 kilobytes/second
This test removes the possiblity that the Samba server
has a poor config.

Using OpenSSH SCP, both get ~150 kilobytes/second
Using ProFTPD FTP, both get ~140 kilobytes/second
Using Apache  HTTP, both are ~125 kilobytes/second

So why when I use SmbFileInputStream am I seeing such
a decrease in data transfer performance?  

I would appreciate any suggestions, I am currently at
a loss.  Maybe I am missing something very simple.

Thank you in advance,
/sLaKr


__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com



More information about the jcifs mailing list