{"id":4019,"date":"2015-12-18T10:48:32","date_gmt":"2015-12-18T00:48:32","guid":{"rendered":"https:\/\/www.flamingspork.com\/blog\/?p=4019"},"modified":"2015-12-18T10:48:32","modified_gmt":"2015-12-18T00:48:32","slug":"power8-accelerated-crc32-merged-in-mariadb-10-1","status":"publish","type":"post","link":"https:\/\/www.flamingspork.com\/blog\/2015\/12\/18\/power8-accelerated-crc32-merged-in-mariadb-10-1\/","title":{"rendered":"POWER8 Accelerated CRC32 merged in MariaDB 10.1"},"content":{"rendered":"<p>Earlier on in benchmarking MySQL and MariaDB on POWER8, we noticed that on write workloads (or read workloads involving a lot of IO) we were spending a bunch of time computing InnoDB page checksums. This is a relatively well known MySQL problem and has existed for many years and <a href=\"http:\/\/www.percona.com\">Percona<\/a> even added <a href=\"https:\/\/www.percona.com\/doc\/percona-server\/5.1\/performance\/innodb_fast_checksum.html\">innodb_fast_checksum to Percona Server<\/a> to help alleviate the problem.<\/p>\n<p>In MySQL 5.6, we got the ability to use CRC32 checksums, which are great in that they&#8217;re a <strong>lot<\/strong> faster to compute than tho old InnoDB &#8220;new&#8221; checksum. There&#8217;s <a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/5.7\/storage\/innobase\/ut\/ut0crc32.cc#L189\">code inside InnoDB to use the x86 SSE2 crc32q<\/a> instruction to accelerate performing the checksum on compatible x86 CPUs (although oddly enough, the CRC32 checksum in the binlog does not use this acceleration).<\/p>\n<p>However, on POWER, we&#8217;d end up using the software implementation of CRC32, which used a lot more CPU than we&#8217;d like. Luckily, CRC32 is <strong>really<\/strong> common code and for POWER8, we got some handy instructions to help computing it. Unfortunately, this required brushing up on vector polynomial math in order to understand how to do it all quickly. The end result was <a href=\"https:\/\/github.com\/antonblanchard\/crc32-vpmsum\/\">Anton coming up with crc32-vpmsum<\/a> code that we could drop into projects that embed a copy of crc32 that was about <strong>41 times faster than the best non-vpmsum implementation.<\/strong><\/p>\n<p>Recently, <a href=\"https:\/\/github.com\/grooverdan\">Daniel Black<\/a> took the patch that had passed through both <a href=\"https:\/\/github.com\/daxtens\">Daniel Axten<\/a>&#8216;s and my hands and worked on upstreaming it into MariaDB and MySQL. We did some pretty solid benchmarking on the improvement you&#8217;d get, and we pretty much cannot notice the difference between innodb_checksum=off and having it use the POWER8 accelerated CRC32 checksum, which frees up maybe 30% of CPU time to be used for things like query execution! My original benchmark showed a 30% improvement in sysbench read\/write workloads.<\/p>\n<p>The excellent news? Two days ago, <a href=\"https:\/\/github.com\/MariaDB\/server\/commit\/953d5680a3c050273a8f29253f7386984679f92b\">MariaDB merged POWER8 accelerated crc32<\/a>! This means that IO heavy workloads on MariaDB on POWER8 will get <strong>much<\/strong> faster in the next release.<\/p>\n<p><a href=\"http:\/\/bugs.mysql.com\/bug.php?id=74776\">MySQL bug 74776<\/a> is open, with patch attached, so hopefully MySQL will merge this soon too (hint hint).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Earlier on in benchmarking MySQL and MariaDB on POWER8, we noticed that on write workloads (or read workloads involving a lot of IO) we were spending a bunch of time computing InnoDB page checksums. This is a relatively well known &hellip; <a href=\"https:\/\/www.flamingspork.com\/blog\/2015\/12\/18\/power8-accelerated-crc32-merged-in-mariadb-10-1\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[570,14],"tags":[648,340,628,579,562,568],"class_list":["post-4019","post","type-post","status-publish","format-standard","hentry","category-ibm-work-et-al","category-mysql","tag-crc32","tag-mariadb","tag-mysql","tag-performance","tag-power","tag-power8"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5a6n8-12P","jetpack-related-posts":[{"id":3950,"url":"https:\/\/www.flamingspork.com\/blog\/2015\/02\/13\/preliminary-results-from-power8-optimized-crc32-for-mysql\/","url_meta":{"origin":4019,"position":0},"title":"Preliminary results from POWER8 optimized CRC32 for MySQL","author":"Stewart Smith","date":"2015-02-13","format":false,"excerpt":"So, Anton got some useful code working that I could patch into a MySQL server for testing purposes - a POWER8 optimized CRC32 implementation. I went with a pretty stock MySQL 5.6.22 (one patch) with sysbench preparing a single 2GB table (10,000,000 rows). I then hacked up innochecksum so that\u2026","rel":"","context":"In &quot;code&quot;","block_context":{"text":"code","link":"https:\/\/www.flamingspork.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4035,"url":"https:\/\/www.flamingspork.com\/blog\/2016\/02\/26\/mysql-contributions-status\/","url_meta":{"origin":4019,"position":1},"title":"MySQL Contributions status","author":"Stewart Smith","date":"2016-02-26","format":false,"excerpt":"This post is an update to the status of various MySQL bugs (some with patches) that I've filed over the past couple of years (or that people around me have). I'm not looking at POWER specific ones, as there are these too, but each of these bugs here deal with\u2026","rel":"","context":"In &quot;code&quot;","block_context":{"text":"code","link":"https:\/\/www.flamingspork.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3959,"url":"https:\/\/www.flamingspork.com\/blog\/2015\/04\/28\/going-beyond-1-3-million-sql-queriessecond\/","url_meta":{"origin":4019,"position":2},"title":"Going beyond 1.3 MILLION SQL Queries\/second","author":"Stewart Smith","date":"2015-04-28","format":false,"excerpt":"So, on a large IBM POWER8 system I was recently running the newly coined \"yesmark\" benchmark, which is best translated as this: Benchmark (N for concurrency): for i in {1..N}; do yes \"DO 0;\" | mysql > \/dev\/null & done Live results: mysqladmin -ri 1 extended-status | grep Questions Which\u2026","rel":"","context":"In &quot;IBM&quot;","block_context":{"text":"IBM","link":"https:\/\/www.flamingspork.com\/blog\/category\/work-et-al\/ibm-work-et-al\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4003,"url":"https:\/\/www.flamingspork.com\/blog\/2015\/10\/19\/1-million-sql-queries-per-second-ga-mariadb-10-1-on-power8\/","url_meta":{"origin":4019,"position":3},"title":"1 Million SQL Queries per second: GA MariaDB 10.1 on POWER8","author":"Stewart Smith","date":"2015-10-19","format":false,"excerpt":"A couple of days ago, MariaDB announced that MariaDB 10.1 is stable GA - around 19 months since the GA of MariaDB 10.0. With MariaDB 10.1 comes some important scalabiity improvements, especially for POWER8 systems. On POWER, we're a bit unique in that we're on the higher end of CPUs,\u2026","rel":"","context":"In &quot;IBM&quot;","block_context":{"text":"IBM","link":"https:\/\/www.flamingspork.com\/blog\/category\/work-et-al\/ibm-work-et-al\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3778,"url":"https:\/\/www.flamingspork.com\/blog\/2014\/07\/17\/update-on-mysql-on-power8\/","url_meta":{"origin":4019,"position":4},"title":"Update on MySQL on POWER8","author":"Stewart Smith","date":"2014-07-17","format":false,"excerpt":"About 1.5 months ago I blogged on MySQL 5.6 on POWER andtalked about what I had to poke at to make modern MySQL versions run and run well on shiny POWER8 systems. One of those bugs, MySQL bug 47213 (InnoDB mutex\/rw_lock should be conscious of memory ordering other than Intel)\u2026","rel":"","context":"In &quot;code&quot;","block_context":{"text":"code","link":"https:\/\/www.flamingspork.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4052,"url":"https:\/\/www.flamingspork.com\/blog\/2016\/05\/06\/video-of-my-percona-live-talk-why-would-i-run-mysqlmariadb-on-power-anyway\/","url_meta":{"origin":4019,"position":5},"title":"Video of my Percona Live Talk: Why would I run MySQL\/MariaDB on POWER anyway?","author":"Stewart Smith","date":"2016-05-06","format":false,"excerpt":"Good news everyone! There's video up for the talk I gave at Percona Live in April 2016 up: Why would I run MySQL\/MariaDB on POWER anyway? The talk is a general overview of POWER and why MySQL\/MariaDB may be a good fit.","rel":"","context":"In &quot;IBM&quot;","block_context":{"text":"IBM","link":"https:\/\/www.flamingspork.com\/blog\/category\/work-et-al\/ibm-work-et-al\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/img.youtube.com\/vi\/UgwGHe46wqk\/0.jpg?resize=350%2C200","width":350,"height":200},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts\/4019","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/comments?post=4019"}],"version-history":[{"count":1,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts\/4019\/revisions"}],"predecessor-version":[{"id":4020,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts\/4019\/revisions\/4020"}],"wp:attachment":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/media?parent=4019"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/categories?post=4019"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/tags?post=4019"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}