From owner-freebsd-bugs@freebsd.org Thu Sep 26 01:43:42 2019 Return-Path: Delivered-To: freebsd-bugs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 408B8F130A for ; Thu, 26 Sep 2019 01:43:42 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 46dyPp0j6sz4q5n for ; Thu, 26 Sep 2019 01:43:42 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.nyi.freebsd.org (Postfix) id 18076F1306; Thu, 26 Sep 2019 01:43:42 +0000 (UTC) Delivered-To: bugs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 17C7CF1305 for ; Thu, 26 Sep 2019 01:43:42 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46dyPn5C2hz4q5m for ; Thu, 26 Sep 2019 01:43:41 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95FED20C5C for ; Thu, 26 Sep 2019 01:43:41 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id x8Q1hftv026075 for ; Thu, 26 Sep 2019 01:43:41 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id x8Q1hfdN026074 for bugs@FreeBSD.org; Thu, 26 Sep 2019 01:43:41 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 240827] ftp(1) is slower than fetch(1) Date: Thu, 26 Sep 2019 01:43:41 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: naito.yuichiro@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Sep 2019 01:43:42 -0000 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.=