java i/o performance

Hi all,

I run into a java i/o performance everytime I do this:

File myfolder = "S:\\remote\\";

File[] manyFiles = myFolder.listFile();

for(int i=0; i<manyFiles.lenghth; i++)

{

manyFiles.getName();

}

I notice ths listFile() only return abstract pathnames to those remote files. So, everytime I want to get an attribute of them, java actually goes out to the remote folder to get it. That causes serious performance when reading remove files' attributes.

any idea of how to solve to improve this performance?

thanks>

[592 byte] By [happy2005a] at [2007-11-27 11:08:34]
# 1

> remote folder to get it. That causes serious

> performance when reading remove files' attributes.

Serious performance issues? I'm skeptical. I've never experienced anything like this.

> any idea of how to solve to improve this

> performance?

Nope. The only idea I have is for you to go out, find a way to code this is some other programming language that can do it faster, and invoke it with JNI. Otherwise, quit complaining.

tjacobs01a at 2007-7-29 13:29:31 > top of Java-index,Java Essentials,Java Programming...
# 2

happy, ive implemented the same code that did a helluva lot more

and i was able to read into memory and process every single

file and folder on my computer (~300,000) in 20 seconds.

Windows itself doesnt search that fast.

TuringPesta at 2007-7-29 13:29:31 > top of Java-index,Java Essentials,Java Programming...
# 3

can you give me an idea of how u did it?

happy2005a at 2007-7-29 13:29:31 > top of Java-index,Java Essentials,Java Programming...
# 4

EXACTLY the way you posted it.

maybe you just have a slow computer?

TuringPesta at 2007-7-29 13:29:31 > top of Java-index,Java Essentials,Java Programming...
# 5

for local file, it's OK. it takes 1 to 2 seconds to get attribute for 16K files

but for remote, it's a huge drop in performance..10 minutes..

happy2005a at 2007-7-29 13:29:31 > top of Java-index,Java Essentials,Java Programming...
# 6

If you are talking about "remote" files, then I would guess the problem is with the network, not Java.

You should probably write some application that you can invoke on the remote server to build a list of all the files and file data that you need and then sent that information back to the client to reduce network traffice.

However, I have no idea how to do this.

camickra at 2007-7-29 13:29:31 > top of Java-index,Java Essentials,Java Programming...
# 7

yah, must be the network. Or the operating system network layer as he's quite obviously using a network drive mapping.

Or maybe the drive he's working on remotely is an external harddisk on a remote computer that's connected over a slow USB or serial cable, or is not a local drive on that computer either but goes through yet another network connection.

jwentinga at 2007-7-29 13:29:31 > top of Java-index,Java Essentials,Java Programming...
# 8

this is not a network problem because i used SynBack to retrieve all those files information within 20 seconds..

happy2005a at 2007-7-29 13:29:31 > top of Java-index,Java Essentials,Java Programming...