您的位置:首页 > 数据库 > MySQL

EXT3/XFS/GFS在单机环境下与MySQL结合的性能简单对比

2009-03-13 00:21 447 查看
环境: SUN 4路4核CPU。16G内存。4 块SCSI 140G硬盘。MySQL 企业版 5.1.30。

简单的测试了一下,可能具体情况下对应的性能有其他差别。
以下是具体的测试步骤。

1. 安装。先用fdisk 工具在第四块硬盘上分好区,每个区30G。对应的文件系统分别是EXT3, XFS, GFS.
如下:

[root@X-39 ~]# mkfs.ext3 /dev/sdd5
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
3662848 inodes, 7325632 blocks
366281 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
224 block groups
32768 blocks per group, 32768 fragments per group
16352 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

[root@X-39 ~]# mkfs.xfs /dev/sdd6
meta-data=/dev/sdd6 isize=256 agcount=4, agsize=1831408 blks
= sectsz=512 attr=2
data = bsize=4096 blocks=7325632, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0
log =internal log bsize=4096 blocks=3576, version=2
= sectsz=512 sunit=0 blks, lazy-count=0
realtime =none extsz=4096 blocks=0, rtextents=0

由于我们只用测试单机的性能,那么 LOCK 的协议就用 lock_nolock,否则就用lock_dlm.
[root@X-39 ~]# gfs_mkfs -t nfs_cluster:gfs1 -p lock_nolock -j 8 /dev/sdd7
This will destroy any data on /dev/sdd7.
It appears to contain a gfs filesystem.

Are you sure you want to proceed? [y/n] y

Device: /dev/sdd7
Blocksize: 4096
Filesystem Size: 7062824
Journals: 8
Resource Groups: 108
Locking Protocol: lock_nolock
Lock Table: nfs_cluster:gfs1

Syncing...
All Done

[root@X-39 opt]# mount -t ext3 /dev/sdd5 /opt/ext3
[root@X-39 opt]# mount -t xfs /dev/sdd6 /opt/xfs
[root@X-39 opt]# mount -t gfs /dev/sdd7 /opt/gfs

2. 建立MySQL 表空间。
分别在3 个分区上建立 3 个 20G 的表空间。

3. 分别测试插入性能和读写混合的性能。

a. 插入性能对比:
EXT3 文件系统。
[root@X-39
bin]# time ./sysbench --test=oltp --mysql-host=localhost
--mysql-user=root --mysql-table-engine=innodb --mysql-db=test
--oltp-table-size=10000000 --db-driver=mysql prepare
sysbench 0.4.10: multi-threaded system evaluation benchmark

Creating table 'sbtest'...
Creating 10000000 records in table 'sbtest'...

real 3m44.272s
user 0m0.088s
sys 0m0.084s

XFS 文件系统。

[root@X-39
bin]# time ./sysbench --test=oltp --mysql-host=localhost
--mysql-user=root --mysql-table-engine=innodb --mysql-db=test
--oltp-table-size=10000000 --db-driver=mysql prepare
sysbench 0.4.10: multi-threaded system evaluation benchmark

Creating table 'sbtest'...
Creating 10000000 records in table 'sbtest'...

real 4m31.288s
user 0m0.060s
sys 0m0.084s

GFS 文件系统。
[root@X-39
bin]# time ./sysbench --test=oltp --mysql-host=localhost
--mysql-user=root --mysql-table-engine=innodb --mysql-db=test
--oltp-table-size=10000000 --db-driver=mysql prepare
sysbench 0.4.10: multi-threaded system evaluation benchmark

Creating table 'sbtest'...
Creating 10000000 records in table 'sbtest'...

real 3m44.084s
user 0m0.000s
sys 0m0.056s

b. 读写混合性能对比:

总共80W个请求,一个事务里面10条Queries.

EXT3 文件系统。
[root@X-39
bin]# time ./sysbench --test=oltp --mysql-host=localhost
--mysql-user=root --mysql-table-engine=innodb --mysql-db=test
--oltp-table-size=10000000 --db-driver=mysql --num-threads=300
--oltp-index-updates=10 --max-requests=800000 run
sysbench 0.4.10: multi-threaded system evaluation benchmark

WARNING: Preparing of "BEGIN" is unsupported, using emulation
(last message repeated 299 times)
Running the test with following options:
Number of threads: 300

Doing OLTP test.
Running mixed OLTP test
Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases)
Using "BEGIN" for starting transactions
Using auto_inc on the id column
Maximum number of requests for OLTP test is limited to 800000
Threads started!
Done.

OLTP test statistics:
queries performed:
read: 11202828
write: 11202810
other: 1600401
total: 24006039
transactions: 800199 (636.77 per sec.)
deadlocks: 3 (0.00 per sec.)
read/write requests: 22405638 (17829.56 per sec.)
other operations: 1600401 (1273.54 per sec.)

Test execution summary:
total time: 1256.6566s
total number of events: 800199
total time taken by event execution: 376926.2708
per-request statistics:
min: 29.47ms
avg: 471.04ms
max: 47376.71ms
approx. 95 percentile: 928.99ms

Threads fairness:
events (avg/stddev): 2667.3300/26.84
execution time (avg/stddev): 1256.4209/0.07

real 21m1.058s
user 4m35.057s
sys 15m32.198s

此时随即抽取系统的负载情况:

[root@X-39 ~]# vmstat 1 10
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
61 0 0 9437104 81404 2840916 0 0 18 898 415 342 5 3 87 4 0
28 1 0 9436352 81420 2840900 0 0 64 2776 40358 220273 31 21 44 4 0
66 2 0 9436448 81428 2840916 0 0 64 3556 41975 223971 32 20 42 6 1
85 1 0 9435456 81444 2840900 0 0 0 5540 40529 220920 31 20 43 4 0
116 2 0 9434340 81452 2840908 0 0 16 2996 41439 223413 32 21 42 4 0
32 2 0 9433896 81460 2840900 0 0 64 3420 39839 217753 32 21 41 6 0
34 1 0 9433260 81492 2840900 0 0 128 5176 33574 186159 26 18 50 5 0
0 1 0 9433508 81492 2840900 0 0 64 6720 37051 206044 31 21 44 4 1
27 1 0 9432640 81508 2840908 0 0 32 6604 33511 184347 25 17 55 3 0
75 1 0 9432268 81516 2840900 0 0 96 2368 40628 219158 30 18 48 2 1

XFS 文件系统。

[root@X-39
bin]# time ./sysbench --test=oltp --mysql-host=localhost
--mysql-user=root --mysql-table-engine=innodb --mysql-db=test
--oltp-table-size=10000000 --db-driver=mysql --num-threads=300
--oltp-index-updates=10 --max-requests=800000 run
sysbench 0.4.10: multi-threaded system evaluation benchmark

WARNING: Preparing of "BEGIN" is unsupported, using emulation
(last message repeated 299 times)
Running the test with following options:
Number of threads: 300

Doing OLTP test.
Running mixed OLTP test
Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases)
Using "BEGIN" for starting transactions
Using auto_inc on the id column
Maximum number of requests for OLTP test is limited to 800000
Threads started!
Done.

OLTP test statistics:
queries performed:
read: 11204298
write: 11204282
other: 1600612
total: 24009192
transactions: 800305 (616.03 per sec.)
deadlocks: 2 (0.00 per sec.)
read/write requests: 22408580 (17248.90 per sec.)
other operations: 1600612 (1232.06 per sec.)

Test execution summary:
total time: 1299.1307s
total number of events: 800305
total time taken by event execution: 389664.0531
per-request statistics:
min: 30.00ms
avg: 486.89ms
max: 57526.27ms
approx. 95 percentile: 911.09ms

Threads fairness:
events (avg/stddev): 2667.6833/29.19
execution time (avg/stddev): 1298.8802/0.13

real 21m43.439s
user 4m27.937s
sys 15m52.172s

随即抽取系统的负载。
[root@X-39 ext3]# vmstat 1 10
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
45 1 0 9672396 84768 2842140 0 0 28 806 183 264 7 5 83 5 0
50 0 0 9672156 84768 2842140 0 0 112 2019 42636 219508 28 19 51 1 1
48 0 0 9670804 84776 2842140 0 0 96 1844 34179 184498 26 19 53 1 0
116 1 0 9670556 84776 2842140 0 0 112 6181 41099 219536 31 21 46 1 0
37 0 0 9670060 84776 2842140 0 0 80 1973 39896 214530 31 21 47 1 0
38 0 0 9668696 84776 2842140 0 0 464 2115 39569 216274 30 21 47 1 0
25 0 0 9667952 84776 2842140 0 0 80 2024 40313 221035 31 20 48 1 1
73 1 0 9666868 84784 2842132 0 0 288 2099 38788 214971 31 22 45 1 1
43 1 0 9666620 84784 2842140 0 0 144 2109 41118 223309 33 21 45 1 0
0 6 0 9665148 84784 2842140 0 0 2608 916 20575 100746 12 9 65 14 0

GFS 文件系统。

[root@X-39
bin]# time ./sysbench --test=oltp --mysql-host=localhost
--mysql-user=root --mysql-table-engine=innodb --mysql-db=test
--oltp-table-size=10000000 --db-driver=mysql --num-threads=300
--oltp-index-updates=10 --max-requests=800000 run
sysbench 0.4.10: multi-threaded system evaluation benchmark

WARNING: Preparing of "BEGIN" is unsupported, using emulation
(last message repeated 299 times)
Running the test with following options:
Number of threads: 300

Doing OLTP test.
Running mixed OLTP test
Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases)
Using "BEGIN" for starting transactions
Using auto_inc on the id column
Maximum number of requests for OLTP test is limited to 800000
Threads started!
Done.

OLTP test statistics:
queries performed:
read: 11202436
write: 11202422
other: 1600346
total: 24005204
transactions: 800172 (625.79 per sec.)
deadlocks: 2 (0.00 per sec.)
read/write requests: 22404858 (17522.21 per sec.)
other operations: 1600346 (1251.59 per sec.)

Test execution summary:
total time: 1278.6545s
total number of events: 800172
total time taken by event execution: 383530.5202
per-request statistics:
min: 34.46ms
avg: 479.31ms
max: 55387.37ms
approx. 95 percentile: 927.04ms

Threads fairness:
events (avg/stddev): 2667.2400/26.40
execution time (avg/stddev): 1278.4351/0.07

real 21m22.963s
user 4m35.093s
sys 16m44.471s

随即抽取系统的负载。

[root@X-39 ext3]# vmstat 1 10
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
25 1 0 9664752 86920 2842136 0 0 33 723 135 261 10 7 78 5 0
89 1 0 9664476 86920 2842144 0 0 160 2416 41533 222591 31 20 45 3 1
50 1 0 9664600 86920 2842144 0 0 160 2360 39494 217981 31 22 44 2 0
83 2 0 9663856 86920 2842144 0 0 160 2384 38925 217437 30 22 46 2 0
182 1 0 9677772 86888 2842144 0 0 96 2372 39189 214399 29 21 47 3 1
32 1 0 9663236 86924 2842144 0 0 160 2408 40523 218183 30 24 43 2 0
23 1 0 9661892 86924 2842144 0 0 96 2364 39017 213529 29 22 46 2 0
70 1 0 9660776 86924 2842144 0 0 80 2380 40441 217191 30 22 45 2 0
35 0 0 9661148 86924 2842144 0 0 112 2360 41679 221171 30 21 46 3 1
7 1 0 9660032 86928 2842144 0 0 144 2576 40352 217351 29 22 46 3 0
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: