Class ConcurrentMergeScheduler

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class ConcurrentMergeScheduler
    extends MergeScheduler
    A MergeScheduler that runs each merge using a separate thread.

    Specify the max number of threads that may run at once, and the maximum number of simultaneous merges with setMaxMergesAndThreads(int, int).

    If the number of merges exceeds the max number of threads then the largest merges are paused until one of the smaller merges completes.

    If more than getMaxMergeCount() merges are requested then this class will forcefully throttle the incoming threads by pausing until one more more merges complete.

    This class attempts to detect whether the index is on rotational storage (traditional hard drive) or not (e.g. solid-state disk) and changes the default max merge and thread count accordingly. This detection is currently Linux-only, and relies on the OS to put the right value into /sys/block/<dev>/block/rotational. For all other operating systems it currently assumes a rotational disk for backwards compatibility. To enable default settings for spinning or solid state disks for such operating systems, use setDefaultMaxMergesAndThreads(boolean).