YunoHost-Apps / nextcloud_ynh

Nextcloud package for YunoHost
https://nextcloud.com/
GNU Affero General Public License v3.0
147 stars 63 forks source link

Fix slow uploads under HTTP2 #602

Closed aquaspy closed 1 year ago

aquaspy commented 1 year ago

Describe the bug

Uploads on Nextcloud are much slower than the expected. This happens with their recommended NGINX settings for HTTP2, but there is a tested and known fix.

Context

Steps to reproduce

1- Go to your Nextcloud domain 2- Upload a large file and check the upload speed. It will be really slow considering your network speed and the server distance.

Expected behavior

The upload should be faster. You can compare with other upload services like Send for example.

How to fix

It's quite easy, we just need to apply the suggested fix from this issue: https://github.com/nextcloud/documentation/issues/9578

The exact commit is: https://github.com/nextcloud/documentation/pull/8323/commits/9c0e018f1859b155f62fa1373517250b8ea3752f

For more information, you can read this Cloudflare blog: https://blog.cloudflare.com/delivering-http-2-upload-speed-improvements/

In short, we need to add this line:

    # The settings allows you to optimize the HTTP2 bandwitdth.
    # See https://blog.cloudflare.com/delivering-http-2-upload-speed-improvements/
    # for tunning hints
    client_body_buffer_size 512k;

At conf/nginx.conf

It can be added on line 49, right after "#pagespeed off;"

I did tests on my end, and I got a HUGE difference on the upload, up to 5 times faster. It would be really great. The mainstream documentation already applied this patch too:

https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html

Thanks for all the hard work on this project! I really appreciate it

lapineige commented 1 year ago

Thanks for reporting and documenting all of this ! @ericgaspar made it real here #603 :ok_hand:

aquaspy commented 1 year ago

Thank you so much guys! I'll go ahead and close this issue :)

Thanks for making the world a better place