cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: It seems that the ftp repospons is so slow than http.

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Fri, 8 May 2015 22:06:37 +0200

On Fri, May 08, 2015 at 10:00:14PM +0800, Hongyi Zhao wrote:
> Hi Daniel,
>
> I running the following two commands:
>
> curl ftp://ftp.cn.debian.org/debian-cd/8.0.0/amd64/iso-cd/debian-8.0.0-amd64-CD-1.iso
>
> and
>
> curl -L http://ftp.cn.debian.org/debian-cd/8.0.0/amd64/iso-cd/debian-8.0.0-amd64-CD-1.iso
>
> It seems the the second one response more fast the first one. Why the
> repospons from ftp for curl is so slow than http?

For large downloads over low-latency connections, ftp should not be
significantly slower. But for shorter downloads over high latency connections,
the extra setup time for ftp connections can dominate the transfer time.
If you use the -v option, you'll quickly see why. ftp by default executes a
single CWD command (which means a network round trip) for every directory
component, plus it requires extra round trips for authentication and metadata
discovery, then it also opens a second TCP connection (with its 3 round trips)
for the data transfer (which goes through TCP's slow start mechanism). You can
shave some of that off by using --ftp-method NOCWD (or SINGLECWD) if the server
supports it, but ftp is always going to inherently take (at least) slightly
longer.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-05-08