Skip to content

[Encryption?] Uploading many small files = very slow #25115

Closed

Description

@mSys-mislav

Steps to reproduce

  1. On local machine I create few hundred txt files with some lorem ipsum stuff
  2. I try to upload them through winscp/windows map network drive/ubuntu davs webdav
  3. Upload is very slow

Expected behaviour

Upload of small files should be faster. Yes indeed, there are many actions/stuff OC must do, that's understandable, but e.g. 200 small files upload through winscp takes like 10 minutes, that is not normal. Speed is in bytes.

Actual behaviour

Bigger files are uploading without any problem and speed is rather fast, however small files uploading is terrible.

Server configuration

Operating system: Debian 8.5

Web server: Apache 2.4.10.

Database: MariaDB 10

PHP version: PHP 5.6.20.

ownCloud version: (see ownCloud admin page) 9.0.2 (stable)

Updated from an older ownCloud or fresh install: Updated from 8.x series

Where did you install ownCloud from: Through apt-get

Signing status (ownCloud 9.0 and above):

Login as admin user into your ownCloud and access 
http://example.com/index.php/settings/integrity/failed 
paste the results here.

No errors have been found.

List of activated apps:

If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your ownCloud installation folder

Enabled:

  • activity: 2.2.1
  • comments: 0.2
  • dav: 0.1.6
  • encryption: 1.2.0
  • external: 1.2
  • federatedfilesharing: 0.1.0
  • federation: 0.0.4
  • files: 1.4.4
  • files_external: 0.5.2
  • files_pdfviewer: 0.8.1
  • files_sharing: 0.9.1
  • files_texteditor: 2.1
  • files_versions: 1.2.0
  • files_videoplayer: 0.9.8
  • gallery: 14.5.0
  • notifications: 0.2.3
  • provisioning_api: 0.4.1
  • systemtags: 0.2
  • templateeditor: 0.1
  • updatenotification: 0.1.0
    Disabled:
  • files_mv
  • files_trashbin
  • firstrunwizard
  • galleryplus
  • passwordpolicy
  • user_external
  • user_ldap

The content of config/config.php:

If you have access to your command line run e.g.:
sudo -u www-data php occ config:list system
from within your ownCloud installation folder

{
"system": {
"instanceid": "oc3su8t4jf9n",
"passwordsalt": "_REMOVED SENSITIVE VALUE",
"secret": "_REMOVED SENSITIVE VALUE
",
"trusted_domains": [
"XX"
],
"datadirectory": "/opt/owncloud/data",
"overwrite.cli.url": "https://XX",
"dbtype": "mysql",
"version": "9.0.2.2",
"dbname": "test_do_ownc_db",
"dbhost": "localhost",
"dbtableprefix": "oc_",
"dbuser": "_REMOVED SENSITIVE VALUE",
"dbpassword": "_REMOVED SENSITIVE VALUE
",
"logtimezone": "UTC",
"installed": true,
"loglevel": 3,
"asset-pipeline.enabled": true,
"memcache.local": "\OC\Memcache\APCu",
"defaultapp": "files",
"check_for_working_htaccess": false,
"mail_smtpmode": "smtp",
"mail_smtpsecure": "ssl",
"mail_smtpauth": 1,
"enable_previews": true,
"singleuser": false,
"maintenance": false,
"theme": "",
"filesystem_check_changes": 0,
"trashbin_retention_obligation": "auto",
"updatechecker": false,
"mail_from_address": "XX",
"mail_domain": "XX",
"mail_smtpauthtype": "LOGIN",
"mail_smtphost": "XX",
"mail_smtpport": "465",
"mail_smtpname": "_REMOVED SENSITIVE VALUE",
"mail_smtppassword": "_REMOVED SENSITIVE VALUE
",
"blacklisted_files": []
}
}

Are you using external storage, if yes which one: local/smb/sftp/... - no external storage

Are you using encryption: yes

Are you using an external user-backend, if yes which one: WebDav


### Client configuration
**Browser:** Firefox/Chrome (latest versions)

**Operating system:** Tested on both win7 and ubuntu 14.04. LTS

### Logs
#### Web server error log

Insert your webserver log here

No entries in apache/mysql/syslog, etc - just some cronjob stuff and mysql restarting entries.

#### ownCloud log (data/owncloud.log)

Insert your ownCloud log here

There are no entries in OC log.

How to debug this? Is there any additional flag I could enable?

Please note that this folder is on local disk, it's not on external storage and it's not shared with anyone.

I've already tried few things as suggested (no result):
https://forum.owncloud.org/viewtopic.php?t=17477
https://forum.owncloud.org/viewtopic.php?t=30083

Activity

  1. PVince81 commented on Jun 15, 2016

    @PVince81
    Contributor

    Can you clarify the winscp part ? Does winscp support Webdav ?
    At first I thought you meant you copied the files to the web server directly using SCP/WinSCP (no OC or Webdav) and that this part was slow too ?

  2. PVince81 commented on Jun 15, 2016

    @PVince81
    Contributor

    @mislav-eu now to rule out any network issue, I guess your OC server is in the same local network and you're not uploading over the internet ?

    When uploading a 20 MB file, do you see the same transfer rate as small ones reported in the sync client ? This to rule out the stream copy part.

    I see you mentioned DAV clients. Note that these do not support sessions so for every new file operation they will retrigger the login code. (could also be some part to optimize)

  3. mSys-mislav commented on Jun 15, 2016

    @mSys-mislav
    Author

    WinSCP part - yes, it supports:
    https://winscp.net/eng/docs/webdav - http://oi68.tinypic.com/20fpwmt.jpg
    I can connect without problems.

    Network - Yes and no. The tests I did before were over the internet. I've also tried now through LAN via VPN - same result.

    Uploading bigger files goes few MB per second.

  4. PVince81 commented on Jun 15, 2016

    @PVince81
    Contributor

    Hmmm, if the slowness is during the bytes transfer, then the problem isn't in the part that initiates it.
    With much bigger files the speed should increase over time since the initial delay is getting averaged out.

    So either there is something in your setup that throttles the transfer speed or there's something in the encryption code that is slower during the stream copy. Because apart from encryption there is nothing else happening apart from moving bytes from the source stream (apache/php input) to the target file.

  5. mSys-mislav commented on Jun 15, 2016

    @mSys-mislav
    Author

    I will configure new virtual machine without encryption and test it out. Will update you with result.

  6. changed the title [-]Synchronizing many small files = very slow[/-] [+][Encryption?] Synchronizing many small files = very slow[/+] on Jun 15, 2016
  7. changed the title [-][Encryption?] Synchronizing many small files = very slow[/-] [+][Encryption?] Uploading many small files = very slow[/+] on Jun 15, 2016
  8. tflidd commented on Jun 15, 2016

    @tflidd
    Contributor

    If you need some benchmarks for comparison: #20967 (comment) (upload was done with the official oc client, no encryption app).

  9. DeepDiver1975 commented on Jun 16, 2016

    @DeepDiver1975
    Contributor

    From my understanding this is the expected behavior when uploading many small files. Each file is one http put request to the server.
    There are no mechanisms like bulk upload or such within plain webdav.

  10. PVince81 commented on Jun 16, 2016

    @PVince81
    Contributor

    Yes, but in the case observed above the transfer itself (bytes) seems to be slow, which is different than the initial transfer initiation.

  11. DeepDiver1975 commented on Jun 16, 2016

    @DeepDiver1975
    Contributor

    Well small Bytes holding almost no content cannot utilize the network from my understanding

  12. mSys-mislav commented on Jun 16, 2016

    @mSys-mislav
    Author

    This webdav under winscp with owncloud is not working at-all. First time I connect it works and second time under any user/even without user/pass I'm getting 405 method not allowed and there is no freaking way to fix it. It seems like OC write this kind of stuff somewhere in some table cache?

    Anyway, some test results:
    without encryption
    LAN - 11KB file size - 201 files - 4 minutes - WEBDAV
    LAN - 11KB file size - 201 files - 15 seconds - OC client

    encryption
    LAN - 11KB file size - 201 files - not able to test
    LAN - 11KB file size - 201 files - 75 seconds - OC client

    in other words, webdav sucks hard time and OC client is way faster. Even with bigger files like 200-300KB, OC client upload and sync files 5-10x faster.

    Any other ideas?

  13. PVince81 commented on Jun 16, 2016

    @PVince81
    Contributor

    The OC client also uses Webdav but uploads files in parallel. Still strange that Webdav is slower when using third party clients.

  14. 57 remaining items

  15. PVince81 commented on Jun 28, 2016

    @PVince81
    Contributor

    At this point I don't think there is anything that OC can do code-wise. If the fread operations from the input socket are slower (meaning, PHP or the socket doesn't deliver the packets faster), then maybe more optimization can be done on the Apache/PHP settings. (I'm not familiar with that part unfortunately)

    The reason why the OC client is able to work faster is because it works with parallel connections but other clients only seem to do serial transfer.

  16. mSys-mislav commented on Jun 28, 2016

    @mSys-mislav
    Author

    If you try to upload same files directly through OC GUI - the speed is also slow.

  17. mSys-mislav commented on Jul 4, 2016

    @mSys-mislav
    Author

    I guess we're kinda stuck here now, nothing to do?

  18. PVince81 commented on Jul 4, 2016

    @PVince81
    Contributor

    Yes. The next step would be to dive into the PHP layer and find out if there is a way to make it deliver packets faster (or rather whether there is something else that might slow them down)

  19. mSys-mislav commented on Jul 4, 2016

    @mSys-mislav
    Author

    But, as I wrote above, problem is not just then with third-party clients like webdav/mapping/winscp, it's also problem of OC itself, through GUI upload. Only thing that is working fast is OC client itself. So, even this functionality directly through OC GUI is broken.

    We will wait for the fix then, if any or try to find some other solution, as this is currently not solution for my client.

  20. PVince81 commented on Jul 4, 2016

    @PVince81
    Contributor

    The reason why web UI upload is slower is because it uses POST. When using POST, PHP will first write the file to a temporary location before passing it to the ownCloud code. The only solution here is to make the web UI use PUT to make it as fast as Webdav: #21237

  21. mSys-mislav commented on Jul 4, 2016

    @mSys-mislav
    Author

    If I got it right, I just need to add this file and it's content
    apps/dav/lib/connector/sabre/iframetransportplugin.php

    and that's it? Nothing else needed?

  22. PVince81 commented on Jul 4, 2016

    @PVince81
    Contributor

    @mislav-eu no, it won't work. That PR is a work in progress for 9.2 that isn't compatible with 9.0.x.

  23. mSys-mislav commented on Jul 4, 2016

    @mSys-mislav
    Author

    Damn. Well then, I have to wait. Thanks for everything @PVince81

  24. added this to the backlog milestone on Jan 27, 2017
  25. PVince81 commented on Jan 27, 2017

    @PVince81
    Contributor

    That PR was merged, you could try with owncloud daily master from https://download.owncloud.org/community/daily/owncloud-daily-master.tar.bz2 and see if the performance issue still exists there.

  26. hodyroff commented on Mar 28, 2017

    @hodyroff

    10.0 Beta is now also available. Closing as PR was merged.

  27. lock commented on Aug 2, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  28. locked as resolved and limited conversation to collaborators on Aug 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions