This topic describes the minor compaction parameters and how to set these parameters.
Minor compaction parameters
The most common parameter for controlling minor compactions is minor_freeze_times, which determines the number of minor compactions that triggers a major compaction. If the parameter is set to 0, minor compactions are disabled, and each time the MemTable memory usage of the tenant reaches the specified threshold, a major compaction is directly performed without performing minor compactions. You can configure the parameters based on the specific business needs.
| Parameter | Description | Default value | Value range |
|---|---|---|---|
| minor_compact_trigger | The number of SSTables to trigger a minor compaction. | 2 | [0, 16] |
| minor_freeze_times | The number of minor compactions to trigger a major compaction. | 5 | [0, 65535] |
| minor_merge_concurrency | The number of concurrent threads or degree of parallelism for a minor compaction. | 0 | [0, 64] |
| minor_warm_up_duration_time | The warm-up time after a minor compaction. The purpose of warm-up is to load the data in the new SSTable to the cache. This operation facilitates subsequent queries. | 30s | [0s, 60m] |
| freeze_trigger_percentage | The threshold of memory used by the MemStore of the tenant in percentage to trigger a minor freeze. | 70 | [1, 99] |
| memstore_limit_percentage | The percentage of the memory occupied by the MemStore of the tenant to the total memory of the tenant. | 50 | [1, 99] |
Note
The value of the
minor_freeze_timesparameter increases along with the number of minor compactions triggered because the MemTable memory usage reaches the specified threshold. Manually executed minor compactions are not counted. The value of theminor_freeze_timesparameter does not increase no matter how many minor compactions are manually executed. For example, assume that the value of theminor_freeze_timesparameter is3. AfterALTER SYSTEM MINOR FREEZEis executed three times, a major compaction is not triggered when the MemTable memory usage reaches the specified threshold, because the manually executed minor compactions are not counted.
OceanBase Cloud Platform (OCP) V2.4.x and later provide parameters to specify the number of SSTables to trigger a minor compaction, the number of minor compactions to trigger a major compaction, the number of threads for minor compactions, and the memory usage to trigger a minor compaction. For more information, see "Modify major compaction settings" in the OCP User Guide.
Modify parameters
Modify minor compaction parameters by using SQL statements
Log on to the
systenant as therootuser.Modify minor compaction parameters.
For example:
obclient> ALTER SYSTEM SET minor_compact_trigger=2; obclient> ALTER SYSTEM SET minor_freeze_times=5; obclient> ALTER SYSTEM SET minor_merge_concurrency=0; obclient> ALTER SYSTEM SET minor_deferred_gc_time='0s'; obclient> ALTER SYSTEM SET minor_warm_up_duration_time='30s'; obclient> ALTER SYSTEM SET freeze_trigger_percentage=70; obclient> ALTER SYSTEM SET memstore_limit_percentage=50;After the parameters are modified, you can execute the
SHOW PARAMETERSstatement to check whether the modification is successful.For example:
obclient>SHOW PARAMETERS LIKE 'minor_compact_trigger'; obclient>SHOW PARAMETERS LIKE 'minor_freeze_times'; obclient>SHOW PARAMETERS LIKE 'minor_merge_concurrency'; obclient>SHOW PARAMETERS LIKE 'minor_deferred_gc_time'; obclient>SHOW PARAMETERS LIKE 'minor_warm_up_duration_time'; obclient>SHOW PARAMETERS LIKE 'freeze_trigger_percentage'; obclient>SHOW PARAMETERS LIKE 'memstore_limit_percentage';
Modify minor compaction parameters in the OCP console
You can also modify the minor compaction parameters in the OCP console, including the number of SSTables to trigger a minor compaction, the number of minor compactions to trigger a major compaction, the number of threads for minor compactions, and the memory usage to trigger a minor compaction.
Log on to the OCP console.
The Clusters page automatically appears.
In the Clusters section, find the target cluster and click the cluster name.
The Overview page of the cluster appears.
In the left-side navigation pane, click Compaction Management.
On the Compaction Management page, click the Configuration for Major Compaction tab.
In the upper-right corner of the Minor Compaction Strategy section, click Modify.
Modify minor compaction parameters as needed.
Hover the pointer over the
icon next to each parameter and configure the minor compaction strategy as prompted.Click Save.