当前位置:网站首页>TiDB v6.0.0 (DMR) :缓存表初试丨TiDB Book Rush
TiDB v6.0.0 (DMR) :缓存表初试丨TiDB Book Rush
2022-06-28 11:09:00 【InfoQ】
一、背景
二、缓存表的使用场景
- 表的数据量不大
- 只读表,或者几乎很少修改
- 表的访问很频繁,期望有更好的读性能
三、测试环境
server_configs:
tidb:
log.slow-threshold: 300
new_collations_enabled_on_first_bootstrap: true
tikv:
readpool.coprocessor.use-unified-pool: true
readpool.storage.use-unified-pool: false
pd:
replication.enable-placement-rules: true
replication.location-labels:
- host
四、性能测试
CREATE TABLE sbtest1 (
id int(11) NOT NULL AUTO_INCREMENT,
k int(11) NOT NULL DEFAULT '0',
c char(120) NOT NULL DEFAULT '',
pad char(60) NOT NULL DEFAULT '',
PRIMARY KEY (id),
KEY k_1 (k)
) ENGINE = InnoDB CHARSET = utf8mb4 COLLATE = utf8mb4_bin AUTO_INCREMENT = 1
读性能测试
SELECT c FROM sbtest1 WHERE id=?SELECT id, k, c, pad FROM sbtest1 WHERE k IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)SELECT count(k) FROM sbtest1 WHERE k BETWEEN ? AND ? OR k BETWEEN ? AND ? OR k BETWEEN ? AND ? OR k BETWEEN ? AND ? OR k BETWEEN ? AND ? OR k BETWEEN ? AND ? OR k BETWEEN ? AND ? OR k BETWEEN ? AND ? OR k BETWEEN ? AND ? OR k BETWEEN ? AND ?SELECT c FROM sbtest1 WHERE id=?SELECT SUM(k) FROM sbtest1 WHERE id BETWEEN ? AND ?SELECT c FROM sbtest1 WHERE id BETWEEN ? AND ? ORDER BY cSELECT DISTINCT c FROM sbtest1 WHERE id BETWEEN ? AND ? ORDER BY csysbench --mysql-host=10.0.0.1 --mysql-port=4000 --mysql-db=sbtest --mysql-user=root --time=600 \
--threads=8 --report-interval=10 --db-driver=mysql oltp_point_select --tables=1 --table-size=5000 run
sysbench --mysql-host=10.0.0.1 --mysql-port=4000 --mysql-db=sbtest --mysql-user=root --time=600 \
--threads=8 --report-interval=10 --db-driver=mysql oltp_read_only --tables=1 --table-size=5000 run
sysbench --mysql-host=10.0.0.1 --mysql-port=4000 --mysql-db=sbtest --mysql-user=root --time=600 \
--threads=8 --report-interval=10 --db-driver=mysql select_random_points --tables=1 --table-size=5000 run
sysbench --mysql-host=10.0.0.1 --mysql-port=4000 --mysql-db=sbtest --mysql-user=root --time=600 \
--threads=8 --report-interval=10 --db-driver=mysql select_random_ranges --tables=1 --table-size=5000 run




读写混合性能测试
INSERT INTO sbtest1 (id, k, c, pad) VALUES (?, ?, ?, ?)DELETE FROM sbtest1 WHERE id=?SELECT c FROM sbtest1 WHERE id=?sysbench --mysql-host=10.0.0.1 --mysql-port=4000 --mysql-db=sbtest --mysql-user=root --time=600 --threads=8 --report-interval=10 --db-driver=mysql oltp_read_write --tables=1 --table-size=5000 --point_selects=10 --non_index_updates=0 --delete_inserts=10 --index_updates=0 run




五、遇到的问题
- 尝试将 30w 数据的表改为缓存表时报错
ERROR 8242 (HY000): 'table too large' is unsupported on cache tables。
ALTER TABLE xxx NOCACHE- 测试过程中缓存表性能出现了不稳定的情况,有些时候缓存表反而比普通表读取性能差,使用 trace 语句(
TRACE SELECT * FROM sbtest1;)查看发现返回结果中出现了regionRequest.SendReqCtx,说明 TiDB 尚未将所有数据加载到内存中,多次尝试均未加载完成。把tidb_table_cache_lease调整为 10 后没有出现该问题。
tidb_table_cache_leasetidb_table_cache_lease六、测试总结
读性能
读写混合
边栏推荐
- [Agora] get an Agora_ Example usage of refptr object
- 第2章 还记得点、线、面吗(二)
- Katalon当中的使用循环for、while和if...else、break、continue
- 阿里三面:LEFT JOIN关联表中用ON还是WHERE跟条件有什么区别
- [QT] connect syntax reference implementation
- 李宏毅《机器学习》丨7. Conclusion(总结)
- 拼接String集合中的字符串_基于Stream
- Gee: mcd64a1 based globfire daily fire data set
- JSON module, hashlib, Base64
- Splicing strings in the string collection_ Stream based
猜你喜欢

Remote connection of raspberry pie in VNC viewer mode without display

JS基础3

移动命令

爱可可AI前沿推介(6.28)

Redis6 一:Nosql引入、Redis可以解决什么问题?

Yann LeCun新论文:构建自动智能体之路

Dataease installation upgrade

Yann Lecun's new paper: the road to building automatic agents
![[practice] 1364- implement a perfect waterfall flow component on the mobile terminal (with source code)](/img/e8/21d8d81a3d7b544687d6adc06ad4b1.png)
[practice] 1364- implement a perfect waterfall flow component on the mobile terminal (with source code)

String & heap & method area
随机推荐
GEE:基于 MCD64A1 的 GlobFire 日常火灾数据集
Katalon global variable is referenced in testobject
Metersphere implements UI automation elements that are not clickable (partially occluded)
还在用 SimpleDateFormat 做时间格式化?小心项目崩掉!
论文阅读 (59):Keyword-Based Diverse Image Retrieval with Variational Multiple Instance Graph
Making and using of static library
Docker modifies the user name and password of MySQL
Makefile introduction
什么是主链系统?
个人买场内基金选择什么证券公司开户好,更安全
What is the function of ICMP Protocol and the principle of Ping of death attack?
拼接String集合中的字符串_基于Stream
Remote connection of raspberry pie in VNC viewer mode without display
Information hidden in the trend chart of Hong Kong London gold market
[function suggestion] select a space when multiple workspaces are started
metersphere使用js刷新当前页面
Ruoyi integrated building block report (NICE)
[practice] appium settings app is not running after 5000ms
Katalon当中的debug调试
什么是DAPP系统发展与解析理解