NOVO servidor (pcie):
CPU Intel® Xeon® E5-2637 v4 @ 3.50GHz, discos NVMe de 1TB, 128 GB de RAM, instalada Debian 4.9.65-3 + deb9u1, Ver 15.1 Distrib. 10.1.26-MariaDB
movido arquivos binário binários de
Servidor antigo:
CPU Intel (R) Xeon (R) E5-1630 v3 a 3.70GHz, disco SSD, 64 GB de RAM, FreeBSD 11.0-STABLE, 10.1.21-MariaDB
Nos servidores está executando apenas o mysql, eu copio o arquivo my.ini, os arquivos de configuração são os mesmos.
Executar benchmark mysqlslap (sempre reiniciado servidor antes de fazer cada teste):
root@db1:/tmp # mysqlslap --user=root --query=/tmp/slap2.sql --create-schema=mydatabase --concurrency=1 --iterations=1
Benchmark
Average number of seconds to run all queries: 59.573 seconds
Minimum number of seconds to run all queries: 59.573 seconds
Maximum number of seconds to run all queries: 59.573 seconds
Number of clients running queries: 1
Average number of queries per client: 100000
root@pcie:~# mysqlslap --user=root --query=/tmp/slap2.sql --create-schema=mydatabase --concurrency=1 --iterations=1
Benchmark
Average number of seconds to run all queries: 31.151 seconds
Minimum number of seconds to run all queries: 31.151 seconds
Maximum number of seconds to run all queries: 31.151 seconds
Number of clients running queries: 1
Average number of queries per client: 100000
====================================================================================================================================
root@db1:/tmp # mysqlslap --user=root --query=/tmp/slap2.sql --create-schema=mydatabase --concurrency=100 --iterations=1
Benchmark
Average number of seconds to run all queries: 568.082 seconds
Minimum number of seconds to run all queries: 568.082 seconds
Maximum number of seconds to run all queries: 568.082 seconds
Number of clients running queries: 100
Average number of queries per client: 100000
root@pcie:/etc/security/limits.d# mysqlslap --user=root --query=/tmp/slap2.sql --create-schema=mydatabase --concurrency=100 --iterations=1
Benchmark
Average number of seconds to run all queries: 2059.712 seconds
Minimum number of seconds to run all queries: 2059.712 seconds
Maximum number of seconds to run all queries: 2059.712 seconds
Number of clients running queries: 100
Average number of queries per client: 100000
====================================================================================================================================
root@db1:/tmp # mysqlslap --user=root --query=/tmp/slap2.sql --create-schema=mydatabase --concurrency=8 --iterations=1
Benchmark
Average number of seconds to run all queries: 134.003 seconds
Minimum number of seconds to run all queries: 134.003 seconds
Maximum number of seconds to run all queries: 134.003 seconds
Number of clients running queries: 8
Average number of queries per client: 100000
root@pcie:/etc/security/limits.d# mysqlslap --user=root --query=/tmp/slap2.sql --create-schema=mydatabase --concurrency=8 --iterations=1
Benchmark
Average number of seconds to run all queries: 133.410 seconds
Minimum number of seconds to run all queries: 133.410 seconds
Maximum number of seconds to run all queries: 133.410 seconds
Number of clients running queries: 8
Average number of queries per client: 100000
Como você pode ver, o servidor NEW (pcie) tem um desempenho muito bom ao executar simultaneidade = 1, o desempenho é o mesmo quando a simultaneidade = 8 e o desempenho é muito ruim quando a simultaneidade = 100.
Aqui estão resultados interessantes usando benchmark interno:
root@pcie:~/slap/employees_db# mysqlslap --auto-generate-sql --concurrency=8 --iterations=500 --verbose
Average number of seconds to run all queries: 0.002 seconds
DB1: Average number of seconds to run all queries: 0.002 seconds
root@pcie:~/slap/employees_db# mysqlslap --auto-generate-sql --concurrency=16 --iterations=500
Average number of seconds to run all queries: 0.007 seconds
DB1: Average number of seconds to run all queries: 0.005 seconds
root@pcie:~/slap/employees_db# mysqlslap --auto-generate-sql --concurrency=32 --iterations=500
Average number of seconds to run all queries: 0.015 seconds
DB1: Average number of seconds to run all queries: 0.011 seconds
root@pcie:~/slap/employees_db# mysqlslap --auto-generate-sql --concurrency=64 --iterations=500
Average number of seconds to run all queries: 0.033 seconds
DB1: Average number of seconds to run all queries: 0.029 seconds
root@pcie:~/slap/employees_db# mysqlslap --auto-generate-sql --concurrency=128 --iterations=500
Average number of seconds to run all queries: 0.074 seconds
DB1: Average number of seconds to run all queries: 0.097 seconds
root@pcie:~/slap/employees_db# mysqlslap --auto-generate-sql --concurrency=256 --iterations=500
Average number of seconds to run all queries: 0.197 seconds
DB1: Average number of seconds to run all queries: 0.293 seconds
root@pcie:~/slap/employees_db# mysqlslap --auto-generate-sql --concurrency=512 --iterations=500
Average number of seconds to run all queries: 0.587 seconds
DB1: Average number of seconds to run all queries: 1.009 seconds
O benchmark mysqlsap interno é muito sintético, então eu carrego os funcionários db:
link
SQL:
#less /root/slap/select_query.sql
SELECT emp_no, first_name, last_name, gender FROM employees LIMIT 10;
SELECT emp_no, first_name, last_name, gender FROM employees ORDER BY last_name ASC LIMIT 10;
SELECT COUNT(emp_no) FROM employees WHERE last_name = 'Aamodt';
SELECT last_name, COUNT(emp_no) AS num_emp FROM employees GROUP BY last_name ORDER BY num_emp DESC LIMIT 10;
SELECT employees.* FROM employees LEFT JOIN dept_emp ON ( dept_emp.emp_no = employees.emp_no ) LEFT JOIN salaries ON ( salaries.emp_no = salaries.emp_no ) WHERE employees.first_name LIKE '%Jo%' AND salaries.from_date > '1993-01-21' AND salaries.to_date < '1998-01-01' LIMIT 0, 100;
Resultados:
root@pcie:~/slap# mysqlslap --pre-query="RESET QUERY CACHE;" --create-schema=employees --query="/root/slap/select_query.sql" --iterations=10 --concurrency=1
Average number of seconds to run all queries: 0.459 seconds
DB1: Average number of seconds to run all queries: 0.627 seconds
root@pcie:~/slap# mysqlslap --pre-query="RESET QUERY CACHE;" --create-schema=employees --query="/root/slap/select_query.sql" --iterations=10 --concurrency=2
Benchmark
Average number of seconds to run all queries: 0.473 seconds
DB1: Average number of seconds to run all queries: 0.626 seconds
root@pcie:~/slap# mysqlslap --pre-query="RESET QUERY CACHE;" --create-schema=employees --query="/root/slap/select_query.sql" --iterations=10 --concurrency=4
Average number of seconds to run all queries: 0.486 seconds
DB1: Average number of seconds to run all queries: 0.656 seconds
root@pcie:~/slap# mysqlslap --pre-query="RESET QUERY CACHE;" --create-schema=employees --query="/root/slap/select_query.sql" --iterations=10 --concurrency=8
Average number of seconds to run all queries: 0.569 seconds
DB1: Average number of seconds to run all queries: 1.136 seconds
root@pcie:~/slap# mysqlslap --pre-query="RESET QUERY CACHE;" --create-schema=employees --query="/root/slap/select_query.sql" --iterations=10 --concurrency=16
Benchmark
Average number of seconds to run all queries: 0.948 seconds
DB1: Average number of seconds to run all queries: 1.750 seconds
root@pcie:~/slap# mysqlslap --pre-query="RESET QUERY CACHE;" --create-schema=employees --query="/root/slap/select_query.sql" --iterations=10 --concurrency=32
Average number of seconds to run all queries: 1.650 seconds
DB1: Average number of seconds to run all queries: 2.455 seconds
root@pcie:~/slap# mysqlslap --pre-query="RESET QUERY CACHE;" --create-schema=employees --query="/root/slap/select_query.sql" --iterations=10 --concurrency=64
Average number of seconds to run all queries: 3.306 seconds
DB1: Average number of seconds to run all queries: 3.176 seconds
root@pcie:~/slap# mysqlslap --pre-query="RESET QUERY CACHE;" --create-schema=employees --query="/root/slap/select_query.sql" --iterations=10 --concurrency=128
Average number of seconds to run all queries: 6.744 seconds
DB1: Average number of seconds to run all queries: 5.737 seconds
root@pcie:~/slap# mysqlslap --pre-query="RESET QUERY CACHE;" --create-schema=employees --query="/root/slap/select_query.sql" --iterations=10 --concurrency=256
Average number of seconds to run all queries: 13.474 seconds (verified 2nd run: 12.883 seconds)
DB1: Average number of seconds to run all queries: 3.451 seconds (verified 2nd run: 4.935 seconds)
root@pcie:~/slap# mysqlslap --pre-query="RESET QUERY CACHE;" --create-schema=employees --query="/root/slap/select_query.sql" --iterations=10 --concurrency=512
Average number of seconds to run all queries: 26.085 seconds (verified 2nd run: 26.307 seconds)
DB1: Average number of seconds to run all queries: 15.862 seconds (verified 2nd run: 11.280 seconds)
com 512 simultaneidade, QUERY CACHE desativado:
OLD db1 server: Average number of seconds to run all queries: 72.710s
NEW PCIE server: Average number of seconds to run all queries: 29.774s
Alguém tem ideia do que verificar, como otimizar a configuração? Eu estou usando tabelas MyISAM apenas no meu DB, mariadb config é o mesmo em ambos os servidores ...
Atualizar com mais informações : Inicialmente eu instalei no novo servidor DB FREEBSD, desempenho MariaDB foi ruim, eu pensei que é problema relacionado OS, mas mesmos sintomas estão no Linux. Durante o benchmark, basicamente não há IO após o preenchimento do cache, portanto, esse não é um problema relacionado a IO.
Obrigado por qualquer ideia.