{"id":12,"date":"2018-10-12T17:19:00","date_gmt":"2018-10-12T17:19:00","guid":{"rendered":""},"modified":"2019-05-01T17:28:28","modified_gmt":"2019-05-01T17:28:28","slug":"hammerdb-mysql-and-mariadb-best-practice-for-performance-and-scalability","status":"publish","type":"post","link":"https:\/\/www.hammerdb.com\/blog\/uncategorized\/hammerdb-mysql-and-mariadb-best-practice-for-performance-and-scalability\/","title":{"rendered":"HammerDB MySQL and MariaDB Best Practice for Performance and Scalability"},"content":{"rendered":"<div style=\"background: white; line-height: normal; margin-bottom: 0cm;\"><span style=\"font-family: 'verdana' , sans-serif;\"><span style=\"color: #666666;\">This post complements the previous best practice guides this time with the focus on MySQL and MariaDB and achieving top levels of performance with the HammerDB MySQL TPC-C test.\u00a0\u00a0As with the previous guides as an Intel employee (#IAMINTEL) the examples are taken from a MySQL 8 on Linux on Intel system and the approach is the same for whatever system you are testing although some of the settings you see may be different. Similarly for this guide MySQL can be swapped for a mySQL based databases such as MariaDB.<\/span><\/span><\/div>\n<div style=\"background: white; line-height: normal; margin-bottom: 0cm;\"><span style=\"font-family: 'verdana' , sans-serif;\"><span style=\"color: #666666;\"><br \/>\n<\/span><span style=\"color: #666666;\">As is exactly the same with PostgreSQL for system choice a 2 socket system is optimal for MySQL OLTP performance. As is also the case this limitation is at the database level (especially the storage engine) rather than the hardware level. InnoDB is the storage engine that will deliver the best OLTP throughput and should be chosen for this test.\u00a0<\/span><\/span><b style=\"color: #666666; font-size: 1.25rem;\"><span style=\"color: #666666; font-family: sans-serif; font-size: 16.5pt;\">\u00a0<\/span><\/b><\/div>\n<div style=\"background: white; line-height: normal; margin-bottom: 0cm;\">\n<p><b style=\"font-size: 0.9375rem;\"><span style=\"color: #666666; font-family: sans-serif; font-size: 16.5pt;\">HammerDB difference from Sysbench<\/span><\/b><\/p>\n<p><span style=\"font-family: verdana, sans-serif; color: #666666; font-size: 1rem;\">For anyone benchmarking MySQL with HammerDB it is important to understand the differences from sysbench workloads as HammerDB is targeted at a testing a different usage model from sysbench. Historically MySQL has been positioned for supporting <\/span><a style=\"font-family: verdana, sans-serif; font-size: 1rem;\" href=\"http:\/\/www.oracle.com\/us\/products\/mysql\/mysql-wp-top10-webbased-apps-461054.pdf\">web-based applications<\/a><span style=\"font-family: verdana, sans-serif; color: #666666; font-size: 1rem;\">\u00a0this is in contrast to enterprise based database workloads that have been served by commercial databases such as Oracle, Db2 and SQL Server. For this reason sysbench presents a vastly more simplified workload than HammerDB.\u00a0\u00a0<\/span><\/p>\n<\/div>\n<div style=\"background: white; line-height: normal; margin-bottom: 0cm;\"><span style=\"color: #666666;\"><span style=\"font-family: 'verdana' , sans-serif;\">By default sysbench creates a single table with an ascending primary key and an identical pad column.\u00a0<\/span><\/span><b><span style=\"color: #666666; font-family: sans-serif; font-size: 16.5pt;\"><br \/>\n<\/span><\/b><\/div>\n<pre><span style=\"font-size: 10pt;\"><span style=\"font-family: 'courier new', courier, monospace; line-height: 11.3067px;\">MariaDB [sbtest]&gt; select * from sbtest limit 10<\/span>\n<span style=\"line-height: 11.3067px;\"><span style=\"font-family: 'courier new', courier, monospace;\">\u00a0\u00a0\u00a0 -&gt; ;<\/span><\/span>\n<span style=\"line-height: 11.3067px;\"><span style=\"font-family: 'courier new', courier, monospace;\">+----+---+---+----------------------------------------------------+<\/span><\/span>\n<span style=\"line-height: 11.3067px;\"><span style=\"font-family: 'courier new', courier, monospace;\">| id | k | c | pad\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<\/span><\/span>\n<span style=\"line-height: 11.3067px;\"><span style=\"font-family: 'courier new', courier, monospace;\">+----+---+---+----------------------------------------------------+<\/span><\/span>\n<span style=\"line-height: 11.3067px;\"><span style=\"font-family: 'courier new', courier, monospace;\">|\u00a0 1 | 0 |\u00a0\u00a0 | qqqqqqqqqqwwwwwwwwwweeeeeeeeeerrrrrrrrrrtttttttttt |<\/span><\/span>\n<span style=\"line-height: 11.3067px;\"><span style=\"font-family: 'courier new', courier, monospace;\">|\u00a0 2 | 0 |\u00a0\u00a0 | qqqqqqqqqqwwwwwwwwwweeeeeeeeeerrrrrrrrrrtttttttttt |<\/span><\/span>\n<span style=\"line-height: 11.3067px;\"><span style=\"font-family: 'courier new', courier, monospace;\">|\u00a0 3 | 0 |\u00a0\u00a0 | qqqqqqqqqqwwwwwwwwwweeeeeeeeeerrrrrrrrrrtttttttttt |<\/span><\/span>\n<span style=\"line-height: 11.3067px;\"><span style=\"font-family: 'courier new', courier, monospace;\">|\u00a0 4 | 0 |\u00a0\u00a0 | qqqqqqqqqqwwwwwwwwwweeeeeeeeeerrrrrrrrrrtttttttttt |<\/span><\/span>\n<span style=\"line-height: 11.3067px;\"><span style=\"font-family: 'courier new', courier, monospace;\">|\u00a0 5 | 0 | \u00a0\u00a0| qqqqqqqqqqwwwwwwwwwweeeeeeeeeerrrrrrrrrrtttttttttt |<\/span><\/span>\n<span style=\"line-height: 11.3067px;\"><span style=\"font-family: 'courier new', courier, monospace;\">|\u00a0 6 | 0 |\u00a0\u00a0 | qqqqqqqqqqwwwwwwwwwweeeeeeeeeerrrrrrrrrrtttttttttt |<\/span><\/span>\n<span style=\"line-height: 11.3067px;\"><span style=\"font-family: 'courier new', courier, monospace;\">|\u00a0 7 | 0 |\u00a0\u00a0 | qqqqqqqqqqwwwwwwwwwweeeeeeeeeerrrrrrrrrrtttttttttt |<\/span><\/span>\n<span style=\"line-height: 11.3067px;\"><span style=\"font-family: 'courier new', courier, monospace;\">|\u00a0 8 | 0 |\u00a0\u00a0 | qqqqqqqqqqwwwwwwwwwweeeeeeeeeerrrrrrrrrrtttttttttt |<\/span><\/span>\n<span style=\"line-height: 11.3067px;\"><span style=\"font-family: 'courier new', courier, monospace;\">|\u00a0 9 | 0 |\u00a0\u00a0 | qqqqqqqqqqwwwwwwwwwweeeeeeeeeerrrrrrrrrrtttttttttt |<\/span><\/span>\n<span style=\"line-height: 11.3067px;\"><span style=\"font-family: 'courier new', courier, monospace;\">| 10 | 0 |\u00a0\u00a0 | qqqqqqqqqqwwwwwwwwwweeeeeeeeeerrrrrrrrrrtttttttttt |<\/span><\/span>\n<span style=\"line-height: 11.3067px;\"><span style=\"font-family: 'courier new', courier, monospace;\">+----+---+---+----------------------------------------------------+<\/span><\/span>\n<span style=\"line-height: 11.3067px;\"><span style=\"font-family: 'courier new', courier, monospace;\">10 rows in set (0.02 sec)<\/span><\/span><\/span><\/pre>\n<div><span style=\"font-family: 'courier new' , 'courier' , monospace;\"><br \/>\n<\/span><span style=\"color: #666666; font-family: 'verdana' , sans-serif;\">The workload then interacts with the database with simple SQL statements, for example with the read-only workload statements such as follows:<\/span><span style=\"color: #666666; font-family: sans-serif;\"><span style=\"font-size: 13.3333px;\"><br \/>\n<\/span><\/span><\/div>\n<pre><span style=\"font-size: 10pt;\"><span style=\"line-height: 11.3067px;\"><span style=\"font-family: 'courier new' , 'courier' , monospace;\">SELECT SUM(K) from sbtest where id between ? and ?<\/span><\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">SELECT DISTINCT c from sbtest where id between ? and ? order by c<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">SELECT c from sbtest where id=?<\/span><\/span><\/pre>\n<div><\/div>\n<div style=\"background: white; line-height: normal; margin-bottom: 0cm;\"><span style=\"color: #666666;\"><span style=\"font-family: 'verdana' , sans-serif;\">Consequently there is no contention and the workload will scale according to the ability of the database to handle these isolated statements.\u00a0<\/span><\/span><br \/>\n<span style=\"color: #666666;\"><span style=\"font-family: 'verdana' , sans-serif;\"><br \/>\n<\/span><\/span><span style=\"color: #666666;\"><span style=\"font-family: 'verdana' , sans-serif;\">HammerDB on the other hand is based on the <a href=\"https:\/\/www.hammerdb.com\/docs\/ch03.html\">TPC-C specification<\/a>\u00a0(but not identical to a full TPC-C workload) and more closely represents an enterprise type workload. There are 9 tables:<\/span><\/span><\/div>\n<div style=\"background: white; line-height: normal; margin-bottom: 0cm;\">\n<div><\/div>\n<pre><span style=\"font-size: 10pt;\"><span style=\"font-family: 'courier new', courier, monospace;\">MariaDB [tpcc]&gt; show tables;<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">+----------------+<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">| Tables_in_tpcc |<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">+----------------+<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">| customer\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">| district\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">| history\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">| item\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">| new_order\u00a0\u00a0\u00a0\u00a0\u00a0 |<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">| order_line\u00a0\u00a0\u00a0\u00a0 |<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">| orders\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">| stock\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">| warehouse\u00a0\u00a0\u00a0\u00a0\u00a0 |<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">+----------------+<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">9 rows in set (0.00 sec)<\/span><\/span><\/pre>\n<div><\/div>\n<div><span style=\"color: #666666; font-family: 'verdana' , sans-serif;\">The tables have more complexity than sbtest:<\/span><\/div>\n<div><span style=\"color: #666666; font-family: sans-serif;\"><span style=\"font-size: 13.3333px;\">\u00a0<\/span><\/span><\/div>\n<pre><span style=\"font-size: 10pt;\">MariaDB [tpcc]&gt; select * from customer limit 1 G\n*************************** 1. row ***************************\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 c_id: 1\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 c_d_id: 1\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 c_w_id: 1\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 c_first: 4fTYMkzYdy8EbABc\n\u00a0\u00a0\u00a0\u00a0\u00a0 c_middle: OE\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 c_last: BARBARBAR\n\u00a0\u00a0\u00a0 c_street_1: G30TzdyBM1xx\n\u00a0\u00a0\u00a0 c_street_2: fRveiqUZDzz54pt9FK8\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 c_city: jVRLzrSBopMpcmN4WYO2\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 c_state: JK\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 c_zip: 603111111\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 c_phone: 4610643910936129\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 c_since: 2018-10-11 08:48:51\n\u00a0\u00a0\u00a0\u00a0\u00a0 c_credit: BC\n\u00a0 c_credit_lim: 50000.00\n\u00a0\u00a0\u00a0 c_discount: 0.2000\n\u00a0\u00a0\u00a0\u00a0 c_balance: -10.00\nc_ytd_payment: 10.00\nc_payment_cnt: 1\nc_delivery_cnt: 0\nc_data: hjtWypvebZZgVhNCdKOhHd50Wn7HQG8XAm9cSHkXTf73KqBHot7IvHq8PtaHdaJ9oMXqFx6aUXrBRxQ44gqLf0k04gkPVWc6Lx3q71gFCu1vZlLhmmIaWQf5zyDD4AAqejVcwYKi50P9rHFegjzURpTf6c9SPEfpupc7378uekwBYTj4Xfm0Od3ukiQIKto8Nlx1Is51pC4qynxLEWWGULhXdBipYckk5EjpbpdKzUjEcMGJ6nCmFpNgXfKDIUpaYsw1dWwgCEhPfXiKjXMO0v0iF56wzD6AOF4w7m8CXSw0x5zKB7URuTqlGedSYK8EvmylYudXLF\n1 row in set (0.00 sec)<\/span><\/pre>\n<div><\/div>\n<div><span style=\"color: #666666; font-family: 'verdana' , sans-serif;\">and the workload is driven by stored procedures:<\/span><\/div>\n<div><span style=\"color: #666666; font-family: sans-serif; font-size: 13.3333px;\">\u00a0<\/span><\/div>\n<pre><span style=\"font-size: 10pt;\"><span style=\"font-family: 'courier new', courier, monospace;\">MariaDB [tpcc]&gt; show procedure status<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">\u00a0\u00a0\u00a0 -&gt; ;<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">+-------+--------------------+-----------+----------------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">| Db\u00a0\u00a0\u00a0 | Name\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | Type\u00a0\u00a0\u00a0\u00a0\u00a0 | Definer\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | Modified\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | Created\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | Security_type | Comment | character_set_client | collation_connection | Database Collation |<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">+-------+--------------------+-----------+----------------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">| tpcc\u00a0 | DELIVERY\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | PROCEDURE | @\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | 2018-10-11 08:57:34 | 2018-10-11 08:57:34 | DEFINER\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | latin1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | latin1_swedish_ci\u00a0\u00a0\u00a0 | latin1_swedish_ci\u00a0 |<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">| tpcc\u00a0 | NEWORD\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | PROCEDURE | @\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0| 2018-10-11 08:57:34 | 2018-10-11 08:57:34 | DEFINER\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | latin1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | latin1_swedish_ci\u00a0\u00a0\u00a0 | latin1_swedish_ci\u00a0 |<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">| tpcc\u00a0 | OSTAT\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | PROCEDURE | @\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | 2018-10-11 08:57:34 | 2018-10-11 08:57:34 | DEFINER\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | latin1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | latin1_swedish_ci\u00a0\u00a0\u00a0 | latin1_swedish_ci\u00a0 |<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">| tpcc\u00a0 | PAYMENT\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | PROCEDURE | @\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | 2018-10-11 08:57:34 | 2018-10-11 08:57:34 | DEFINER\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | latin1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | latin1_swedish_ci\u00a0\u00a0\u00a0 | latin1_swedish_ci\u00a0 |<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">| tpcc\u00a0 | SLEV\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | PROCEDURE | @\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | 2018-10-11 08:57:34 | 2018-10-11 08:57:34 | DEFINER\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | latin1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | latin1_swedish_ci\u00a0\u00a0\u00a0 | latin1_swedish_ci\u00a0 |<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">+-------+--------------------+-----------+----------------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">7 rows in set (0.00 sec)<\/span><\/span><\/pre>\n<div><span style=\"color: #666666;\"><span style=\"font-family: 'verdana' , sans-serif;\">an example is shown of the shortest of these:\u00a0<\/span><\/span><\/div>\n<div><\/div>\n<pre><span style=\"font-size: 10pt;\"><span style=\"font-family: 'courier new', courier, monospace;\">CREATE DEFINER=`` PROCEDURE `slev`(<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">st_w_id\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 INTEGER,<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">st_d_id\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 INTEGER,<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">threshold\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 INTEGER<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">)<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">BEGIN<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">DECLARE st_o_id\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 INTEGER;<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">DECLARE stock_count\u00a0\u00a0\u00a0\u00a0 INTEGER;<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">DECLARE `Constraint Violation` CONDITION FOR SQLSTATE '23000';<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">DECLARE EXIT HANDLER FOR `Constraint Violation` ROLLBACK;<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">DECLARE EXIT HANDLER FOR NOT FOUND ROLLBACK;<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">SELECT d_next_o_id INTO st_o_id<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">FROM district<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">WHERE d_w_id=st_w_id AND d_id=st_d_id;<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">SELECT COUNT(DISTINCT (s_i_id)) INTO stock_count<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">FROM order_line, stock<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">WHERE ol_w_id = st_w_id AND<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">ol_d_id = st_d_id AND (ol_o_id &lt; st_o_id) AND<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">ol_o_id &gt;= (st_o_id - 20) AND s_w_id = st_w_id AND<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">s_i_id = ol_i_id AND s_quantity &lt; threshold;<\/span><\/span><\/pre>\n<p><span style=\"font-family: 'verdana' , sans-serif;\"><span style=\"color: #666666;\">As a result there is deliberate contention in the HammerDB workload that is not seen in a sysbench one. Also as HammerDB is making one call to\u00a0<\/span><span style=\"color: #666666;\">stored procedure that then contains multiple SQL statements the workload throughput is significantly higher than sysbench.\u00a0<\/span><\/span><br \/>\n<span style=\"color: #666666;\"><span style=\"font-family: 'verdana' , sans-serif;\"><br \/>\n<\/span><\/span><span style=\"color: #666666;\"><span style=\"font-family: 'verdana' , sans-serif;\">More recently MySQL and MariaDB has been positioned in the enterprise space competing with commercial database such as Oracle with features such as PL\/SQL compatibility.\u00a0 Therefore if you are testing MySQL or MariaDB&#8217;s ability to support web-based applications that use\u00a0 SQL statements with minimal contention then sysbench is likely to present the best assessment of the system for this type of workload. On the other hand if testing MySQL or MariaDB for the ability to handle a more complex workload such as the use of stored procedures and in particular if looking to compare scalability with a traditional database then HammerDB is focused more towards testing those enterprise features. Finally it is also important to note that this comparison is focused around OLTP based workloads, HammerDB also supports a TPC-H based workload for analytics with complex ad-hoc queries. Traditionally MySQL has not supported such workloads however features such as columnstore in MariaDB now make this possible.\u00a0<\/span><\/span><b><span style=\"color: #666666; font-family: sans-serif; font-size: 16.5pt;\">\u00a0<\/span><\/b><\/p>\n<p><b><span style=\"color: #666666; font-family: sans-serif; font-size: 16.5pt;\">System Setup: CPU, Memory and\u00a0<\/span><\/b><b><span style=\"color: #666666; font-family: sans-serif; font-size: 16.5pt;\">I\/O\u00a0<\/span><\/b><b><span style=\"color: #666666; font-family: sans-serif; font-size: 16.5pt;\">Configuration<\/span><\/b><\/p>\n<\/div>\n<div style=\"background: white; line-height: normal; margin-bottom: 0cm;\"><span style=\"font-family: 'verdana' , sans-serif;\"><span style=\"color: #666666;\">System setup is covered on the <a href=\"https:\/\/www.hammerdb.com\/blog\/uncategorized\/hammerdb-best-practice-for-postgresql-performance-and-scalability\/\">PostgreSQL Best Practice post<\/a>\u00a0so it will not be repeated here as the steps are the same. Make sure that the<\/span><span style=\"color: #666666;\">\u00a0I\/O that is able to keep up with writing to the redo log. Also make sure that if using an Intel CPU it is correctly configured with the right drivers and setup for turbo boost with cpupower output as follows:\u00a0<\/span><\/span><\/div>\n<div><\/div>\n<pre><span style=\"font-size: 10pt;\"><span style=\"font-family: 'courier new', courier, monospace;\"><span style=\"color: #666666;\">.\/cpupower frequency-info\n<\/span><\/span><span style=\"font-family: 'courier new', courier, monospace;\"><span style=\"color: #666666;\">analyzing CPU 0:<\/span><\/span> <span style=\"font-family: 'courier new', courier, monospace;\"><span style=\"color: #666666;\">\u00a0 \ndriver:\u00a0<b>intel_pstate\n\u00a0 CPUs which run at the same hardware frequency: 0 \u00a0 \nCPUs which need to have their frequency coordinated by software: 0 \u00a0 \nmaximum transition latency:\u00a0 Cannot determine or is not supported. \u00a0 \nhardware limits: 1000 MHz - 3.80 GHz\navailable cpufreq governors: performance powersave \u00a0 \ncurrent policy: frequency should be within\u00a01000 MHz and 3.80 GHz.\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 The governor\u00a0\"performance\"\u00a0may decide which speed to use\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 within this range.\n current CPU frequency: Unable to call hardware \u00a0 \n current CPU frequency: 1.99 GHz (asserted by call to kernel) \u00a0\u00a0\nboost state support:\n \u00a0 \u00a0\u00a0Supported: yes\n <span style=\"color: #666666; font-family: 'courier new' , 'courier' , monospace;\">\u00a0 \u00a0\u00a0Active: yes<\/span><\/b><\/span><\/span><\/span><b>\n<\/b><\/pre>\n<div style=\"background: white; line-height: normal; margin-bottom: 0cm;\">\n<p><span style=\"color: #666666; font-family: 'verdana' , sans-serif;\">Finally in testing Huge Pages has less of an impact than with PostgreSQL, although performance should not be lower than having Huge Pages disabled. Just note that if using MariaDB in <a href=\"https:\/\/jira.mariadb.org\/browse\/MDEV-13785\">some versions<\/a> a bug means that Huge Pages cannot be enabled although this does not greatly impact performance.<\/span><\/p>\n<p><b><span style=\"color: #666666; font-family: sans-serif; font-size: 16.5pt;\">Install MySQL or MariaDB from Source<\/span><\/b><\/p>\n<p>(Note that the following section applies in particular to pre-2019 versions of MySQL and MariaDB and more recent versions of MySQL 8 have already been updated for optimal performance on multiple platforms and therefore the change is this section is not required)<\/p>\n<div><\/div>\n<div><\/div>\n<div><span style=\"color: #666666;\">The <a href=\"https:\/\/dev.mysql.com\/doc\/refman\/8.0\/en\/source-installation.html\">MySQL manual<\/a> <\/span><span style=\"color: #666666;\">advises that building from source allows you customize build parameters and as with PostgreSQL this can also be the best way to achieve maximum performance. In particular with a workload such as HammerDB there is a lot of emphasis on locking and latching that is not seen in a sysbench workload and therefore you may see gains in modifying the InnoDB storage engine code. In InnoDB some of this behaviour is hardcoded however the CPU PAUSE instruction that is used by the UT_RELAX_CPU macro can and does vary between CPUs.\u00a0 In particular on Intel Scalable Processors (Skylake architecture) the PAUSE instruction is much longer than previous architectures and therefore calling UT_RELAX_CPU can consume a lot more time resulting in reduced performance.\u00a0 It may be the case that by the time you are testing this you can modify this behaviour with a parameter. Otherwise find the file\u00a0ut0ut.cc in the directory\u00a0storage\/innobase\/ut and modify the value accordingly, by default it is set to 50, for Skylake 5 is more appropriate for the delay multiplier.\u00a0<\/span><\/div>\n<\/div>\n<div><\/div>\n<pre><span style=\"font-size: 10pt;\"><span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">for (i = 0; i &lt;delay * 5<\/span>; i++) {\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">\u00a0\u00a0\u00a0 j += i;<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">\u00a0\u00a0\u00a0 UT_RELAX_CPU();<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">\u00a0 }<\/span>\n<\/span><\/pre>\n<div><\/div>\n<p><span style=\"color: #666666; font-family: 'courier new' , 'courier' , monospace; font-size: x-small; line-height: 14.1333px;\"><span style=\"background-color: white; font-family: 'verdana' , sans-serif; font-size: small;\">If unsure on whether to do this run the workload and use the perf command to observe the top functions. If &#8220;ut_delay&#8221; is consuming most of the CPU (in most cases it will still be one of the top functions) then potentially modifying this code can increase performance.\u00a0<\/span><\/span><\/p>\n<p><b><span style=\"color: #666666; font-family: sans-serif; font-size: 16.5pt;\">Configure MySQL<\/span><\/b><\/p>\n<div style=\"background: white; line-height: normal; margin-bottom: 12.0pt;\">\n<p><span style=\"font-family: 'verdana' , sans-serif;\">An example MySQL my.cnf file is shown.\u00a0 Note that innodb_file_per_table is set then when we use partition in HammerDB it can insert into multiple files one per partition. \u00a0This gives a performance gain. One configured start the MySQL or MariaDB database.\u00a0 For more details on MySQL and optimization see the website by <a href=\"http:\/\/dimitrik.free.fr\/blog\/index.html\">Dimitri Kravtchuk<\/a>.\u00a0<\/span><\/p>\n<\/div>\n<pre><span style=\"font-size: 10pt;\"><span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">[mysqld]<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">large-pages<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">skip-log-bin<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">datadir=\/home\/mysql\/data<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">language=\/homemysql\/bld\/share\/english<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">default_authentication_plugin=mysql_native_password<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">socket=\/tmp\/mysql.sock<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">port=3306<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">bind_address=192.168.1.1<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\"># general<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">max_connections=4000<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">table_open_cache=8000<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">table_open_cache_instances=16<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">back_log=1500<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">default_password_lifetime=0<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">ssl=0<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">performance_schema=OFF<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">max_prepared_stmt_count=128000<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">skip_log_bin=1<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">character_set_server=latin1<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">collation_server=latin1_swedish_ci<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">transaction_isolation=REPEATABLE-READ<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\"># files<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_file_per_table<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_log_file_size=1024M<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_log_files_in_group=32<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_open_files=4000<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\"># buffers<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_buffer_pool_size=64000M<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_buffer_pool_instances=16<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_log_buffer_size=64M<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\"># tune<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_doublewrite=0<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_thread_concurrency=0<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_flush_log_at_trx_commit=0<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_max_dirty_pages_pct=90<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_max_dirty_pages_pct_lwm=10<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">join_buffer_size=32K<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">sort_buffer_size=32K<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_use_native_aio=1<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_stats_persistent=1<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_spin_wait_delay=6<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_max_purge_lag_delay=300000<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_max_purge_lag=0<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_flush_method=O_DIRECT_NO_FSYNC<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_checksum_algorithm=none<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_io_capacity=4000<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_io_capacity_max=20000<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_lru_scan_depth=9000<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_change_buffering=none<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_read_only=0<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_page_cleaners=4<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_undo_log_truncate=off<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\"># perf special<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_adaptive_flushing=1<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_flush_neighbors=0<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_read_io_threads=16<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_write_io_threads=16<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_purge_threads=4<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_adaptive_hash_index=0<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\"># monitoring<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 14.1333px;\">innodb_monitor_enable='%'<\/span><\/span><\/pre>\n<div>\n<h6><span style=\"color: #333333;\"><b style=\"background-color: white;\"><span style=\"font-family: sans-serif; font-size: 16.5pt;\">Configure the HammerDB Client<\/span><\/b><\/span><\/h6>\n<\/div>\n<div style=\"background: white; line-height: normal; margin-bottom: 0cm;\">\n<p><span style=\"color: #444444; font-family: 'verdana' , sans-serif;\">Download and install HammerDB on a test client system, Like PostgreSQL another 2 socket server is ideal. You need the client libraries so\u00a0\u00a0ensure the MySQL 5.7 library file \u201clibmysqlclient.so.20\u201d is findable \u2013 you only need this one file and then run hammerdbcli to check for this file:\u00a0<\/span><\/p>\n<pre><span style=\"font-family: 'courier new', courier, monospace; font-size: 10pt;\"><span style=\"line-height: 14.1333px;\">export LD_LIBRARY_PATH=\/home\/mysql:$LD_LIBRARY_PATH<\/span>\n<\/span><\/pre>\n<pre><span style=\"font-size: 10pt;\"><span style=\"font-family: 'courier new', courier, monospace;\"><span style=\"color: #1f497d;\">H<\/span>ammerDB CLI v3.1<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">Copyright (C) 2003-2018 Steve Shaw<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">Type \"help\" for a list of commands<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">The xml is well-formed, applying configuration<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">hammerdb&gt;librarycheck<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">..<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">Checking database library for MySQL<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">Success ... loaded library mysqltcl for MySQL<\/span><\/span><\/pre>\n<\/div>\n<div style=\"background: white; line-height: normal; margin-bottom: 0cm;\"><span style=\"color: #666666; font-family: sans-serif; font-size: 10.0pt;\">\u00a0<\/span><\/div>\n<h6 style=\"background: white; line-height: normal; margin-bottom: 0cm;\"><b><span style=\"color: #666666; font-family: sans-serif; font-size: 16.5pt;\">Create the Schema and Run the Test<\/span><\/b><b><\/b><\/h6>\n<div><\/div>\n<div><span style=\"font-family: verdana, geneva, sans-serif;\">Just before running the schema creation double check that you have initialised mysql correctly and the mysql directory exists, otherwise the tables will be created and loaded with data but you will get the following error when creating the stored procedures<\/span><\/div>\n<pre>Error in Virtual User 1: mysqlexec\/db server: Table 'mysql.proc' doesn't exist<\/pre>\n<div><span style=\"font-family: verdana, geneva, sans-serif;\">an example of how to do this is as follows:<\/span><\/div>\n<pre>$ .\/scripts\/mysql_install_db --srcdir=\/home\/mariadb\/mariadb-10.2 --defaults-file=.\/..\/my.cnf\nInstalling MariaDB\/MySQL system tables in '\/home\/mariadb\/data' ...\nOK<\/pre>\n<div><span style=\"color: #000000;\"><span style=\"font-family: 'verdana' , sans-serif;\">If using the HammerDB CLI an example script saved as innodbbuild.tcl is shown update accordingly for your system and make sure partitioning is included:<\/span><\/span><\/div>\n<pre><span style=\"font-size: 10pt;\"><span style=\"font-family: 'courier new', courier, monospace;\">#!\/bin\/tclsh<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">puts \"SETTING CONFIGURATION\"<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">dbset db mysql<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">diset connection mysql_host <span style=\"background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial;\">192.168.1.1<\/span><\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">diset connection mysql_port <span style=\"background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial;\">3306<\/span><\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">diset tpcc mysql_count_ware 800<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">diset tpcc mysql_partition true<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">diset tpcc mysql_num_vu 64<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">diset tpcc mysql_storage_engine innodb<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">print dict<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">buildschema<\/span><\/span><\/pre>\n<div>\n<pre><span style=\"font-size: 10pt;\"><span style=\"font-family: 'courier new', courier, monospace; line-height: 13.78px;\">$ .\/hammerdbcli<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 13.78px;\">HammerDB CLI v3.1<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 13.78px;\">Copyright (C) 2003-2018 Steve Shaw<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 13.78px;\">Type \"help\" for a list of commands<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 13.78px;\">The xml is well-formed, applying configuration \nhammerdb&gt;source innodbbuild.tcl<\/span><\/span><\/pre>\n<\/div>\n<div>\n<p><span style=\"color: #444444; font-family: 'verdana' , sans-serif;\">It will return to the prompt when built \u2013 then restart the MySQL instance and run a single test. On an up to date system around mid-2018 expect to see up to 2M MySQL TPM and around 650K NOPM.\u00a0<\/span><\/p>\n<\/div>\n<pre><span style=\"font-size: 10pt;\"><span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">Vuser 1:56 Active Virtual Users configured<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">Vuser 1:TEST RESULT : System achieved 1994844 MySQL TPM at 658082 NOPM<\/span><\/span><\/pre>\n<div><span style=\"color: #1f497d;\"> \u00a0<\/span><span style=\"color: #444444; font-family: 'verdana' , sans-serif;\">Then on a load test client run a script such as the following at the command line this does the same as autopilot in the GUI so make sure you log to temp.<\/span><\/div>\n<div><span style=\"color: #1f497d;\"> \u00a0<\/span><\/div>\n<pre><span style=\"font-size: 10pt;\"><span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">#!\/bin\/tclsh<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">proc runtimer { seconds } {<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">set x 0<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">set timerstop 0<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">while {!$timerstop} {<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">incr x<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">after 1000<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">\u00a0 if { ![ expr {$x % 60} ] } {<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 set y [ expr $x \/ 60 ]<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 puts \"Timer: $y minutes elapsed\"<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">\u00a0 }<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">update<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">if {\u00a0 [ vucomplete ] || $x eq $seconds } { set timerstop 1 }<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">\u00a0\u00a0\u00a0 }<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">return<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">}<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">puts \"SETTING CONFIGURATION\"<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">dbset db mysql<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">diset connection mysql_host 192.168.142.1<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">diset connection mysql_port 3307<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">diset tpcc mysql_driver timed<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">diset tpcc my_rampup 2<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">diset tpcc my_duration 5<\/span>\n<span style=\"font-family: 'courier new', courier, monospace;\">vuset logtotemp 1<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">loadscript<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">puts \"SEQUENCE STARTED\"<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">foreach z { 1 2 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 } {<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">puts \"$z VU TEST\"<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">vuset vu $z<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">vucreate<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">vurun<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">runtimer 600<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">vudestroy<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">after 5000<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/span>\n<span style=\"font-family: 'courier new', courier, monospace; line-height: 106%;\">puts \"TEST SEQUENCE COMPLETE\"<\/span><\/span><\/pre>\n<div>\n<h6><span style=\"color: #666666; font-family: sans-serif; font-size: 16.5pt;\">\u00a0<\/span><b style=\"background-color: white;\"><span style=\"color: #666666; font-family: sans-serif; font-size: 16.5pt;\">Test Results<\/span><\/b><\/h6>\n<\/div>\n<div>\n<p><span style=\"color: #000000;\"><span style=\"font-family: verdana, sans-serif;\">Grab the TPM or NOPM from the logfile. If everything went well you should get a sequence as follows peaking at around 650,000 NOPM on an up to date system in mid-2018.\u00a0\u00a0<\/span><span style=\"background-color: white;\"><span style=\"font-family: 'verdana' , sans-serif;\">To be clear this chart shows the data from 20 performance tests, each with a 2 minute rampup time and 5 minute test. After each test completed HammerDB then increased the virtual user count and repeated the test. Fortunately HammerDB allows all of this process to be automated.\u00a0 Each data point shows the average transaction rate captured over the 5 minute test so not the peak performance that may be higher.\u00a0<\/span><\/span><\/span><\/p>\n<\/div>\n<div>\n<div style=\"clear: both; text-align: center;\"><a style=\"margin-left: 1em; margin-right: 1em;\" href=\"https:\/\/4.bp.blogspot.com\/-5CX7z_9Bz9M\/W8Co-s05-gI\/AAAAAAAAAHg\/fy4Cf4LkuQULQqvwZCJDMwv3owq6SgO-QCLcBGAs\/s1600\/mySQL8BP%25282%2529.PNG\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/4.bp.blogspot.com\/-5CX7z_9Bz9M\/W8Co-s05-gI\/AAAAAAAAAHg\/fy4Cf4LkuQULQqvwZCJDMwv3owq6SgO-QCLcBGAs\/s640\/mySQL8BP%25282%2529.PNG\" width=\"640\" height=\"438\" border=\"0\" data-original-height=\"637\" data-original-width=\"924\" \/><\/a><\/div>\n<p><span style=\"color: #444444; font-family: 'verdana' , sans-serif;\">Note that after a point, in this case after 56 virtual users, performance will decrease as you increase the number of virtual users. This is to be expected and is due to the limitations of the scalability of the storage engine. If you report the stored procedure response times (see the HammerDB manual for how to do this) you will see the time increase especially for the DELIVERY stored procedure that is updating the ORDER_LINE table while the NEWORD stored procedure is trying to insert into it. As a result the NOPM or New Orders per minute reduces as more contention is experienced. This is not a limitation of HammerDB that has been observed to drive significantly higher transaction rates.\u00a0 Nevertheless around 2M MySQL TPM is very respectable throughput for an enterprise workload and as there is a lot more CPU available the potential is there to go a lot higher.\u00a0<\/span><\/p>\n<\/div>\n<p><script><br \/>\n  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){<br \/>\n  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),<br \/>\n  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)<br \/>\n  })(window,document,'script','https:\/\/www.google-analytics.com\/analytics.js','ga');<br \/>\n  ga('create', 'UA-87720879-1', 'auto');<br \/>\n  ga('send', 'pageview');<br \/>\n<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post complements the previous best practice guides this time with the focus on MySQL and MariaDB and achieving top levels of performance with the HammerDB MySQL TPC-C test.\u00a0\u00a0As with the previous guides as an Intel employee (#IAMINTEL) the examples are taken from a MySQL 8 on Linux on Intel system and the approach is &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.hammerdb.com\/blog\/uncategorized\/hammerdb-mysql-and-mariadb-best-practice-for-performance-and-scalability\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;HammerDB MySQL and MariaDB Best Practice for Performance and Scalability&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"image","meta":{"footnotes":""},"categories":[1],"tags":[],"ppma_author":[5],"class_list":["post-12","post","type-post","status-publish","format-image","hentry","category-uncategorized","post_format-post-format-image"],"authors":[{"term_id":5,"user_id":2,"is_guest":0,"slug":"hammerdb","display_name":"HammerDB","avatar_url":{"url":"https:\/\/www.hammerdb.com\/blog\/wp-content\/uploads\/2018\/10\/logo-white.png","url2x":"https:\/\/www.hammerdb.com\/blog\/wp-content\/uploads\/2018\/10\/logo-white.png"},"author_category":"","user_url":"http:\/\/www.hammerdb.com","last_name":"","first_name":"","job_title":"","description":""}],"_links":{"self":[{"href":"https:\/\/www.hammerdb.com\/blog\/wp-json\/wp\/v2\/posts\/12","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hammerdb.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hammerdb.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hammerdb.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hammerdb.com\/blog\/wp-json\/wp\/v2\/comments?post=12"}],"version-history":[{"count":22,"href":"https:\/\/www.hammerdb.com\/blog\/wp-json\/wp\/v2\/posts\/12\/revisions"}],"predecessor-version":[{"id":376,"href":"https:\/\/www.hammerdb.com\/blog\/wp-json\/wp\/v2\/posts\/12\/revisions\/376"}],"wp:attachment":[{"href":"https:\/\/www.hammerdb.com\/blog\/wp-json\/wp\/v2\/media?parent=12"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hammerdb.com\/blog\/wp-json\/wp\/v2\/categories?post=12"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hammerdb.com\/blog\/wp-json\/wp\/v2\/tags?post=12"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.hammerdb.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=12"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}