commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel F. Savarese" <...@savarese.org>
Subject Re: [commons-net ftp] why is commons ftp so slow compared with http?
Date Fri, 11 Aug 2006 02:48:05 GMT

In message <20060809035054.15472.qmail@web52701.mail.yahoo.com>, Anil Philip wr
ites:
>My program is logging into my server and doing an ls
>in an almost empty directory. It takes about 10
>seconds.
>Contrast this with: I create an .htaccess file in the
>same dir so that the dir can be accessed in Internet
>Explorer and lists the folder contents. (Options
>+Indexes). It takes about 2.5 seconds.
>why is commons-net so painfully slow compared with
>http for a similar operation? (Is it just the
>authentication?)

Presumably you're talking about FTP.  FTPClient is far from perfect
and its implementation is very dated and inefficient.  However, one
should always keep in mind that the basic code has been used by 
innumerable programmers for almost 10 years now, so when you run
into an issue like this, it's probably not commons-net, but rather
how you're using it.

First, establishing a new FTP connection every time you list a
directory will always be slower than HTTP.  First you have to log in,
then you have to establish a data connection for the file listing.
The fact that it takes 10 seconds for you has to do with your
particular code and runtime environment.  Using a modified version
of the ftp.java example (so that it will print a listing in addition
to performing the file transfer), I can list 
ftp://distro.ibiblio.org/pub/linux/distributions/fedora/linux/core/5/i386/os/
and 
download
ftp://distro.ibiblio.org/pub/linux/distributions/fedora/linux/core/5/i386/os/RPM
-GP-KEY
in less than a second.  And that includes the JVM start up time (I
just use /usr/bin/time to time it).

Without a precisely specified test case that other people can run to
try to reproduce the behavior you are encountering, there's no telling
what you are experiencing.

daniel


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message