Class MemoryCircuitBreaker

  • All Implemented Interfaces:
    Closeable, AutoCloseable, NamedListInitializedPlugin

    public class MemoryCircuitBreaker
    extends CircuitBreaker
    Tracks the current JVM heap usage and triggers if a moving heap usage average over 30 seconds exceeds the defined percentage of the maximum heap size allocated to the JVM. Once the average memory usage goes below the threshold, it will start allowing queries again.

    The memory threshold is defined as a percentage of the maximum memory allocated -- see memThreshold in solrconfig.xml.

    • Constructor Detail

      • MemoryCircuitBreaker

        public MemoryCircuitBreaker()
        Creates an instance which averages over 6 samples during last 30 seconds.
      • MemoryCircuitBreaker

        protected MemoryCircuitBreaker​(int numSamples,
                                       int sampleInterval)
        Constructor that allows override of sample interval for which the memory usage is fetched. This is provided for testing, not intended for general use because the average metric provider implementation is the same for all instances of the class.
        Parameters:
        numSamples - number of samples to calculate average for
        sampleInterval - interval between each sample