Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

Recent my sql_performance Test detail

on

  • 506 views

Mysql performance test

Mysql performance test

Statistics

Views

Total Views
506
Views on SlideShare
506
Embed Views
0

Actions

Likes
0
Downloads
6
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Recent my sql_performance Test detail Recent my sql_performance Test detail Presentation Transcript

  • www.yhd.comMySQL performance Tips (recently update)5.5.32 vs 5.6.12 MySQL performance test -----by yihaodian Tomleng.The Hardware environment:[root@db-2-9 ~]# dmidecode -s system-product-namePowerEdge R720xd[root@db-2-9 ~]# cat /proc/meminfo |moreMemTotal: 65962096 kBMemFree: 54150924 kB[root@db-2-9 ~]# cat /proc/cpuinfo |moreprocessor : 0vendor_id : GenuineIntelcpu family : 6model : 45model name: Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHzstepping: 7cpu MHz : 2000.059cache size : 15360 KB
  • www.yhd.com[root@db-2-9 ~]# cat /proc/cpuinfo |grep processor |wc -l24[root@db-2-9 ~]# cat /etc/my.cnf[client]port = 3306socket = /data/mysql/data/mysql.sock[mysql]max_allowed_packet = 16Mdefault_character_set = utf8no_auto_rehashprompt = "R:m:s d> "pager = "more"[mysqld]open_files_limit = 65535server-id = 201basedir = /data/mysqldatadir = /data/mysql/datasocket = /data/mysql/data/mysql.sockport = 3306character_set_server = utf8skip_external_lockingmax_allowed_packet = 16Mkey_buffer_size = 1Gmyisam_sort_buffer_size=64M
  • www.yhd.comsort_buffer_size = 4Mread_buffer_size = 4Mread_rnd_buffer_size = 8Mtmp_table_size=64Mquery_cache_size=0query_cache_type=0table_open_cache = 512thread_cache_size = 100wait_timeout = 86400interactive_timeout = 86400thread_concurrency = 48max_connections=1000#transaction-isolation = READ-COMMITTEDtransaction-isolation = REPEATABLE-READsysdate-is-nowbinlog_format = MIXEDlog-bin=/data/mysql/arch/mysql-bin#log_bin_trust_function_creators=1slow_query_log=1slow_query_log_file=/data/mysql/data/slow_query.loglong_query_time=2log-queries-not-using-indexes=0performance_schemainnodb_data_home_dir = /data/mysql/datainnodb_data_file_path = ibdata1:1G:autoextend
  • www.yhd.cominnodb_log_group_home_dir = /data/mysql/archinnodb_log_files_in_group = 2innodb_log_file_size = 512Minnodb_log_buffer_size = 8Minnodb_buffer_pool_size = 40Ginnodb_additional_mem_pool_size = 16Minnodb_buffer_pool_instances=1innodb_lock_wait_timeout = 100innodb_thread_concurrency = 48innodb_flush_log_at_trx_commit = 0#innodb_locks_unsafe_for_binlog=1innodb_locks_unsafe_for_binlog=0innodb_read_io_threads=8innodb-write-io-threads=8innodb_io_capacity = 600innodb_purge_threads=1innodb_file_per_table = 1innodb_flush_log_at_trx_commit = 1sync_binlog = 1lower_case_table_names=1autocommit=1[mysqldump]quickmax_allowed_packet = 16M[myisamchk]key_buffer_size = 256M
  • www.yhd.comsort_buffer_size = 256Mread_buffer = 2Mwrite_buffer = 2MBASED Test by Mysqlslap:5.6.12 has a big improvement than 5.5.32Details: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
  • www.yhd.com5.5.32-linuxBenchmarkRunning for engine innodbAverage number of seconds to run all queries: 112.919 secondsMinimum number of seconds to run all queries: 112.919 secondsMaximum number of seconds to run all queries: 112.919 secondsNumber of clients running queries: 30Average number of queries per client: 100005.6.12-linuxBenchmarkRunning for engine innodbAverage number of seconds to run all queries: 27.625 secondsMinimum number of seconds to run all queries: 27.625 secondsMaximum number of seconds to run all queries: 27.625 secondsNumber of clients running queries: 30Average number of queries per client: 10000Update by primary key/data/mysql/bin/mysqlslap --verbose -uroot -pyihaodian --delimiter=";" --engine=innodb --auto-generate-sql
  • 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=1005.5.32-linuxBenchmarkRunning for engine innodbAverage number of seconds to run all queries: 111.260 secondsMinimum number of seconds to run all queries: 111.260 secondsMaximum number of seconds to run all queries: 111.260 secondsNumber of clients running queries: 30Average number of queries per client: 100005.6.12-linuxBenchmarkRunning for engine innodbAverage number of seconds to run all queries: 28.978 secondsMinimum number of seconds to run all queries: 28.978 secondsMaximum number of seconds to run all queries: 28.978 secondsNumber of clients running queries: 30Average number of queries per client: 10000
  • www.yhd.comSelect 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=1005.5.32-linuxBenchmarkRunning for engine innodbAverage number of seconds to run all queries: 38.402 secondsMinimum number of seconds to run all queries: 38.402 secondsMaximum number of seconds to run all queries: 38.402 secondsNumber of clients running queries: 30Average number of queries per client: 1000005.6.12-linuxBenchmark
  • www.yhd.comRunning for engine innodbAverage number of seconds to run all queries: 35.801 secondsMinimum number of seconds to run all queries: 35.801 secondsMaximum number of seconds to run all queries: 35.801 secondsNumber of clients running queries: 30Average 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.sqlselect 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 ,
  • www.yhd.com2032072 , 8416919 , 8416916 , 7062075 , 2654715 , 1331867 , 7062077 , 2276845 , 1331860 , 7968487 , 5295442 , 2276836 , 1251528 ,1399311 , 1075199 , 8884055 , 8884050 , 8884051 , 8813522 , 8300860 , 1153477 , 8813531 , 8813530 , 8813529 , 8813528 , 8300848 ,8813533 , 8813532 , 7023655 , 6805848 , 1243672 , 3963615 , 1220245 , 953681 , 908198 , 8813513 , 1075739 , 8813519 , 8813516 , 7150642 ,7061050 , 1571509 , 1396400 , 962499 , 4864931 , 2825440 , 2307262 , 8774580 , 2336679 , 1865431 , 7911009 , 6074748 , 8882682 ,3972790 , 8882681 , 7911011 , 3972789 , 7911010 , 2397343 , 1275145 , 8251031 , 1866262 , 1866282 , 7911002 , 5000307 , 4999134 ,4999132 , 7911006 , 7862722 , 7911004 , 8775379 , 8251067 , 2771462 , 1242424 , 7975528 , 2142022 , 7975529 , 7975530 , 1042807 ,2394413 , 7290569 , 4122707 , 6110109 , 4122708 , 4122711 , 1544885 , 1461975 , 7964248 , 1292344 , 3800190 , 8602069 , 2183098 ,8007307 , 7015670 , 8525318 , 7015671 , 1880949 , 7015668 , 7015669 , 2307264 , 8882313 , 3836630 , 4706682 , 4706681 , 8421482 ,7015672 , 2463156 , 3600516 , 7131438 , 7164295 , 7250167 , 7250170 );mysqlslap --verbose -uroot -pyihaodian --create-schema=gss_data --no-drop --delimiter=";" --query=query.sql --detach=100 --concurrency=30 --number-of-queries=300005.5.32-linuxBenchmarkAverage number of seconds to run all queries: 71.257 secondsMinimum number of seconds to run all queries: 71.257 secondsMaximum number of seconds to run all queries: 71.257 secondsNumber of clients running queries: 30
  • www.yhd.comAverage number of queries per client: 10005.6.12-linuxBenchmarkAverage number of seconds to run all queries: 3.738 secondsMinimum number of seconds to run all queries: 3.738 secondsMaximum number of seconds to run all queries: 3.738 secondsNumber of clients running queries: 30Average number of queries per client: 1000mysqlslap --verbose -uroot -pyihaodian --create-schema=gss_data --no-drop --delimiter=";" --query=query.sql --detach=100 --concurrency=1 --number-of-queries=300005.5.32-linuxBenchmarkAverage number of seconds to run all queries: 120.504 secondsMinimum number of seconds to run all queries: 120.504 secondsMaximum number of seconds to run all queries: 120.504 seconds
  • www.yhd.comNumber of clients running queries: 1Average number of queries per client: 300005.6.12-linuxBenchmarkAverage number of seconds to run all queries: 48.158 secondsMinimum number of seconds to run all queries: 48.158 secondsMaximum number of seconds to run all queries: 48.158 secondsNumber of clients running queries: 1Average number of queries per client: 30000
  • www.yhd.comTPCC Test
  • www.yhd.com
  • www.yhd.com
  • www.yhd.comMySQL binary installation VS MySQL source code installation----by yihaodian rzjHardware :# Percona Toolkit System Summary Report ######################Date | 2013-06-14 03:31:12 UTC (local TZ: CST +0800)Hostname | SHABBO2-SRV-0041Uptime | 25 days, 33 min, 3 users, load average: 0.77, 0.57, 0.38System | Dell Inc.; PowerEdge R815; vNot Specified (<OUT OF SPEC>)Platform | LinuxRelease | Red Hat Enterprise Linux Server release 5.8 (Tikanga)Kernel | 2.6.32-300.10.1.el5uekArchitecture | CPU = 64-bit, OS = 64-bitThreading | NPTL 2.5Compiler | GNU CC version 4.1.2 20080704 (Red Hat 4.1.2-50).SELinux | DisabledVirtualized | No virtualization detected# Processor ##################################################Processors | physical = 4, cores = 48, virtual = 48, hyperthreading = noSpeeds | 48x2100.117
  • www.yhd.comModels | 48xAMD Opteron(tm) Processor 6172Caches | 48x512 KB# Memory #####################################################Total | 126.2GFree | 54.8GUsed | physical = 71.4G, swap allocated = 125.0G, swap used = 387.5M, virtual = 71.8GBuffers | 288.8MCaches | 23.8GTest tool:Percona-TPCCMore 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 differenceis port number 。1.create test database
  • www.yhd.com# mysqladmin -h127.0.0.1 -P3306 -uroot -pyihaodian create tpcc50# mysqladmin -h127.0.0.1 -P3308 -uroot -pyihaodian create tpcc502.create test tables# mysql -h127.0.0.1 -P3306 -uroot -pyihaodian tpcc50 < create_table.sql# mysql -h127.0.0.1 -P3308 -uroot -pyihaodian tpcc50 < create_table.sql3.add index and PK# mysql -h127.0.0.1 -P3306 -uroot -pyihaodian tpcc50 < add_fkey_idx.sql# mysql -h127.0.0.1 -P3308 -uroot -pyihaodian tpcc50 < add_fkey_idx.sql4.create 50 DWs# ./tpcc_load 127.0.0.1:3306 tpcc50 root yihaodian 50# ./tpcc_load 127.0.0.1:3308 tpcc50 root yihaodian 50Reporting and Analysis# ./tpcc_start -h127.0.0.1 -P3306 -d tpcc50 -u root -p yihaodian -w 50 -c 1 -r 60 -l 300 -f tpcc50_3306_c1.txt
  • www.yhd.comResult :5606.600 TpmC# ./tpcc_start -h127.0.0.1 -P3308 -d tpcc50 -u root -p yihaodian -w 50 -c 1-r 60 -l 300 -f tpcc50_3308_c1.txtResult :6586.600 TpmC# ./tpcc_start -h127.0.0.1 -P3306 -d tpcc50 -u root -p yihaodian -w 50 -c 10 -r 60 -l 300 -f tpcc50_3306_c10.txtResult : 36890.398 TpmC# ./tpcc_start -h127.0.0.1 -P3308 -d tpcc50 -u root -p yihaodian -w 50 -c 10 -r 60 -l 300 -f tpcc50_3308_c10.txtResult: 33451.398 TpmC# ./tpcc_start -h127.0.0.1 -P3306 -d tpcc50 -u root -p yihaodian -w 50 -c 30 -r 60 -l 300 -f tpcc50_3306_c30.txtResult : 44680.199TpmC# ./tpcc_start -h127.0.0.1 -P3308 -d tpcc50 -u root -p yihaodian -w 50 -c 30 -r 60 -l 300 -f tpcc50_3308_c30.txtResult : 43589.000 TpmC
  • www.yhd.com# ./tpcc_start -h127.0.0.1 -P3306 -d tpcc50 -u root -p yihaodian -w 50 -c 60 -r 60 -l 300 -f tpcc50_3306_c60.txtResult : 47708.602 TpmC# ./tpcc_start -h127.0.0.1 -P3308 -d tpcc50 -u root -p yihaodian -w 50 -c 60 -r 60 -l 300 -f tpcc50_3308_c60.txtResult :35535.199 TpmC# ./tpcc_start -h127.0.0.1 -P3306 -d tpcc50 -u root -p yihaodian -w 50 -c 80 -r 60 -l 300 -f tpcc50_3306_c80.txtResult :46586.000 TpmC# ./tpcc_start -h127.0.0.1 -P3308 -d tpcc50 -u root -p yihaodian -w 50 -c 80 -r 60 -l 300 -f tpcc50_3308_c80.txtResult :38174.199 TpmC
  • www.yhd.comEnding Report
  • www.yhd.comOS kernel difference leading MySQL performance undulate -----by willyLinux 5.8 with FusionIO[root@GSS-02 ioDrive2]# uname -aLinux 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 -aLinux 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/sdadefault=1 ------------------> default not 1 (default 0)
  • www.yhd.comtimeout=5splashimage=(hd0,0)/grub/splash.xpm.gzhiddenmenutitle 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=offinitrd /initrd-2.6.32-300.10.1.el5uek.imgtitle 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=offinitrd /initrd-2.6.18-308.0.0.0.1.el5.imgTest : use java client to run simple select command to see MySQL performance1.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.el5uek0SECONDS:60
  • www.yhd.commaxMills:3minMills:0countMax:0avgMills:1allMills:60000countAll:52644 --------- not good[oracle@yhdem dbtest]$ java dbtest.DBTest select46o.xml -------------select returns rows from kernel 2.6.18-308.0.0.0.1.el50SECONDS:60maxMills:2minMills:0countMax:0avgMills:0allMills:60000countAll:98914 ----------almost double TPS of test 12.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)
  • www.yhd.comMySQL NUMA TipsAs 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 canuse -- 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 0Due to Node 0 being completely exhausted of free memory, even though the system has plenty of free memory overall (over 10GB has beenused 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
  • www.yhd.comalready-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 Linuxkernel in many circumstances (which admittedly I don’t totally understand3) prefers to page out Node 0 memory rather than free some of thecache on Node 1 and use that memory. Of course the paging is far more expensive than non-local memory access ever would be.