[jcifs] Delay in listing network hosts
mballen at erols.com
Fri Nov 16 19:41:28 EST 2001
On Thu, 15 Nov 2001 12:48:38 -0800
"Kurien Mathew" <kurien at envivio.com> wrote:
> > 1) What _exactly_ are you doing?
> I adapted the code from the SmbCrawler example.
> The example invokes SmbFile.list() on each resource traversing the depth
> specified in the command line.
> I needed to traverse atmost 2 levels
> 1) workgroup
> 2) hosts
> So I tried the following commands with the SmbCrawler example
> java -classpath .;c:\lib\jcifs-0.5.1.jar SmbCrawler smb:// 2
> java -classpath .;c:\lib\jcifs-0.5.1.jar SmbCrawler smb://pdx 1
> Both of them take 9-11 seconds to list all the 15 hosts.
Well think about what's happening. You are _sequentially_ connecting to
and authenticating with each host and enumerating shares. These times
don't surprise me. The new version I'm about to release will do much
better with exactly this sort of thing however because the top level
glue that drives how the client behaves is much smarter.
> > 2) What type of name service are you using (WINS, DNS, ...)?
Well, names returned from enumerating hosts in a workgroup are NetBIOS
names so DNS is never used. I can see all the lookups are broadcast
Admittedly the example trace is rather noisy. I'm confident the next rev
will do better. If you used the ThreadedSmbCrawler you could probably
get that time down to 2 secs but of course there's a lot more overhead
with creating a bunch of threads like that.
More information about the jcifs