Group commit is a performance optimization feature provided by OBKV-Table for single-operation requests. When the database server aggregates single-operation requests from clients, it processes these requests in batches for combined computation, write, or read operations, thereby reducing the overhead of multiple transaction and storage calls.
Supported operations
Currently, group commit supports the following single operations in Table mode:
getputinsertdeletereplaceupdateinsert_or_updateincrementappend
For more information about the single operations supported in Table mode, see OBKV-Table operations.
Usage instructions
To use group commit, you only need to enable the corresponding parameter on the server side. After group commit is enabled, the API behavior and usage remain unchanged, and only performance is expected to improve.
Group commit provides the following two parameters, kv_group_commit_batch_size and kv_group_commit_rw_mode, to control whether it is enabled. They are described as follows:
Parameter
kv_group_commit_batch_sizeThis parameter specifies the batch size of group commit. When it is set to 1, group commit is disabled, which is the default value. A value greater than 1 enables group commit. When you enable group commit, you must set a batch size, which affects the performance of single operations. For more information about the
kv_group_commit_batch_sizeparameter, see kv_group_commit_batch_size.The configuration method is as follows:
-- Default value, which disables group commit. ALTER SYSTEM SET kv_group_commit_batch_size = 1 TENANT = <tenant_name>; -- Set the group commit batch size to 10. ALTER SYSTEM SET kv_group_commit_batch_size = 10 TENANT = <tenant_name>;Parameter
kv_group_commit_rw_modeIn some scenarios, you may want to enable group commit only for certain types of operations. For example, in scenarios with uneven read and write traffic, such as read-heavy workloads, batching read operations can take a long time and increase the response latency of read requests. In such cases, you can enable group commit only for write operations.
kv_group_commit_rw_modetakes effect only when group commit is enabled. Its default value isALL, which means that all operations support group commit.READmeans that only read operations support group commit, andWRITEmeans that only write operations support group commit. For more information about thekv_group_commit_rw_modeparameter, see kv_group_commit_rw_mode.The configuration method is as follows:
-- Default value, which enables group commit for all operation types. ALTER SYSTEM SET kv_group_commit_rw_mode = 'ALL' TENANT = <tenant_name>; -- Enable group commit only for read operations. ALTER SYSTEM SET kv_group_commit_rw_mode = 'READ' TENANT = <tenant_name>;The operations supported by each value of
kv_group_commit_rw_modeare described as follows:ALL: All single operations in Table mode.WRITE: All operations exceptGET.READ:GET.
Monitoring
Group commit provides the monitoring view (G)V$OB_KV_GROUP_COMMIT_STATUS. After group commit is enabled, you can query the group commit views to observe the status of requests processed by group commit. In group commit, different types of operations are divided into different groups. Each group has a request queue to hold KV operation requests. Worker threads take out requests in batches of batch_size from the request queue to form a batch for batch execution and then return a response.
- In the sys tenant,
GV$OB_KV_GROUP_COMMIT_STATUSprovides access to the group commit status information of all OBKV tenants. For more information about theGV$OB_KV_GROUP_COMMIT_STATUSview, see GV$OB_KV_GROUP_COMMIT_STATUS.V$OB_KV_GROUP_COMMIT_STATUSrecords the group commit status information of all tenants on the current observer node. For more information about theV$OB_KV_GROUP_COMMIT_STATUSview, see V$OB_KV_GROUP_COMMIT_STATUS. - In a user tenant,
GV$OB_KV_GROUP_COMMIT_STATUSprovides access only to the group commit status information of the current tenant. For more information about theGV$OB_KV_GROUP_COMMIT_STATUSview, see GV$OB_KV_GROUP_COMMIT_STATUS.V$OB_KV_GROUP_COMMIT_STATUSprovides access only to the group commit status information of the current tenant on the current observer node. For more information about theV$OB_KV_GROUP_COMMIT_STATUSview, see V$OB_KV_GROUP_COMMIT_STATUS.
Limitations
In a minor compaction scenario, the performance of group commit is affected by the disk I/O performance bottleneck. When the I/O performance bottleneck is reached, the performance of group commit degrades.
In scenarios with low load pressure, we do not recommend that you enable group commit. Take a tenant specification of 16C32G as an example. When the CPU load is below 60%, for write operations, setting the batch size to less than 5 provides some optimization, whereas setting it to greater than 10 results in performance regression. For read operations, enabling group commit does not significantly improve overall performance.