neoremind commented on PR #16894:
URL: https://github.com/apache/lucene/pull/16894#issuecomment-6772019430

   Thanks @owaiskazi19 for the improvement on CI! Share two comments.
     
   1. 
   Would it be better to measure indexing performance as well? I read from the 
comment that these scripts are purposely built for pure query performance. 
Consider adding a new label like `benchmark:luceneutil-1m-reindex-candidate` 
that passes `--reindex` to `localrun.py`.  With reindex, the report can also 
show the indexing throughput diff. Indexing 1m docs only takes ~1min locally on 
my Mac, will not drag the CI time too much. In addition, it can also handle 
index format upgrade case, like if file format changes bumping version, the 
candidate may read the baseline's indices with old format and reports "no 
diff", or it fails with incompatible format error.
   
   2. 
   I ran the default 1m docs setup locally with `verbose=True`, it flushed 552 
times, 75 CMS merges, generating 9 segments. This is because `localrun.py` 
doesn't set `ramBufferMB` by default (there is legacy logic 
[here](https://github.com/mikemccand/luceneutil/blob/main/src/python/competition.py#181),
 we may need to change this later). I would suggest a large RAM buffer like 2GB 
if the test env allows, so we get exactly one segment for 1m docs, then query 
run on top of more compact segments. In the future, if we use large doc numbers 
like full 33m, this can benefit a lot more avoiding fragmented segments and 
busy frequent merge.
   
   We can specify ramBufferMB by overriding `localrun.py`. Below is the setup I 
usually use, this minics the real 
[nightly](https://github.com/mikemccand/luceneutil/blob/main/src/python/nightlyBench.py)
 run, there are different setups. The drawback is that we need to update the 
postings format names whenever there's a format bump, but since this is 
infrequent, which might be OK.
   
   <details>
       <summary>my localrun.py</summary>
   
   ```
   #!/usr/bin/env python
   
   # Licensed to the Apache Software Foundation (ASF) under one or more
   # contributor license agreements.  See the NOTICE file distributed with
   # this work for additional information regarding copyright ownership.
   # The ASF licenses this file to You under the Apache License, Version 2.0
   # (the "License"); you may not use this file except in compliance with
   # the License.  You may obtain a copy of the License at
   #
   #     http://www.apache.org/licenses/LICENSE-2.0
   #
   # Unless required by applicable law or agreed to in writing, software
   # distributed under the License is distributed on an "AS IS" BASIS,
   # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   # See the License for the specific language governing permissions and
   # limitations under the License.
   
   import argparse
   import os
   
   import competition
   
   # simple example that runs benchmark with WIKI_MEDIUM source and taks files
   # Baseline here is ../lucene_baseline versus ../lucene_candidate
   if __name__ == "__main__":
     parser = argparse.ArgumentParser(prog="Local Benchmark Run", 
description="Run a local benchmark on provided source dataset.")
     parser.add_argument("-s", "-source", "--source", help="Data source to run 
the benchmark on.")
     parser.add_argument("-searchConcurrency", "--searchConcurrency", 
default="-1", type=int, help="Search concurrency, 0 for disabled, -1 for using 
all cores")
     parser.add_argument("-b", "--baseline", default=os.environ.get("BASELINE") 
or "lucene_baseline", help="Path to lucene repo to be used for baseline")
     parser.add_argument("-c", "--candidate", 
default=os.environ.get("CANDIDATE") or "lucene_candidate", help="Path to lucene 
repo to be used for candidate")
     parser.add_argument("-r", "--reindex", action="store_true", help="Reindex 
data for candidate run")
     parser.add_argument("-iterations", "--iterations", default=20, type=int, 
help="Number of JVM iterations (separate JVM processes, default: 20)")
     parser.add_argument("-warmups", "--warmups", default=20, type=int, 
help="Number of times each query runs within a single JVM for warmup (default: 
20)")
     args = parser.parse_args()
     print("Running benchmarks with the following args: %s" % args)
   
     sourceData = competition.sourceData(args.source)
     countsAreCorrect = args.searchConcurrency != 0
     comp = competition.Competition(verifyCounts=not countsAreCorrect, 
jvmCount=args.iterations, taskRepeatCount=args.warmups)
   
     index = comp.newIndex(
       args.baseline,
       sourceData,
         addDVFields=True,
   #     useCMS=True,
   #     mergePolicy="TieredMergePolicy",
         facets=(
           ("taxonomy:Date", "Date"),
           ("taxonomy:Month", "Month"),
           ("taxonomy:DayOfYear", "DayOfYear"),
           ("sortedset:Date", "Date"),
           ("sortedset:Month", "Month"),
           ("sortedset:DayOfYear", "DayOfYear"),
           ("taxonomy:RandomLabel", "RandomLabel"),
           ("sortedset:RandomLabel", "RandomLabel"),
         ),
         postingsFormat="Lucene104",
         idFieldPostingsFormat="Lucene104",
         directory="MMapDirectory",
         ramBufferMB=2048,
         waitForMerges=True,
         waitForCommit=True,
         grouping=False,
         verbose=False,
         mergePolicy="TieredMergePolicy",
         useCMS=False,
     )
   
     # create a competitor named baseline with sources in the ../trunk folder
     comp.competitor("baseline", args.baseline, index=index, 
searchConcurrency=args.searchConcurrency)
   
     # use the same index as baseline unless --reindex was passed.
     # create a competitor named my_modified_version (or provided candidate 
name) with sources in the ../patch folder
     # if --reindex flag is not used, luceneutil will automatically use the 
index from the base competitor for searching
     # while the codec that is used for running this competitor is taken from 
this competitor.
     candidate_index = index
     if args.reindex:
       candidate_index = comp.newIndex(
         args.candidate,
         sourceData,
         addDVFields=True,
         extraNamePart="candidate",
         facets=(
           ("taxonomy:Date", "Date"),
           ("taxonomy:Month", "Month"),
           ("taxonomy:DayOfYear", "DayOfYear"),
           ("sortedset:Date", "Date"),
           ("sortedset:Month", "Month"),
           ("sortedset:DayOfYear", "DayOfYear"),
           ("taxonomy:RandomLabel", "RandomLabel"),
           ("sortedset:RandomLabel", "RandomLabel"),
         ),
         postingsFormat="Lucene104",
         idFieldPostingsFormat="Lucene104",
         directory="MMapDirectory",
         ramBufferMB=2048,
         waitForMerges=True,
         waitForCommit=True,
         grouping=False,
         verbose=False,
         mergePolicy="TieredMergePolicy",
         useCMS=False,
       )
     comp.competitor("my_modified_version", args.candidate, 
index=candidate_index, searchConcurrency=args.searchConcurrency)
   
     # start the benchmark - this can take long depending on your index and 
machines
     comp.benchmark("baseline_vs_patch")
   ```
   
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to