Hi Dynamicweb,
After upgrading a solution from 8.9 to 9.4 we experience serious performance issues in the cart!
The server side loading time goes from 600ms to at least 10.000ms and up to 37.000ms if we have the cart module setting "remove unavailable products" activated. If I then deactivate "assortments" the loading times goes down to appr. 1.000ms which is acceptable.
The solution has appr. 1.2 mio items in EcomAssortmentItems-table, and I can see that the logic in HasAccessToProduct as been changed to rely only on linq-expressions which have a terrible performance on large datasets. I the believe the issue is caused by changing this from:
Dim productAssortmentIds As IEnumerable(Of String) = AssortmentItem.GetAssortmentsByProduct(product).
Where(Function(a) (Not IsNothing(a) AndAlso a.Active AndAlso a.LanguageID = Context.LanguageID)).Select(Function(a) a.ID)
To:
Dim productAssortmentIds As IEnumerable(Of String) = AssortmentItem.GetAssortmentItemsByLanguageID(
Common.Context.LanguageID).
Where(
Function(ai) _
(ai.ProductID = product.Id AndAlso ai.ProductVariantID = product.VariantId AndAlso
ai.LanguageID = product.LanguageId AndAlso Not IsNothing(ai.Assortment) AndAlso
ai.Assortment.Active)).Select(Function(ai) ai.AssortmentID).ToList()
Can you please change this back or put it into e.g. a dictionary which is much better for large lookups.
Please provide a quick fix for this as we are going live with the upgraded solution next week.
Best regards, Anders