Merge metrics MBean 

The merge metrics MBean is useful for tuning merge operations.

The merge metrics MBean tracks the time that Solr/Lucene spends on merging segments that accumulate on disk. Segments are files that store new documents and are a self-contained index. When data is deleted, Lucene does not remove it, but instead marks documents as deleted. For example, during the merging process, Lucene copies the data from 100 segment files into a single new file. Documents that are marked deleted are not included in the new segment files. Next, Lucene removes the 100 old segment files, and the single new file holds the index on disk.

After segments are written to disk, they are immutable.

In a high throughput environment, a single segment file is rare. Typically, there are several files and Lucene runs the merge metric operation concurrently with inserts and updates of the data using a merge policy and merge schedule.

Merge operations are costly and can impact the performance of Solr queries. A huge merge operation can cause a sudden increase in query execution time.

Main operational phases

The main phases of a merge operation on the index are:
How long it takes to initialize the merge process.
How long it takes to execute the merge process.
How long it takes to warm up segments to speed up cold queries.

WARM time is part of EXECUTE time: EXECUTE time = WARM time + other operations. For example, if the EXECUTE phase is 340 ms, and the WARM phase is 120 ms, then other operations account for the remainder, 220 ms.

The merge metrics MBean operations, as shown in the following figure, are:
  • getRecordedLatencyCount
  • getLatencyPercentile
  • getAverageLatency
  • resetLatency
  • resetLatencies
JConsole showing the merge metrics MBean operations.

To get merge metrics, insert one of the phases of the merge operation and select a phase, for example EXECUTE.