Krunal
Krunal

Reputation: 3269

Improve Slow Solr Query Performance

We are using Solr on Windows with multiple collections. Collections are having multiple stored and indexed fields with appx 200k documents. The use case is for e-commerce website search. The size of index is appx. 200 MB

While the normal search takes less than few ms, the query where I need to find all data for multiple categories are taking somewhere around 1100ms to 1200ms. The query includes appx. 400 categories with OR something like..

Category:(5 OR 33 OR 312 OR 1192 OR 1193 OR 1196 OR .....)

I have increased Heap Size to 4gb, and configured Solr cache value to be on higher size, this reduced the query time from 2000ms to 1100ms, but we are looking for more improvement.

I also found following on Solr UI: lockFactory=org.apache.lucene.store.NativeFSLockFactory@56761b2a; maxCacheMB=48.0 maxMergeSizeMB=4.0

But not sure does that impact? And if Yes, how to change that? Can you advise what else we can do? Let me know if you need more details.

Thank you in anticipation.

Upvotes: 0

Views: 2334

Answers (1)

Persimmonium
Persimmonium

Reputation: 15791

you should add your full request so it's easier to give some advice. But, from your sentence "The query includes appx. 400 categories with OR something like.." I understand you are putting your huge clause in q param? That is not the right approach.

Instead use q=* :* and put your clause in fq. This way, it will be cached, and subsequent queries will be much faster. If you get a good cache hit rate, queries will be significantly faster.

As a second thing you might try (but go first with the above) could be transforming the big OR clause into a (or a combination of) range clauses, as:

Category:[5 TO 1190] OR Category:[1192 TO 1196]

If your type is an tint, and you can transform the clause into ranges combination by significantly decreasing it's size, it might work too

Upvotes: 2

Related Questions