Copied to clipboard

Flag this post as spam?

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


  • Keith Donnell 82 posts 187 karma points
    Oct 05, 2016 @ 21:20
    Keith Donnell
    0

    (V 1.14.1) merchHelper.Query.Product.GetFromCollection(guid, 1, 1500).Items Performance

    merchHelper.Query.Product.GetFromCollection(collection.Key, 1, 1500).Items currently takes 3+ seconds when returning ~100 items. On some pages, we pull all of the child collections, and all child products of those collections, so we can display a grid of available options for the collection page. Depending on the number of collections within the parent collection and the number of products, this process can take 20+ seconds.

    Example:

                var collections = MerchelloContext.Current.Services.EntityCollectionService.GetChildren(brand.Key).ToList();
                foreach (var collection in collections)
                {
                    var products = merchHelper.Query.Product.GetFromCollection(collection.Key, 1, 1500).Items.ToList();
                    // do stuff with product "detached data"
                }
    

    Normally if I have a performance issue like this, I would write a view or a direct SQL query to get at the data I need, however because I need to group, sort, and select by the detached data, this is not an option.

    Ultimately What I'm trying to do: Get specific detached data "columns" for all products underneath a given product collection.

    How can I accomplish this without 20+ second load times (i.e. without pulling all of the data from the product records, and without the overhead of loading one object at a time into memory)?

    When I stepped through the Merchello code, I noticed that it first pulls the keys for the products, and then, one at a time, loads a typed object from lucene (or cached lucene data?) via the key. It seems like there is a more performant way to do this if you know you are loading a collection.

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Oct 06, 2016 @ 15:23
    Rusty Swayne
    1

    Hey Keith,

    We've made a lot of changes to the collection caching between 2.1 and 2.2 and we're about ready to launch 2.3.0 (by tomorrow).

    For V3 we are refactoring the way the underlying aspects work as well. Adding new features as quickly as we have over the past year can cause these sorts of performance issues - as we can't always totally refactor everything to get the feature in there without breaking a bunch of existing stuff - but again I think you'll find V2 stuff much quicker.

  • Simon Dingley 1470 posts 3427 karma points c-trib
    Oct 06, 2016 @ 15:55
    Simon Dingley
    1

    @Keith I can confirm that I had similar issues in that version and they went away when I moved to v2 which is much faster at rendering collections like this.

    Simon

Please Sign in or register to post replies

Write your reply to:

Draft