Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • andy_rose 91 posts 117 karma points
    Aug 26, 2009 @ 18:50
    andy_rose
    0

    Accessing a media node is very slow

    We have 2000+ pdf files that are to be listed on our site and I have created them as a custom 'Magazine' media type and imported them all under a root node in the media section where they are then further divided into year and month folders i.e. the node path would be something like:

    Magazines - 2009 - JUN - Magazine.pdf

    There is approxiamately 20-30 'Magazine' media types in each month folder going back to 2002.

    I noticed that the xslt that I have writted to loop through and display them was quite slow. After some investigation it appears that the initial call to GetMedia to return the root folder containing all the magazine media types was taking the bulk of the page processing time. I have read that this method is not the fastest and was after some confirmation that this is the culprit and if there is anything I can do to improve the performance.

    Andy

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Aug 26, 2009 @ 20:03
    Dirk De Grave
    101

    Yup, GetMedia() is indeed the culprit as it requires lots of db calls (A folder with 20 pdf's will result in 20+ db calls). You may improve performance by caching on the macro level (which will help improve performance significantly if you're not content editing all day - because a publish of content will make the cache expire immediately)

    You can further optimize the system by adding your own caching mechanism. I'd create a xslt extension that does the db plumbing and caching of the results. And you could build some action handlers that fire on adding/deleting media (and perform extra check for your media type 'Magazine') and expire the cache if a new magazine gets uploaded.

     

    Hope this helps.

     

    Regards,

    /Dirk

     

  • Chris Koiak 700 posts 2626 karma points
    Aug 26, 2009 @ 22:37
    Chris Koiak
    0

    Great advice from Dirk.

    Andy - the second part of Dirk's response is a must.

    There was asimilar discussion in this forum about listing members and the response was based on http://forum.umbraco.org/yaf_postst9591_Getting-Members-Groups-From-Member-ID-in-XSLT.aspx. I couldn't find the our.umbraco topic/discussion.

    A similar media-orientated xslt extension could be a good idea.

  • andy_rose 91 posts 117 karma points
    Aug 27, 2009 @ 10:44
    andy_rose
    0

    Thank you both for the responses; it was about time I started finding out a bit more about macro caching in Umbraco.

    Unfortunately these pages are going to be searchable using querystring parameters and the scope of variation will really prevent caching from helping too much so it looks like i'm going to have to delve into custom xslt extensions.

    @Chris: FYI, the link in your post fails as it contains a full stop at the end. I don't know if this can be edited.

Please Sign in or register to post replies

Write your reply to:

Draft