# Large-region scheduling can cause level-0 SST accumulation and flow-control throttling

Source note: adapted from the internal Feishu notes referenced by the `tikv-performance` skill: <https://pingcap.feishu.cn/wiki/LBOEw7aRbi5q2QkoWndcCd61nue>.

## Issue

- Summary: when a region becomes large, scheduling operations are more likely to overlap with a broad SST key range. This increases the chance that SST files are ingested into level 0, which can accumulate quickly and trigger TiKV flow control.

## Phenomenon

- Level-0 files accumulate quickly.
- `l0-files-threshold` is triggered.
- Write throughput drops and latency increases.
- Some incidents also report `8022` errors.

## Root Cause

Large regions cover wider key ranges and contain more SST files. During scheduling operations such as peer migration, balance region, or merge, business writes overlap with these SST key ranges more often. That makes SST ingestion into level 0 more likely, increasing compaction pressure and eventually triggering flow-control throttling.

## Diagnostic Steps

1. Check `tikv-details -> rocksdb kv -> ingestion picked level`.
2. Check `tikv-details -> flow-control`.
3. Correlate the timing with scheduling operations on large regions, especially after region size adjustments or burst traffic.

## Workaround

- Increase `l0-files-threshold`.
- Note that versions earlier than `v8.0` still require a restart for this change.

## Related Oncall

- v7.1.5 TiKV frequently reported `8022` after region size was adjusted to 960 MB `ONCALL-7598` / `TICKET-5547`
- v7.1.5 the cluster suddenly became stuck after burst traffic without obvious resource bottlenecks `TICKET-5535`
