Bug 26369 - Set use_zebra_facets to 0 in the templates
Summary: Set use_zebra_facets to 0 in the templates
Status: RESOLVED WONTFIX
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Zebra (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Nick Clemens (kidclamp)
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-03 13:05 UTC by Nick Clemens (kidclamp)
Modified: 2024-05-10 15:01 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 26369: Set use_zebra_facets to 0 in templates (974 bytes, patch)
2020-09-03 13:06 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 2020-09-03 13:05:33 UTC
bug 13665 points out performance issues of zebra facets, let's not enable them by default
Comment 1 Nick Clemens (kidclamp) 2020-09-03 13:06:55 UTC
Created attachment 109623 [details] [review]
Bug 26369: Set use_zebra_facets to 0 in templates
Comment 2 David Cook 2020-09-04 05:09:14 UTC
Hmm that's an interesting one. 

According to Hea (https://hea.koha-community.org/), the average number of biblios are ~36,000 and the median is ~3,000.

It seems to me that it might be safer to default to using Zebra facets for the majority of installations, and only large installations should turn off Zebra facets?

Of course, not everyone is reporting to Hea...

I don't have a strong feeling either way I suppose.
Comment 3 Nick Clemens (kidclamp) 2020-09-09 18:27:47 UTC
(In reply to David Cook from comment #2)
> Hmm that's an interesting one. 
> 
> According to Hea (https://hea.koha-community.org/), the average number of
> biblios are ~36,000 and the median is ~3,000.
> 
> It seems to me that it might be safer to default to using Zebra facets for
> the majority of installations, and only large installations should turn off
> Zebra facets?
> 
> Of course, not everyone is reporting to Hea...
> 
> I don't have a strong feeling either way I suppose.

I lean towards 'if it breaks...' don't default it. 

I do not know that the opposite case is true, that enabling them has a large performance increase.
Comment 4 David Cook 2020-09-10 02:29:43 UTC
(In reply to Nick Clemens from comment #3)
> I lean towards 'if it breaks...' don't default it. 
> 

It doesn't sound like Zebra facets breaks anything. Rather it's super suboptimal for very large resultsets, so the optimisation would be to turn off Zebra facets.

(Arguably you could also say the optimisation is to switch to Elasticsearch, yes?)

> I do not know that the opposite case is true, that enabling them has a large
> performance increase.

I don't have benchmarks at hand, but I want to say that historically enabling Zebra facets had large performance increases for small to medium sized libraries. It's been too long for me to recall with certainty though. Maybe the thing we cared about most at that time was that Zebra facets provided facets for the full result set, rather than just the top of the result set (like the naive Koha facets do).
Comment 5 David Cook 2020-09-10 02:31:23 UTC
Looking at Bug 13665, Tomas indicates that he also recalls the Zebra facets being much faster when we first did the facet work together back in 2013, but he also indicates that performance has appeared to degrade in newer versions of Zebra. Interesting!

I actually have some follow-up questions, but I'm going to put them on Bug 13665...
Comment 6 David Cook 2020-09-10 02:39:51 UTC
Looking at Koha, I see maxRecordsForFacets which says facets are based off the first 20 records only.

So yeah... turning off Zebra facets might mean that the search results return faster, but the quality of those facets is going to be terrible.

I'm going to mention it on Bug 13665, but another logical pathway is to perform the facet calculation asynchronously. Of course, that would be a lot more work...
Comment 7 David Cook 2020-09-10 02:53:27 UTC
Actually, I have a compromise. 

I just checked a database of 1,000,000+ bib records and it's blazingly fast to get the hit count for a even a very large result set.

Z> find d
Sent searchRequest.
Received SearchResponse.
Search was a success.
Number of hits: 670262, setno 2
SearchResult-1: term=d cnt=670262
records returned: 0
Elapsed: 0.200435

So why don't we keep the zebra facets default to 1, but add a sanity check to the Koha code where we don't use Zebra facets after we've reached a certain configurable limit say maybe 50,000 records? (We could do some benchmarking to figure out an optimal imit.)

That way we can have our cake and eat it too :D
Comment 8 Victor Grousset/tuxayo 2020-12-11 17:24:04 UTC
Hi :)
My two cents:
I'm not sure it's worth it to add a more complex behavior (which might need offer an override) depending on the number of records for Zebra.
Maybe it could be a warning in about.pl?

Also, what can give the worst experience in the case where the admin won't find the root cause?
The slow search or the bad facets?
I don't know ^^"
Question for a dev meeting?


Question about the patch:
shouldn't debian/templates/koha-conf-site.xml.in be modified also?
Comment 9 Kyle M Hall 2024-05-10 15:01:14 UTC
I think we can drop this issue now!