Skip to content

Migrate preview generation to async job execution #11685

Closed

Description

@LukasReschke

The preview generation should happen using cron (preferably only the system cron) instead of happening on demand. - Currently we have a lot of users complaining about the performance just because preview generation is taking ages.

\cc @georgehrke
@karlitschek FYI

Activity

  1. LukasReschke commented on Oct 21, 2014

    @LukasReschke
    ContributorAuthor

    And yes, I know that this is not possible with encryption, but the cronjob could just check whether the instance is encrypted or not.

    Just because there is one use-case where it doesn't work shouldn't prevent massive speed gains on other use-cases ;-)

  2. LukasReschke commented on Oct 21, 2014

    @LukasReschke
    ContributorAuthor

    Actually, we should not remove the on-demand generation but add another cronjob that does the generation already before in some "common" sizes (i.e. retina and non-retina).
    If the user visits the folder before the cronjob happened the on-demand generation would happen, otherwise the existing pre-generated thumbnails would be shown.

  3. karlitschek commented on Oct 21, 2014

    @karlitschek
    Contributor

    I'm not really sure how this would improve the user experience. A background job is not faster with generating the thumbnails neither is it done necessarily at the optimal time. I assume people keep on suggesting a background job because the old on demand generation was blocking the UI which is horrible. So perhaps we should wait if people are more happy with the behavior of 7.0.3

  4. georgehrke commented on Oct 21, 2014

    @georgehrke
    Contributor

    I agree with @karlitschek here. Let's wait for user-feedback from 7.0.3.
    If people still experience performance issues with 7.0.3 this is definitely something we should consider for ownCloud 8.

    a few things we should discuss when considering implementing this:

    • breadth-first or depth-first. (I'd vote for breadth-first)
    • sizes for caching: maybe also 1024x1024 for public sharing
  5. added this to the milestone on Oct 21, 2014
  6. LukasReschke commented on Oct 21, 2014

    @LukasReschke
    ContributorAuthor

    Setting to ownCloud 8 and triaging. - Let's close this if nobody complains, if not let's see what we can do.

  7. ronnicek commented on Oct 24, 2014

    @ronnicek

    @karlitschek it's easy.. set up Raspberry Pi /w Owncloud and load gallery with some photos :)

  8. budulinek commented on Oct 24, 2014

    @budulinek

    Hi, first of all thanks a lot for considering the issue.

    @karlitschek the problem is not the UI, but the preview generation.

    I have just installed 7.0.3 and the UI itself is really quick. Good job. But the preview generation takes ages on slow machines (15 images take cca 2 minutes). I have a router running Openwrt (1200 MHz, 2GB RAM).

    Background job is not faster. I agree. But once the process is over, all thumbnails are ready to be shown. And they do not have to be generated on-demand.

    With the cron job, the user (server administrator) can decide when thumbnails are generated. Of course, it is difficult to choose optimal time. But it will be up to him to decide which time is optimal for the thumbnail pre-generation.

    My suggestion:

    • create new php file, do not use existing cron.php for thumbnail pre-generation
    • the new php file would trigger preview generation for Gallery and for Files app
    • server administrator can schedule the preview generation using crontab
    • server administrator can set the priority of the thumbnail generation with nice
    • If the user visits the folder before the cronjob happened the on-demand generation would happen, otherwise the existing pre-generated thumbnails would be shown
  9. oparoz commented on Nov 24, 2014

    @oparoz
    Contributor
    • Define a max size and expose it in the admin area perhaps Introducing the maximum size preview #13674
    • Suggest all apps use that setting for performance reasons.Preview providers should take maxX and maxY into consideration #13607
    • Add a batch processing button for users so that they can upload all the pics from their camera, press the button and come back later to check the result. Users don't know when the cron job will run and are less likely to get frustrated with the gallery loading pictures slowly if they know they simply have to wait 30 minutes for all previews to get generated
  10. DeepDiver1975 commented on Nov 25, 2014

    @DeepDiver1975
    Contributor

    As soon come to a conclusion regarding asnc file handling/job queing/etc thumbnail generation can make use of this as well. No specific implementation only for thumbnail operations. THX

  11. modified the milestones: , on Jan 8, 2015
  12. 73 remaining items

  13. nero120 commented on Nov 30, 2018

    @nero120

    Note: the preview system will be reworked / rewritten in the future as the current way is suboptimal and outdated.

    That is a very welcome statement @PVince81! Any idea on when we might be able to expect it?

  14. jonferreira commented on Feb 12, 2019

    @jonferreira

    Wondering if there's any updates on this subject? Preview is still painfully slow and sucks that thumbnails can't be generated "automagically" with a cronjob :(

  15. fungs commented on Feb 12, 2019

    @fungs

    @jonferreira see my suggestion #17916 from 2015, basically I was proposing to integrate another JPEG preview program which takes 3 sek instead of 3 min for my example digital photo on a weak CPU. Nothing has happened since :(

  16. nero120 commented on Feb 12, 2019

    @nero120

    @PVince81 are you able to incorporate @fungs solution into your reworking of the preview system?

  17. jonferreira commented on Feb 12, 2019

    @jonferreira
  18. PVince81 commented on Feb 12, 2019

    @PVince81
    Contributor

    @nero120 the reason this was likely never incorporated back then is because the design goals of ownCloud was to be purely PHP to make sure that everyone can deploy this on their shared hosters, etc.

    Now in 2019 I'm still unsure if / how to incorporate such external tool in a way to make it work from OC. Maybe it needs an OC app that is able to call it with shell_exec.

    In any case, I don't think that's the right direction and we should stay in PHP-world to keep the easy of deployment for everyone.

    Currently we're reworking the frontend and integrating both the video player and slideshow view into a single app, see https://github.com/owncloud/files_mediaviewer (release coming soon).

    This app implements the previews with fixed scales instead of expecting previews with every possible pixel size. So the viewer would pick the preview with the closest size instead of requesting a preview with the exact size from the server.

    I think this is a good prerequisite for a future background job for preview generation, because said job could then simply build previews for all these fixed supported sizes.

    Now I'm not aware of any timeline to provide such background job.
    On server with 100k users it is likely that such background job would take ages to finish and consume a lot of CPU on many servers. So this needs careful consideration.

    @pmaier1

  19. elpraga commented on Feb 12, 2019

    @elpraga

    Finally!! Set preview sizes!! Finally!

  20. nero120 commented on Feb 13, 2019

    @nero120

    Thanks for your comments @PVince81.

    On server with 100k users it is likely that such background job would take ages to finish and consume a lot of CPU on many servers.

    Whilst that may or may not be true (depending on whether the users on the server upload many high quality images), surely it's for the server admin to determine how best to spend the server's resources and that will depend on the hosting scenario. If you are an admin intending to provide users with a place to upload and share their photos then without preview generation this is not really fit for purpose.

    I appreciate your point, but the risk can easily be mitigated by providing a preview generation job with parameters to enable admins to control when and how previews are generated. But I have to be honest, a cpu intensive task such as preview generation must be done in the background otherwise the experience is severely degraded whilst the user is forced to wait long moments every time they want to look at an image...

  21. PVince81 commented on Feb 13, 2019

    @PVince81
    Contributor

    so instead of an OC bkg job this could be implemented as an occ command instead, which gives more freedom for admins to decide when to run them.

  22. tribut commented on Feb 13, 2019

    @tribut
    Contributor
  23. TNCS-git commented on Dec 22, 2019

    @TNCS-git

    After 5-years, still a milestone of 'maybe someday' goal... I sincerely think the target of 'ownCloud' audience is loosing its plot along the way. I believe ownCloud is best suit target at the audience of people who choose not their data over public cloud offering, whether it Dropbox, LiveDrive, Sharepoint, etc. The reason can simply be, but not limited to:

    1. Privacy reason
    2. Decision over it should be opex (Cloud based) or capex (self host solution)
    3. People who like more flexibility and control

    I have so many self scenario that a simple OCC command line for admins to do background thumbnail generating at their own freewill will work out better than ondemand generation. For one, copy over the images manually (without OC), another sync mass images without the OC due to performance factors. Made a decision of sync over my Android phone using Folder sync, after 8000+ images, realize it was impossible to use now as ownCloud app can never finish generating the Thumbnail.

    Regardless of which situation, this type of limit (and few others), really make me think the ownCloud target audience isn't for what aforementioned, but instead smaller Cloud reseller. What even puzzling me is, how NextCloud has implemented this nearly two years ago, and ownCloud is still considering to do this or not...

  24. nagelp commented on Aug 18, 2020

    @nagelp

    so instead of an OC bkg job this could be implemented as an occ command instead, which gives more freedom for admins to decide when to run them.

    Any update on this? I think an occ command would be perfect. My small home server takes really long to generate the thumbnails, so browsing images through the web interface is really painful.

  25. hast0011 commented on Aug 18, 2020

    @hast0011
  26. micbar commented on Sep 16, 2021

    @micbar
    Contributor

    This will be implemented in the future in ocis. Closing here.

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