Closed dbsid closed 2 years ago
running two business simulation of a core-bank application using single one connection, the prepared plan cache is up to ~500
Is this value configurable?
Is this value configurable?
changing the values requires restart the tidb instance.
Could you please post more specified data to show the benefit and risks of increasing this config item? E.g. the latency, throughput, CPU usage, memory usage after increasing this config. @dbsid We need to prove that this modify is reasonable, for example, high benefits and low risks in some crucial scenarios.
@qw4990
test case: sysbench oltp_read_write.lua
threads:128
time: 600s
sysbench --config-file=config oltp_read_write.lua --tables=32 --table-size=10000000 run
prepared-plan-cache.capacity 100vs1000 | 100 | 1000 | diff(%) |
---|---|---|---|
cpu | 1230% | 1140% | -7.31% |
memory | 1.54G | 2.15G | +39.61% |
qps | 16997.86 | 17636.77 | +3.76% |
tps | 849.89 | 881.84 | +3.76% |
Queries Using Plan Cache OPS | 10.3K | 15.2K | +47.57% |
latency(avg) | 150.59 | 145.13 | -3.63% |
95th percentile: | 189.93 | 179.94 | -5.26% |
@qw4990 Two more test case for the value of prepared-plan-cache.capacity 100 vs 1000 Test case 1: systench Config: tables=32 table-size=10000000 threads=400、800 time:300s
400并发 | 800并发 | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
400并发 | 800并发 | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
400并发 | 800并发 | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
400并发 | 800并发 | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
Test Case 2:TPC-C Config: threads=400、800 | 400并发 | 800并发 | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@tiancaiamao @qw4990 From the test, for cases such as sysbench read-write on 32 tables, the number of prepared statement exceeds 100. By increasing the limit from 100 to 1000, we basically get more qps、less cpu usage and lower latency, at the cost of more memory usage. We think it's a reasonable tradeoff. In real-world, it's super hard for user to spot the size limitation of plan cache and extend it correspondingly. For other cases when the number of prepared statements does not exceeds 100 and just use query interface, we don't see performance penalty from this change.
Enhancement
Typically a transaction for core-banking application will contains several hundreds of statement. The default value 100 for prepared-plan-cache.capacity is way too small, I'll propose to increase the default value to 1000+, anyway we have the memory-guard-ratio to protect from oom.