File tree Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -173,6 +173,8 @@ show warnings;
173
173
| pessimistic-txn.wake-up-delay-duration | 悲观事务被重新唤醒的时间 |
174
174
| pessimistic-txn.pipelined | 是否开启流水线式加悲观锁流程 |
175
175
| pessimistic-txn.in-memory | 是否开启内存悲观锁功能 |
176
+ | pessimistic-txn.in-memory-peer-size-limit | 控制单个 Region 内存悲观锁的内存使用上限 |
177
+ | pessimistic-txn.in-memory-instance-size-limit | 控制单个 TiKV 实例内存悲观锁的内存使用上限 |
176
178
| quota.foreground-cpu-time | 限制处理 TiKV 前台读写请求所使用的 CPU 资源使用量,软限制 |
177
179
| quota.foreground-write-bandwidth | 限制前台事务写入的带宽,软限制 |
178
180
| quota.foreground-read-bandwidth | 限制前台事务读取数据和 Coprocessor 读取数据的带宽,软限制 |
Original file line number Diff line number Diff line change @@ -186,7 +186,7 @@ set config tikv pessimistic-txn.pipelined='false';
186
186
187
187
TiKV 在 v6 .0 .0 中引入了内存悲观锁功能。开启内存悲观锁功能后,悲观锁通常只会被存储在 Region leader 的内存中,而不会将锁持久化到磁盘,也不会通过 Raft 协议将锁同步到其他副本,因此可以大大降低悲观事务加锁的开销,提升悲观事务的吞吐并降低延迟。
188
188
189
- 当内存悲观锁占用的内存达到 Region 或节点的阈值时 ,加悲观锁会回退为使用 [pipelined 加锁流程](# pipelined-加锁流程)。当 Region 发生合并或 leader 迁移时,为避免悲观锁丢失,TiKV 会将内存悲观锁写入磁盘并同步到其他副本。
189
+ 当内存悲观锁占用的内存达到 [ Region]( / tikv - configuration - file . md # in-memory-peer-size-limit-从-v840-版本开始引入) 或 [TiKV 节点](/tikv-configuration-file.md#in-memory-instance-size-limit-从-v840-版本开始引入)的阈值时 ,加悲观锁会回退为使用 [pipelined 加锁流程](#pipelined-加锁流程)。当 Region 发生合并或 leader 迁移时,为避免悲观锁丢失,TiKV 会将内存悲观锁写入磁盘并同步到其他副本。
190
190
191
191
内存悲观锁实现了和 [pipelined 加锁](# pipelined-加锁流程)类似的表现,即集群无异常时不影响加锁表现,但当 TiKV 出现网络隔离或者节点宕机时,事务加的悲观锁可能丢失。
192
192
@@ -206,3 +206,18 @@ in-memory = false
206
206
` ` ` sql
207
207
set config tikv pessimistic-txn.in-memory='false';
208
208
` ` `
209
+
210
+ 从 v8 .4 .0 开始,你可以通过 [` pessimistic-txn.in-memory-peer-size-limit` ](/ tikv- configuration- file .md # in-memory-peer-size-limit-从-v840-版本开始引入) 或 [`pessimistic-txn.in-memory-instance-size-limit`](/tikv-configuration-file.md#in-memory-instance-size-limit-从-v840-版本开始引入) 配置项修改 Region 或 TiKV 节点内存悲观锁的内存使用上限:
211
+
212
+ ` ` ` toml
213
+ [pessimistic-txn]
214
+ in-memory-peer-size-limit = "512KiB"
215
+ in-memory-instance-size-limit = "100MiB"
216
+ ` ` `
217
+
218
+ 也可通过[在线修改 TiKV 配置](/ dynamic- config .md # 在线修改-tikv-配置)功能动态调整:
219
+
220
+ ` ` ` sql
221
+ SET CONFIG tikv ` pessimistic- txn .in - memory- peer- size- limit ` ="512KiB";
222
+ SET CONFIG tikv ` pessimistic- txn .in - memory- instance- size- limit ` ="100MiB";
223
+ ` ` `
Original file line number Diff line number Diff line change @@ -2324,6 +2324,18 @@ Raft Engine 相关的配置项。
2324
2324
+ 默认值:true
2325
2325
+ 注意:` in-memory ` 仅在 ` pipelined ` 为 true 时生效。
2326
2326
2327
+ ### ` in-memory-peer-size-limit ` <span class =" version-mark " >从 v8.4.0 版本开始引入</span >
2328
+
2329
+ + 控制单个 Region [ 内存悲观锁] ( /pessimistic-transaction.md#内存悲观锁 ) 的内存使用上限。超过此限制时,悲观锁将回退到持久化方式写入磁盘。
2330
+ + 默认值:512KiB
2331
+ + 单位:KiB|MiB|GiB
2332
+
2333
+ ### ` in-memory-instance-size-limit ` <span class =" version-mark " >从 v8.4.0 版本开始引入</span >
2334
+
2335
+ + 控制单个 TiKV 实例[ 内存悲观锁] ( /pessimistic-transaction.md#内存悲观锁 ) 的内存使用上限。超过此限制时,悲观锁将回退到持久化方式写入磁盘。
2336
+ + 默认值:100MiB
2337
+ + 单位:KiB|MiB|GiB
2338
+
2327
2339
## quota
2328
2340
2329
2341
用于请求限流 (Quota Limiter) 相关的配置项。
You can’t perform that action at this time.
0 commit comments