MySQL每秒57萬的寫入,帶你裝逼,帶你飛 !!
往期熱門文章:
1、用 Java 擼了一款 SSH 客戶端 2、處理 Exception 的幾種實(shí)踐,很優(yōu)雅,被很多團(tuán)隊(duì)采納! 3、一致性協(xié)議算法-2PC、3PC、Paxos、Raft、ZAB、NWR詳解 4、這款I(lǐng)DEA插件刷爆了朋友圈,網(wǎng)友:一定是女朋友送的~ 5、@Autowire和@Resource注解使用的正確姿勢,別再用錯(cuò)的了!! 來源 |?網(wǎng)絡(luò)
一、需求
二、實(shí)現(xiàn)再分析
三、XeLabs TokuDB介紹
內(nèi)置了jemalloc 內(nèi)存分配
引入更多的內(nèi)置的TokuDB性能指標(biāo)
支持Xtrabackup備份
引入ZSTD壓縮算法
支持TokuDB的binloggroupcommit特性
四、測試表
loose_tokudb_cache_size=4G
loose_tokudb_directio=ON
loose_tokudb_fsync_log_period=1000
tokudb_commit_sync=0
CREATE TABLE `user_summary` (
`user_id` bigint(20) unsigned NOT NULL COMMENT '用戶id/手機(jī)號(hào)',
`weight` varchar(5) DEFAULT NULL COMMENT '和碼體重(KG)',
`level` varchar(20) DEFAULT NULL COMMENT '重量級(jí)',
`beat_rate` varchar(12) DEFAULT NULL COMMENT '擊敗率',
`level_num` int(10) DEFAULT NULL COMMENT '同噸位人數(shù)',
UNIQUE KEY `u_user_id` (`user_id`)
) ENGINE=TokuDB DEFAULT CHARSET=utf8
root@localhost [zst]>LOAD DATA INFILE '/u01/work/134-136.txt' \
INTO TABLE user_summary(user_id, weight, level, beat_rate,level_num);
Query OK, 200000000 rows affected (5 min 48.30 sec)
Records: 200000000 Deleted: 0 Skipped: 0 Warnings: 0
root@localhost [zst]>select 200000000/(5*60+48.30);
+------------------------+
| 200000000/(5*60+48.30) |
+------------------------+
| 574217.6285 |
+------------------------+
1 row in set (0.00 sec)
-rw-r--r-- 1 root root 8.5G 11月 25 20:05 134-136.txt
-rw-r----- 1 mysql mysql 8.6K 11月 25 20:44 user_summary.frm
-rw-r----- 1 mysql mysql 3.5G 11月 25 20:51 user_summary_main_229_1_1d_B_0.tokudb
-rw-r----- 1 mysql mysql 35G 11月 25 23:29 user2_main_26a_1_1d_B_0.tokudb
-rw-r----- 1 mysql mysql 176G 11月 26 03:32 user5.ibd
root@localhost [zst]>CREATE TABLE `user3` (
-> `user_id` bigint(20) unsigned NOT NULL COMMENT '用戶id/手機(jī)號(hào)',
-> `weight` varchar(5) DEFAULT NULL COMMENT '和碼體重(KG)',
-> `level` varchar(20) DEFAULT NULL COMMENT '重量級(jí)',
-> `beat_rate` varchar(12) DEFAULT NULL COMMENT '擊敗率',
-> `level_num` int(10) DEFAULT NULL COMMENT '同噸位人數(shù)',
-> `id` bigint(20) NOT NULL AUTO_INCREMENT,
-> PRIMARY KEY (`id`),
-> UNIQUE KEY `u_user_id` (`user_id`)
-> ) ENGINE=TokuDB;
Query OK, 0 rows affected (0.03 sec)
root@localhost [zst]>LOAD DATA INFILE '/u01/work/134-136.txt' INTO TABLE user3(user_id, weight, level, beat_rate,level_num);
Query OK, 200000000 rows affected (22 min 43.62 sec)
Records: 200000000 Deleted: 0 Skipped: 0 Warnings: 0
五、測試環(huán)境說明
最近熱文閱讀:
1、用 Java 擼了一款 SSH 客戶端 2、處理 Exception 的幾種實(shí)踐,很優(yōu)雅,被很多團(tuán)隊(duì)采納! 3、一致性協(xié)議算法-2PC、3PC、Paxos、Raft、ZAB、NWR詳解 4、這款I(lǐng)DEA插件刷爆了朋友圈,網(wǎng)友:一定是女朋友送的~ 5、@Autowire和@Resource注解使用的正確姿勢,別再用錯(cuò)的了!! 6、Java中的Switch都支持String了,為什么不支持long? 7、請(qǐng)謹(jǐn)慎使用Arrays.asList、ArrayList的subList 8、人臉識(shí)別“抓”錯(cuò)了人,他在監(jiān)獄呆了 10 天 9、騷操作 !IDEA 防止寫代碼沉迷插件 ! 10、這四種情況下,才是考慮分庫分表的時(shí)候! 關(guān)注公眾號(hào),你想要的Java都在這里
