wolpi / prim-ftpd

FTP server app for android
Other
583 stars 78 forks source link

Speed falling when copying large files #268

Open OmlineEditor opened 2 years ago

OmlineEditor commented 2 years ago

if you copy 1 GB of files to several small files, then the speed is stable and does not fall. (the speed is approximately ~12 Мбит/с)

if you copy a 1 GB file with one large file, then the speed does not drop by about 2-3 times from the maximum over time. (the speed at the start is approximately ~12 Mbit/sec, in a few minutes 4-5 Mbit/sec).

the problem is precisely in the program. If you use another program, then the speed is stable and high.

ftpd v6.11 f-droid copying via: secure ftp storage type: standard file system Test phone 1: Redmi Note 7 (Android 9) Test phone 2: Redmi Note 7 (Android 10) Test on two identical phones but with different versions android.

you can check for yourself how the speed drops if you copy 1 large file from your computer to your phone?

wolpi commented 2 years ago

It will take a while until I find time to look into this.

OmlineEditor commented 8 months ago

Termux:15M/bps ftpd:1.5M/bps

have you tested it yourself and it turned out that the speed drops 10 times compared to another program? did I understand this message correctly?

r3a1d3a1 commented 3 months ago

I noticed this the other day as well. It happens only w/ plain old method to internal storage, and my guess is that it doesn't reserve the full size in advance, so it progressively requests more and more storage. NAND storage is pretty bad for this sorta remapping blocks, and if TRIM isn't happening, wears out the storage horribly as well. So my suggestion to the devs: please ensure reserving the full size in advance. (like how aria2 does it for downloads)

wolpi commented 3 months ago

How would that be done with Java FileSystem API? That would affect uploaded files only. What about downloads?

r3a1d3a1 commented 3 months ago

https://stackoverflow.com/questions/9252332/android-pre-allocate-space-for-a-file-before-downloading-it https://stackoverflow.com/questions/245251/create-file-with-given-size-in-java

wolpi commented 3 months ago

Good to know. I'll see how that could be integrated, when I find time

wolpi commented 3 months ago

With current APIs filesize is not known on file creation. Thus the above approach is not possible.

r3a1d3a1 commented 3 months ago

You mean FTP clients do not tell the server the size of the item they're about to upload/put? I.e. You can upload/put a 1 TB file and it may fail due to the server being out of space after uploading 900 GBs? :)

wolpi commented 2 months ago

I did not check the protocol. But APIs this app is based on. And yes, that can happen.