📜 ⬆️ ⬇️

Testing the performance of forks Mysql on real data

Introduction


An upgrade of the web server system has started, on which the website of the online store has been spinning since 2007 on the mysql 5.1 + perl + apache + nginx samopisny engine.

As usual, with an increase in attendance, everything began to rest on the database. Began to choose a new database that is compatible with the current one. Chose from Mysql 5.5, Mysql 5.6, MariaDB 10, Percona Sever 5.6.

After a long study of benchmarks, it became clear that you need to test performance on real data. Firstly, in most cases InnoDB and XtraDB were compared, secondly, they were testing mostly mad loads on monster servers, I was interested in the indicators on a narrow section of the graph, where usually nothing was clear.

Preparation for testing


  1. Create a virtual machine, I chose a simple configuration with 4 cores and 4GB of RAM, Debian 7.6;
  2. We put nginx and apache, the configuration is taken out of the box without cache and tuning;
  3. We put siege - a utility for load testing, there is a standard repository;
  4. We climb to the site statistics and select the most popular pages in order to test the work of the site fully. I selected the first 50 pages of hits over the last month, save these URLs in urls.txt, Yandex.Metrica can upload this data to csv;
  5. Register in / etc / hosts virtual ip for the required domain;
  6. We connect repositories of Mysql, Maria, Percona
    ')
      deb http://mirror.timeweb.ru/mariadb/repo/10.0/debian wheezy main
     deb-src http://mirror.timeweb.ru/mariadb/repo/10.0/debian wheezy main
     deb http://repo.flops.ru/debian/ wheezy free
    
     deb http://repo.percona.com/apt wheezy main
     deb-src http://repo.percona.com/apt wheezy main
    
     deb http://repo.mysql.com/apt/debian/ wheezy mysql-5.6
     deb-src http://repo.mysql.com/apt/debian/ wheezy mysql-5.6
    


    Mysql 5.5 is in the standard repository;
  7. We transfer the dump of the old database, create another 2 dumps with the substitution of the inventory
     sed -e 's / myisam / InnoDB / gi' dump_myisam.sql> dump_innodb.sql 
     sed -e 's / myisam / XtraDB / gi' dump_myisam.sql> dump_xtradb.sql
    


Self testing


We put in turn the databases and fill in the dumps we created there, we are testing using siege. When installing a new database, we completely demolish the previous packages and in order not to bathe with the conversion, delete the / var / lib / mysql directory, then fill in the new dump.

I chose the following parameters for siege: / usr / bin / siege -b -c 20 -r 50 -f urls.txt -v

As a result, siege makes 1000 requests to the site in 20 threads.

Trusted database options


Disk Size: 300MB (in MyIsam)
Read / Write: 98% / 2%

The main table has 40000 records, about 200 columns (it stores goods and their properties), additional parameters join it: manufacturers, exchange rates, groups, discounts and other special signs, units of measure, collections ... About 10 joins.

my.cnf

 key_buffer = 512M
 join_buffer_size = 158M
 max_allowed_packet = 16M
 thread_stack = 192K
 thread_cache_size = 8
 myisam-recover = BACKUP
 max_connections = 100
 table_cache = 500
 query_cache_limit = 16M
 query_cache_size = 2G

 innodb_log_file_size = 50M
 innodb_buffer_pool_size = 512M
 innodb_log_buffer_size = 8M
 innodb_file_per_table = 1
 innodb_open_files = 2548
 innodb_io_capacity = 400
 innodb_flush_method = O_DIRECT



Test results


Column Description



Base / StoreETimeRTimeTRateConcOkLAMem
Mysql 5.1 mysam252.983.953.8315.159696.981055
Mysql 5.5 myisam500.197.481.8013.5090214.671265
Mysql 5.6 MyISAM289.895.553.4319.019946.591000
Percona 5.6 MyISAM510.718.421.8015.1591911.761657
MariaDB 10.0 MyISAM351.746.102.7416.7196410.23889
MariaDB 10.0 Aria page = 8k Trans904.7612.070.748.8966627.861545
MariaDB 10.0 Aria page = 1k NonTrans781.4310.470.949.8973827.761465
Mysql 5.1 InnoDB368.215.912.5515.089407.231241
Mysql 5.6 InnoDB229.924.544.3519.7610006.661414
MariaDB InnoDB223.354.384.4819.6110006.241813
Percona 5.6 XtraDB223.784.424.4719.7510005.091176
MariaDB 10.0 XtraDB222.554.384.4919.6610006.391176


Charts





From the test data I choose between Maria DB and Percona Server on XtraDB. I bow to Percona. In addition to a slight gain in performance, there are also extended statistics on queries to tables and a good set of utilities.

PS Testing took about 5 hours, most of the time it took the transfer of data from the combat vehicles and the installation / demolition of packages. In general, my hoster (flops.ru) allows you to clone a virtual machine, it takes about 1 minute and transfer IP between virtual machines. If it were not for the old software on the combat virtual machine, it would be possible to clone it and test it (the funds are debited daily for consumption). It would save me a lot of time.

PPS I think the next step is to arrange testing in combat mode, make a virtual clone, set up a test slice and transfer the IP address from the combat one day.

Source: https://habr.com/ru/post/242337/


All Articles