https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42878 --- Comment #2 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208522 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208522&action=edit Benchmark scripts for full-reindex / batch indexing (bug 42881 family) Clarifying the goal of this work (bug 42881 family): the target is infrastructure-facing - the time and CPU a FULL REINDEX (misc/search_tools/rebuild_elasticsearch.pl) and LARGE BATCH re-indexes (batch record modification, imports; these enqueue index jobs of up to chunk_size = 5000 records) consume. It is not about how quickly a cataloguer sees one edit: in KTD we measured the edit-to-searchable time through the stock es_indexer_daemon and it is dominated by job dispatch (roughly one job per second), so these patches do not change it. I am attaching a small benchmark package (bug42881-es-indexing-bench.tar.gz, see README.txt inside) so testers can reproduce the before/after numbers below and, importantly, verify that the generated Elasticsearch documents are byte-for-byte identical (SHA-256 over every document) with and without the patch. Setup, once, in a KTD with Elasticsearch (stock sample data works; 10,000 generated records give steadier numbers - gen_records.pl + bulkmarcimport.pl, see README): mkdir -p _bench && cp <extracted files> _bench/ Test plan for this bug 1. prove t/db_dependent/Koha/SearchEngine/Elasticsearch.t (includes the new "batch query available items" subtest) 2. Before/after, with this patch applied on a branch: _bench/ab_bench.sh main HEAD Expect: "output identical to baseline" = yes; DB statements per record fall (2.0 -> 1.0 at batch 500, 2.1 -> 1.2 at batch 10). 3. Semantics: pick a biblio whose only items are lost (itemlost != 0) or checked out, and one with a normally available item; after reindexing, the ES document has available=false / available=true respectively: curl -s es:9200/koha_<instance>_biblios/_doc/<biblionumber> | jq '._source.available' (inside the KTD container; in KTD <instance> is kohadev). Records without a biblionumber field get no "available" key, as before. 4. Optional, full reindex wall-clock: bash _bench/bench_rebuild.sh before / after. Our results (10,436 generated records, KTD + ES 9, one core, best of 3 interleaved rounds, spread 0-1%), decode + mapping, ms per record: batch 1: 24.8 -> 24.9 (1.00x, nothing to batch) batch 10: 6.6 -> 5.5 (1.22x) batch 500: 4.6 -> 3.3 (1.42x) full rebuild_elasticsearch.pl: 103.8 s -> 89.2 s (1.16x) Note KTD's database is local; the saving is one round trip per record, so on a networked database server the effect should be larger. If you can test against a remote DB, please report. -- You are receiving this mail because: You are watching all bug changes.