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

Overhaul ShapeFieldCache because its a memory pig

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • None
    • None
    • modules/spatial
    • None
    • New

    Description

      The org.apache.lucene.spatial.util.ShapeFieldCache* classes together implement a spatial field cache for points, similar to FieldCache for other fields. It supports a variable number of points per document, and it's currently only used by the SpatialPrefixTree strategy because that's the only strategy that supports a variable number of points per document. The other spatial strategies use the FieldCache. The ShapeFieldCache has problems:

      • It's a memory pig. Each point is stored as a Point object, instead of an array of x & y coordinates. Furthermore, each Point is in an ArrayList that exists for each Document. It's not done any differently when your spatial data isn't multi-valued.
      • The cache is not per-segment, it's per-IndexReader, thereby making it un-friendly to NRT search.
      • The cache entries don't self-expire optimally to free up memory. The cache is simply stored in a WeakHashMap<IndexReader,ShapeFieldCache>. The big cache entries are only freed when the WeakHashMap is used and the JVM realizes the IndexSearcher instance has been GC'ed.

      Attachments

        1. solr_spatial_leak1.png
          34 kB
          Hal Deadman

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dsmiley David Smiley
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: