Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-12688

LTR Multiple performance fixes + pure DocValues support for FieldValueFeature

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • contrib - LTR
    • None

    Description

      This ticket is related to 2 performance and 1 functional/performance issue that I had found during integrating LTR in our e-commerce search engine : 

      1. FieldValueFeature doesn't support pure DocValues fields (Stored false). Please also note that for fields which are both stored and DocValues it is working not optimal because it is extracting just one field from the stored document. DocValues are obviously faster for such usecases. Below are screenshots of JFR profiles without and with new support of DocValues for the case when it can be read from DocValues. 

      2. SolrFeature was not optimally implemented for the case when no fq parameter was passed. I'm not absolutely sure what was the intention to introduce both q(which is supposed to be a function query) and fq parameter for the same SolrFeature at all(Is there a case when they will be used together ? ), so I decided not to change behavior but just optimize described case
      3. LTRScoringModel was a mutable object. It was leading to the calculation of hashcode on each query, which in turn can consume a lot of time in cases when a model is big(In our case we were using LambdaMART with 100 trees and leaves which was consuming 3MB of the disk space). So I decided to make LTRScoringModel immutable and cache hashCode calculation. Below are the screenshots before and after. 

      In our case, we had a feature.json file with 8 FieldValueFeatures, 5 SolrFeatures and 1 OriginalScoreFeature.
      Before introducing the optimizations performance overhead for LTR reranking of top 48 documents was 300ms. With all the optimizations in it was decreased to 35ms.

      Please also note that JFR screenshots were captured on Solr 6.6 codebase. All the numbers are also taken from Solr version 6.6.
      I hope that changes of the DocValues interface(method get() was removed and advanceExact was added) won't affect it (At least for DenseNumericDocValues it will work as expected.)

      Attachments

        1. LTRModelHashCodeBefore.png
          43 kB
          Stanislav Livotov
        2. LTRModelHashCodeAfter.png
          37 kB
          Stanislav Livotov
        3. LTRwithoutDVOptimisation.png
          74 kB
          Stanislav Livotov
        4. LTRwithDVOptimisation.png
          95 kB
          Stanislav Livotov
        5. LTRSolrFeatureAfter.png
          88 kB
          Stanislav Livotov
        6. LTRSolrFeatureBefore.png
          87 kB
          Stanislav Livotov
        7. MultiplePerformanceFixes.patch
          17 kB
          Stanislav Livotov
        8. NoFQSolrFeatureOptimisation.patch
          2 kB
          Stanislav Livotov
        9. LTRScoringModelHashCodeCaching.patch
          2 kB
          Stanislav Livotov
        10. DocValuesSupportForFieldValueFeature.patch
          12 kB
          Stanislav Livotov

        Activity

          People

            Unassigned Unassigned
            slivotov Stanislav Livotov
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 16.5h
                16.5h