Skip to content

Fixing preview caching #13609

Closed
Closed

Description

@oparoz

This is a meta ticket used to reference all the various problems that need sorting so that preview generation and caching works quickly in all situations. The current solution is unbearably slow as soon as large images are involved.

Current situation

Asking for the first preview

This can be a Files thumbnail or a Gallery image per example, depending on how the picture was uploaded

The preview class collapses #13493

  • 9.0 if applying a simple local fix.
  • 9.0 if waiting on the move of the preview system to the AppFramework use appframework for preview system #13610. This would not solve all problems as some apps use the AppFramwork's PreviewManager internally

Large previews are returned by some preview providers #13607

Thumbnails of large files result in a time-out #13218

Save memory by streaming large previews straight from disk #13611

Asking for a new preview of different size

Caching seems to not be working #13516 #8196

Many PRs touching on thumbnail generation performance are affected by this, but the people most affected are the ones using large images, especially in formats which need to be converted by ImageMagick

How things will work

Once all those issues are fixed, we should have something that works like this

Asking for the first preview

  • Is size less than 50MB? Only process those
  • Do we have a max preview? If not, ask the provider for a 2048x2048 preview and it will return exactly that
  • Store that max preview, resize it to fulfil the request and send it back

Asking for a new preview of different size

  • Is a preview of that exact dimension stored already? Use that
  • If not, do we have a preview for this preview category? Use that
  • If not let's create a new preview for that category from the max preview and store it in the cache

@georgehrke Feel free to add any missing issues and PRs.
People who might be interested in this: @libasys @icewind1991

Activity

  1. added this to the milestone on Jan 22, 2015
  2. georgehrke commented on Jan 22, 2015

    @georgehrke
    Contributor

    Once enhancement we could add:

    • OC\Preview\Provider::getThumbnail will get a new parameter: a file handle

    Instead of returning the OC_Image object, write the preview to the handle and just return true/false.

    Any opinions?

  3. georgehrke commented on Jan 22, 2015

    @georgehrke
    Contributor

    Another enhancement would be stream-based response types, that won't require us to load the cached preview into memory.
    This was also requested here: #12988, not sure if there is a dedicated issue yet.

  4. georgehrke commented on Jan 22, 2015

    @georgehrke
    Contributor
  5. oparoz commented on Jan 22, 2015

    @oparoz
    ContributorAuthor

    Added StreamedResponse to the OP.
    Regarding the handle, I'm not sure it would make a difference since the first thing the Image class is doing is loading the file to process it? What am I missing?

  6. georgehrke commented on Jan 22, 2015

    @georgehrke
    Contributor

    I'm not sure it would make a difference since the first thing the Image class is doing is loading the file to process it?

    • There are preview generators, e.g. movies, that generate the png not using php.
    • Even if the preview generators use OC_Image, this way (combined with StreamedResponses) we would release the used memory earlier.
  7. oparoz commented on Jan 22, 2015

    @oparoz
    ContributorAuthor

    I guess if OC_Image doesn't need to load the data in memory to do its resizing, it would be a good thing to have, yes. We can already do that for some providers by using OC_Image::loadFromFileHandle no?

  8. oparoz commented on Jan 23, 2015

    @oparoz
    ContributorAuthor

    Previews generated by the bitmap preview class are now limited in their maximum dimensions: #13635

    Affects:

    • PDF
    • Photoshop
    • Illustrator
    • Postscript
    • TIFF
  9. modified the milestones: , on Mar 11, 2015
  10. oparoz commented on Mar 11, 2015

    @oparoz
    ContributorAuthor

    Most of it should be done by the time 8.1 launches if all the PR get merged, but some changes will have to wait for 8.2

  11. PVince81 commented on Sep 21, 2015

    @PVince81
    Contributor

    @oparoz move to 9.0 as we're past feature freeze ?

  12. 15 remaining items

  13. ownclouders commented on Jan 13, 2018

    @ownclouders
    Contributor

    Hey, this issue has been closed because the label status/STALE is set and there were no updates for 7 days. Feel free to reopen this issue if you deem it appropriate.

    (This is an automated comment from GitMate.io.)

  14. PVince81 commented on Jan 15, 2018

    @PVince81
    Contributor

    @DeepDiver1975 since you were working on preview stuff.

  15. ownclouders commented on Feb 23, 2018

    @ownclouders
    Contributor

    Hey, this issue has been closed because the label status/STALE is set and there were no updates for 7 days. Feel free to reopen this issue if you deem it appropriate.

    (This is an automated comment from GitMate.io.)

  16. stale commented on Sep 21, 2021

    @stale

    This issue has been automatically closed.

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