tencent cloud

Feedback

Adjusting Database Parameters

Last updated: 2024-10-10 14:47:30
    TencentDB for MongoDB allows you to adjust certain database parameters, so that the database features can better adapt to your business needs.

    Overview

    In the daily Ops process, quickly adjusting database parameters can optimize the query and management performance of the database in a targeted manner for ever-changing business scenarios. In addition, the parameter modification records can be viewed at any time for evidence-based problem locating.

    Version Description

    Currently, TencentDB for MongoDB 3.2 and later support database parameter modification. However, there are differences in the modifiable parameters on each version as displayed in the console.

    Note

    Currently, the parameter modification feature only supports parameters that can take effect without requiring a restart after modification. It will support other parameters in future iterations. You can also restart the instance on the MongoDB terminal, but the restart will cause a disconnection. Therefore, make business arrangements in advance and proceed with caution.
    When updating the cluster architecture or configuration, such as adjusting specifications, nodes, or shards, upgrading nodes, and migrating nodes, you don't need to configure parameters repeatedly, as the system will automatically sync the parameter configuration data.

    Prerequisites

    You have created a TencentDB for MongoDB instance. For more information, see Creating TencentDB for MongoDB Instance.
    The instance is running normally.

    Directions

    Querying the parameter configuration

    2. On the left sidebar, select Replica Set Instance or Sharded Cluster Instance. The directions for the two types of instances are similar.
    3. In the instance list on the right, find the target instance.
    4. Click the target instance ID to enter the Instance Details page.
    5. Select the Parameter Settings tab to view the database parameter configuration.

    Modifying the parameter configuration

    1. On the Modifiable Parameters tab, click Modify Current Value.
    2. In the input box in the Current Value column, set the desired parameter value as shown below:
    Note:
    You can modify multiple parameters at the same time.
    When modifying parameters, be sure to set them according to the acceptable values.
    In the Restart upon Modification column, check whether the instance will be restarted. The restart will cause a disconnection. Therefore, make business arrangements in advance and proceed with caution.
    The acceptable values of parameters depend on the instance version and architecture. The parameters that can be modified on the current version are as listed below:
    Parameter
    Restart Required
    Default Value
    Acceptable Values
    Supported Version
    Supported Instance Type
    Applicable Scope
    Description
    operation.profiling.slowOpThresholdMs
    No
    100
    [0-65536]
    4.0, 4.2, 4.4
    Replica set instance, sharded cluster instance
    mongod, mongos
    This parameter is used to set the slow query judgment time in ms.
    operationProfiling.mode
    No
    off
    [off | slowOp | all]
    4.0, 4.2, 4.4
    Replica set instance, sharded cluster instance
    mongod
    This parameter is used to set the operational performance analysis mode for the database. By setting different modes, the performance data of database operations can be recorded for performance optimization and troubleshooting. This parameter has the following optional values:
    off: Disable operational performance analysis.
    slowOp: Record slow operations, that is, operations with execution time exceeding the threshold. The default threshold is 100 ms.
    all: Records performance data for all operations.
    setParameter.cursorTimeoutMillis
    No
    600000
    [1-2147483647]
    3.2, 3.6, 4.0, 4.2, 4.4
    Replica set instance, sharded cluster instance
    3.2 and 3.6: mongod; 4.0, 4.2, and 4.4: mongod, mongos
    This parameter is used to set the maximum idle time of the cursor, that is, when the cursor is not used within a certain period of time, it will be automatically closed to release related resources. By default, the value of this parameter is 10 minutes. If you need to extend or shorten the timeout period of the cursor, you can do so by modifying the value of this parameter. It should be noted that if this parameter is set to 0, it means that the cursor timeout mechanism is disabled, and the cursor will remain open until the client actively closes it.
    setParameter.intenalQueryExecMaxBlockingSortBytes
    No
    33554432
    [33554432-268435456]
    4.0, 4.2, 4.4
    Replica set instance, sharded cluster instance
    mongod, mongos
    This parameter controls the maximum memory that MongoDB can use when performing sort operations. When MongoDB executes a query that requires sorting, it may need to sort the result set in memory. If the size of the result set exceeds the set value, MongoDB will use disk for sorting operations, which may compromise performance. Unit: Byte.
    setParameter.maxTransactionLockRequestTimeoutMillis
    No
    5
    [0-60]
    4.0, 4.2, 4.4
    Replica set instance, sharded cluster instance
    mongod
    This parameter controls the maximum timeout period for MongoDB transactions waiting to acquire locks. When a transaction needs to acquire a lock, if the lock is already held by other transactions, then the transaction will wait for a period of time and try to acquire the lock. If the waiting time exceeds the value set by this parameter, the transaction will report a timeout exception. Unit: ms.
    setParameter.transactionLifetimeLimitSeconds
    No
    60
    [5-300]
    4.0, 4.2, 4.4
    Replica set instance, sharded cluster instance
    mongod
    This parameter is used to set the maximum lifetime of a single transaction in seconds. When a transaction starts executing, MongoDB will assign a unique transaction ID to the transaction and record the start time of the transaction. If the transaction is not completed within the set time, MongoDB will automatically roll back the transaction and release related resources.
    setParameter.failIndexKeyTooLong
    No
    true
    [true | false]
    3.2, 3.6, 4.0
    Replica set instance, sharded cluster instance
    mongod
    This parameter is used to set whether to limit the length of the index key.
    If this parameter is set to true, when MongoDB creates an index, if the length of the index key exceeds the maximum limit supported by MongoDB, MongoDB will report an error and refuse to create the index.
    balance.window
    No
    NULL
    [00:00 | 23:00]
    4.0, 4.2, 4.4
    Sharded cluster instance
    mongos
    The MongoDB cluster balancing operation is used to distribute the data in the cluster to each node as evenly as possible to improve the performance and availability of the cluster. This parameter specifies how long MongoDB performs a balancing operation on the cluster to ensure that the data is evenly distributed among the nodes.
    openBalance.window
    No
    false
    [true | false]
    4.0, 4.2, 4.4
    Sharded cluster instance
    mongos
    This parameter is used to enable or disable the balance window.
    3. Click OK.

    Querying the parameter modification record

    1. On the Parameter Settings tab, click Modification Log.
    2. View the parameter modification log, including values before and after modification, modification status, and modification time.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support