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

FuzzyQuery has severe memory usage in 8.5

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 8.5, 8.5.1
    • Fix Version/s: 8.6
    • Component/s: None
    • Labels:
      None

      Description

      I sent this to the mailing list

      I'm moving from 8.3.1 to 8.5.1, and started getting Out Of Memory Errors while running our normal tests. After profiling it was clear that the majority of the heap was allocated through FuzzyQuery.
      LUCENE-9068 moved construction of the automata from the FuzzyTermsEnum to the FuzzyQuery's constructor.

      I created a little test ( FuzzyHammer.java ) that fires off fuzzy queries from random UUID strings for 5 minutes

      FIELD_NAME + ":" + UUID.randomUUID().toString().replace("-", "") + "~2"
      

      When running against a vanilla Solr 8.31 and 8.4.1 there is no problem, while the memory usage has increased drastically on 8.5.0 and 8.5.1.

      Comparison of heap usage while running the attached test against Solr 8.3.1 and 8.5.1 with a single (empty) shard and 4GB heap:

      And with 4 shards on 8.4.1 and 8.5.0:

      I'm guessing that the memory might be being leaked if the FuzzyQuery objects are referenced from the cache, while the FuzzyTermsEnum would not have been.

      Query Result Cache on 8.5.1:

      ~316mb in the cache

      QRC on 8.3.1

      <1mb

      With an empty cache, running this query field_s:e41848af85d24ac197c71db6888e17bc~2 results in the following memory allocation

      8.3.1: CACHE.searcher.queryResultCache.ramBytesUsed:      1520
      8.5.1: CACHE.searcher.queryResultCache.ramBytesUsed:    648855
      

      ~1 gives 98253 and ~0 gives 6339 on 8.5.1. 8.3.1 is constant at 1520

        Attachments

        1. image-2020-04-23-09-18-06-070.png
          35 kB
          Colvin Cowie
        2. FuzzyHammer.java
          1 kB
          Colvin Cowie
        3. screenshot-2.png
          31 kB
          Colvin Cowie
        4. screenshot-3.png
          29 kB
          Colvin Cowie
        5. screenshot-4.png
          29 kB
          Colvin Cowie
        6. image-2020-04-24-20-09-31-179.png
          47 kB
          Colvin Cowie
        7. SOLR-14428-WeakReferences.patch
          5 kB
          Colvin Cowie

        Issue Links

          Activity

            People

            • Assignee:
              romseygeek Alan Woodward
              Reporter:
              cjcowie Colvin Cowie

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

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

                  Issue deployment