cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Does libcurl cache downloads?

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Thu, 22 Dec 2005 13:52:04 -0800

On Thu, Dec 22, 2005 at 03:40:28PM -0500, Zibiao.Wei_at_atxinc.com wrote:
> I traditionally thought ftp is faster then http download. I did some tests
> using libcurl for both ftp and http. When download the same set of files, http
> is always much faster than ftp, for example,
> Download 229 files through Intranet, it takes 20 seconds for http and 48
> seconds for ftp.
> Download 94 files through Internet, it takes 15 seconds for http and 75 seconds
> for ftp.
> Why http is so fast? Does libcurl (or any router) cache downloaded files like
> the web browser?

libcurl doesn't do any data caching, so the speed differences you are seeing
are a result of other factors. There may be a transparent http proxy between
you and the server that is doing some caching without your knowledge, but
it's more likely that the ftp session connection overheads are what's
slowing down your ftp transfers: each file downloaded with ftp needs a new
TCP connection established. There is also several more round-trips needed
to start an ftp transfer, including one for each directory path component.

The CVS (and daily snapshot) version of curl contains an experimental (and
undocumented) command-line option --ftp-method=X where X is singlecwd,
nocwd or multicwd, that adjusts how curl changes directories on an ftp
server. Depending on the URLs you are downloading, this option could have a
noticable effect on your ftp download times.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2005-12-22