Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-10576

ConcurrentMergeScheduler maxThreadCount calculation is artificially low

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Won't Fix
    • None
    • None
    • None
    • None
    • New

    Description

      https://github.com/apache/lucene/blob/main/lucene/core/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java#L177

      maxThreadCount = Math.max(1, Math.min(4, coreCount / 2));
      

      This has a practical limit of max of 4 threads due to the Math.min. This doesn't take into account higher coreCount.

      I can't seem to tell if this is by design or this is just a mix up of logic during the calculation.

      If I understand it looks like 1 and 4 are mixed up and should instead be:

      maxThreadCount = Math.max(4, Math.min(1, coreCount / 2));
      

      which then simplifies to

      maxThreadCount = Math.max(4, coreCount / 2);
      

      So that you have a minimum of 4 maxThreadCount and max of coreCount/2.


      Based on the history I could find, this has been this way forever.

      Attachments

        Issue Links

          Activity

            People

              krisden Kevin Risden
              krisden Kevin Risden
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 40m
                  1h 40m