Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Sep 2019 01:43:41 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 240827] ftp(1) is slower than fetch(1)
Message-ID:  <bug-240827-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D240827

            Bug ID: 240827
           Summary: ftp(1) is slower than fetch(1)
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: naito.yuichiro@gmail.com

Created attachment 207828
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D207828&action=
=3Dedit
ftp.patch

Of course this problem depends on network environment,
I can see this problem in my home network only.

In my home network,
the bandwidth of the internet connection is 100Mbps.
Fetch(1) downloads in mostly full speed of the bandwidth.
But ftp(1) seems about half speed of fetch(1).

I have tried to download FreeBSD iso image file
from the fastest mirror from my home.
The results are shown below.

```
$ fetch
ftp://ftp.jp.freebsd.org/pub/FreeBSD/releases/ISO-IMAGES/12.0/FreeBSD-12.0-=
RELEASE-amd64-disc1.iso
FreeBSD-12.0-RELEASE-amd64-disc1.iso                   851 MB   10 MBps 01m=
20s
```

```
$ ftp
ftp://ftp.jp.freebsd.org/pub/FreeBSD/releases/ISO-IMAGES/12.0/FreeBSD-12.0-=
RELEASE-amd64-disc1.iso
Trying 2405:f000:202:2598:210:231:212:2:21 ...
Connected to ftp.lab.bbtower.net.
220- Welcome to ftp.lab.BBTower.net,
220-            Located in Tokyo, Japan.
220-
220- This server maintenanced by BroadBand Tower, Inc.
220-
220-             BBTower Web site is at
220-             http://www.bbtower.co.jp/
220-
220- If you have any problem, please contact ftp-contact@bbtower.co.jp.
220 FTP server ready.
331 Guest login ok, send your email address as password.
230 Guest login ok, access restrictions apply.
Remote system type is UNKNOWN.
200 Type set to I.
250 CWD command successful.
250 CWD command successful.
250 CWD command successful.
250 CWD command successful.
250 CWD command successful.
local: FreeBSD-12.0-RELEASE-amd64-disc1.iso remote:
FreeBSD-12.0-RELEASE-amd64-disc1.iso
229 Entering Extended Passive Mode (|||63019|)
150 Opening BINARY mode data connection for
'FreeBSD-12.0-RELEASE-amd64-disc1.iso' (892467200 bytes).
100% |***********************************|   851 MiB    5.14 MiB/s    00:00=
 ETA
226 Transfer complete.
892467200 bytes received in 02:45 (5.14 MiB/s)
221 Goodbye.
```

This is because socket buffer size is not large enough to ftp(1).
Ftp(1) always set the buffer size to the default value.
It prevents FreeBSD kernel from increasing socket buffer size automatically.

So setting `sysctl net.inet.tcp.recvspace=3D131072` speeds up the ftp downl=
oad
for workaround.

```
$ sudo sysctl net.inet.tcp.recvspace=3D131072
Password:
net.inet.tcp.recvspace: 65536 -> 131072
$ ftp
ftp://ftp.jp.freebsd.org/pub/FreeBSD/releases/ISO-IMAGES/12.0/FreeBSD-12.0-=
RELEASE-amd64-disc1.iso
Trying 2405:f000:202:2598:210:231:212:2:21 ...
Connected to ftp.lab.bbtower.net.
220- Welcome to ftp.lab.BBTower.net,
220-            Located in Tokyo, Japan.
220-
220- This server maintenanced by BroadBand Tower, Inc.
220-
220-             BBTower Web site is at
220-             http://www.bbtower.co.jp/
220-
220- If you have any problem, please contact ftp-contact@bbtower.co.jp.
220 FTP server ready.
331 Guest login ok, send your email address as password.
230 Guest login ok, access restrictions apply.
Remote system type is UNKNOWN.
200 Type set to I.
250 CWD command successful.
250 CWD command successful.
250 CWD command successful.
250 CWD command successful.
250 CWD command successful.
local: FreeBSD-12.0-RELEASE-amd64-disc1.iso remote:
FreeBSD-12.0-RELEASE-amd64-disc1.iso
229 Entering Extended Passive Mode (|||59743|)
150 Opening BINARY mode data connection for
'FreeBSD-12.0-RELEASE-amd64-disc1.iso' (892467200 bytes).
100% |***********************************|   851 MiB    9.67 MiB/s    00:00=
 ETA
226 Transfer complete.
892467200 bytes received in 01:27 (9.67 MiB/s)
221 Goodbye.
```

Basically ftp(1) should allow FreeBSD kernel to adjust socket buffer size.
I suggest the attached patch that prevents ftp(1) from setting socket buffer
size
unless user input 'rcvbuf' or 'sndbuf' command.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-240827-227>