Repository navigation
Description
Expected behaviour
Files sync at about the speed of the broadband connection, independent of size unless limited by CPU or IO on client or server.
Actual behaviour
Synchronizing a folder with many small files is terribly slow. For instance a test folder with 10k 3-byte-files synchronizes with a speed of about 1 file per second over a broadband connection. The load on both client and server while doing this is negligible. Tested with server running Ubuntu 12.04 with current owncloud 6.0.1-1, client current Linux or Macos clients. The transfer rates on the broadband connection are very low as well, so this is not the bottleneck.
Steps to reproduce
- Download http://xn--grgen-jua.name/owncloudStressTest.tar.bz2
- unpack it into an owncloud folder that syncs with a remote owncloud machine.
- Observe upload speeds of one to a few 3-byte-files per second.
Server configuration
Operating system: Ubuntu 12.04
Web server: lighttpd
Database: mysql
PHP version: PHP 5.3.10-1ubuntu3.9
ownCloud version: 6.0.1-1
Updated from an older ownCloud or fresh install: Updated from ownCloud 5
The content of config/config.php:
$CONFIG = array ( 'instanceid' => 'removed', 'passwordsalt' => 'removed', 'datadirectory' => '/var/www/owncloud/data', 'dbtype' => 'mysql', 'version' => '6.0.0.16', 'dbname' => 'dropbox', 'dbhost' => 'localhost', 'dbtableprefix' => 'removed', 'dbuser' => 'removed', 'dbpassword' => 'removed', 'installed' => true, 'theme' => '', 'maintenance' => false, );
no external storage used.
Log files do not show error messages or warnings that seem related.
Client configuration
Both MacosX and Ubuntu 13.10 running current owncloud versions are affected. Browser was not used.
Why I think this is an issue
I regularly sync folders with several thousands of files. I think I am not the only one.
What I think is the reason
I am guessing that owncloud does at least one if not several http requests per file sent. It works sequentially, so the next file can only be sent when the last file is acknowledged. Therefore while preparing the request takes no time and effort, and storing the file does not either, the network delay comes into play: For each file to be sent you have to wait at least one if not several round-trip times.
Another indication is that syncing the folder on the local network or between two VMs on the same machine is much faster. This emphasizes the network delay being of importance in this scenario.
How I think it could be circumvented
Sync not file-by-file but instead several files per request, at least if the files are small.
Activity
IngLP commentedon Feb 4, 2014
Or, sync with multiple threads and split the work. Much more easy.
Only one thread search for the files to sync, splits the list of files to be uploaded, and starts the threads.
PVince81 commentedon Feb 4, 2014
@dragotin did you guys have plans looking into uploading multiple files through the same connection ?
PVince81 commentedon Feb 4, 2014
Just had a try locally, using "localhost" and the sync client is able to upload many files within a second:

I can imagine that each connection might take more time over the internet, also if it includes name resolution.
Have you tried directly with the IP address to rule out the name resolution case ?
PVince81 commentedon Feb 4, 2014
It still feels a bit slow, this is about 41 M which I'd expect to be uploaded much faster.
The problem also is that it might wait for the server to finish creating/saving/indexing the file before continuing, as the server won't give an answer until that happened.
PVince81 commentedon Feb 4, 2014
I tried with the tar file without compression (bunzip2) which is 11Mb big, it took less than a second to upload. I'd almost think that before uploading many files those could be tar'ed together, uploaded then untarred on the server...
PVince81 commentedon Feb 4, 2014
@gluap hmm right. I was actually looking at the progress bar and saw the file name changing 3-4 times within a second and thought the log would reflect that.
enoch85 commentedon Feb 4, 2014
Dont know if it helps you guys, but theese are my results.
100/10 Mbit/s Server
100/10 Mbit Client.
jcfischer commentedon Feb 4, 2014
We are in the same boat (and have filed #6937 ). I have traced the application with New Relic and I see hundreds of SELECTs for every file uploaded - that slows the processing down considerably.
135 remaining items
mgscreativa commentedon Mar 30, 2016
hi @divinity76!, Where should I add that exactly?
By the way, I have tested in three scenarios, one VM installed with https://github.com/enoch85/ownCloud-VM/blob/master/production/owncloud_install_production.sh, a second VM using a fresh Ubuntu Server 14.04.4 installing ISPConfig and a third scenario using a owncloud docker image, in all of them, the file syncing goes just fine, the only slow thing is my real LAN server.
I really don't know what can be causing the slowness, but I really don't care now, because I know that is my server, will waith till Ubuntu Server 16.04 releases so I can test in that new version...
divinity76 commentedon Mar 30, 2016
do i look like an ownCloud Client dev? :p or to say it another way, i don't know, but my best guess is
client/src/libsync/abstractnetworkjob.cpp in
void AbstractNetworkJob::setupConnectionsguruz commentedon Mar 30, 2016
If you don't have issues with server performance/load I suggest to try a nightly build of oC client 2.2.x
It automatically syncs more files at once if they are small files
http://download.owncloud.com/desktop/daily/
https://software.opensuse.org/download.html?project=isv%3AownCloud%3Acommunity%3Anightly&package=owncloud-client
mgscreativa commentedon Mar 30, 2016
Nope...installed Revisión Git 173056 en Mar 30 2016 but the slowness persists. I really don't care now, because I was able to check that is an issue on my 2 years old server installation, maybe in that time, I setup something that causes the pauses for security. Anyway, will wait to Ubuntu Server 16.04 release an try again. Will let you know then.
divinity76 commentedon Mar 31, 2016
@ghiama why do you think this is an OS issue?
mgscreativa commentedon Mar 31, 2016
Hi @divinity76.
I think of it because the test I've made, in three different VM scenarios, using my Laptop connected to my WiFi LAN the stress test files sync is really quick, but testing to my real LAN server, the stress test files sync take a very long time to sync compared to the other scenarios.
As you can see on my previous posts here, you can check my server specs and realize that is solid rock, but still OC is slow, so, in my opinion, maybe there's something I installed on my server on this two years run that maybe, got this slowness with OC, maybe it's a security measure, because the files sync very fast, but by batches of three.
Thanks in you interest.
adrianvg commentedon Apr 7, 2016
@guruz;
Are there any nightly builds for CentOS 7 available as well?
I took the (maybe premature) step to move my local homefolder to Owncloud to get a sort of poor-mans-backup solution, and am now seeing very slow update checks.
dragotin commentedon Apr 7, 2016
Sure, here is the centos 7 nightly: http://download.opensuse.org/repositories/isv:/ownCloud:/community:/nightly/CentOS_7/
adrianvg commentedon Apr 7, 2016
I must be going blind...
Thanks @dragotin !
mSys-mislav commentedon Jun 15, 2016
Why is this closed if it's not fixed? There is still issue with small file uploading - even on 9.0.2. - as mentioned above, bigger file upload is not the problem, but small file upload.
I've tried to upload through my linux network drive, mapping the same in windows machine, WinSCP - it's slow, very slow. There are no errors in logs, just slow speed - in bytes!!!
I've created few hundred of files of size in range of 10-1000kB and always the same problem. I've also tried setting as suggested "innodb_flush_log_at_trx_commit = 2" but that didn't help. We also changed disks, also no luck.
Any idea how to proceed? It's making a huge problem for us/clients.
PVince81 commentedon Jun 15, 2016
@mislav-eu it's likely closed because the slowness is on a case by case basis. For one person it can be environment issue A. For another it's environment issue B. For some people and environments it's not a problem at all.
In your case need to find out what environment you are using so best would be to make a new report using the issue template: https://raw.githubusercontent.com/owncloud/core/master/issue_template.md
I assume that you already checked https://owncloud.org/support/ or the forums for known environment issues that would cause upload slowness ?
mSys-mislav commentedon Jun 15, 2016
I will open then new report. But yes, mostly people have the same problem:
https://forum.owncloud.org/viewtopic.php?t=17477
https://forum.owncloud.org/viewtopic.php?t=30083
I've tried mentioned things, but no result.
PVince81 commentedon Jun 15, 2016
During the upload of small files there is no chunking involved, so no chunk assembly.
This means that in most cases the file is directly streaming by Apache to PHP and PHP passes it to the ownCloud code which stream-copies it into a part file. Then the part file gets renamed to the final file. So the part where the bytes are copied should be optimal.
Now if there's encryption in the middle it can be a little slower because the stream copy also encrypts every block.
So the slowness could be due to the stream copying from the web server to PHP being slow. Some web servers even create a temporary file before streaming the file to ownCloud (seen it happening with some nginx settings).
Then the other part which could be slow is setting up the network connection and later on PHP setting up its internal filesystem, but this happens before the stream copy. So the question is whether the transfer speed values are based on the stream copy part or whether they look lower (averaged?) because the start of the transfer was slower.
Also to check if whether the target folder is a received shared folder, and whether that one was reshared. If the target folder is on external storage, it will likely be much slower due to the extra upload to the external storage.
mSys-mislav commentedon Jun 15, 2016
Dear @PVince81 - I will create separated report for this. #25115
PVince81 commentedon Jun 15, 2016
@mislav-eu thanks!