title | summary | aliases | ||
---|---|---|---|---|
TiKV Configuration File |
Learn the TiKV configuration file. |
|
The TiKV configuration file supports more options than command-line parameters. You can find the default configuration file in etc/config-template.toml and rename it to config.toml
.
This document only describes the parameters that are not included in command-line parameters. For more details, see command-line parameter.
-
Sets whether to call
abort()
to exit the process when TiKV panics. This option affects whether TiKV allows the system to generate core dump files.- If the value of this configuration item is
false
, when TiKV panics, it callsexit()
to exit the process. - If the value of this configuration item is
true
, when TiKV panics, TiKV callsabort()
to exit the process. At this time, TiKV allows the system to generate core dump files when exiting. To generate the core dump file, you also need to perform the system configuration related to core dump (for example, setting the size limit of the core dump file viaulimit -c
command, and configure the core dump path. Different operating systems have different related configurations). To avoid the core dump files occupying too much disk space and causing insufficient TiKV disk space, it is recommended to set the core dump generation path to a disk partition different to that of TiKV data.
- If the value of this configuration item is
-
Default value:
false
- The log level
- Value options: "trace", "debug", "info", "warning", "error", "critical"
- Default value: "info"
- The log file. If this configuration is not set, logs are output to "stderr" by default.
- Default value: ""
- The log format
- Value options: "json", "text"
- Default value: "text"
- The timespan between log rotations. When this timespan passes, log files are rotated, that is, a timestamp is appended to the file name of the current log file, and a new file is created.
- Default value: "24h"
- The size of a log file that triggers log rotation. Once the size of a log file is bigger than the specified threshold value, log files are rotated. The old log file is placed into the new file, and the new file name is the old file name with a timestamp suffix.
- Default value: "300MB"
- The file to store slow logs
- If this configuration is not set but
log-file
is set, slow logs are output to the log file specified bylog-file
. If neitherslow-log-file
norlog-file
are set, all logs are output to "stderr". - Default value: ""
- The threshold for outputing slow logs. If the processing time is longer than this threshold, slow logs are output.
- Default value: "1s"
- Configuration items related to the server
- The number of worker threads for the
HTTP
API service - Default value:
1
- Minimum value:
1
- The compression algorithm for gRPC messages
- Optional values:
"none"
,"deflate"
,"gzip"
- Default value:
"none"
- Note: When the value is
gzip
, TiDB Dashboard will have a display error because it might not complete the corresponding compression algorithm in some cases. If you adjust the value back to the defaultnone
, TiDB Dashboard will display normally.
- The number of gRPC worker threads. When you modify the size of the gRPC thread pool, refer to Performance tuning for TiKV thread pools.
- Default value:
5
- Minimum value:
1
- The maximum number of concurrent requests allowed in a gRPC stream
- Default value:
1024
- Minimum value:
1
- Limits the memory size that can be used by gRPC
- Default: No limit
- Limit the memory in case OOM is observed. Note that limit the usage can lead to potential stall
- The maximum number of links among TiKV nodes for Raft communication
- Default:
1
- Minimum value:
1
- Sets the maximum length of a gRPC message that can be sent
- Default:
10485760
- Unit: Bytes
- Maximum value:
2147483647
- The window size of the gRPC stream
- Default: 2MB
- Unit: KB|MB|GB
- Minimum value:
"1KB"
- The time interval at which that gRPC sends
keepalive
Ping messages - Default:
"10s"
- Minimum value:
"1s"
- Disables the timeout for gRPC streams
- Default:
"3s"
- Minimum value:
"1s"
- The maximum number of snapshots sent at the same time
- Default value:
32
- Minimum value:
1
- The maximum number of snapshots received at the same time
- Default value:
32
- Minimum value:
1
- The maximum number of recursive levels allowed when TiKV decodes the Coprocessor DAG expression
- Default value:
1000
- Minimum value:
1
- The longest duration allowed for a TiDB's push down request to TiKV for processing tasks
- Default value:
"60s"
- Minimum value:
"1s"
- The maximum allowable disk bandwidth when processing snapshots
- Default value:
"100MB"
- Unit: KB|MB|GB
- Minimum value:
"1KB"
- The time threshold for a TiDB's push-down request to output slow log. If the processing time is longer than this threshold, the slow logs are output.
- Default value:
"1s"
- Minimum value:
0
- Specifies the queue size of the Raft messages in TiKV. If too many messages not sent in time result in a full buffer, or messages discarded, you can specify a greater value to improve system stability.
- Default value:
8192
Configuration items related to the single thread pool serving read requests. This thread pool supersedes the original storage thread pool and coprocessor thread pool since the 4.0 version.
- The minimal working thread count of the unified read pool
- Default value:
1
- The maximum working thread count of the unified read pool or the UnifyReadPool thread pool. When you modify the size of this thread pool, refer to Performance tuning for TiKV thread pools.
- Default value:
MAX(4, CPU * 0.8)
- The stack size of the threads in the unified thread pool
- Type: Integer + Unit
- Default value:
"10MB"
- Unit: KB|MB|GB
- Minimum value:
"2MB"
- Maximum value: The number of Kbytes output in the result of the
ulimit -sH
command executed in the system.
- The maximum number of tasks allowed for a single thread in the unified read pool.
Server Is Busy
is returned when the value is exceeded. - Default value:
2000
- Minimum value:
2
Configuration items related to storage thread pool.
- Determines whether to use the unified thread pool (configured in
readpool.unified
) for storage requests. If the value of this parameter isfalse
, a separate thread pool is used, which is configured through the rest parameters in this section (readpool.storage
). - Default value: If this section (
readpool.storage
) has no other configurations, the default value istrue
. Otherwise, for the backward compatibility, the default value isfalse
. Change the configuration inreadpool.unified
as needed before enabling this option.
- The allowable number of concurrent threads that handle high-priority
read
requests - When
8
≤cpu num
≤16
, the default value iscpu_num * 0.5
; whencpu num
is greater than8
, the default value is4
; whencpu num
is greater than16
, the default value is8
. - Minimum value:
1
- The allowable number of concurrent threads that handle normal-priority
read
requests - When
8
≤cpu num
≤16
, the default value iscpu_num * 0.5
; whencpu num
is greater than8
, the default value is4
; whencpu num
is greater than16
, the default value is8
. - Minimum value:
1
- The allowable number of concurrent threads that handle low-priority
read
requests - When
8
≤cpu num
≤16
, the default value iscpu_num * 0.5
; whencpu num
is greater than8
, the default value is4
; whencpu num
is greater than16
, the default value is8
. - Minimum value:
1
- The maximum number of tasks allowed for a single thread in a high-priority thread pool.
Server Is Busy
is returned when the value is exceeded. - Default value:
2000
- Minimum value:
2
- The maximum number of tasks allowed for a single thread in a normal-priority thread pool.
Server Is Busy
is returned when the value is exceeded. - Default value:
2000
- Minimum value:
2
- The maximum number of tasks allowed for a single thread in a low-priority thread pool.
Server Is Busy
is returned when the value is exceeded. - Default value:
2000
- Minimum value:
2
- The stack size of threads in the Storage read thread pool
- Type: Integer + Unit
- Default value:
"10MB"
- Unit: KB|MB|GB
- Minimum value:
"2MB"
- Maximum value: The number of Kbytes output in the result of the
ulimit -sH
command executed in the system.
Configuration items related to the Coprocessor thread pool.
- Determines whether to use the unified thread pool (configured in
readpool.unified
) for coprocessor requests. If the value of this parameter isfalse
, a separate thread pool is used, which is configured through the rest parameters in this section (readpool.coprocessor
). - Default value: If none of the parameters in this section (
readpool.coprocessor
) are set, the default value istrue
. Otherwise, the default value isfalse
for the backward compatibility. Adjust the configuration items inreadpool.unified
before enabling this parameter.
- The allowable number of concurrent threads that handle high-priority Coprocessor requests, such as checkpoints
- Default value:
CPU * 0.8
- Minimum value:
1
- The allowable number of concurrent threads that handle normal-priority Coprocessor requests
- Default value:
CPU * 0.8
- Minimum value:
1
- The allowable number of concurrent threads that handle low-priority Coprocessor requests, such as table scan
- Default value:
CPU * 0.8
- Minimum value:
1
- The number of tasks allowed for a single thread in a high-priority thread pool. When this number is exceeded,
Server Is Busy
is returned. - Default value:
2000
- Minimum value:
2
- The number of tasks allowed for a single thread in a normal-priority thread pool. When this number is exceeded,
Server Is Busy
is returned. - Default value:
2000
- Minimum value:
2
- The number of tasks allowed for a single thread in a low-priority thread pool. When this number is exceeded,
Server Is Busy
is returned. - Default value:
2000
- Minimum value:
2
- The stack size of the thread in the Coprocessor thread pool
- Type: Integer + Unit
- Default value:
"10MB"
- Unit: KB|MB|GB
- Minimum value:
"2MB"
- Maximum value: The number of Kbytes output in the result of the
ulimit -sH
command executed in the system.
Configuration items related to storage
- A built-in memory lock mechanism to prevent simultaneous operations on a key. Each key has a hash in a different slot.
- Default value:
524288
- Minimum value:
1
- The number of
scheduler
threads, mainly used for checking transaction consistency before data writing. If the number of CPU cores is greater than or equal to16
, the default value is8
; otherwise, the default value is4
. When you modify the size of the Scheduler thread pool, refer to Performance tuning for TiKV thread pools. - Default value:
4
- Minimum value:
1
- The maximum size of the write queue. A
Server Is Busy
error is returned for a new write to TiKV when this value is exceeded. - Default value:
"100MB"
- Unit: MB|GB
- When TiKV is started, some space is reserved on the disk as disk protection. When the remaining disk space is less than the reserved space, TiKV restricts some write operations. The reserved space is divided into two parts: 80% of the reserved space is used as the extra disk space required for operations when the disk space is insufficient, and the other 20% is used to store the temporary file. In the process of reclaiming space, if the storage is exhausted by using too much extra disk space, this temporary file serves as the last protection for restoring services.
- The name of the temporary file is
space_placeholder_file
, located in thestorage.data-dir
directory. When TiKV goes offline because its disk space ran out, if you restart TiKV, the temporary file is automatically deleted and TiKV tries to reclaim the space. - When the remaining space is insufficient, TiKV does not create the temporary file. The effectiveness of the protection is related to the size of the reserved space. The size of the reserved space is the larger value between 5% of the disk capacity and this configuration value. When the value of this configuration item is
"0MB"
, TiKV disables this disk protection feature. - Default value:
"5GB"
- Unite: MB|GB
- TTL is short for "Time to live". If this item is enabled, TiKV automatically deletes data that reaches its TTL. To set the value of TTL, you need to specify it in the requests when writing data via the client. If the TTL is not specified, it means that TiKV does not automatically delete the corresponding data.
- Note: The TTL feature is only available for the RawKV interface for now. You can only configure this feature when creating a new cluster because TTL uses different data formats in the storage layer. If you modify this item on an existing cluster, TiKV reports errors when it starts.
- Default value:
false
- The interval of checking data to reclaim physical spaces. If data reaches its TTL, TiKV forcibly reclaims its physical space during the check.
- Default value:
"12h"
- Minimum value:
"0s"
Configuration items related to the sharing of block cache among multiple RocksDB Column Families (CF). When these configuration items are enabled, block cache separately configured for each column family is disabled.
- Enables or disables the sharing of block cache.
- Default value:
true
- The size of the shared block cache.
- Default value: 45% of the size of total system memory
- Unit: KB|MB|GB
Configuration items related to the flow control mechanism in TiKV. This mechanism replaces the write stall mechanism in RocksDB and controls flow at the scheduler layer, which avoids the issue of QPS drop caused by the stuck Raftstore or Apply threads when the write traffic is high.
- Determines whether to enable the flow control mechanism. After it is enabled, TiKV automatically disables the write stall mechanism of KvDB and the write stall mechanism of RaftDB (excluding memtable).
- Default value:
true
- When the number of kvDB memtables reaches this threshold, the flow control mechanism starts to work.
- Default value:
5
- When the number of kvDB L0 files reaches this threshold, the flow control mechanism starts to work.
- Default value:
20
- When the pending compaction bytes in KvDB reach this threshold, the flow control mechanism starts to reject some write requests and reports the
ServerIsBusy
error. - Default value:
"192GB"
- When the pending compaction bytes in KvDB reach this threshold, the flow control mechanism rejects all write requests and reports the
ServerIsBusy
error. - Default value:
"1024GB"
Configuration items related to the I/O rate limiter.
- Limits the maximum I/O bytes that a server can write to or read from the disk (determined by the
mode
configuration item below) in one second. When this limit is reached, TiKV prefers throttling background operations over foreground ones. The value of this configuration item should be set to the disk's optimal I/O bandwidth, for example, the maximum I/O bandwidth specified by your cloud disk vendor. When this configuration value is set to zero, disk I/O operations are not limited. - Default value:
"0MB"
- Determines which types of I/O operations are counted and restrained below the
max-bytes-per-sec
threshold. Currently, only the write-only mode is supported. - Optional value:
"write-only"
- Default value:
"write-only"
Configuration items related to Raftstore
- Enables or disables
prevote
. Enabling this feature helps reduce jitter on the system after recovery from network partition. - Default value:
true
- The path to the Raft library, which is
storage.data-dir/raft
by default - Default value: ""
- The time interval at which the Raft state machine ticks
- Default value:
"1s"
- Minimum value: greater than
0
- The number of passed ticks when the heartbeat is sent. This means that a heartbeat is sent at the time interval of
raft-base-tick-interval
*raft-heartbeat-ticks
. - Default value:
2
- Minimum value: greater than
0
- The number of passed ticks when Raft election is initiated. This means that if Raft group is missing the leader, a leader election is initiated approximately after the time interval of
raft-base-tick-interval
*raft-election-timeout-ticks
. - Default value:
10
- Minimum value:
raft-heartbeat-ticks
- The minimum number of ticks during which the Raft election is initiated. If the number is
0
, the value ofraft-election-timeout-ticks
is used. The value of this parameter must be greater than or equal toraft-election-timeout-ticks
. - Default value:
0
- Minimum value:
0
- The maximum number of ticks during which the Raft election is initiated. If the number is
0
, the value ofraft-election-timeout-ticks
*2
is used. - Default value:
0
- Minimum value:
0
- The soft limit on the size of a single message packet
- Default value:
"1MB"
- Minimum value:
0
- Unit: MB
- The number of Raft logs to be confirmed. If this number is exceeded, log sending slows down.
- Default value:
256
- Minimum value: greater than
0
- The hard limit on the maximum size of a single log
- Default value:
"8MB"
- Minimum value:
0
- Unit: MB|GB
- The time interval at which the polling task of deleting Raft logs is scheduled.
0
means that this feature is disabled. - Default value:
"10s"
- Minimum value:
0
- The soft limit on the maximum allowable count of residual Raft logs
- Default value:
50
- Minimum value:
1
- The hard limit on the allowable number of residual Raft logs
- Default value: the log number that can be accommodated in the 3/4 Region size (calculated as 1MB for each log)
- Minimum value:
0
- The hard limit on the allowable size of residual Raft logs
- Default value: 3/4 of the Region size
- Minimum value: greater than
0
- The maximum remaining time allowed for the log cache in memory.
- Default value:
"30s"
- Minimum value:
0
- Enables or disables Hibernate Region. When this option is enabled, a Region idle for a long time is automatically set as hibernated. This reduces the extra overhead caused by heartbeat messages between the Raft leader and the followers for idle Regions. You can use
peer-stale-state-check-interval
to modify the heartbeat interval between the leader and the followers of hibernated Regions. - Default value:
true
in v5.0.2 and later versions;false
in versions before v5.0.2
- Specifies the interval at which to check whether the Region split is needed.
0
means that this feature is disabled. - Default value:
"10s"
- Minimum value:
0
- The maximum value by which the Region data is allowed to exceed before Region split
- Default value: 1/16 of the Region size.
- Minimum value:
0
- The time interval at which to check whether it is necessary to manually trigger RocksDB compaction.
0
means that this feature is disabled. - Default value:
"5m"
- Minimum value:
0
- The number of Regions checked at one time for each round of manual compaction
- Default value:
100
- Minimum value:
0
- The number of tombstones required to trigger RocksDB compaction
- Default value:
10000
- Minimum value:
0
- The proportion of tombstone required to trigger RocksDB compaction
- Default value:
30
- Minimum value:
1
- Maximum value:
100
- The time interval at which a Region's heartbeat to PD is triggered.
0
means that this feature is disabled. - Default value:
"1m"
- Minimum value:
0
- The time interval at which a store's heartbeat to PD is triggered.
0
means that this feature is disabled. - Default value:
"10s"
- Minimum value:
0
- The time interval at which the recycle of expired snapshot files is triggered.
0
means that this feature is disabled. - Default value:
"1m"
- Minimum value:
0
- The longest time for which a snapshot file is saved
- Default value:
"4h"
- Minimum value:
0
- The time interval at which TiKV triggers a manual compaction for the Lock Column Family
- Default value:
"256MB"
- Default value:
"10m"
- Minimum value:
0
- The size out of which TiKV triggers a manual compaction for the Lock Column Family
- Default value:
"256MB"
- Minimum value:
0
- Unit: MB
- The longest length of the Region message queue.
- Default value:
40960
- Minimum value:
0
- The maximum number of messages processed per batch
- Default value:
4096
- Minimum value:
0
- The longest inactive duration allowed for a peer. A peer with timeout is marked as
down
, and PD tries to delete it later. - Default value:
"10m"
- Minimum value: When Hibernate Region is enabled, the minimum value is
peer-stale-check-interval * 2
; when Hibernate Region is disabled, the minimum value is0
.
- The longest duration allowed for a peer to be in the state where a Raft group is missing the leader. If this value is exceeded, the peer verifies with PD whether the peer has been deleted.
- Default value:
"2h"
- Minimum value: greater than
abnormal-leader-missing-duration
- The longest duration allowed for a peer to be in the state where a Raft group is missing the leader. If this value is exceeded, the peer is seen as abnormal and marked in metrics and logs.
- Default value:
"10m"
- Minimum value: greater than
peer-stale-state-check-interval
- The time interval to trigger the check for whether a peer is in the state where a Raft group is missing the leader.
- Default value:
"5m"
- Minimum value: greater than
2 * election-timeout
- The maximum number of missing logs allowed for the transferee during a Raft leader transfer
- Default value:
128
- Minimum value:
10
- The memory cache size required when the imported snapshot file is written into the disk
- Default value:
"10MB"
- Minimum value:
0
- Unit: MB
- The time interval at which the consistency check is triggered.
0
means that this feature is disabled. - Default value:
"0s"
- Minimum value:
0
- The longest trusted period of a Raft leader
- Default value:
"9s"
- Minimum value:
0
- Determines whether to allow deleting the main switch
- Default value:
false
- The maximum number of missing logs allowed when
merge
is performed - Default value:
10
- Minimum value: greater than
raft-log-gc-count-limit
- The time interval at which TiKV checks whether a Region needs merge
- Default value:
"2s"
- Minimum value: greater than
0
- Determines whether to delete data from the
rocksdb delete_range
interface - Default value:
false
- The time interval at which the expired SST file is checked.
0
means that this feature is disabled. - Default value:
"10m"
- Minimum value:
0
- The maximum number of read requests processed in one batch
- Default value:
1024
- Minimum value: greater than
0
- The maximum number of requests for data flushing in one batch
- Default value:
256
- Minimum value: greater than
0
- The allowable number of threads in the pool that flushes data to storage. When you modify the size of this thread pool, refer to Performance tuning for TiKV thread pools.
- Default value:
2
- Minimum value: greater than
0
- The maximum number of requests processed in one batch
- If
hibernate-regions
is enabled, the default value is256
. Ifhibernate-regions
is disabled, the default value is1024
. - Minimum value: greater than
0
- The allowable number of threads that process Raft, which is the size of the Raftstore thread pool. When you modify the size of this thread pool, refer to Performance tuning for TiKV thread pools.
- Default value:
2
- Minimum value: greater than
0
- The allowable number of threads that process Raft I/O tasks, which is the size of the StoreWriter thread pool. When you modify the size of this thread pool, refer to Performance tuning for TiKV thread pools.
- Default value:
0
- Minimum value:
0
- The allowable number of threads that drive
future
- Default value:
1
- Minimum value: greater than
0
- Controls whether to enable batch processing of the requests. When it is enabled, the write performance is significantly improved.
- Default value:
true
- At a certain interval, TiKV inspects the latency of the Raftstore component. This parameter specifies the interval of the inspection. If the latency exceeds this value, this inspection is marked as timeout.
- Judges whether the TiKV node is slow based on the ratio of timeout inspection.
- Default value:
"500ms"
- Minimum value:
"1ms"
- Determines the threshold at which Raft data is written into the disk. If the data size is larger than the value of this configuration item, the data is written to the disk. When the value of
store-io-pool-size
is0
, this configuration item does not take effect. - Default value:
1MB
- Minimum value:
0
- Determines the interval at which Raft messages are sent in batches. The Raft messages in batches are sent at every interval specified by this configuration item. When the value of
store-io-pool-size
is0
, this configuration item does not take effect. - Default value:
250us
- Minimum value:
0
Configuration items related to Coprocessor
- Determines whether to split Region by table. It is recommended for you to use the feature only in TiDB mode.
- Default value:
false
- The threshold of Region split in batches. Increasing this value speeds up Region split.
- Default value:
10
- Minimum value:
1
- The maximum size of a Region. When the value is exceeded, the Region splits into many.
- Default value:
"144MB"
- Unit: KB|MB|GB
- The size of the newly split Region. This value is an estimate.
- Default value:
"96MB"
- Unit: KB|MB|GB
- The maximum allowable number of keys in a Region. When this value is exceeded, the Region splits into many.
- Default value:
1440000
- The number of keys in the newly split Region. This value is an estimate.
- Default value:
960000
Configuration items related to RocksDB
- The number of background threads in RocksDB. When you modify the size of the RocksDB thread pool, refer to Performance tuning for TiKV thread pools.
- Default value:
8
- Minimum value:
2
- The maximum number of concurrent background memtable flush jobs
- Default value:
2
- Minimum value:
1
- The number of sub-compaction operations performed concurrently in RocksDB
- Default value:
3
- Minimum value:
1
- The total number of files that RocksDB can open
- Default value:
40960
- Minimum value:
-1
- The maximum size of a RocksDB Manifest file
- Default value:
"128MB"
- Minimum value:
0
- Unit: B|KB|MB|GB
- Determines whether to automatically create a DB switch
- Default value:
true
- WAL recovery mode
- Value options:
0
,1
,2
,3
0
(TolerateCorruptedTailRecords
): tolerates and discards the records that have incomplete trailing data on all logs.1
(AbsoluteConsistency
): abandons recovery when corrupted logs are found.2
(PointInTimeRecovery
): recovers log sequentially until the first corrupted log is encountered.3
(SkipAnyCorruptedRecords
): recovery after a disaster. Corrupted records are skipped- Default value:
2
- Minimum value:
0
- Maximum value:
3
- The directory in which WAL files are stored
- Default value:
"/tmp/tikv/store"
- The living time of the archived WAL files. When the value is exceeded, the system deletes these files.
- Default value:
0
- Minimum value:
0
- unit: second
- The size limit of the archived WAL files. When the value is exceeded, the system deletes these files.
- Default value:
0
- Minimum value:
0
- Unit: B|KB|MB|GB
- Determines whether to enable the statistics of RocksDB
- Default value:
true
- The interval at which statistics are output to the log.
- Default value:
10m
- Enables the readahead feature during RocksDB compaction and specifies the size of readahead data. If you are using mechanical disks, it is recommended to set the value to 2MB at least.
- Default value:
0
- Minimum value:
0
- Unit: B|KB|MB|GB
- The maximum buffer size used in WritableFileWrite
- Default value:
"1MB"
- Minimum value:
0
- Unit: B|KB|MB|GB
- Determines whether to use
O_DIRECT
for both reads and writes in the background flush and compactions. The performance impact of this option: enablingO_DIRECT
bypasses and prevents contamination of the OS buffer cache, but the subsequent file reads require re-reading the contents to the buffer cache. - Default value:
false
- The maximum rate permitted by RocksDB's compaction rate limiter
- Default value:
10GB
- Minimum value:
0
- Unit: B|KB|MB|GB
- RocksDB's compaction rate limiter mode
- Optional values:
1
(ReadOnly
),2
(WriteOnly
),3
(AllIo
) - Default value:
2
- Minimum value:
1
- Maximum value:
3
- Determines whether to automatically optimize the configuration of the RocksDB's compaction rate limiter based on recent workload. When this configuration is enabled, compaction pending bytes will be slightly higher than usual.
- Default value:
true
- Enables or disables Pipelined Write
- Default value:
true
- The rate at which OS incrementally synchronizes files to disk while these files are being written asynchronously
- Default value:
"1MB"
- Minimum value:
0
- Unit: B|KB|MB|GB
- The rate at which OS incrementally synchronizes WAL files to disk while the WAL files are being written
- Default value:
"512KB"
- Minimum value:
0
- Unit: B|KB|MB|GB
- The maximum size of Info log
- Default value:
"1GB"
- Minimum value:
0
- Unit: B|KB|MB|GB
- The time interval at which Info logs are truncated. If the value is
0s
, logs are not truncated. - Default value:
"0s"
- The maximum number of kept log files
- Default value:
10
- Minimum value:
0
- The directory in which logs are stored
- Default value: ""
Configuration items related to Titan
- Enables or disables Titan
- Default value:
false
- The directory in which the Titan Blob file is stored
- Default value:
"titandb"
- Determines whether to disable Garbage Collection (GC) that Titan performs to Blob files
- Default value:
false
- The maximum number of GC threads in Titan
- Default value:
4
- Minimum value:
1
Configuration items related to rocksdb.defaultcf
, rocksdb.writecf
, and rocksdb.lockcf
.
- The default size of a RocksDB block
- Default value for
defaultcf
andwritecf
:"64KB"
- Default value for
lockcf
:"16KB"
- Minimum value:
"1KB"
- Unit: KB|MB|GB
- The cache size of a RocksDB block
- Default value for
defaultcf
:Total machine memory * 25%
- Default value for
writecf
:Total machine memory * 15%
- Default value for
lockcf
:Total machine memory * 2%
- Minimum value:
0
- Unit: KB|MB|GB
- Enables or disables block cache
- Default value:
false
- Enables or disables caching index and filter
- Default value:
true
- Determines whether to pin the index and filter blocks of the level 0 SST files in memory.
- Default value:
true
- Enables or disables bloom filter
- Default value:
true
- Determines whether to optimize the hit ratio of filters
- Default value for
defaultcf
:true
- Default value for
writecf
andlockcf
:false
- Determines whether to put the entire key to bloom filter
- Default value for
defaultcf
andlockcf
:true
- Default value for
writecf
:false
- The length that bloom filter reserves for each key
- Default value:
10
- unit: byte
- Determines whether each block creates a bloom filter
- Default value:
false
- Enables or disables statistics of read amplification.
- Optional values:
0
(disabled), >0
(enabled). - Default value:
0
- Minimum value:
0
- The default compression algorithm for each level
- Optional values: ["no", "no", "lz4", "lz4", "lz4", "zstd", "zstd"]
- Default value for
defaultcf
andwritecf
: ["no", "no", "lz4", "lz4", "lz4", "zstd", "zstd"] - Default value for
lockcf
: ["no", "no", "no", "no", "no", "no", "no"]
- Sets the compression algorithm of the bottommost layer. This configuration item overrides the
compression-per-level
setting. - Ever since data is written to LSM-tree, RocksDB does not directly adopt the last compression algorithm specified in the
compression-per-level
array for the bottommost layer.bottommost-level-compression
enables the bottommost layer to use the compression algorithm of the best compression effect from the beginning. - If you do not want to set the compression algorithm for the bottommost layer, set the value of this configuration item to
disable
. - Default value: "zstd"
- Memtable size
- Default value for
defaultcf
andwritecf
:"128MB"
- Default value for
lockcf
:"32MB"
- Minimum value:
0
- Unit: KB|MB|GB
- The maximum number of memtables
- Default value:
5
- Minimum value:
0
- The minimum number of memtables required to trigger flush
- Default value:
1
- Minimum value:
0
- The maximum number of bytes at base level (L1). Generally, it is set to 4 times the size of a memtable.
- Default value for
defaultcf
andwritecf
:"512MB"
- Default value for
lockcf
:"128MB"
- Minimum value:
0
- Unit: KB|MB|GB
- The size of the target file at base level. This value is overridden by
compaction-guard-max-output-file-size
when theenable-compaction-guard
value istrue
. - Default:
"8MB"
- Minimum value:
0
- Unit: KB|MB|GB
- The maximum number of files at L0 that trigger compaction
- Default value for
defaultcf
andwritecf
:4
- Default value for
lockcf
:1
- Minimum value:
0
- The maximum number of files at L0 that trigger write stall
- Default value:
20
- Minimum value:
0
- The maximum number of files at L0 required to completely block write
- Default value:
36
- Minimum value:
0
- The maximum number of bytes written into disk per compaction
- Default value:
"2GB"
- Minimum value:
0
- Unit: KB|MB|GB
- The priority type of compaction
- Optional values:
0
(ByCompensatedSize
),1
(OldestLargestSeqFirst
),2
(OldestSmallestSeqFirst
),3
(MinOverlappingRatio
) - Default value for
defaultcf
andwritecf
:3
- Default value for
lockcf
:0
- Determines whether to optimize dynamic level bytes
- Default value:
true
- The maximum number of levels in a RocksDB file
- Default value:
7
- The default amplification multiple for each layer
- Default value:
10
- Compaction method
- Optional values:
"level"
,"universal"
- Default value:
"level"
- Enables or disables automatic compaction
- Default value:
false
- The soft limit on the pending compaction bytes
- Default value:
"192GB"
- Unit: KB|MB|GB
- The hard limit on the pending compaction bytes
- Default value:
"256GB"
- Unit: KB|MB|GB
- Enables or disables the compaction guard, which is an optimization to split SST files at TiKV Region boundaries. This optimization can help reduce compaction I/O and allows TiKV to use larger SST file size (thus less SST files overall) and at the time efficiently clean up stale data when migrating Regions.
- Default value for
defaultcf
andwritecf
:true
- Default value for
lockcf
:false
- The minimum SST file size when the compaction guard is enabled. This configuration prevents SST files from being too small when the compaction guard is enabled.
- Default value:
"8MB"
- Unit: KB|MB|GB
- The maximum SST file size when the compaction guard is enabled. The configuration prevents SST files from being too large when the compaction guard is enabled. This configuration overrides
target-file-size-base
for the same column family. - Default value:
"128MB"
- Unit: KB|MB|GB
Configuration items related to rocksdb.defaultcf.titan
.
- The smallest value stored in a Blob file. Values smaller than the specified size are stored in the LSM-Tree.
- Default value:
"1KB"
- Minimum value:
0
- Unit: KB|MB|GB
- The compression algorithm used in a Blob file
- Optional values:
"no"
,"snappy"
,"zlib"
,"bzip2"
,"lz4"
,"lz4hc"
,"zstd"
- Default value:
"lz4"
- The cache size of a Blob file
- Default value:
"0GB"
- Minimum value:
0
- Unit: KB|MB|GB
- The minimum total size of Blob files required to perform GC for one time
- Default value:
"16MB"
- Minimum value:
0
- Unit: KB|MB|GB
- The maximum total size of Blob files allowed to perform GC for one time
- Default value:
"64MB"
- Minimum value:
0
- Unit: KB|MB|GB
- The ratio at which GC is triggered for Blob files. The Blob file can be selected for GC only if the proportion of the invalid values in a Blob file exceeds this ratio.
- Default value:
0.5
- Minimum value:
0
- Maximum value:
1
- The ratio of (data read from a Blob file/the entire Blob file) when sampling the file during GC
- Default value:
0.1
- Minimum value:
0
- Maximum value:
1
- When the size of a Blob file is smaller than this value, the Blob file might still be selected for GC. In this situation,
discardable-ratio
is ignored. - Default value:
"8MB"
- Minimum value:
0
- Unit: KB|MB|GB
- Specifies the running mode of Titan.
- Optional values:
normal
: Writes data to the blob file when the value size exceedsmin-blob-size
.read_only
: Refuses to write new data to the blob file, but still reads the original data from the blob file.fallback
: Writes data in the blob file back to LSM.
- Default value:
normal
- Determines whether to optimize the read performance. When
level-merge
is enabled, there is more write amplification. - Default value:
false
- Determines whether to use the merge operator to write back blob indexes for Titan GC. When
gc-merge-rewrite
is enabled, it reduces the effect of Titan GC on the writes in the foreground. - Default value:
false
Configuration items related to raftdb
- The number of background threads in RocksDB. When you modify the size of the RocksDB thread pool, refer to Performance tuning for TiKV thread pools.
- Default value:
4
- Minimum value:
2
- The number of concurrent sub-compaction operations performed in RocksDB
- Default value:
2
- Minimum value:
1
- The directory in which WAL files are stored
- Default value:
"/tmp/tikv/store"
Configuration items related to security
- The path of the CA file
- Default value: ""
- The path of the Privacy Enhanced Mail (PEM) file that contains the X.509 certificate
- Default value: ""
- The path of the PEM file that contains the X.509 key
- Default value: ""
- A list of acceptable X.509 Common Names in certificates presented by clients. Requests are permitted only when the presented Common Name is an exact match with one of the entries in the list.
- Default value:
[]
. This means that the client certificate CN check is disabled by default.
- This configuration item enables or disables log redaction. If the configuration value is set to
true
, all user data in the log will be replaced by?
. - Default value:
false
Configuration items related to encryption at rest (TDE).
- The encryption method for data files
- Value options: "plaintext", "aes128-ctr", "aes192-ctr", and "aes256-ctr"
- A value other than "plaintext" means that encryption is enabled, in which case the master key must be specified.
- Default value:
"plaintext"
- Specifies how often TiKV rotates the data encryption key.
- Default value:
7d
- Enables the optimization to reduce I/O and mutex contention when TiKV manages the encryption metadata.
- To avoid possible compatibility issues when this configuration parameter is enabled (by default), see Encryption at Rest - Compatibility between TiKV versions for details.
- Default value:
true
- Specifies the master key if encryption is enabled. To learn how to configure a master key, see Encryption at Rest - Configure encryption.
- Specifies the old master key when rotating the new master key. The configuration format is the same as that of
master-key
. To learn how to configure a master key, see Encryption at Rest - Configure encryption.
Configuration items related to TiDB Lightning import and BR restore.
- The number of threads to process RPC requests
- Default value:
8
- Minimum value:
1
- The number of jobs imported concurrently
- Default value:
8
- Minimum value:
1
- Controls whether to enable the GC in Compaction Filter feature
- Default value:
true
Configuration items related to BR backup.
- The number of worker threads to process backup
- Default value:
MIN(CPU * 0.75, 32)
. - Minimum value:
1
Configuration items related to TiCDC.
- The interval at which Resolved TS is calculated and forwarded.
- Default value:
"1s"
- The upper limit of memory usage by TiCDC old values.
- Default value:
512MB
- The upper limit of memory usage by TiCDC data change events.
- Default value:
512MB
- The maximum speed at which historical data is incrementally scanned.
- Default value:
"128MB"
, which means 128 MB per second.
- The number of threads for the task of incrementally scanning historical data.
- Default value:
4
, which means 4 threads.
- The maximum number of concurrent executions for the tasks of incrementally scanning historical data.
- Default value:
6
, which means 6 tasks can be concurrent executed at most. - Note: The value of
incremental-scan-concurrency
must be greater than or equal to that ofincremental-scan-threads
; otherwise, TiKV will report an error at startup.
Configuration items related to maintaining the Resolved TS to serve Stale Read requests.
- Determines whether to maintain the Resolved TS for all Regions.
- Default value:
true
- The interval at which Resolved TS is calculated and forwarded.
- Default value:
"1s"
- The number of threads that TiKV uses to scan the MVCC (multi-version concurrency control) lock data when initializing the Resolved TS.
- Default value:
2
, which means 2 threads.
For pessimistic transaction usage, refer to TiDB Pessimistic Transaction Mode.
- The longest time that a pessimistic transaction in TiKV waits for other transactions to release the lock. If the time is out, an error is returned to TiDB, and TiDB retries to add a lock. The lock wait timeout is set by
innodb_lock_wait_timeout
. - Default value:
"1s"
- Minimum value:
"1ms"
- When pessimistic transactions release the lock, among all the transactions waiting for lock, only the transaction with the smallest
start_ts
is woken up. Other transactions will be woken up afterwait-up-delay-duration
. - Default value:
"20ms"
- This configuration item enables the pipelined process of adding the pessimistic lock. With this feature enabled, after detecting that data can be locked, TiKV immediately notifies TiDB to execute the subsequent requests and write the pessimistic lock asynchronously, which reduces most of the latency and significantly improves the performance of pessimistic transactions. But there is a still low probability that the asynchronous write of the pessimistic lock fails, which might cause the failure of pessimistic transaction commits.
- Default value:
true