[InnoDB系列] - InnoDB VS PBXT实测
1、前言
PBXT 是 PrimeBase 公司推出的MySQL插件引擎,其功能和 InnoDB 类似,主要特性如下:
- MVCC Support:
MVCC stands for Multi-version Concurrency Control. MVCC allows reading the database without locking. - Fully ACID complient:
This means that transactionally safe, and able to handle multiple concurrent transactions. - Row-level locking:
When updating, PBXT uses row-level locking. Row-level locking is also used during SELECT FOR UPDATE. - Fast Rollback and Recovery:
PBXT
uses a specialized method to identify garbage which makes "undo"
unncessary. This make both rollback of transactions and recovery after
restart very fast. - Deadlock Detection:
PBXT identifies all kinds of deadlocks immediately. - Write-once:
PBXT
uses a log-based storage which makes it possible to write transactional
data directly to the database, without first being writen to the
transaction log. - Referential Integrity:
PBXT supports foreign key definitions, including cascaded updates and deletes. - BLOB streaming:
In combination with the BLOB Streaming engine PBXT can stream binary and media directly in and out of the database.
本次我们来实际对比测试下InnoDB和PBXT的性能区别。
2、准备
2.1 配置
PBXT 和 InnoDB 主要配置参数如下:
innodb:
innodb_buffer_pool_size = 6G innodb_data_file_path = ibdata1:1024M:autoextend innodb_thread_concurrency = 8 innodb_flush_log_at_trx_commit = 1 innodb_log_buffer_size = 16M innodb_log_file_size = 256M innodb_log_files_in_group = 3 innodb_max_dirty_pages_pct = 90 innodb_file_per_table
pbxt:
pbxt_checkpoint_frequency = 28MB pbxt_data_file_grow_size = 8MB pbxt_data_log_threshold = 128MB pbxt_garbage_threshold = 50 pbxt_index_cache_size = 2G pbxt_log_buffer_size = 2M pbxt_log_cache_size = 16MB pbxt_log_file_count = 3 pbxt_log_file_threshold = 128MB pbxt_record_cache_size = 4G pbxt_row_file_grow_size = 1M pbxt_transaction_buffer_size = 32MB
2.2 准备数据
本次测试分2部分进行,一部分是利用MySQL官方提供的 sql-bench 工具测试,另一部分采用 sysbench 做一个基准测试。
3、测试结果
3.1 sql-bench测试结果
Operation |
seconds |
usr |
sys |
cpu |
tests |
|
alter_table_add |
12 |
0.01 |
0 |
0.01 |
100 |
innodb |
11 |
0 |
0 |
0 |
100 |
pbxt |
|
alter_table_drop |
12 |
0.01 |
0.01 |
0.02 |
91 |
|
10 |
0.01 |
0 |
0.01 |
91 |
||
connect |
4 |
1.98 |
1.08 |
3.06 |
10000 |
|
4 |
1.99 |
1.04 |
3.03 |
10000 |
||
connect+select_1_row |
5 |
2.17 |
1.16 |
3.33 |
10000 |
|
5 |
2.08 |
1.15 |
3.23 |
10000 |
||
connect+select_simple |
5 |
2.11 |
1.2 |
3.31 |
10000 |
|
5 |
1.91 |
1.31 |
3.22 |
10000 |
||
count |
16 |
0.01 |
0.01 |
0.02 |
100 |
|
14 |
0 |
0 |
0 |
100 |
||
count_distinct |
0 |
0.08 |
0.02 |
0.1 |
1000 |
|
1 |
0.08 |
0.02 |
0.1 |
1000 |
||
count_distinct_2 |
0 |
0.07 |
0.03 |
0.1 |
1000 |
|
0 |
0.08 |
0.03 |
0.11 |
1000 |
||
count_distinct_big |
10 |
3.14 |
0.74 |
3.88 |
120 |
|
9 |
3.17 |
0.72 |
3.89 |
120 |
||
count_distinct_group |
0 |
0.4 |
0.1 |
0.5 |
1000 |
|
0 |
0.4 |
0.07 |
0.47 |
1000 |
||
count_distinct_group_on_key |
0 |
0.09 |
0.03 |
0.12 |
1000 |
|
0 |
0.09 |
0.04 |
0.13 |
1000 |
||
count_distinct_group_on_key_parts |
1 |
0.4 |
0.08 |
0.48 |
1000 |
|
1 |
0.36 |
0.11 |
0.47 |
1000 |
||
count_distinct_key_prefix |
1 |
0.08 |
0.03 |
0.11 |
1000 |
|
0 |
0.08 |
0.02 |
0.1 |
1000 |
||
count_group_on_key_parts |
0 |
0.37 |
0.1 |
0.47 |
1000 |
|
0 |
0.39 |
0.08 |
0.47 |
1000 |
||
count_on_key |
13 |
3.46 |
1.27 |
4.73 |
50100 |
|
16 |
3.45 |
1.35 |
4.8 |
50100 |
||
create+drop |
67 |
0.01 |
0.04 |
0.05 |
10000 |
|
74 |
0 |
0 |
0 |
10000 |
||
create_MANY_tables |
84 |
0.02 |
0.01 |
0.03 |
9999 |
|
138 |
0.52 |
0.19 |
0.71 |
9999 |
||
create_index |
2 |
0 |
0 |
0 |
8 |
|
1 |
0 |
0 |
0 |
8 |
||
create_key+drop |
64 |
0.25 |
0.32 |
0.57 |
10000 |
|
74 |
0 |
0.06 |
0.06 |
10000 |
||
create_table |
0 |
0 |
0 |
0 |
31 |
|
0 |
0 |
0 |
0 |
31 |
||
delete_all_many_keys |
19 |
0.02 |
0 |
0.02 |
1 |
|
1 |
0 |
0 |
0 |
1 |
||
delete_autocommit |
1 |
0.09 |
0.21 |
0.3 |
10000 |
|
delete_big |
0 |
0 |
0 |
0 |
1 |
|
0 |
0 |
0 |
0 |
1 |
||
delete_big_many_keys |
18 |
0.02 |
0 |
0.02 |
128 |
|
1 |
0 |
0 |
0 |
128 |
||
delete_commit |
0 |
0.07 |
0.2 |
0.27 |
10000 |
|
delete_key |
1 |
0.06 |
0.13 |
0.19 |
10000 |
|
1 |
0.11 |
0.17 |
0.28 |
10000 |
||
delete_range |
4 |
0 |
0 |
0 |
12 |
|
5 |
0 |
0 |
0 |
12 |
||
delete_rollback |
1 |
0.09 |
0.2 |
0.29 |
100 |
|
drop_index |
2 |
0 |
0 |
0 |
8 |
|
2 |
0 |
0 |
0 |
8 |
||
drop_table |
0 |
0 |
0 |
0 |
28 |
|
0 |
0 |
0 |
0 |
28 |
||
drop_table_when_MANY_tables |
74 |
0.27 |
0.24 |
0.51 |
9999 |
|
30 |
0.02 |
0.02 |
0.04 |
9999 |
||
insert |
32 |
3.54 |
7.23 |
10.77 |
350768 |
|
62 |
3 |
5.42 |
8.42 |
350768 |
||
insert_autocommit |
1 |
0.15 |
0.22 |
0.37 |
10000 |
|
insert_commit |
1 |
0.11 |
0.2 |
0.31 |
10000 |
|
insert_duplicates |
9 |
0.96 |
1.98 |
2.94 |
100000 |
|
15 |
1.03 |
1.85 |
2.88 |
100000 |
||
insert_key |
28 |
1.69 |
1.59 |
3.28 |
100000 |
|
66 |
1.84 |
1.59 |
3.43 |
100000 |
||
insert_many_fields |
3 |
0.1 |
0.03 |
0.13 |
2000 |
|
2 |
0.1 |
0.03 |
0.13 |
2000 |
||
insert_rollback |
1 |
0.14 |
0.21 |
0.35 |
100 |
|
insert_select_1_key |
3 |
0 |
0 |
0 |
1 |
|
5 |
0 |
0 |
0 |
1 |
||
insert_select_2_keys |
4 |
0 |
0 |
0 |
1 |
|
11 |
0 |
0 |
0 |
1 |
||
min_max |
6 |
0.01 |
0 |
0.01 |
60 |
|
6 |
0.01 |
0 |
0.01 |
60 |
||
min_max_on_key |
11 |
5.75 |
2.09 |
7.84 |
85000 |
|
10 |
5.83 |
2.18 |
8.01 |
85000 |
||
multiple_value_insert |
2 |
0.12 |
0.02 |
0.14 |
100000 |
|
4 |
0.13 |
0.01 |
0.14 |
100000 |
||
once_prepared_select |
19 |
2.61 |
2.58 |
5.19 |
100000 |
|
18 |
2.53 |
2.79 |
5.32 |
100000 |
||
order_by_big |
15 |
9.43 |
2.26 |
11.69 |
10 |
|
14 |
9.35 |
2.35 |
11.7 |
10 |
||
order_by_big_key |
13 |
9.64 |
2.34 |
11.98 |
10 |
|
12 |
9.63 |
2.31 |
11.94 |
10 |
||
order_by_big_key2 |
12 |
9.4 |
2.24 |
11.64 |
10 |
|
12 |
9.32 |
2.32 |
11.64 |
10 |
||
order_by_big_key_desc |
13 |
9.61 |
2.34 |
11.95 |
10 |
|
13 |
9.58 |
2.36 |
11.94 |
10 |
||
order_by_big_key_diff |
12 |
9.38 |
2.27 |
11.65 |
10 |
|
14 |
9.29 |
2.35 |
11.64 |
10 |
||
order_by_big_key_prefix |
13 |
9.33 |
2.29 |
11.62 |
10 |
|
12 |
9.27 |
2.34 |
11.61 |
10 |
||
order_by_key2_diff |
1 |
0.83 |
0.19 |
1.02 |
500 |
|
1 |
0.82 |
0.18 |
1 |
500 |
||
order_by_key_prefix |
1 |
0.44 |
0.11 |
0.55 |
500 |
|
1 |
0.43 |
0.12 |
0.55 |
500 |
||
order_by_range |
1 |
0.42 |
0.12 |
0.54 |
500 |
|
2 |
0.45 |
0.1 |
0.55 |
500 |
||
outer_join |
2 |
0 |
0 |
0 |
10 |
|
10 |
0 |
0 |
0 |
10 |
||
outer_join_found |
1 |
0 |
0 |
0 |
10 |
|
11 |
0 |
0 |
0 |
10 |
||
outer_join_not_found |
1 |
0 |
0 |
0 |
500 |
|
9 |
0 |
0 |
0 |
500 |
||
outer_join_on_key |
1 |
0 |
0 |
0 |
10 |
|
15 |
0.01 |
0 |
0.01 |
10 |
||
prepared_select |
24 |
7.76 |
2.8 |
10.56 |
100000 |
|
24 |
7.26 |
2.76 |
10.02 |
100000 |
||
select_1_row |
12 |
1.35 |
2.36 |
3.71 |
100000 |
|
13 |
1.33 |
2.59 |
3.92 |
100000 |
||
select_1_row_cache |
5 |
1.08 |
2.13 |
3.21 |
100000 |
|
5 |
0.64 |
2.81 |
3.45 |
100000 |
||
select_2_rows |
13 |
1.34 |
2.34 |
3.68 |
100000 |
|
14 |
1.4 |
2.6 |
4 |
100000 |
||
select_big |
12 |
9.41 |
2.35 |
11.76 |
80 |
|
12 |
9.46 |
2.31 |
11.77 |
80 |
||
select_big_str |
4 |
1.18 |
0.79 |
1.97 |
10000 |
|
4 |
1.18 |
0.77 |
1.95 |
10000 |
||
select_cache |
1 |
0.72 |
0.26 |
0.98 |
10000 |
|
1 |
0.71 |
0.22 |
0.93 |
10000 |
||
select_cache2 |
57 |
0.75 |
0.21 |
0.96 |
10000 |
|
61 |
0.65 |
0.29 |
0.94 |
10000 |
||
select_column+column |
13 |
1.03 |
2.22 |
3.25 |
100000 |
|
14 |
1.09 |
2.19 |
3.28 |
100000 |
||
select_diff_key |
0 |
0.03 |
0.02 |
0.05 |
500 |
|
0 |
0.05 |
0.02 |
0.07 |
500 |
||
select_distinct |
1 |
0.66 |
0.14 |
0.8 |
800 |
|
1 |
0.66 |
0.14 |
0.8 |
800 |
||
select_group |
2 |
0.44 |
0.11 |
0.55 |
2911 |
|
4 |
0.44 |
0.13 |
0.57 |
2911 |
||
select_group_when_MANY_tables |
2 |
0.12 |
0.22 |
0.34 |
9999 |
|
9 |
0.12 |
0.2 |
0.32 |
9999 |
||
select_join |
1 |
0.19 |
0.05 |
0.24 |
100 |
|
0 |
0.18 |
0.06 |
0.24 |
100 |
||
select_key |
41 |
15.46 |
5.69 |
21.15 |
200000 |
|
41 |
15.18 |
5.5 |
20.68 |
200000 |
||
select_key2 |
44 |
15.69 |
5.56 |
21.25 |
200000 |
|
42 |
15.49 |
5.36 |
20.85 |
200000 |
||
select_key2_return_key |
41 |
14.63 |
4.94 |
19.57 |
200000 |
|
40 |
14.52 |
4.93 |
19.45 |
200000 |
||
select_key2_return_prim |
42 |
14.94 |
5.2 |
20.14 |
200000 |
|
41 |
14.85 |
5.2 |
20.05 |
200000 |
||
select_key_prefix |
42 |
15.84 |
5.41 |
21.25 |
200000 |
|
41 |
15.54 |
5.42 |
20.96 |
200000 |
||
select_key_prefix_join |
2 |
1.76 |
0.41 |
2.17 |
100 |
|
2 |
1.74 |
0.43 |
2.17 |
100 |
||
select_key_return_key |
39 |
14.97 |
5.14 |
20.11 |
200000 |
|
40 |
14.87 |
5.24 |
20.11 |
200000 |
||
select_many_fields |
4 |
2.85 |
1.61 |
4.46 |
2000 |
|
5 |
2.75 |
1.82 |
4.57 |
2000 |
||
select_range |
5 |
3.55 |
0.78 |
4.33 |
410 |
|
5 |
3.53 |
0.81 |
4.34 |
410 |
||
select_range_key2 |
2 |
1.68 |
0.43 |
2.11 |
25010 |
|
2 |
1.58 |
0.51 |
2.09 |
25010 |
||
select_range_prefix |
3 |
1.65 |
0.47 |
2.12 |
25010 |
|
2 |
1.6 |
0.51 |
2.11 |
25010 |
||
select_simple |
6 |
0.81 |
2.6 |
3.41 |
100000 |
|
6 |
0.98 |
2.54 |
3.52 |
100000 |
||
select_simple_cache |
6 |
0.9 |
2.15 |
3.05 |
100000 |
|
6 |
1.02 |
2.27 |
3.29 |
100000 |
||
select_simple_join |
0 |
0.23 |
0.05 |
0.28 |
500 |
|
1 |
0.23 |
0.07 |
0.3 |
500 |
||
update_autocommit |
0 |
0.09 |
0.2 |
0.29 |
10000 |
|
update_big |
23 |
0 |
0 |
0 |
10 |
|
170 |
0 |
0 |
0 |
10 |
||
update_commit |
1 |
0.1 |
0.21 |
0.31 |
10000 |
|
update_of_key |
8 |
0.43 |
1.06 |
1.49 |
50000 |
|
11 |
0.43 |
0.81 |
1.24 |
50000 |
||
update_of_key_big |
33 |
0 |
0.02 |
0.02 |
501 |
|
24 |
0.01 |
0.02 |
0.03 |
501 |
||
update_of_primary_key_many_keys |
39 |
0 |
0 |
0 |
256 |
|
37 |
0.01 |
0.01 |
0.02 |
256 |
||
update_rollback |
1 |
0.15 |
0.22 |
0.37 |
100 |
|
update_with_key |
33 |
2.28 |
5.87 |
8.15 |
300000 |
|
68 |
2.64 |
4.8 |
7.44 |
300000 |
||
update_with_key_prefix |
12 |
1.88 |
2.42 |
4.3 |
100000 |
|
11 |
2.03 |
2.2 |
4.23 |
100000 |
||
wisc_benchmark |
2 |
1.03 |
0.16 |
1.19 |
114 |
|
1 |
1.04 |
0.17 |
1.21 |
114 |
||
TOTALS |
1198 |
225.92 |
104.12 |
330.04 |
3486247 |
innodb |
1486 |
222.57 |
100.39 |
322.96 |
3425947 |
pbxt |
3.2 sysbench测试结果
|
prepare |
tranaction/s |
r/w request/s |
other/s |
time |
|
500w innodb |
1m28.533s |
1866.39 |
35461.43 |
3732.78 |
53.5826 |
innodb |
500w pbxt |
4m21.189s |
548.4 |
10419.65 |
1096.8 |
182.3515 |
pbxt |
4、总结
关注下 sql-bench 测试结果中的 create_MANY_tables, create+drop, delete_all_many_keys, create_key+drop, delete_all_many_keys, delete_big_many_keys,drop_table_when_MANY_tables,insert, update_big, update_with_key 几个值,就可以发现InnoDB在对索引的维护上会比PBXT慢以外,其他均比PBXT强。采用新的InnoDB-plugin后, InnoDB 在处理 secondary index 方面的能力会得到大大提升,这方面的劣势就不复存在。看来短期内PBXT想要取代 InnoDB 还没那么容易。
最近评论