May
24
2013
--

Percona Server for MySQL 5.5.31-30.3 now available

id="attachment_13396" class="wp-caption alignright" style="width: 257px"> href="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/03/Percona-Server.jpg"> class="size-full wp-image-13396" alt="Percona Server for MySQL version 5.5.31-30.3" src="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/03/Percona-Server.jpg" width="247" height="97" /> class="wp-caption-text">Percona Server for MySQL version 5.5.31-30.3

Percona is glad to announce the release of  href="http://www.percona.com/software/percona-server">Percona Server for MySQL 5.5.31-30.3 on May 24, 2013 (Downloads are available  href="http://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-5.5.31-30.3/">here and from the  href="http://www.percona.com/doc/percona-server/5.5/installation.html">Percona Software Repositories). Based on  href="http://dev.mysql.com/doc/relnotes/mysql/5.5/en/news-5-5-31.html">MySQL 5.5.31, including all the bug fixes in it, Percona Server 5.5.31-30.3 is now the current stable release in the 5.5 series. All of Percona‘s software is open-source and free, all the details of the release can be found in the  href="https://launchpad.net/percona-server/+milestone/5.5.31-30.3">5.5.31-30.3 milestone at Launchpad.

New Features:

  • Percona Server has ported the href="http://www.percona.com/doc/percona-server/5.5/performance/atomic_fio.html#atomic-fio">Atomic write support for Fusion-io devices patch from MariaDB. This feature adds atomic write support for directFS filesystem on Fusion-io devices. This feature implementation is considered BETA quality.
  • Percona Server has introduced href="http://www.percona.com/doc/percona-server/5.5/diagnostics/innodb_show_status.html#innodb_read_views_memory">innodb_read_views_memory and href="http://www.percona.com/doc/percona-server/5.5/diagnostics/innodb_show_status.html#innodb_descriptors_memory">innodb_descriptors_memory status variables in the href="http://www.percona.com/doc/percona-server/5.5/diagnostics/innodb_show_status.html#innodb-show-status">Extended Show Engine InnoDB Status to improve InnoDB memory usage diagnostics.

Bugs Fixed:

  • Fix for bug href="https://bugs.launchpad.net/percona-server/+bug/1131187">#1131187 introduced a regression that could cause a memory leak if query cache was used together with InnoDB. Bug fixed href="https://bugs.launchpad.net/percona-server/+bug/1170103">#1170103.
  • Fixed the RPM packaging regression that was introduced with the fix for bug href="https://bugs.launchpad.net/percona-server/+bug/710799">#710799. This regression caused mysql schema to be missing after the clean RPM installation. Bug fixed href="https://bugs.launchpad.net/percona-server/+bug/1174426">#1174426.
  • Fixed the Percona-Server-shared-55 and Percona-XtraDB-Cluster-shared RPM package dependences. Bug fixed href="https://bugs.launchpad.net/percona-server/+bug/1050654">#1050654.
  • Fixed the upstream bug href="http://bugs.mysql.com/bug.php?id=68999">#68999 which caused compiling Percona Server to fail on CentOS 5 and Debian squeeze due to older OpenSSL version. Bug fixed href="https://bugs.launchpad.net/percona-server/+bug/1183610">#1183610.
  • If a slave was running with its binary log enabled and then restarted with the binary log disabled, Crash-Resistant Replication could overwrite the relay log info log with an incorrect position. Bug fixed href="https://bugs.launchpad.net/percona-server/+bug/1092593">#1092593.
  • Fixed the href="http://www.securiteam.com/cves/2012/CVE-2012-5615.html">CVE-2012-5615 vulnerability. This vulnerability would allow remote attacker to detect what user accounts exist on the server. This bug fix comes originally from MariaDB (see href="https://mariadb.atlassian.net/browse/MDEV-3909">MDEV-3909). Bug fixed href="https://bugs.launchpad.net/percona-server/+bug/1171941">#1171941.
  • Fixed the href="http://www.securiteam.com/cves/2012/CVE-2012-5627.html">CVE-2012-5627 vulnerability, where an unprivileged MySQL account owner could perform brute-force password guessing attack on other accounts efficiently. This bug fix comes originally from MariaDB (see href="https://mariadb.atlassian.net/browse/MDEV-3915">MDEV-3915). Bug fixed href="https://bugs.launchpad.net/percona-server/+bug/1172090">#1172090.
  • mysql_set_permission was failing on Debian due to missing libdbd-mysql-perl package. Fixed by adding the package dependency. Bug fixed href="https://bugs.launchpad.net/percona-server/+bug/1003776">#1003776.
  • Rebuilding Debian source package would fail because dpatch and automake were missing from build-dep. Bug fixed href="https://bugs.launchpad.net/percona-server/+bug/1023575">#1023575 (Stephan Adig).
  • Backported the fix for the upstream bug href="http://bugs.mysql.com/bug.php?id=65077">#65077 from the MySQL 5.6 version, which removed MyISAM internal temporary table mutex contention. Bug fixed href="https://bugs.launchpad.net/percona-server/+bug/1179978">#1179978.

Release notes for Percona Server for MySQL 5.5.31-30.3 are available in our href="http://www.percona.com/doc/percona-server/5.5/release-notes/Percona-Server-5.5.31-30.3.html">online documentation. Bugs can be reported on the href="https://bugs.launchpad.net/percona-server/+filebug">launchpad bug tracker.

The post href="http://www.mysqlperformanceblog.com/2013/05/24/percona-server-for-mysql-5-5-31-30-3-now-available/">Percona Server for MySQL 5.5.31-30.3 now available appeared first on href="http://www.mysqlperformanceblog.com/">MySQL Performance Blog.

May
24
2013
--

Status Update May 2013 and beta readers wanted

Golden Gate BridgeHello. Hey, it’s me, in case you’re wondering who this stranger is. I haven’t posted for a whole month because May has been an insanely busy month.

My mother came over from England for 3 weeks and we had a great time. Even though I had to work, we still found time to take her to Palm Springs and up to San Francisco. We had tremendous fun up there touring the city, going out into the harbor and driving up to Napa to sample some wines. This photo is me grinning ear to ear because the Golden Gate finally came into view, but not until we sailed through the famous fog almost underneath it.

During May we are also re-financing our house, installing solar panels (the latest in our continuing efforts to become greener), and a bunch of other life changes. And all of this on top of work. I’ll be glad to get into June!

Alas, I haven’t written for 3 weeks and will be back at the keyboard tonight and all through the Memorial Day weekend. Yay! I have about 15,000 words to go to complete the first draft of my 2nd book, which is provisionally entitled Necro. It’s dark fantasy, first person in the head of a Necromancer, but I think it’s quite different to other books you might have read about Necromancers.  Once the first draft is done, I intend to make 2 further drafts between now and August after which I’ll be ready for beta readers.

If you’d like to be a beta reader, please contact me! I don’t expect line edits, just an honest read in 4-6 weeks and a response with your thoughts on what worked and what didn’t, what you liked or hated. In return you’ll get a mention in the book and a free ebook copy.

I’m also furiously scribbling background and plot notes for the first in a series of futuristic paranormal novellas that I’ll start this summer.

Finally, a plea to anyone who has read Ocean of Dust, enjoyed it but is nervous of writing a review on Amazon, B&N, Kobo, or even Goodreads. Please do – you only have to write a few sentences, and every review helps a budding new author like me. :) I appreciate it.

 

May
24
2013
--

ZFS on Linux and MySQL

href="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/03/Percona-Remote-DBA-for-MySQL.jpg"> class="alignleft size-medium wp-image-13691" style="margin: 9px;" alt="Data center" src="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/03/Percona-Remote-DBA-for-MySQL-300x194.jpg" width="300" height="194" />I am currently working with a large customer and I am involved with servers located in two data centers, one with Solaris servers and the other one with Linux servers. The Solaris side is cleverly setup using zones and ZFS and this provides a very low virtualization overhead. I learned quite a lot about these technologies while looking at this, thanks to Corey Mosher.

On the Linux side, we recently deployed a pair on servers for backup purpose, boxes with 64 300GB SAS drives, 3 raid controllers and 192GB of RAM. These servers will run a few slave instances each of production database servers and will perform the backups.  The write load is not excessive so a single server can easily handle the write load of all the MySQL instances.  The original idea was to configure them with raid-10 + LVM, making sure to stripe the LV when we need to and align the partition correctly.

We got decent tpcc performance, nearly 37k NoTPM using 5.6.11 and xfs.  Then, since ZFS on Linux is available and there is in house ZFS knowledge, we decided to reconfigure one of the server and give ZFS a try.  So I trashed the raid-10 arrays, configure JBODs and gave all those drives to ZFS (30 mirrors + spares + OS partition mirror) and I limited the ARC size to 4GB.  I don’t want to start a war but ZFS performance level was less than half of xfs for the tpcc test and that’s maybe just normal.  We didn’t try too hard to get better performance because we already had more than enough for our purpose and some ZFS features are just too useful for backups (most apply also for btrfs). Let’s review them.

Snapshots

ZFS does snapshot, like LVM but… since it is a copy on write filesystem, the snapshots are free, no performance penalty.  You can easily run a server with hundreds of snapshots.  With LVM, your IO performance drops to 33% after the first snapshot so keeping a large number of snapshots running is simply not an option.  With ZFS you can easily have:

  • style="line-height: 13px;">one snapshot per day for the last 30 days
  • one snapshot per hour for the last 2 days
  • one snapshot per 5min for the last 2 hours

and that will be perfectly fine.  Since starting a snapshot take less than a second, you could even be more zealous.  Pretty interesting to speed up point in time recovery when you dataset is 700GB.  If you google a bit with “zfs snapshot script” you’ll many scripts ready for the task.  Snapshots work best with InnoDB, with MyISAM you’ll have to start the snapshot while holding a “flush tables with read lock” and the flush operation will take some time to complete.

Compression

ZFS can compress data on the fly and it is surprisingly cheap.  In fact the best tpcc results I got were when using compression.  I still have to explain this, maybe it is related to better raid controller write cache use.  Even the fairly slow gzip-1 mode works well.  The tpcc database, which contains a lot of random data that doesn’t compress well showed a compression ration of 1.70 with gzip-1.  Real data will compress much more.  That gives us much more disk space than we expected so even more snapshots!

Integrity

With ZFS each record on disk has a checksum.  If a cosmic ray flip a bit on a drive, instead of crashing InnoDB, it will be caught by ZFS and the data will be read from the other drive in the mirror.

Better availability and disk usage

On purpose, I allocated mirror pairs using drives from different controllers.  That way, if a controller dies, the storage will still be working.  Also, instead of having 1 or 2 spare drives per controller, I have 2 for the whole setup.  A small but yet interesting saving.

All put together, ZFS on Linux is a very interesting solution for MySQL backup servers.  All backup solutions have an impact on performance with ZFS the impact is up front and the backups are almost free.

The post href="http://www.mysqlperformanceblog.com/2013/05/24/zfs-on-linux-and-mysql/">ZFS on Linux and MySQL appeared first on href="http://www.mysqlperformanceblog.com/">MySQL Performance Blog.

May
23
2013
--

Experiences with the McAfee MySQL Audit Plugin

I recently had to do some customer work involving the McAfee MySQL Audit Plugin and would like to share my experience in this post.

Auditing user activity in MySQL  has traditionally been challenging. Most data can be obtained from the slow or general log, but this involves a lot of data you don’t need too, and isn’t flexible at all. The specific problem of logging failed connection attempts has been discussed on a title="auditing login attempts in mysql" href="http://www.mysqlperformanceblog.com/2012/12/28/auditing-login-attempts-in-mysql/">previous post in our blog.

Starting with 5.1, the new plugin API gives us more flexibility by allowing users to extend the server’s functionality with their own code, and this is what the title="mcaffee mysql audit plugin @ github" href="https://github.com/mcafee/mysql-audit">McAffee plugin does.

title="audit plugin - Installation" href="https://github.com/mcafee/mysql-audit/wiki/Installation">Installation and title="audit plugin - Configuration" href="https://github.com/mcafee/mysql-audit/wiki/Configuration">configuration are straightforward following the available instructions. The only extra step I had to take was to extract the offsets for the Percona Server version I was using for the test (5.5.28-29.1). This is needed as the plugin needs the offset to some MySQL data structures that, the plugin authors say, aren’t exposed by a consistent API. If you also need to do this, the details are clearly explained title="audit plugin - Troubleshooting" href="https://github.com/mcafee/mysql-audit/wiki/Troubleshooting">here.

The plugin writes its output in json format, and supports writing it directly to a file, or to a unix socket, which means you can write a script to listen on this socket and process the audit records as you wish.

Performance-wise, I did basic tests on the VM I was working in and didn’t get significant differences between either output option, or between using the plugin or enabling the general log. Bear in mind these were basic tests (just a few mysqlslap runs with increasing levels of concurrency), but initially, I would think the advantage of the plugin is its flexibility, and not its performance, which seems to be on par with having the general log enabled.

The flexibility comes from the three variables that can be set to control what is logged by the plugin: /> – audit_record_cmds : This is the list of commands you want written to the log (all the lists in these variables are comma separated). As pointed title="mysql plugin audit API" href="http://karlssonondatabases.blogspot.com/2010/03/mysql-audit-plugin-api.html">here, anything that would generate a write to the general log will be sent to the plugin, and you can control if it gets written on not with this list. I tested this with “connect,Quit” to log successful and failed connections. Yes, it had to be a capital Q in Quit for that to work, and no, my code-fu was not enough to understand why that is the case. Maybe someone more knowledgeable in MySQL internals can enlighten me here. /> – audit_record_objs : List of database objects (tables, according to the docs) for which you want events written to the log. /> – audit_whitelist_users : This one is undocumented on the wiki at the time of writing, and is a list of users for which you do not want events written to the log.

Just for reference, these are the lines I had to add to my config file for the plugin to work (plus one commented line for switching between file and socket for output):

/> plugin-load=AUDIT=libaudit_plugin.so /> audit_offsets=6464, 6512, 4072, 4512, 104, 2584 /> audit_json_file=1 /> audit_json_socket_name=/tmp/audit.sock /> #audit_json_socket=1 /> audit_json_log_file=/var/lib/mysql/audit.log /> audit_record_cmds=connect,Quit />

Notice the audit_offsets that I mentioned had to be extracted due to this Percona Server version not being included in the binary.

And here’s a few sample output lines generated by the plugin with this configuration:

{"msg-type":"activity","date":"1369155747373","thread-id":"6439","query-id":"0","user":"debian-sys-maint","priv_user":"debian-sys-maint","host":"localhost","cmd":"Connect","query":"Connect"} /> {"msg-type":"activity","date":"1369155747373","thread-id":"6439","query-id":"219309","user":"debian-sys-maint","priv_user":"debian-sys-maint","host":"localhost","cmd":"Quit","query":"Quit"} /> {"msg-type":"activity","date":"1369155747383","thread-id":"6440","query-id":"0","user":"debian-sys-maint","priv_user":"debian-sys-maint","host":"localhost","cmd":"Connect","query":"Connect"} />

In conclusion, the plugin API seems to be opening new possibilities of extending MySQL’s behavior in a way that, once set up, is transparent to users, and the McAfee MySQL Audit Plugin is only one of example of what can be achieved with it. It is a very good one for me, since I think proper audit trail support has been an important missing feature on the server, which has made using MySQL in PCI or SOX compliant environments, to name just two, artificially complicated, as one had to rely on too much info (general log) or external help (snort or similar IDS).

The post href="http://www.mysqlperformanceblog.com/2013/05/23/experiences-with-the-mcafee-mysql-audit-plugin/">Experiences with the McAfee MySQL Audit Plugin appeared first on href="http://www.mysqlperformanceblog.com/">MySQL Performance Blog.

May
22
2013
--

Percona XtraBackup 2.1.3 for MySQL available for download

href="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/01/Percona_XtraBackup.jpg"> class="alignleft wp-image-12668" style="margin-top: 5px; margin-bottom: 5px;" alt="Percona XtraBackup for MySQL" src="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/01/Percona_XtraBackup.jpg" width="206" height="78" /> Percona is glad to announce the release of href="http://www.percona.com/software/percona-xtrabackup">Percona XtraBackup 2.1.3 for MySQL on May 22, 2013. Downloads are available from our download site href="http://www.percona.com/downloads/XtraBackup/XtraBackup-2.1.3/">here and href="http://www.percona.com/doc/percona-xtrabackup/2.1/installation.html">Percona Software Repositories.

This release fixes a high priority bug. It’s advised to upgrade your latest 2.1 version to 2.1.3 if you’re using the href="http://www.percona.com/software/percona-xtrabackup">Percona XtraBackup with href="http://www.percona.com/software/percona-xtradb-cluster">Percona XtraDB Cluster. This release is the latest stable release in the 2.1 series.

Bug Fixed:

  • Percona XtraBackup 2.1.2 would hang when performing href="http://www.percona.com/doc/percona-xtradb-cluster/manual/state_snapshot_transfer.html">State Snapshot Transfer. Bug fixed href="https://bugs.launchpad.net/percona-xtrabackup/+bug/1182698">#1182698.

Release notes with all the bugfixes for Percona XtraBackup 2.1.3 are available in our href="http://www.percona.com/doc/percona-xtrabackup/release-notes/2.1/2.1.3.html">online documentation. Bugs can be reported on the href="https://bugs.launchpad.net/percona-xtrabackup/+filebug">launchpad bug tracker.

style="text-align: center;">* * *

href="http://www.percona.com/software/percona-xtrabackup" >Percona XtraBackup is the world’s only open-source, free MySQL hot backup software that performs non-blocking backups for InnoDB and XtraDB databases. With Percona XtraBackup, you can achieve the following benefits:

  • Backups that complete quickly and reliably
  • Uninterrupted transaction processing during backups
  • Savings on disk space and network bandwidth
  • Automatic backup verification
  • Higher uptime due to faster restore time

XtraBackup makes MySQL hot backups for all versions of Percona Server, MySQL, MariaDB, and Drizzle. It performs streaming, compressed, and incremental MySQL backups.

Percona’s enterprise-grade commercial href="http://www.percona.com/mysql-support" >MySQL Support contracts include support for XtraBackup. We recommend support for critical production deployments.

The post href="http://www.mysqlperformanceblog.com/2013/05/22/percona-xtrabackup-2-1-3-for-mysql-available-for-download/">Percona XtraBackup 2.1.3 for MySQL available for download appeared first on href="http://www.mysqlperformanceblog.com/">MySQL Performance Blog.

May
22
2013
--

Percona MySQL University @Portland: June 17

id="attachment_12663" class="wp-caption alignleft" style="width: 310px"> href="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/01/PMySQLU.jpg"> class="size-medium wp-image-12663" alt="Percona CEO Peter Zaitsev leads a track at the inaugural Percona MySQL University event in Raleigh, N.C. on Jan. 29, 2013." src="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/01/PMySQLU-300x224.jpg" width="300" height="224" /> class="wp-caption-text">Peter Zaitsev leads a track at the inaugural Percona MySQL University event in Raleigh, N.C. on Jan. 29, 2013.

Portland is a well-recognized hub for Open Source technologies in the Northwest, home to conferences such as href="http://www.oscon.com/oscon2013">OSCON and href="http://www.opensourcebridge.org/">Open Source Bridge as well as hosts of OpenSQL Camp in 2009. As such it is a very natural place for our next href="http://www.percona.com/news-and-events/percona-mysql-university/portland-oregon-2013">Percona MySQL University event scheduled for June 17.

We run this event in partnership with href="http://www.meetup.com/Portland-MySQL-User-Group-PDX-MUG/">MySQL Meetup at Portland organized by our own href="http://www.percona.com/about-us/our-team/daniel-nichter" >Daniel Nichter, who recently moved to the area.

Percona MySQL University is a daylong, free, fast-paced and very technical MySQL educational event for wide range of people interested in MySQL – Developers, System Administrators, DBAs, etc. It will be held at Portland State University’s href="http://www.pdx.edu/conferences/smith-memorial-student-union" >Smith Memorial Student Union.

We’ll finalize the schedule next week and still have some speaking opportunities available – if you would like to share your MySQL story at this event please email href="mailto:matthew.dowell@percona.com">Matthew Dowell by Tuesday, May 28.

If you’re not in Portland and would like Percona MySQL University to come to your city, please href="http://form.percona.com/Percona_MySQL_University_Interest.html">fill out the form to let us know. We’ll try to come to the cities showing greatest interest.

As usual space is limited, so href="http://www.percona.com/news-and-events/percona-mysql-university/portland-oregon-2013">Register Now!

The post href="http://www.mysqlperformanceblog.com/2013/05/22/percona-mysql-university-portland-june-17-2013/">Percona MySQL University @Portland: June 17 appeared first on href="http://www.mysqlperformanceblog.com/">MySQL Performance Blog.

May
22
2013
--

MySQL and the SSB – Part 2 – MyISAM vs InnoDB low concurrency

This blog post is part two in what is now a continuing series on the Star Schema Benchmark.

In my  href="http://www.mysqlperformanceblog.com/2013/03/11/mysql-5-6-vs-5-5-on-the-star-schema-benchmark/" >previous blog post I compared MySQL 5.5.30 to MySQL 5.6.10, both with default settings using only the InnoDB storage engine.  In my testing I discovered that innodb_old_blocks_time had an effect on performance of the benchmark.  There was some discussion in the comments and I promised to follow up with more SSB tests at a later date.

I also promised more low concurrency SSB tests when Peter href="http://www.mysqlperformanceblog.com/2013/03/27/why-mysql-performance-at-low-concurrency-is-important/">blogged about the importance of performance at low concurrency.

The SSB /> The SSB tests a database’s ability to optimize queries for a star schema. A star schema presents some unique challenge to the database optimizer. The SSB benchmark consists of four sets of queries. Each set is known as a “flight”. I have labeled each query as Q{FLIGHT_NUMBER}.{QUERY_NUMBER}. In general, each flight examines different time periods or different regions. The flights represent the type of investigations and drill-downs that are common in OLAP analysis.

Each query in each flight (Q1.1 for example) is tested with a cold buffer pool. Then the query is tested again without restarting the database. The first test is described as the cold test, and the second as the hot test. The database software is restarted after the hot test. All OS caches are dropped at this time as well.

These set of queries were tested on the SSB at SCALE FACTOR: 20. This means there is approximately 12GB of data in the largest table.

You can find the individual SSB query definitions href="http://www.mysqlperformanceblog.com/?p=15287">in my previous blog post.

Test environment /> These tests were done on a relatively fast machine with a Xeon E5-2680 (8 cores, 16 threads) with fast IO (OCZ R4 1.6TB) and 128GB memory. For the hot test, the data fits in the buffer pool and has been loaded by the cold test already. The buffer pool and adaptive hash index are cold for the cold test. All tests were done with no concurrency. The hardware for this test was provided by href="http://www.adotomi.com/">Adotomi. I will be blogging about raw performance of the OCZ card in another post.

Also, while it is labeled on the graphs, it is important to note that in all cases, lower times are better.

SSB Flight #1 /> Here you will see the start of an interesting trend. MyISAM is faster when the data is not cached (the cold run) but is slower in the hot (cached) run. I did some investigation during the testing and found that InnoDB does more IO than MyISAM when the database is cold, but uses less CPU time when the database is hot. I am only speculating (and I can investigate further), but I believe the adaptive hash index is improving performance of InnoDB significantly during the hot run, as hash indexes are faster than a b-tree index. Also accessing pages from the buffer pool should be faster than getting them from the OS cache, which is another advantage of InnoDB.

 

 

 

/> href="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/05/image009.png"> alt="image009" src="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/05/image009.png" width="482" height="290" />
 

 

 

 

 

 

/> href="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/05/image001.png"> alt="image001" src="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/05/image001.png" width="482" height="290" />
 

 

 

SSB Flight #2 /> Flight #2 is similar to Flight #1. MyISAM is faster than InnoDB when the database is cold, but the opposite is true when the database is hot.

 

 

/> href="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/05/image012.png"> alt="image012" src="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/05/image012.png" width="482" height="290" />
 

 

 

 

 

 

/> href="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/05/image003.png"> alt="image003" src="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/05/image003.png" width="482" height="290" />
 

 

 

 

SSB Flight #3 /> Here in some cases MyISAM is substantially faster than InnoDB both cold and hot.

 

 

/> href="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/05/image014.png"> alt="image014" src="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/05/image014.png" width="482" height="290" />
 

 

 

 

 

 

/> href="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/05/image005.png"> alt="image005" src="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/05/image005.png" width="482" height="290" />
 

 

 

 

SSB Flight #4 /> There is one query in this flight, Q4.3, which is faster using MyISAM than InnoDB. Like the queries in Flight #3 that are faster using MyISAM, Q4.3 examines very little data. It seems that InnoDB performs better when a larger number of rows must be joined together (Q4.1, Q4.2) but worse when small amounts of data are examined.

 

 

/> href="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/05/image016.png"> alt="image016" src="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/05/image016.png" width="482" height="290" />
 

 

 

 

 

 

/> href="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/05/image007.png"> alt="image007" src="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/05/image007.png" width="482" height="290" />
 

 

 

Conclusion

In some cases MyISAM is faster than InnoDB, but usually only when the buffer pool is cold. Please don’t take away that you should be using MyISAM for everything!. MyISAM may be good for raw performance, but there are limitations which MyISAM imposes that are difficult to work with.  MyISAM does not maintain checksum consistency during regular operations and is not ACID compliant. MyISAM and InnoDB may perform differently under concurrency, which this benchmark does not cover. I will make a follow-up post about concurrency in another blog post in this series. Regardless, when the working set fits in memory, InnoDB almost always performs better, at least for this workload.

Notes

MySQL version used: 5.6.11, custom compiled to remove performance_schema

For the InnoDB tests, a 64GB buffer pool was used. O_DIRECT was used so, there was no caching of data at the filesystem level. The InnoDB indexes were built using ALTER TABLE fast index creation (merge sort).

For the MyISAM tests I used a 10GB key buffer. I used ALTER TABLE DISABLE KEYS and built the keys with sort via ALTER TABLE ENABLE KEYS. /> my.cnf

[mysqld]
datadir=/mnt/mysql56/data
basedir=/usr/local/mysql
socket=/var/lib/mysql/mysql.sock
user=justin
innodb_buffer_pool_size=64G
innodb_log_file_size=4G
innodb_file_per_table
innodb_stats_on_metadata=off
innodb_file_format=barracuda
innodb_log_buffer_size=32M
innodb_buffer_pool_instances=16
metadata_locks_hash_instances=32
table_open_cache_instances=8
sort_buffer_size=128k
read_rnd_buffer_size=8M
join_buffer_size=8M
default_tmp_storage_engine=myisam
tmpdir=/dev/shm
innodb_undo_logs=32
innodb_old_blocks_time=0
table_open_cache=2048
table_definition_cache=16384
innodb_flush_method=O_DIRECT
key_buffer_size=10G
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
innodb_stats_persistent
innodb_stats_auto_update=off
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

The post href="http://www.mysqlperformanceblog.com/2013/05/22/mysql-and-the-ssb-part-2-myisam-vs-innodb-low-concurrency/">MySQL and the SSB – Part 2 – MyISAM vs InnoDB low concurrency appeared first on href="http://www.mysqlperformanceblog.com/">MySQL Performance Blog.

May
21
2013
--

Replication in MySQL 5.6: GTIDs benefits and limitations – Part 1

href="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/05/data_replication2.jpg"> class="alignleft wp-image-15554" style="margin-left: 9px; margin-right: 9px;" alt="GTID-based replication" src="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/05/data_replication2-300x204.jpg" width="270" height="184" />Global Transactions Identifiers are one of the new features regarding replication in MySQL 5.6. They open up a lot of opportunities to make the life of DBAs much easier when having to maintain servers under a specific replication topology. However you should keep in mind some limitations of the current implementation. This post is the first one of a series of articles focused on the implications of enabling GTIDs on a production setup.

The href="http://dev.mysql.com/doc/refman/5.6/en/replication-gtids-howto.html" >manual describes very nicely how to switch to GTID-based replication, I won’t repeat it.

Basically the steps are:

  • Make the master read-only so that the slaves can execute all events and be in sync with the master
  • Change configuration for all servers and restart them
  • Use CHANGE MASTER TO to instruct all servers to use GTIDs
  • Disable read-only mode

This procedure will switch all your servers from regular replication to GTID replication. But if you are running a production system, you will probably want to gradually enable GTID replication for an easier rollback in the event of a problem. And some items in the documentation are not so clear.

For instance:

  • Do we really need to restart all the servers at the same time? Downtime is something we like to avoid!
  • Is it necessary to make the master read-only?
  • Can we use regular replication for some slaves and GTID replication for other slaves at the same time?

To find an answer to these questions, let’s create a simple replication configuration with one master and two slaves, all running MySQL 5.6 with GTIDs disabled.

First try: configure only one of the servers with GTIDs

Let’s stop slave #2, change configuration and restart it:

mysql> show slave status\G
[...]
Slave_IO_Running: No
Slave_SQL_Running: Yes
          [...]

The error log tells us why the IO thread has not started:

2013-05-17 13:21:26 3130 [ERROR] Slave I/O: The slave IO thread stops because the master has GTID_MODE OFF and this server has GTID_MODE ON, Error_code: 1593

So unfortunately if you want replication to work correctly, gtid_mode must be ON on all servers or OFF on all servers, but not something in the middle.

What if we try to reconfigure the master? This time, replication on slave #1 will stop:

2013-05-17 13:32:08 2563 [ERROR] Slave I/O: The slave IO thread stops because the master has GTID_MODE ON and this server has GTID_MODE OFF, Error_code: 1593

These simple tests answer the first two questions: replication works only if all servers have the same value for gtid_mode, so you should restart them at the same time, which is best done by making the master read-only. However, “at the same time” means “at the same binlog position”, so you can perfectly restart the servers one by one.

Second try: GTIDs enabled, mixing regular replication and GTID replication

This time, we will enable GTID replication on slave #1, but not on slave #2:

# slave #1
mysql> change master to master_auto_position = 1;
mysql> start slave;

and let’s create a new table on the master:

mysql> create table test.t (id int not null auto_increment primary key);

Executing SHOW TABLES FROM test on both slaves shows that the table has been created everywhere. So once GTIDs are enabled on all servers, you can have some slaves using file-based positioning and some other slaves using GTID-based positioning.

This answers the second question: we can have different replication modes on different servers, but only if all servers have gtid_mode set to ON. Could it be interesting to run file-based replication when gtid_mode is ON? I can’t think of any use case, so in practice, you’ll probably use either file-based replication only (gtid_mode=off for all servers) or GTID-based replication only (gtid_mode=on for all servers).

Additional question: how can you know if a slave is using GTID-based replication by inspecting the output of SHOW SLAVE STATUS? Look at the last field, Auto_Position:

# Slave #1
mysql> show slave status\G
[...]
Auto_Position: 1  -> GTID-based positioning
# Slave #2
mysql> show slave status\G
[...]
Auto_Position: 0  -> File-based positioning

Conclusion

Enabling GTID-based replication can be tricky if your application does not easily tolerate downtime or read-only mode, especially if you have a lot of servers to reconfigure. It would be really nice to be able to mix servers where gtid_mode is ON with servers where gtid_mode is OFF. This would greatly simplify the transition to GTID-based replication and allow easier rollbacks if something goes wrong.

The post href="http://www.mysqlperformanceblog.com/2013/05/21/replication-in-mysql-5-6-gtids-benefits-and-limitations-part-1/">Replication in MySQL 5.6: GTIDs benefits and limitations – Part 1 appeared first on href="http://www.mysqlperformanceblog.com/">MySQL Performance Blog.

May
21
2013
--

Training and Conference Dates

A few weeks ago I invited you to take part in a survey about your interest in SQL performance training for developers. In the meanwhile there is a schedule for German and English trainings available. In particular, I’d like to point out four online courses I’m giving during summer time. Hope to see you there.

Another opportunity for a short get-together are conferences I’ll attend and/or speak at. The next one is the Prague PostgreSQL Developers’ Day (p2d2) next Thursday. You can buy SQL Performance Explained there (CZK 700; in the breaks and after the conference). The next conference that I can already confirm is this years PostgreSQL Conference Europe in Dublin end of October. You might have noticed that I attended a lot of PostgreSQL conferences recently (Brussels in February, Paris in March). I do plan to attend other conferences too and I’ve just filed some proposals for talks at other conferences. I’ll let you know if they are accepted.

One more thing: in case you are involved in the organization of developer and/or database centric event—no matter how small—you might want to have a look at the small sponsoring I can offer.

Original title and author: “Training and Conference Dates” by Markus Winand.

May
20
2013
--

Webinar: SQL Query Patterns, Optimized

href="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/02/Percona-MySQL-Webinars.jpg"> class="alignleft wp-image-12964" alt="Using MySQL 5.6 Performance Schema to Troubleshoot Typical Workload Bottlenecks" src="http://www.mysqlperformanceblog.com/wp-content/uploads/2013/02/Percona-MySQL-Webinars-285x300.jpg" width="171" height="180" />Next Friday, May 31 at 10 a.m. Pacific, I’ll present Percona’s next webinar, “ href="http://www.percona.com/webinars/mysql-query-patterns-optimized">SQL Query Patterns, Optimized.”

Based on my experiences solving tough SQL problems for href="http://www.percona.com/training">Percona training and href="http://www.percona.com/mysql-consulting/overview">consulting, I’ll classify several common types of queries with which developers struggle. I’ll test several SQL solutions for each type of query objective, and show how you can use MySQL 5.6 built-in methods to analyze them for optimal query efficiency.  The discussion will cover optimizer reports, query profiling, and session status to measure performance.

The query patterns will include:

  • Exclusion Join
  • Random Selection
  • Greatest-Per-Group
  • Dynamic Pivot
  • Relational Division

Please href="http://www.percona.com/webinars/mysql-query-patterns-optimized">register for this webinar and join me next Friday!

The post href="http://www.mysqlperformanceblog.com/2013/05/20/webinar-sql-query-patterns-optimized/">Webinar: SQL Query Patterns, Optimized appeared first on href="http://www.mysqlperformanceblog.com/">MySQL Performance Blog.

Powered by WordPress | Theme: Aeros 2.0 by TheBuckmaker.com