Skip to content

Commit

Permalink
*: always enable block cache (pingcap#12053)
Browse files Browse the repository at this point in the history
  • Loading branch information
Oreoxmt authored Feb 1, 2023
1 parent c03865a commit ea3c5ad
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
8 changes: 1 addition & 7 deletions hybrid-deployment-topology.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,9 @@ This section introduces the key parameters when you deploy multiple instances on
```
readpool.unified.max-thread-count = cores * 0.8 / the number of TiKV instances
```
- To configure the storage CF (all RocksDB column families) to be self-adaptive to memory. By configuring the `storage.block-cache.capacity` parameter, you can make CF automatically balance the memory usage.

- `storage.block-cache` enables the CF self-adaptation by default. You do not need to modify it.
- To configure the storage CF (all RocksDB column families) to be self-adaptive to memory. By configuring the `storage.block-cache.capacity` parameter, you can make CF automatically balance the memory usage.

```yaml
storage.block-cache.shared: true
```
- The calculation method:

```
Expand Down
9 changes: 2 additions & 7 deletions tikv-configuration-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -491,12 +491,7 @@ Configuration items related to storage.
## storage.block-cache

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.

### `shared`

+ Enables or disables the sharing of block cache.
+ Default value: `true`
Configuration items related to the sharing of block cache among multiple RocksDB Column Families (CF).

### `capacity`

Expand Down Expand Up @@ -1267,7 +1262,7 @@ Configuration items related to `rocksdb.defaultcf`, `rocksdb.writecf`, and `rock

### `block-cache-size`

+ The cache size of a RocksDB block
+ The cache size of a RocksDB block. Starting from v6.6.0, this configuration is only used to calculate the default value of `storage.block-cache.capacity`.
+ Default value for `defaultcf`: `Total machine memory * 25%`
+ Default value for `writecf`: `Total machine memory * 15%`
+ Default value for `lockcf`: `Total machine memory * 2%`
Expand Down
3 changes: 2 additions & 1 deletion tune-tikv-memory-performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ TiKV implements `Column Families` (CF) from RocksDB.

- The `default` CF stores the Raft log. The corresponding parameters are in `[raftdb.defaultcf]`.

After TiKV 3.0, by default, all CFs share one block cache instance. You can configure the size of the cache by setting the `capacity` parameter under `[storage.block-cache]`. The bigger the block cache, the more hot data can be cached, and the easier to read data, in the meantime, the more system memory is occupied. To use a separate block cache instance for each CF, set `shared=false` under `[storage.block-cache]`, and configure individual block cache size for each CF. For example, you can configure the size of `write` CF by setting the `block-cache-size` parameter under `[rocksdb.writecf]`.
After TiKV 3.0, by default, all CFs share one block cache instance. You can configure the size of the cache by setting the `capacity` parameter under `[storage.block-cache]`. The bigger the block cache, the more hot data can be cached, and the easier to read data, in the meantime, the more system memory is occupied.

Before TiKV 3.0, shared block cache is not supported, and you need to configure block cache for each CF individually.

Expand Down Expand Up @@ -73,6 +73,7 @@ log-level = "info"
##
## The rest of config in the storage.block-cache session is effective only when shared block cache
## is on.
## Starting from v6.6.0, the `shared` option is always enabled and cannot be disabled.
# shared = true
## Size of the shared block cache. Normally it should be tuned to 30%-50% of system's total memory.
Expand Down

0 comments on commit ea3c5ad

Please sign in to comment.