vscode-sftp icon indicating copy to clipboard operation
vscode-sftp copied to clipboard

Why is Upload / Download so slow?

Open mat01 opened this issue 6 years ago • 80 comments

I am connecting via FTP on port 21 to a micro EC2 instance on AWS.

Upload and Downloading files is hilariously slow. I would say both upload and download for 1 small text file takes 20 - 30 seconds.

Is this a bug, or is there something I can tweek?

mat01 avatar Jan 09 '19 18:01 mat01

Extension Logs from Startup - required

  1. Open User Settings.

    • On Windows/Linux - File > Preferences > Settings
    • On macOS - Code > Preferences > Settings
  2. Set sftp.debug to true and reload vscode.

  3. Reproduce the problem, get the logs from View > Output > sft

liximomo avatar Jan 10 '19 06:01 liximomo

[info] config at c:\Users\mat01\xxxxxxxxxxx {"remotePath":"/","uploadOnSave":true,"downloadOnOpen":false,"ignore":[],"concurrency":1,"protocol":"ftp","connectTimeout":10000,"interactiveAuth":false,"secure":false,"passive":false,"remoteTimeOffsetInHours":0,"port":21,"name":"xxxxxxx","host":"xxxxxxx","username":"","password":""} [debug] < '220 (vsFTPd 2.2.2)\r\n' [debug] > USER ftpuser [debug] < '331 Please specify the password.\r\n' [debug] > PASS ****** [debug] < '230 Login successful.\r\n' [debug] > FEAT [debug] < '211-Features:\r\n' [debug] < ' EPRT\r\n EPSV\r\n MDTM\r\n' [debug] < ' PASV\r\n REST STREAM\r\n SIZE\r\n' [debug] < ' TVFS\r\n UTF8\r\n211 End\r\n' [debug] > TYPE I [debug] < '200 Switching to Binary mode.\r\n' [debug] > PASV [debug] < '227 Entering Passive Mode (81,98,222,74,4,22).\r\n' [debug] > NOOP [debug] > LIST / [debug] < '150 Here comes the directory listing.\r\n' [debug] < '226 Directory send OK.\r\n' [debug] > PASV [debug] < '227 Entering Passive Mode (81,98,222,74,4,19).\r\n' [debug] > NOOP [debug] > LIST /app [debug] < '150 Here comes the directory listing.\r\n' [debug] < '226 Directory send OK.\r\n' [trace] run command 'Edit In Local' [trace] handle download file for c:\Users\mat01\xxxxxxxxxx\app\Permission.php [debug] > PASV [debug] < '227 Entering Passive Mode (81,98,222,74,4,22).\r\n' [debug] > NOOP [debug] > LIST /app [debug] < '150 Here comes the directory listing.\r\n' [debug] < '226 Directory send OK.\r\n' [debug] > PASV [debug] < '227 Entering Passive Mode (81,98,222,74,4,10).\r\n' [debug] > NOOP [debug] > RETR /app/Permission.php [debug] < '150 Opening BINARY mode data connection for /app/Permission.php (390 bytes).\r\n' [debug] < '226 Transfer complete.\r\n' [debug] > MODE S [debug] < '200 Mode set to S.\r\n' [info] remote -> local c:\Users\mat01\xxxxxxxxxx\app\Permission.php

mat01 avatar Jan 10 '19 12:01 mat01

[debug] < '220 (vsFTPd 2.2.2)\r\n'
[debug] > USER ftpuser
[debug] < '331 Please specify the password.\r\n'
[debug] > PASS ******
[debug] < '230 Login successful.\r\n'
[debug] > FEAT
[debug] < '211-Features:\r\n'
[debug] < ' EPRT\r\n EPSV\r\n MDTM\r\n'
[debug] < ' PASV\r\n REST STREAM\r\n SIZE\r\n'
[debug] < ' TVFS\r\n UTF8\r\n211 End\r\n'
[debug] > TYPE I
[debug] < '200 Switching to Binary mode.\r\n'
[debug] > PASV
[debug] < '227 Entering Passive Mode (81,98,222,74,4,22).\r\n'
[debug] > NOOP
[debug] > LIST /
[debug] < '150 Here comes the directory listing.\r\n'
[debug] < '226 Directory send OK.\r\n'
[debug] > PASV
[debug] < '227 Entering Passive Mode (81,98,222,74,4,19).\r\n'
[debug] > NOOP
[debug] > LIST /app
[debug] < '150 Here comes the directory listing.\r\n'
[debug] < '226 Directory send OK.\r\n'
[trace] run command 'Edit In Local'
[trace] handle download file for c:\Users\mat01\xxxxxxxxxx\app\Permission.php
[debug] > PASV
[debug] < '227 Entering Passive Mode (81,98,222,74,4,22).\r\n'
[debug] > NOOP
[debug] > LIST /app
[debug] < '150 Here comes the directory listing.\r\n'
[debug] < '226 Directory send OK.\r\n'
[debug] > PASV
[debug] < '227 Entering Passive Mode (81,98,222,74,4,10).\r\n'
[debug] > NOOP
[debug] > RETR /app/Permission.php
[debug] < '150 Opening BINARY mode data connection for /app/Permission.php (390 bytes).\r\n'
[debug] < '226 Transfer complete.\r\n'
[debug] > MODE S
[debug] < '200 Mode set to S.\r\n'

Which part takes 20 - 30 seconds?

liximomo avatar Jan 11 '19 02:01 liximomo

I think there are two operations here, a directory list, and a file download. Both are part of 1 action (edit file locally) from VSC. The whole lot took 20 to 30 seconds.

I'm afraid I don't know exactly which commands are the slowest - as you can see, there are no timestamps on the log.

mat01 avatar Jan 13 '19 17:01 mat01

there are no timestamps on the log.

But there are time gaps between each log.

[debug] > LIST /
[debug] < '150 Here comes the directory listing.\r\n'

Does the second line take 10s to show after the first one?

liximomo avatar Jan 14 '19 02:01 liximomo

The biggest delay seems to happen after '227 Entering Passive Mode (81,98,222,74,4,21).\r\n'

Since there are 2 of these during one file fetch, I'm get 2x12 seconds delay.

mat01 avatar Jan 14 '19 10:01 mat01

Turn on Passive mode in your FTP server.

liximomo avatar Jan 15 '19 01:01 liximomo

Valuable advice, thank you.

Here's an extract (last few lines) from my vsftpd .conf file.

pasv_enable=YES pasv_min_port=1024 pasv_max_port=1048

Since, there is no error message on the debug log after 'entering passive mode', surely we must assume that passive mode was successfully (although slowly) entered?

Furthermore - I've just tested our server by connecting to FTP via another client - WinSCP. This works flawlessly downloading a file in well under a second.

So, this all points to your extension not working properly (I guess that's not the case), or a setting within it being incorrect.

My config file in vscode is

{ "name": "xxx", "protocol": "ftp", "host": "xx.xx.xx.xx", "username": "username", "password": "password", "port":21, "remotePath": "/", "uploadOnSave": true }

Please advise.

mat01 avatar Jan 15 '19 11:01 mat01

Hello? Any word on this please?

mat01 avatar Jan 18 '19 17:01 mat01

Same problem, no error, just downloading 1 file every 10 seconds or so.

[debug] > PASV
[debug] < '227 Entering Passive Mode (185,216,26,23,117,96).\r\n'
[debug] > RETR /path/to/file.json
[debug] < '150 Opening BINARY mode data connection for /path/to/file.json (77 bytes)\r\n'
[debug] < '226 Transfer complete\r\n'
[debug] > MODE S
[debug] < '200 Mode set to S\r\n'
[info] remote -> local c:\path\to\file.json

Ploppy3 avatar Feb 13 '19 21:02 Ploppy3

I have a similar problem, taking up to 23 seconds to download a file. Using Filezilla, there is no delay at all.

This is where it hangs: [debug] < '227 Entering Passive Mode (xxx,xxx,xxx,xxx).\r\n' [debug] > RETR /public_html/xxx/xxx/xxxxxxphp [debug] < '150 Opening BINARY mode data connection for /public_html/xxx/xxx/xxx.php (575 bytes)\r\n'

About 18 seconds later it continues and completes:

[debug] < '226 Transfer complete\r\n' [debug] > MODE S [debug] < '200 Mode set to S\r\n' [info] remote -> local c:\wamp\www\xxx\xxx\xxx\xxx.php

As can be seen this is 600byte file

This problem occurs over many different servers.

I have just tested on my laptop and the problem starts once VSCode upgrades to 1.31.1 Jan 2019 Update

I have also tried this with NO other extentions loaded, to make sure that there is not a conflict somewhere. It still can take up to 35 seconds to fetch a 6k file when I open it locally. It is also liable to call data loss locally when you close the file before it downloads. I have a habit of hitting Ctrl S before closing anything and this saves a blank file.

My config is as follows:

{ "name": "SFTP Test", "protocol": "ftp", "host": "rem.ote.ser.ver", "username": "xxxxxxxx", "password": "*********", "port": 21, "remotePath": "/public_html/sftptest/", "uploadOnSave": true, "downloadOnOpen": true }

CWSmart avatar Feb 15 '19 11:02 CWSmart

I have that problem too. Really weird.

boneus avatar Feb 19 '19 13:02 boneus

Same problem Here. Problem appears only for remote->local(Download). For uploding Everything seems and works fine. Problem appears after the update to 1.31.1

piliop avatar Feb 19 '19 20:02 piliop

Same problem here. In debug mode the longest delay is after "opening binay mode data connection".

[info] remote -> local d:\some.file [debug] > PASV [debug] < '227 Entering Passive Mode (xxxxxxxxxxxxx).\r\n' [debug] > RETR /domains/some.file [debug] < '150 Opening BINARY mode data connection for /domains/some.file (20126 bytes)\r\n'

Here it hangs for 5-60secs and it shows: [debug] < '226 Transfer complete\r\n' [debug] > MODE S [debug] < '200 Mode set to S\r\n'

And it goes to next file...

My vscode bersion is 1.31.1. Do anyone have solution for this?

kieliszek85 avatar Feb 22 '19 10:02 kieliszek85

Same here. All downloads go to PASV mode and every action on the server i.e. Opening BINARY mode data connection for [...] takes forever. Hosting and therefore FTP-Server is at Checkdomain.

bebeGit avatar Feb 28 '19 10:02 bebeGit

Hello, same problem for me. Loooong delay before downloading from server. But for the same server, really fast on Filezilla. Weird.

philmarty avatar Mar 11 '19 08:03 philmarty

Same here. Super fast on other FTP client.

xtremforce avatar Mar 25 '19 05:03 xtremforce

same here, taking very long time every file download. i'm using vscode version 1.32.3-1552607091.el7 on fedora 29

abudawud avatar Mar 29 '19 11:03 abudawud

same here, taking very long time every file download. i'm using vscode version 1.32.3-1552607091.el7 on fedora 29

Problem solved by down grade my vscode version to 1.30.2-1546901769.el7.

abudawud avatar Apr 01 '19 06:04 abudawud

@liximomo do you have any update on this issue?

kieliszek85 avatar Apr 09 '19 05:04 kieliszek85

I have the same issue. Great plugin but the download speed is very slow. I hope you manage to fix it. Thank you very much in advance.

trenccan777 avatar Apr 10 '19 16:04 trenccan777

@liximomo I found out that it has something in common with the project I use. If project is relatively small (or not regularly opened) then it works ok. If project is big then it happens to download files very slowly. I have no idea if it can be related to other plugin like 'intelephense' but other plugins work without issues.

kieliszek85 avatar Apr 20 '19 11:04 kieliszek85

What if is this a problem with operating system? Maybe firewall. I'm using Windows 10. I also tried FTP-Sync addon and the speed is also very slow.

trenccan777 avatar Apr 23 '19 17:04 trenccan777

The same problem. MacOS Mojave.

PetrKapishev avatar Apr 25 '19 05:04 PetrKapishev

Same problem here. Any project takes ages to download either a single file or a directory of files etc.

Whether SFTP or FTP...

zigojacko avatar Apr 25 '19 09:04 zigojacko

My case seems related, i hope this helps fix this. I'm connecting to a m4.2xlarge in amazon. This is what's happening to me:

[debug] < '150 Opening BINARY mode data connection for /public_html/xxxxxx/xx.php (5713 bytes)\r\n'

The file appears in the folder almost instantly and i can open it with another editor checking is full downloaded

10-20 seconds waiting

[debug] < '226 Transfer complete\r\n'

The file opens in vscode.

hesos avatar Apr 25 '19 09:04 hesos

An extension in which the maximum number of installations has such a serious compatibility problem with vscode 1.31 and higher is sadness ... in fact, it is impossible to use the extension because of downloading a small file in 20-30 seconds.

AndryWJ avatar Apr 29 '19 08:04 AndryWJ

Same problem on VSCode 1.33.1 The problem is observed in Remote -> local mode. In the opposite direction, everything happens without any trouble. Tried to use VSCode 1.34.0-insider - the problem is the same.

Downgrading to version 1.30.2 solves the problem. Do not forget to turn off automatic updates.

balya avatar May 02 '19 20:05 balya

Yeah downgrade to 1.30.x solved for me also...

Any chance soon to solve this problem with compatibility ??? Thanks and send much love ;)

krzysmierz avatar May 08 '19 09:05 krzysmierz

@krzysmierz It seems that this is related to vscode. 🤔

liximomo avatar May 09 '19 08:05 liximomo