Search code examples
marklogic

How to control Merging stands in MarkLogic


Marklogic will determine when to run merges in the background, based on size and number of stands. In order to keep the number of stands to a manageable level, when in-memory stands are filled up, they are written to on-disk stands.

Merges tend to be CPU and disk intensive. How can I control when merges happen? I would like merges to happen at night instead during business hours.


Solution

  • I would recommend reading the Understanding And Controlling Database Merges section of the Admin guide.

    You might want to first explore tuning the merge policy settings to see if you can minimize the impact of merge activity for online traffic.

    If you do decide that you want to prevent merges from occurring during certain peak business hours, then there is a section that describes how to configure Blackout Periods for Merges, which you can use to configure a window of time in which merges are disabled:

    Although merges are a normal part of system behavior, there are times when it is inconvenient for a merge to start. Merge blackout periods allow you to specify times when a merge should not begin.

    enter image description here

    However, there are some trade-offs and considerations.

    Be sure to read and understand the Dangers of Disabling Merges. As described in that section, there are other configurations that can be applied to help mitigate the impacts of merging.

    • Disabling or eliminating merging may eventually lead to a condition in which the server is unable to make changes to the database. For example, when an in-memory stands fills up, it is written to an on-disk stand. MarkLogic Server has a fixed limit for the maximum number of stands (64), and eventually, that limit will occur and you will no longer be able to update your system. Therefore, there is no control available to disable merges. If you feel you need to disable merges and you have an active maintenance contract, you can contact MarkLogic Technical Support for help.

    • In most cases where merges are causing disruptions to your system, you should be able to adjust the merge policy parameters to settings that will work in your environment. If you feel you need to disable merges and you have an active maintenance contract, you can contact MarkLogic Technical Support for help. Monitor the system and make sure the number of stands per forest does not grow too high. For details on setting merge controls, see Description of Merge Policy Parameters and Configuring Merge Policy Rules.

    • In some cases, especially in environments with many forests and constantly changing content across many of the forests, an alternative to disabling merges is to set one or more forests to be delete-only. For details, see Making a Forest Delete-Only.

    Whatever you decide, be sure to test your scenarios and actively monitor the system if you decide to implement a change to your merge policy.