-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slow Search Queries - Possibly related to virtual categories #2097
Comments
Hello @harrigo Could you copy/paste an example of generated query ? You can enable logging in Stores > Configuration > Elasticsuite > Enable Debug Mode and the queries will be logged into the system.log If we can see the query we'll be able to give you insights about the processing time. |
Have attached as was large, this was only one or two queries but looks quite crazy to me. I have not got that many optimisers or anything although have played with a few, (there are 5 active ones at present). I have also reduced down i believe searchable attributes to just skus, mpn meta data title and a few others I believe via Magento attributes "use in search" config to try and speed it up. I also thought it might be to do with Use Category Name in product search so have disabled that on atleast all the virtual categories but unsure if it has made that query any lighter. Any more advice would be greatly appreciated. |
Well there's a lot of virtual categories clauses combined in this query, indeed. The query itself has a size of 1.7Mo :/ What is the use case behind your virtual categories ? I see some of them based on product material, style, etc... Is this due to the fact that you do not have anything efficient to order your products before they are added to Magento ? |
Well most should be brands, as that allows products to be placed in one main category and then autofilled into brands so we don't have to worry about forgetting to add them there. When they have a colour / style that might be in cases where brand and range and that range is all blue like a certain range of crockery or we often give a range a style and so that is what builds the range section for that brand. I have been asking to keep usage to minimum on these and removed around 100 virtual categories and made sure they have a root category that is not the main store root however it still keeps getting larger. Yeah that query is very large does it need to include all the VCS in a search query or could I botch it out in my case, not sure why it needs to know about categories in initial query? |
Right so i'm just testing botching them out although i know probably not a great idea and no idea what i'm doing i'm just wondering if this may just help in my case...
Just to return an empty array I guess but not entirely sure what i've messsed with everything seems to work and rapid compared to before (ES:Execute Search Query | 0.022710) with much smaller queries. What repercussions can i expect from doing that? |
Hello we have seen similar problems. The query that gives us the most trouble is the one in the backend when you go to the categories overview. Apparently all categories are fetched there with one ES query. We had Eleastic Search 7.12 in use so far after an update to 7.13 there were failures of Eleastic Search when someone in the backend accessed the category overview. Only a downgrade to ES 7.12 brought stability again.The store has about 20.000 simple products, 3000 config products and about 100 to 150 virtual categories. |
Hi, we have same problem. but I can't say it's slow query, this is killer query. I checked that problem are with this line:
Adding line |
This comment has been minimized.
This comment has been minimized.
…e than 75 subcategories
Same issue here, on a big category, with a lot of virtual children, there is two huge queries that took 1sec each. (I can send query log if needed) I guess the only solution would be to use a mixed system :
EDIT: If the root category of the virtual child category is the current category, or one of its child, there's actually no need to add the rules to the query. For instance :
If I understand correctly what's going on currently, is that retrieving products for Cat A generates a request like this : And I guess 99% of real-world virtual categories are in the case of Cat B/D (using a parent category as category root) |
I made a PR for this : #2926 I tested on a category, the loading time was 3.43sec before, 1.3sec after. ES http calls from 1.3sec to 167ms. I guess the rest of the gain is on query building. I checked product count before/after on 10 categories, and it's the same. However, it would probably require more tests to be sure there's no regression. @harrigo @frostblogNet @bmxmale @romainruaud |
Probably solves #1798 too |
Hi @Nuranto Thank you for contributing this. As you said, this will require a bit of testing before getting merged, because there can be several different uses cases. But it looks definitely promising. Best regards |
Hi @romainruaud Thanks. Do you know why the automated tests aren't starting on this PR ? Do I have to do something ? |
Hi did this get anywhere? |
We have the same issue with around 400 virtual categories. How is the status? Has anyone tested the patch and can confirm success? |
This was partially integrated in a recent rework of assembling virtual categories queries. Which version are you using @tim-breitenstein-it ? Regards |
v2.10.15 We are currently working on an Update for Magento v2.4.6 with the latest Smile\Elasticsuite v2.11.6.1, but this take at least a month or longer so we need to fix this quite soon on our productive environment. |
I have been using this module for a few years now and have found it relatively quick however over time have noticed a bit of a slow down. I have been playing with this on lesser hardware recently and found queries to be quite slow... here is a section of my profiler:
So the whole page is taking around 1.74 seconds which is pretty slow for my site with uncached product and category pages taking like 0,5-0,7s TTFB. The main issue I am having is certain search queries. My store has about 20,000 products and feel that should be relatively small but searching plates can take a while as have a few 1000 of them and I feel this shouldn't be the case.
The main slow down seems to be within the ES:Execute search query (taking 1.1s of the 1.7) and i thought that should be pretty lightning quick. I have looked at other "slow" examples on here where the issue was not the ES query time as that was clocking in at 0.001889 which would be magic if that was the case for me!
I have been finding reducing my usage of virtual categories has been helping this and the more that are created seems to be worsening but I do like the feature and have come to reply on it in some cases.
I am working on moving to having these "virtual categories" actually indexed based on rules so they are just normal categories refreshed every night due to this but just wanted to check it this was normal and if there was anything else that could be suggested that may be going wrong or if this is completely abnormal?
The text was updated successfully, but these errors were encountered: