Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow upload speed to server #360

Open
sQty opened this issue Nov 3, 2021 · 11 comments
Open

Slow upload speed to server #360

sQty opened this issue Nov 3, 2021 · 11 comments

Comments

@sQty
Copy link

sQty commented Nov 3, 2021

all visible here ...

139915611-eed53174-87dd-4b61-a056-d792fd712ff4

upload to uppy demo server tus ( are they using this server implementation ? dunno )

so i downloaded uppy js client and this tus php server
and have similar speeds on lan upload like on uppy test server .... ( issue like #246 )

@@@
uppy team said transloadit/uppy#3292 that their demo server is capable up to 2Gbit/s

so that not likely bandwidth problem....

can u check this ????

@ankitpokhrel
Copy link
Owner

Hi @sQty, If I get you right, you are getting similar upload speed on both uppy js demo server and tus-php server locally. I am pretty sure uppy demo page is not using PHP implementation in the server. So its not clear if this is an issue with tus-php since multiple server implementation is giving you same upload speed.

What is the upload speed you are expecting?

@sQty
Copy link
Author

sQty commented Nov 9, 2021

using local uploads ( server, lan ) more that 100Mb ..... and get only up to 40Mbps .... ( upload from server browser to server disk .... lan usage 0 so all fly local .... )

@ankitpokhrel
Copy link
Owner

I will keep this issue open to see if someone else is also facing a similar issue. And can hopefully provide us with a clue to move ahead with debugging.

So far, with the information I have, I am not even sure if this is the issue with tus-php or something else (eg: server conf, network).

@darthf1
Copy link
Contributor

darthf1 commented Nov 22, 2021

Are you using PHP fpm? If so, did you try to change pm.max_children to a higher value?

@leipsfur
Copy link

Hello,

I am facing a similar issue. I think the source for this problem is the fact that S3 does not support seekable streams and file appends only in a very limited fashion.

So the streamWrapper implementation of the AWS S3 SDK is supporting seekable streams by fetching the whole file content from the S3 API because. I have not complelty debugged myself through the tus-php servers code but my assumption is that due to this limitation of the S3 streamWrapper there is a high bandwith overhead between the tus-server and the S3 server.

Maybe there is a possibility to cache the file contents somewhere before streaming it into S3.

@ponasromas
Copy link

Slow upload issue exist also on simple Nginx server (4GB KVM VPS / NVMe drives). No matter nginx configuration, but files larger then ~10 MB tend to upload insanely slow. Specially upload start stalling. Use demo and standard Nginx on Debian or Alma 8 in order to recreate issue.

@ponasromas
Copy link

Update on the problem: when file uploading without chunking, it uploads much faster.

This:

$bytesUploaded = $client->setKey($uploadKey)->file($fileMeta['tmp_name'], $file_uid . '_' . $file_prefix . '_' . $fileMeta['name'])->upload();

Vs this:

$client->setKey($uploadKey)->file($fileMeta['tmp_name'], $file_uid . '_' . $file_prefix . '_' . $fileMeta['name']);
$bytesUploaded = $client->upload(10000000); // Chunk of 10 MB

Is around 11 times faster. So yea, there is place form improvements.

@tetrode
Copy link

tetrode commented Mar 15, 2022

I am experiencing slow uploads as well, both locally and on our servers, any idea?

in /usr/local/var/log/php-fpm.log:

/usr/local/var # tail /usr/local/var/log/php-fpm.log
[15-Mar-2022 08:00:14] ERROR: failed to ptrace(ATTACH) child 35: Operation not permitted (1)
[15-Mar-2022 08:00:14] WARNING: [pool www] child 35, script '/var/www/html/basic/upload.php' (request: "POST /basic/upload.php") executing too slow (33.033399 sec), logging
[15-Mar-2022 08:00:45] ERROR: failed to ptrace(ATTACH) child 38: Operation not permitted (1)
[15-Mar-2022 08:00:45] WARNING: [pool www] child 38, script '/var/www/html/basic/upload.php' (request: "POST /basic/upload.php") executing too slow (30.917014 sec), logging
[15-Mar-2022 08:01:19] ERROR: failed to ptrace(ATTACH) child 39: Operation not permitted (1)
[15-Mar-2022 08:01:19] WARNING: [pool www] child 39, script '/var/www/html/basic/upload.php' (request: "POST /basic/upload.php") executing too slow (32.033336 sec), logging
[15-Mar-2022 08:01:52] ERROR: failed to ptrace(ATTACH) child 36: Operation not permitted (1)
[15-Mar-2022 08:01:52] WARNING: [pool www] child 36, script '/var/www/html/basic/upload.php' (request: "POST /basic/upload.php") executing too slow (32.070539 sec), logging
[15-Mar-2022 08:02:24] ERROR: failed to ptrace(ATTACH) child 37: Operation not permitted (1)
[15-Mar-2022 08:02:24] WARNING: [pool www] child 37, script '/var/www/html/basic/upload.php' (request: "POST /basic/upload.php") executing too slow (30.470423 sec), logging

@ponasromas
Copy link

Just do not use chunked upload. That fixed the problem for me and upload goes maximum.

@rajpt
Copy link

rajpt commented Aug 31, 2022

Just do not use chunked upload. That fixed the problem for me and upload goes maximum.

in that case i am not able to resume my upload.

@dokicro
Copy link

dokicro commented Aug 10, 2023

What I found out is that fastcgi_request_buffering off; limits upload speed to ~2.5MB I tested that with XHR as well.
Once that is removed upload is much much faster, but you lose resumable uploads so a workaround is to send files in chunks on FE, I ended up using 50MB chunk...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants