The document compares the performance of MySQL installed from binary versus from source code on a Dell PowerEdge R815 server with 4 CPUs and 48 cores. TPCC tests were run against both installations using the same parameters except for port number. The source code installation outperformed the binary installation, achieving 6586.6 transactions per minute versus 5606.6 transactions per minute for the binary installation in a test with 1 client and 50 warehouses over 60 seconds.
5. www.yhd.com
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
BASED Test by Mysqlslap:
5.6.12 has a big improvement than 5.5.32
Details:
All insert
/data/mysql/bin/mysqlslap --verbose
-uroot -pyihaodian
--delimiter=";"
--engine=innodb
--auto-generate-sql
--auto-generate-sql-add-autoincrement
--number-char-cols=5
--number-int-cols=10
--auto-generate-sql-load-type=write
--auto-generate-sql-execute-number=10000
--concurrency=30
--detach=100
6. www.yhd.com
5.5.32-linux
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 112.919 seconds
Minimum number of seconds to run all queries: 112.919 seconds
Maximum number of seconds to run all queries: 112.919 seconds
Number of clients running queries: 30
Average number of queries per client: 10000
5.6.12-linux
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 27.625 seconds
Minimum number of seconds to run all queries: 27.625 seconds
Maximum number of seconds to run all queries: 27.625 seconds
Number of clients running queries: 30
Average number of queries per client: 10000
Update by primary key
/data/mysql/bin/mysqlslap --verbose
-uroot -pyihaodian
--delimiter=";"
--engine=innodb
--auto-generate-sql
7. www.yhd.com
--auto-generate-sql-add-autoincrement
--number-char-cols=5
--number-int-cols=10
--auto-generate-sql-load-type=update
--auto-generate-sql-execute-number=10000
--concurrency=30
--detach=100
5.5.32-linux
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 111.260 seconds
Minimum number of seconds to run all queries: 111.260 seconds
Maximum number of seconds to run all queries: 111.260 seconds
Number of clients running queries: 30
Average number of queries per client: 10000
5.6.12-linux
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 28.978 seconds
Minimum number of seconds to run all queries: 28.978 seconds
Maximum number of seconds to run all queries: 28.978 seconds
Number of clients running queries: 30
Average number of queries per client: 10000
8. www.yhd.com
Select by primary key
/data/mysql/bin/mysqlslap --verbose
-uroot -pyihaodian
--delimiter=";"
--engine=innodb
--auto-generate-sql
--auto-generate-sql-add-autoincrement
--number-char-cols=5
--number-int-cols=10
--auto-generate-sql-load-type=key
--auto-generate-sql-execute-number=100000
--concurrency=30
--detach=100
5.5.32-linux
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 38.402 seconds
Minimum number of seconds to run all queries: 38.402 seconds
Maximum number of seconds to run all queries: 38.402 seconds
Number of clients running queries: 30
Average number of queries per client: 100000
5.6.12-linux
Benchmark
9. www.yhd.com
Running for engine innodb
Average number of seconds to run all queries: 35.801 seconds
Minimum number of seconds to run all queries: 35.801 seconds
Maximum number of seconds to run all queries: 35.801 seconds
Number of clients running queries: 30
Average number of queries per client: 100000
--------------------------------------------------------------------------------
On staging test environment:
5.6.12 has a bigger performance improvement than 5.5.32 when parallel sessions are increasing ,more concurrency better performance.
Detail SQL text :
vi query.sql
select count(1) from gss_data.pm_stock_3 where pm_info_id in ( 1381898 , 995717 , 7061062 , 1009835 , 7061064 , 2274824 , 6464315 ,
4667866 , 8416932 , 3942438 , 3942439 , 1932770 , 7061075 , 972348 , 7061073 , 8007295 , 8007281 , 7061080 , 2001017 , 7061087 ,
8882284 , 1126760 , 8416950 , 2274844 , 7061089 , 1047183 , 8983344 , 3814131 , 8416910 , 4608916 , 3814130 , 1457653 , 7061099 ,
4608923 , 1878335 , 7061098 , 7061101 , 7061100 , 1047170 , 7062092 , 7062088 , 8416927 , 8416924 , 7558294 , 8416912 , 7061114 ,
11. www.yhd.com
Average number of queries per client: 1000
5.6.12-linux
Benchmark
Average number of seconds to run all queries: 3.738 seconds
Minimum number of seconds to run all queries: 3.738 seconds
Maximum number of seconds to run all queries: 3.738 seconds
Number of clients running queries: 30
Average number of queries per client: 1000
mysqlslap --verbose
-uroot -pyihaodian
--create-schema=gss_data
--no-drop
--delimiter=";"
--query=query.sql
--detach=100
--concurrency=1
--number-of-queries=30000
5.5.32-linux
Benchmark
Average number of seconds to run all queries: 120.504 seconds
Minimum number of seconds to run all queries: 120.504 seconds
Maximum number of seconds to run all queries: 120.504 seconds
12. www.yhd.com
Number of clients running queries: 1
Average number of queries per client: 30000
5.6.12-linux
Benchmark
Average number of seconds to run all queries: 48.158 seconds
Minimum number of seconds to run all queries: 48.158 seconds
Maximum number of seconds to run all queries: 48.158 seconds
Number of clients running queries: 1
Average number of queries per client: 30000
16. www.yhd.com
MySQL binary installation VS MySQL source code installation----by yihaodian rzj
Hardware :
# Percona Toolkit System Summary Report ######################
Date | 2013-06-14 03:31:12 UTC (local TZ: CST +0800)
Hostname | SHABBO2-SRV-0041
Uptime | 25 days, 33 min, 3 users, load average: 0.77, 0.57, 0.38
System | Dell Inc.; PowerEdge R815; vNot Specified (<OUT OF SPEC>)
Platform | Linux
Release | Red Hat Enterprise Linux Server release 5.8 (Tikanga)
Kernel | 2.6.32-300.10.1.el5uek
Architecture | CPU = 64-bit, OS = 64-bit
Threading | NPTL 2.5
Compiler | GNU CC version 4.1.2 20080704 (Red Hat 4.1.2-50).
SELinux | Disabled
Virtualized | No virtualization detected
# Processor ##################################################
Processors | physical = 4, cores = 48, virtual = 48, hyperthreading = no
Speeds | 48x2100.117
17. www.yhd.com
Models | 48xAMD Opteron(tm) Processor 6172
Caches | 48x512 KB
# Memory #####################################################
Total | 126.2G
Free | 54.8G
Used | physical = 71.4G, swap allocated = 125.0G, swap used = 387.5M, virtual = 71.8G
Buffers | 288.8M
Caches | 23.8G
Test tool:Percona-TPCC
More information about TPCC you can visit http://www.tpc.org/tpcc/
Test process :
We do this test on MySQL (Be installed by MySQL binary and MySQL source code) all of them have the same parameters only the difference
is port number 。
1.create test database
22. www.yhd.com
OS kernel difference leading MySQL performance undulate -----by willy
Linux 5.8 with FusionIO
[root@GSS-02 ioDrive2]# uname -a
Linux GSS-02 2.6.18-308.0.0.0.1.el5 #1 SMP Sat Feb 25 16:16:23 EST 2012 x86_64 x86_64 x86_64 GNU/Linux
[root@GSS-03 ioDrive2]# uname -a
Linux ITEM-LGSTD01 2.6.32-300.10.1.el5uek #1 SMP Wed Feb 22 17:37:40 EST 2012 x86_64 x86_64 x86_64 GNU/Linux
[root@GSS-02 ioDrive2]# cat /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/sda3
# initrd /initrd-version.img
#boot=/dev/sda
default=1 ------------------> default not 1 (default 0)
23. www.yhd.com
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Oracle Linux Server (2.6.32-300.10.1.el5uek)
root (hd0,0)
kernel /vmlinuz-2.6.32-300.10.1.el5uek ro root=LABEL=/ rhgb quiet numa=off
initrd /initrd-2.6.32-300.10.1.el5uek.img
title Oracle Linux Server-base (2.6.18-308.0.0.0.1.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-308.0.0.0.1.el5 ro root=LABEL=/ rhgb quiet numa=off
initrd /initrd-2.6.18-308.0.0.0.1.el5.img
Test : use java client to run simple select command to see MySQL performance
1.One session to run same sql query on different kernels
[oracle@yhdem dbtest]$ java dbtest.DBTest select45o.xml ---------- select returns rows from kernel 2.6.32-300.10.1.el5uek
0
SECONDS:60
24. www.yhd.com
maxMills:3
minMills:0
countMax:0
avgMills:1
allMills:60000
countAll:52644 --------- not good
[oracle@yhdem dbtest]$ java dbtest.DBTest select46o.xml -------------select returns rows from kernel 2.6.18-308.0.0.0.1.el5
0
SECONDS:60
maxMills:2
minMills:0
countMax:0
avgMills:0
allMills:60000
countAll:98914 ----------almost double TPS of test 1
2.multi sessions to run same sql query on different kernels (Gap of TPS is not huge but still have gap)
3.MySQL 5.6 has a better performance in these situation (TPS performance is better on os kernel 2.6.32-300.10.1.el5uek)
25. www.yhd.com
MySQL NUMA Tips
As MySQL can’t work well on NUMA,We can disable numa when you’re running single instance MySQL on Physical PC-server.And also we can
use -- cpunodebind to bind MySQL instance to different nodes.
But In MySQL 5.6 oracle seems to change MySQL behavior so performance improves a lot.
Reference : http://blog.jcole.us/2010/09/28/mysql-swap-insanity-and-the-numa-architecture/
The memory allocated by MySQL looks something like this:
Allocating memory severely imbalanced, preferring Node 0
Due to Node 0 being completely exhausted of free memory, even though the system has plenty of free memory overall (over 10GB has been
used for caches) it is entirely on Node 1. If any process scheduled on Node 0 needs local memory for anything, it will cause some of the
26. www.yhd.com
already-allocated memory to be swapped out in order to free up some Node 0 pages. Even though there is free memory on Node 1, the Linux
kernel in many circumstances (which admittedly I don’t totally understand3
) prefers to page out Node 0 memory rather than free some of the
cache on Node 1 and use that memory. Of course the paging is far more expensive than non-local memory access ever would be.