<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Grep My Mind &#187; mysql08</title>
	<atom:link href="http://www.grepmymind.com/tags/mysql08/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.grepmymind.com</link>
	<description>Wonder what’s on my mind? Now you know.</description>
	<lastBuildDate>Wed, 14 Oct 2009 22:20:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>MySQL Conf 2008 &#8211; MySQL Proxy (Day 4)</title>
		<link>http://www.grepmymind.com/2008/04/21/mysql-conf-2008-mysql-proxy-day-4/</link>
		<comments>http://www.grepmymind.com/2008/04/21/mysql-conf-2008-mysql-proxy-day-4/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 22:40:10 +0000</pubDate>
		<dc:creator>Michael Tougeron</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql proxy]]></category>
		<category><![CDATA[mysql08]]></category>
		<category><![CDATA[mysqlconf08]]></category>

		<guid isPermaLink="false">http://www.grepmymind.com/?p=58</guid>
		<description><![CDATA[MySQL Proxy is one of the new products that MySQL released this year that has some real promise. In the MySQL Proxy, the Friendly Man in the Middle session Jan Kneschke went over the existing and planned features of the proxy. MySQL Proxy has a c-based event driven core that has command line support, event [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://forge.mysql.com/wiki/MySQL_Proxy">MySQL Proxy</a> is one of the new products that MySQL released this year that has some real promise.   In the <a href="http://en.oreilly.com/mysql2008/public/schedule/detail/495">MySQL Proxy, the Friendly Man in the Middle</a> session <a href="http://jan.kneschke.de/">Jan Kneschke</a> went over the existing and planned features of the proxy.</p>
<p>MySQL Proxy has a c-based event driven core that has command line support, event handling and a <a href="http://www.lua.org/">Lua</a>-based scripting layer.  The proxy is loading into MySQL via the plugin interface.  With the community edition, you are responsible for writing your own scripts.  But with <a href="http://www.mysql.com/products/enterprise/">MySQL Enterprise</a>, it will come with several pre-built scripts that add some enhanced functionality.</p>
<p>The most basic use of MySQL Proxy is to rewrite or alter your queries.  If you have a costly query that is killing your db, but you&#8217;re not sure where it is coming from, you can write a Lua script to either reject the query or to alter it and make it more manageable.  It stops the dba from having to wait for a developer to update code and/or deploy the fix.</p>
<p>Another trick you can do with MySQL Proxy is to create new SQL commands.  While this is probably not going to be a great idea, you can see a few interesting examples at <a href="http://thenoyes.com/littlenoise/?p=63">http://thenoyes.com/littlenoise/?p=63</a>.  It is a good way to expand on functionality at the lowest level.  Or to lose/forget where you put it when you switch to another db.  <img src='http://www.grepmymind.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><span id="more-27"></span></p>
<p>One of the features MySQL was thinking of when they built MySQL Proxy is the ability to manage your queries at the database level.  Imagine tracking query quotas, by ip, user, db, etc., then rejecting queries automatically if over quota.  Or perhaps to simulate a db outage or transaction failure when testing code to ensure properly fail-over or error handling.</p>
<p>One of the default Lua scripts that comes with MySQL Proxy is a basic <a href="http://en.wikipedia.org/wiki/Load_balancing_(computing)">load balancer</a> for the db.  It rotates the connections round-robin betweeen the MySQL servers.  Since it is in the database layer, it can be aware of slag lag and adjust the rotation accordingly.  Since it is a Lua script, you can customize it to work how you want it to.</p>
<p>In MySQL Enterprise, this script is on steroids and does so much more.  The load balancer automatically checks the slave state, including lag, # of connections, last error, etc., and kicks the server from rotation if it finds something &#8220;wrong&#8221; with the slave.  This functionality will be integrated with MySQL Enterprise Monitor so that you will have an easy view into how the load balancer is working.</p>
<p>Also for Enterprise, the MySQL team is working on an automated sharding algorithm to go with <a href="http://dev.mysql.com/doc/refman/5.1/en/partitioning.html">MySQL 5.1&#8242;s table partitioning</a>.  I&#8217;m not sure how easy that will be to implement, but if they are able to pull it off, I&#8217;ll be mighty happy.  At least for basic partitioning or sharding, like with a user table, you could do it through MySQL Proxy without having to worry about missing an update someplace in your code.  If you combine this with logging, you can update your code at your leisure and easily find the queries you missed without having to worry about breaking the site.</p>
<p>Other planned improvements include being able to run parallel queries, two-phased commits and syncronyous replication.  Since the proxy is not the database engine, it can use multiple cores on a server and assign out queries and other processes in ways that the db engine you are using cannot.</p>
<p>This is still very new technology/product for MySQL, but I&#8217;m looking forward to what comes out of it.  There is a lot of possibility in it, as well as the potential for bloat.  Personally, I think it will end up back as MySQL core so that the engines can take advantage of some of the Proxy abilities.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.grepmymind.com/2008/04/21/mysql-conf-2008-mysql-proxy-day-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Conf 2008 &#8211; Maria Engine (Day 3)</title>
		<link>http://www.grepmymind.com/2008/04/17/mysql-conf-2008-maria-engine-day-3/</link>
		<comments>http://www.grepmymind.com/2008/04/17/mysql-conf-2008-maria-engine-day-3/#comments</comments>
		<pubDate>Thu, 17 Apr 2008 18:53:07 +0000</pubDate>
		<dc:creator>Michael Tougeron</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[Maria]]></category>
		<category><![CDATA[myisam]]></category>
		<category><![CDATA[mysql08]]></category>
		<category><![CDATA[mysqlconf08]]></category>

		<guid isPermaLink="false">http://www.grepmymind.com/?p=57</guid>
		<description><![CDATA[Wednesday afternoon Monty went through the Architecture of Maria, what the new features are and what its roadmap will be. For those of you who are not aware of Maria, it is a new db engine that Monty announced back in January. Maria was designed to be a crash-safe replacement for MyISAM. Maria supports the [...]]]></description>
			<content:encoded><![CDATA[<p>Wednesday afternoon <a href="http://monty-says.blogspot.com/">Monty</a> went through the <a href="http://en.oreilly.com/mysql2008/public/schedule/detail/521">Architecture of Maria</a>, what the new features are and what its roadmap will be.  For those of you who are not aware of <a href="http://dev.mysql.com/doc/refman/5.1-maria/en/se-maria.html">Maria</a>, it is a new db engine that <a href="http://monty-says.blogspot.com/2008/01/maria-engine-is-released.html">Monty announced</a> back in January.</p>
<p>Maria was designed to be a crash-safe replacement for <a href="http://dev.mysql.com/doc/refman/5.1/en/myisam-storage-engine.html">MyISAM</a>.  Maria supports the same row formats and features as MyISAM.  This means it can be fully compatible with MyISAM by simply running it in non-transactional control.  It will be ACID compliant and have multi-version concurrency control (MVCC).</p>
<p><span id="more-26"></span></p>
<p>Version 1.0 of Maria was released in January as a <a href="http://dev.mysql.com/downloads/maria/index.html">branch of MySQL</a>.  It will continue to be a branch until version 2.0 where it will hopefully be part of MySQL 6.  Customized documentation is also available on <a href="http://dev.mysql.com/doc/refman/5.1-maria/en/se-maria.html">http://dev.mysql.com/doc/refman/5.1-maria/en/se-maria.html</a>.</p>
<p>Version 1.5 of Maria should be released any week now.  Monty had originally hoped to announce it this week at the conference, but it is not quite done yet.  He says that it should be out sometime between Late April to mid-May.  Starting with version 1.5, Maria will support concurrent INSERT and SELECT operation.  This will give Maria a nice feature merge between InnoDB and MyISAM.</p>
<p>Starting with MySQL 6 in Q4 of 2008, version 2 of Maria will be fully transactional and ACID compliant.  Having the crash recovery will be a great thing to have with the read speed of MyISAM.  Version 3 will be optimized for higher concurrency.</p>
<p>With the expected small footprint and the efficient data storage model, Maria will be a good engine of choice for desktop applications or embedding in applications.</p>
<p>The way in which Maria is crash-safe is kind of interesting.  It stores everything except table definitions into log files.  While these log files can be quite large, starting size is 1GB, it creates a few cool features.  With MyISAM tables, you can apply a lock to the db (or shutdown the server) and then copy the data to a new server.  With Maria, you can simply copy the data and the logs to the new server.  Like with MyISAM, the new server will have corrupted tables.  Unlike MyISAM, Maria will then run through the logs and recover the db to where it should be.  Or, if you don&#8217;t like that method, you can take last night&#8217;s backup to the new server, copy just today&#8217;s logs from the donor server and start up MySQL.  Maria will take the data from the backup and then automatically apply the logs until the new server is up-to-date.</p>
<p>There is quite a list of features that are either already in Maria or will be by the time version 3 comes out.</p>
<ul>
<li>MVCC &amp; ACID</li>
<li>Equal lookup speed for all indexes</li>
<li>Allows easy copying of tables and/or Maria logs</li>
<li>Has instant COUNT(*) queries</li>
<li>Better BLOG handling than MyISAM</li>
<li>Versioned</li>
<li>Crash safe</li>
<li>Data stored in 8k pages for less locking and improved query performance</li>
</ul>
<p>By using 8k pages Maria will be faster on static size indexes than MyISAM, but slower on variable length keys.  Updates that are planned for version 2 or 3 will make variable length indexes just as fast.</p>
<p>There are a few disadvantages of Maria over MyISAm.</p>
<ul>
<li>No INSERT DELAYED (may or may not eventually be added)</li>
<li>Fulltext indexes are not yet crash-safe (planned to be fixed in version 3)</li>
<li>No external locking</li>
<li>Like MyISAM it will not support RAID</li>
<li>When using checksums, the data size will be slightly larger for indexes</li>
<li>Storage of very small rows (&lt;25 bytes) are not efficient with the new page format</li>
</ul>
<p>All in all, I&#8217;m pretty excited about where they are going with Maria.  While some of the databases I use are write heavy the vaste majority are primarily reads; there are only so many news stories a day.  I looks like Maria will give us the stability and locking abilities of InnoDB while keeping the speed of MyISAM reads.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.grepmymind.com/2008/04/17/mysql-conf-2008-maria-engine-day-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Conf 2008 &#8211; Applied Partitioning (Day 3)</title>
		<link>http://www.grepmymind.com/2008/04/16/mysql-conf-2008-applied-partitioning-day-3/</link>
		<comments>http://www.grepmymind.com/2008/04/16/mysql-conf-2008-applied-partitioning-day-3/#comments</comments>
		<pubDate>Thu, 17 Apr 2008 03:46:42 +0000</pubDate>
		<dc:creator>Michael Tougeron</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql08]]></category>
		<category><![CDATA[mysqlconf08]]></category>
		<category><![CDATA[partitioning]]></category>

		<guid isPermaLink="false">http://www.grepmymind.com/?p=56</guid>
		<description><![CDATA[The Applied Partitioning and Scaling Your Database System session by Phil Hildebrand appears to be a very popular session. The line outside the door was more of a crowd than a line. The talk was about the new partitioning abilities of MySQL 5.1. The new table partitioning system has several benefits for your large datasets [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://en.oreilly.com/mysql2008/public/schedule/detail/133">Applied Partitioning and Scaling Your Database System</a> session by <a href="http://theplatform.com/">Phil Hildebrand</a> appears to be a very popular session.  The line outside the door was more of a crowd than a line.  The talk was about the new <a href="http://dev.mysql.com/doc/refman/5.1/en/partitioning.html">partitioning abilities of MySQL 5.1</a>.</p>
<p>The new table partitioning system has several benefits for your large datasets where you are having performance issues due to the volume of data.  It can reduce the seek &amp; scan set sizes and reduce the INSERT/UPDATE transaction durations.  If you are already performing UNION queries or secondary queries to find data in an archive table, this functionality may be for you.</p>
<p>There are four (point 5) partitioning styles available for your use:</p>
<ol>
<li><a href="http://dev.mysql.com/doc/refman/5.1/en/partitioning-range.html">Range </a>
<ul>
<li>Very useful for situations where the data is accessed by date</li>
<li>Usually used when a limited number of primary partitions are needed</li>
<li>It supports sub-partitions (the .5 partition type)</li>
</ul>
</li>
<li><a href="http://dev.mysql.com/doc/refman/5.1/en/partitioning-list.html">List </a>
<ul>
<li>Good for when you are grouping data in partitions out of order (e.g., SELECT 1,5,7 in partition X)</li>
</ul>
<ul>
<li>As the name implies, you list which data goes into which partition</li>
<li>Higher maintenance costs in many situations</li>
<li>Supports sub-partitions</li>
</ul>
</li>
<li><a href="http://dev.mysql.com/doc/refman/5.1/en/partitioning-hash.html">Hash </a>
<ul>
<li>Usually has a lower maintenance cost</li>
<li>Partitions the data based on the hash that you tell it</li>
<li>Good for when you have non-intelligent keys</li>
<li>Works with both a limited and a large number of Partitions</li>
</ul>
</li>
<li><a href="http://dev.mysql.com/doc/refman/5.1/en/partitioning-key.html">Key </a>
<ul>
<li>Similar to Hash partitioning, but based on one or more of the fields in the primary key instead of a user-defined hash</li>
<li>If there is no primary key, then the first unique index is used</li>
<li>Does not require the key to be integer based</li>
</ul>
</li>
<li><a href="http://dev.mysql.com/doc/refman/5.1/en/partitioning-subpartitions.html">Subpartitions </a>
<ul>
<li>As the name implies, a partition within a partition</li>
<li>You can only create subpartitions for Range &amp; List</li>
<li>If needed, subpartitions can be spread across volumes</li>
</ul>
</li>
</ol>
<p>The alter table statements are fairly simplistic; &#8220;ALTER TABLE my_table PARTITION BY KEY() PARTITIONS 50&#8243; will create 50 partitions for that table.  If you need to add more partitions, you can just run &#8220;ALTER TABLE my_table ADD PARTITION PARTITIONS 25&#8243; and your table will now have 75 partitions.  Of course you can shrink the size of the partitions as well.  One of the nice features of the partition modification is that the data is re-allocated as appropriate.</p>
<p>All in all, this looks like a much better solution than the standard 10/90 tables.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.grepmymind.com/2008/04/16/mysql-conf-2008-applied-partitioning-day-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Conf 2008 &#8211; MySQL Sandbox (Day 3)</title>
		<link>http://www.grepmymind.com/2008/04/16/mysql-conf-2008-mysql-sandbox-day-3/</link>
		<comments>http://www.grepmymind.com/2008/04/16/mysql-conf-2008-mysql-sandbox-day-3/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 21:42:32 +0000</pubDate>
		<dc:creator>Michael Tougeron</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql sandbox]]></category>
		<category><![CDATA[mysql08]]></category>
		<category><![CDATA[mysqlconf08]]></category>

		<guid isPermaLink="false">http://www.grepmymind.com/?p=55</guid>
		<description><![CDATA[This morning&#8217;s first session is hosted by Giuseppe Maxia about MySQL Sandbox. This tool was created so that you can quickly &#38; easily setup sandbox servers for testing MySQL. It installs side servers on a machine that is already running MySQL. Sandbox installs quickly without disturbing the existing MySQL installation. The home for the MySQL [...]]]></description>
			<content:encoded><![CDATA[<p>This morning&#8217;s first session is hosted by <a href="http://datacharmer.org/">Giuseppe Maxia</a> about <a href="http://en.oreilly.com/mysql2008/public/schedule/detail/311">MySQL Sandbox</a>.  This tool was created so that you can quickly &amp; easily setup sandbox servers for testing MySQL.  It installs side servers on a machine that is already running MySQL.  Sandbox installs quickly without disturbing the existing MySQL installation.</p>
<p>The <a href="http://sourceforge.net/projects/mysql-sandbox/">home for the MySQL Sandbox project</a> is hosted on <a href="http://www.sourceforget.net/">SourceForge.net</a>.  It is not an officially supported product which is why Giuseppe keeps it on SourceForge.</p>
<p>The Sandbox was designed so that you don&#8217;t have to go through the hassle, and potentially error prone, steps of setting up multiple sandbox databases.  It&#8217;s very common for these manual installations to accidentally install in the same data directory (can corrupt your data) or install with the same port/socket (MySQL won&#8217;t start).</p>
<p>Details of installing and using after the break&#8230;<span id="more-24"></span></p>
<p>The simple installation steps for MySQL Sandbox automatically creates a new instance of MySQL with a sandboxed data directory, port, and socket.  In order to use Sandbox&#8217;s express_install script you need to download and un-tar a copy of MySQL for each version you wish to install.  The script by default uses $HOME/opt/mysql as its base directory so be sure to extract MySQL there.  You can change the default source directory, but by being in your home directory it helps keep your instance separate from everyone else&#8217;s.</p>
<p>Next download and extract the MySQL Sandbox from SourceForge and run the following:<br />
./express_install.pl {directory in $HOME/opt/mysql}<br />
If you prefer, you can run ./express_install.pl /path/to/mysql/directory</p>
<p>You can setup replication or multiple instances by ./set_replication.pl and ./set_custom_many.pl respectively.  You also have a variety of install options that can be found by adding &#8211;help to the commands.</p>
<p>One of the nice commands you can use once the sandbox is setup and running is &#8220;clear.&#8221;  This command will reset the data and instance back to default so that you can start again from scratch.  Running the &#8220;use&#8221; command will get you into the <a href="http://en.wikipedia.org/wiki/Command_line_interface">CLI</a> of the appropriate instance.  One thing to keep in mind is that the commands to interact with the sandboxes must be run from the installed directory.  You also have access to some of the standard MySQL command line tools by running &#8220;my {sqldump|sqlbinlog|sqladmin}&#8221; (Note the space after my).</p>
<p>It seems like this would be a good system to use in conjunction with <a href="http://www.phpunit.de/wiki/TestDatabase">DBUnit</a>.  As I <a href="http://www.grepmymind.com/2008/04/15/mysql-conf-2008-phpdbunit-day-2/">talked about yesterday</a>, DBUnit can auto-load/populate data.  By putting the two together you should have a very maintainable and separate testing environment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.grepmymind.com/2008/04/16/mysql-conf-2008-mysql-sandbox-day-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Conf 2008 &#8211; InnoDB (Day 2)</title>
		<link>http://www.grepmymind.com/2008/04/15/mysql-conf-2008-innodb-day-2/</link>
		<comments>http://www.grepmymind.com/2008/04/15/mysql-conf-2008-innodb-day-2/#comments</comments>
		<pubDate>Tue, 15 Apr 2008 22:06:30 +0000</pubDate>
		<dc:creator>Michael Tougeron</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[InnoDB]]></category>
		<category><![CDATA[mysql08]]></category>
		<category><![CDATA[mysqlconf08]]></category>

		<guid isPermaLink="false">http://www.grepmymind.com/?p=52</guid>
		<description><![CDATA[A new version for InnoDB was announced today. During the InnoDB: Fast, Reliable, Proven Transactional Storage for MySQL session Heikki Tuuri and Ken Jacobs (Heikki&#8217;s handler) went over the changes and improvements. InnoDB is now using MySQL 5.1&#8242;s plugin API and has some very cool/interesting new features, including: Fast index creation &#8211; Add/drop indexes without [...]]]></description>
			<content:encoded><![CDATA[<p>A new version for <a href="http://www.innodb.com/wp/2008/04/15/innodb-plugin-announced/">InnoDB</a> was announced today.  During the <a href="http://en.oreilly.com/mysql2008/public/schedule/detail/2257">InnoDB: Fast, Reliable, Proven Transactional Storage for MySQL</a> session Heikki Tuuri and Ken Jacobs (Heikki&#8217;s handler) went over the changes and improvements.  InnoDB is now using <a href="http://dev.mysql.com/doc/refman/5.1/en/plugin-api.html">MySQL 5.1&#8242;s plugin API</a> and has some very cool/interesting new features, including:<br />
<a href="http://www.grepmymind.com/2008/04/15/mysql-conf-2008-innodb-day-2/#fastindex">Fast index creation</a> &#8211; Add/drop indexes without copying the data.<br />
<a href="http://www.grepmymind.com/2008/04/15/mysql-conf-2008-innodb-day-2/#datacompression">Data compression</a> &#8211; Significantly reduces storage size &amp; I/O by shrinking the tables.<br />
<a href="http://www.grepmymind.com/2008/04/15/mysql-conf-2008-innodb-day-2/#rowformat">New row format</a> &#8211; Off-page storage of large data elements like BLOB, TEXT, etc.</p>
<p>The new format of InnoDB can be dynamically installed w/o re-linking MySQL, which should be pretty handy for people who cannot easily re-build MySQL.  The InnoDB upgrade is fully compatible with existing InnoDB tables and can even be downgraded back to the old version if you need to.</p>
<p>Installation is a breeze and can be done by downloading, extracting the ha_innodb.so into the MySQL Server plugin directory, and then restarting the mysqld.  Be sure to enable &#8220;skip_innodb&#8221; in the my.cnf so that it doesn&#8217;t conflict with the engine already in MySQL.  The innodb_file_format is now Barracuda.  Finally log into the cli and &#8220;INSTALL PLUGIN INNODB SONAME &#8216;ha_innodb.so&#8217;&#8221; and &#8220;INSTALL PLUGIN INNODB_LOCKS SONAME &#8216;ha_innodb.s&#8217;&#8221;</p>
<p><span id="more-23"></span></p>
<p>MySQL/InnoDB 5.1 rebuilds the entire table row by row when creating a new index.  The InnoDB Plugin builds just the new index.  DROP INDEX for secondary indexes has improved performance as well because it only changes the data dictionary.  When changing the PRIMARY KEY or FOREIGN KEYs it still needs to rebuild the table; it&#8217;s faster then 5.1.</p>
<p>Any C/U/D style queries will wait on the index creation, but SELECTs will still go through in shared mode.  Newly created indexes lack the historical version info for row (for only that index).  This can affect consistent read SELECTs of older transactions.</p>
<p>According the benchmarks that <a href="http://www.mysqlperformanceblog.com/">Peter Zaitsev</a> performed, creating a new index on a 3GB table it takes 88 minutes with version 5.1 and an amazing <strong>8 minutes</strong> with the new InnoDB plugin.</p>
<p>With the new table compression you can choose the compressed page size on a per table basis.   In order to use this functionality, you need to have innodb_file_per_table = 1 and innodb_file_format = barracuda.  The patterns in the data will determine your compression rate.  According to Heikki, it can often be &gt;50%. Both the tables <em>and</em> the indexes are compressed using zlib.  It now trys to do updates and inserted in small sets so that it does not need to recompress when the data is updated.  Deletions do not require page recreation.If the page is frequently accessed, it will keep it uncompressed.  It is important to monitoring the compress vs uncompressed rates in the INFORMATION_SCHEMA.  As few as 1% unsuccessful compression operations wastes your cpu time.</p>
<p>The best time to use compression is when you are I/O bound.  If you are cpu-bound, then it is not a good idea to use compression as it will spend even more cpu time compressing and uncompressing.  As a test, you can gzip your .ibd data file and see what level of compression you get.  If it does not compress to significantly less than 50% of the original size, it probably won&#8217;t be worth doing.</p>
<p><a name="rowformat"></a></p>
<p>The new ROW_FORMAT = DYNAMIC also requires the Baricuda file format.  It is meant for situations when you have a table with a lot of large data elements like BLOB or TEXT.  Now InnoDB can store the data off-page.</p>
<p>With the INFORMATION_SCHEMA updates, you can now find out much more information about the status of InnoDB and the individual tables.  You can even now easily find the blocking queries and which process id is the owner.  This should be a great help to DBAs who need to manage large sets of InnoDB databases.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.grepmymind.com/2008/04/15/mysql-conf-2008-innodb-day-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Conf 2008 &#8211; PHP/DBUnit (Day 2)</title>
		<link>http://www.grepmymind.com/2008/04/15/mysql-conf-2008-phpdbunit-day-2/</link>
		<comments>http://www.grepmymind.com/2008/04/15/mysql-conf-2008-phpdbunit-day-2/#comments</comments>
		<pubDate>Tue, 15 Apr 2008 20:50:39 +0000</pubDate>
		<dc:creator>Michael Tougeron</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[dbunit]]></category>
		<category><![CDATA[mysql08]]></category>
		<category><![CDATA[mysqlconf08]]></category>
		<category><![CDATA[phpunit]]></category>

		<guid isPermaLink="false">http://www.grepmymind.com/?p=51</guid>
		<description><![CDATA[I started off the day today listening to the keynotes at the MySQL Conference. Unfortunately I had to work on something so I wasn&#8217;t able to really pay attention. I hope I didn&#8217;t miss anything important. After the keynotes, I decided to start off with the Testing PHP/MySQL Applications with PHPUnit/DbUnit session by Sebastian Bermann. [...]]]></description>
			<content:encoded><![CDATA[<p>I started off the day today listening to the keynotes at the MySQL Conference.  Unfortunately I had to work on something so I wasn&#8217;t able to really pay attention.  <img src='http://www.grepmymind.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />   I hope I didn&#8217;t miss anything important.</p>
<p>After the keynotes, I decided to start off with the <a href="http://en.oreilly.com/mysql2008/public/schedule/detail/165">Testing PHP/MySQL Applications with PHPUnit/DbUnit</a> session by <a href="http://sebastian-bergmann.de/">Sebastian Bermann</a>.  I know I should already be using <a href="http://www.phpunit.de/">PHPUnit</a>, but honestly I&#8217;ve never gotten around to it.  I&#8217;m hoping that this will give me the kick in the ass that I need to start.  <img src='http://www.grepmymind.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p><span id="more-22"></span></p>
<p>The first thing that Sebastian wanted us to note is that the PHPUnit listed on SourceForget.net is not the real PHPUnit.  I kind of thought that weird and confusing.  You&#8217;d think by now that he could get that old project de-listed.</p>
<p>Installing PHPUnit is fairly simple.  It is not hosted off the standard PEAR channel, but by a quick extra command you can get access to it.<br />
pear channel-discover pear.phpunit.de<br />
pear install phpunit/PHPUnit</p>
<p>By setting up a reusable testing environment with PHPUnit you&#8217;ll be able to do automatic execution of your test code.  This would be good for things like over night tests of the latest code commits.  If a test fails, the developer team can be immediately notified.  Be sure to enforce strict separation between production and testing environments.  The last thing you want to happen is to have your test cases somehow break production.</p>
<p>Setting up a test case can be as simple or complex as you need it to be.  You setup a class for each element/object you need to test.  Each test case is a member function of this class where you assert value comparisons.  While the <a href="http://www.phpunit.de/pocket_guide/3.2/en/writing-tests-for-phpunit.html">documentation examples are best</a>, here is a very simple example:</p>
<pre>
&lt;?php
class BankAccountTest extends PHPUnit_Framework_TestCase {

    public function testBalanceIsInitiallyZero() {
        $ba = new BankAccount;
        $this-&gt;assertEquals(0, $ba-&gt;getBalance());
    }
}
?&gt;</pre>
<p>Where things can now start to get interesting is when you use the <a href="http://www.phpunit.de/wiki/TestDatabase">database extension</a> to PHPUnit.  The DBUnit extension was ported from <a href="http://www.junit.org/">jUnit</a> by <a href="http://www.ds-o.com/">Michael Lively Jr</a>.</p>
<p>DBUnit uses PDO to talk to a default SQLite database.  However, a database it not required as it can emulate a database in memory or via XML.  It also works with MySQL, but if the tests are written in a way that is compatible with SQLite, then the tests can be faster by about 20%.</p>
<p>Once of the nice things about how DBUnit works is how it puts the db into a known state between each test run.  This means it avoids problems with one test case corrupting the db for other tests.  By using its ability to import/export data to/from XML datasets, your db tests will run reliably and accurately.</p>
<p>Like with PHPUnit, DBUnit has assert methods like &#8220;assertTableEquals(expected, actual)&#8221; and can use PHP arrays for comparison.  This can be good for comparing records in the database.  e.g., The db gets updated via a PHPunit test and you then do a DBUnit test to verify the action.</p>
<p>A quick example of a DBUnit test case:</p>
<pre>
&lt;?php
class BankAccountTest extends PHPUnit_Extensions_Database_TestCase {
    protected $pdo;

    public function __construct() {
        $this-&gt;pdo = PHPUnit_Util_PDO::factory($dsn);
        BankAccount::createTable($this-&gt;pdo);
    }

    protected function getConnection() {
        return $tihs-&gt;createDefaultDBConnection($this-&gt;pdo, 'mysql');
    }

    protect function getDataSet() {
        return $this-&gt;createFlatXMLDataSet('/path/to/seed.xml');
    }
}
?&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.grepmymind.com/2008/04/15/mysql-conf-2008-phpdbunit-day-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Conf 2008 &#8211; Memcached (Day 1)</title>
		<link>http://www.grepmymind.com/2008/04/14/mysql-conf-2008-memcached-day-1/</link>
		<comments>http://www.grepmymind.com/2008/04/14/mysql-conf-2008-memcached-day-1/#comments</comments>
		<pubDate>Tue, 15 Apr 2008 00:24:01 +0000</pubDate>
		<dc:creator>Michael Tougeron</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[memcached]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql08]]></category>
		<category><![CDATA[mysqlconf08]]></category>

		<guid isPermaLink="false">http://www.grepmymind.com/2008/04/14/mysql-conf-2008-memcached-day-1/</guid>
		<description><![CDATA[The session I&#8217;m attending this afternoon is Memcached and MySQL: Everything You Need To Know. I&#8217;m really looking forward to this talk. For whatever geeky reason I think Memcached is the coolest. Brian Aker has put the PDF of the slides at http://download.tangent.org/talks/Memcached%20Study.pdf. The slides will be updated as time goes on so this link [...]]]></description>
			<content:encoded><![CDATA[<p>The session I&#8217;m attending this afternoon is <a href="http://en.oreilly.com/mysql2008/public/schedule/detail/1627">Memcached and MySQL: Everything You Need To Know</a>.  I&#8217;m really looking forward to this talk.  For whatever geeky reason I think <a href="http://danga.com/memcached/">Memcached</a> is the coolest.  <img src='http://www.grepmymind.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Brian Aker has put the PDF of the slides at <a href="http://download.tangent.org/talks/Memcached%20Study.pdf">http://download.tangent.org/talks/Memcached%20Study.pdf</a>.  The slides will be updated as time goes on so this link should always have the most up-to-date stuff.  In case at some point he removes them, you can find them <a title="Memcached Slides" href="http://www.grepmymind.com/wp-content/uploads/2008/04/memcached-study.pdf">attached</a>.</p>
<p>2:15pm: Talking about <a href="http://grazr.com/">Grazr</a> and how they have a daemon to do write-through cache.  Now talking about processing data so that the data normally/frequently used is always in cache.</p>
<p>2:25pm: Memcached is supposed to be &#8220;simple&#8221; so that it can be faster.  Has its own memory slab allocator, it originally tried using malloc but that was way too slow.  The way it assigns blocks for memory assignment means that each data store goes into one of those &#8220;blocks.&#8221;  If the # of available room in the block is full, then it drops the oldest record in that block.  Written around libevent for scalable network connections.  That was only connections sending data are &#8220;active&#8221; on the server.</p>
<p>2:27pm: The clients handle the majority of the load.  It takes the cache key and hashes it so that it knows which server to send to the data to.  Server doesn&#8217;t do the serialization either.</p>
<p>2:30pm: Server is not redundant and does not handle failover.  But some clients like with <a href="http://pecl.php.net/memcache">PHP&#8217;s PECL</a>, the client can implement this type of functionality.</p>
<p>2:33pm: Available commands are pretty much only set/get/replace/add, append/prepend, increment/decrement, <a href="http://en.wikipedia.org/wiki/Compare_and_swap">cas</a> and stats.  While they say append/prepend are easy to be abused it is still an easy &amp; quick way to store the keys used for something.  Unless the size of the keys that you are storing reaches close to 1MB, it&#8217;s okay.  It&#8217;s a great way to know what keys you&#8217;ll need to clear when product information has been updated.</p>
<p>2:38pm: <a href="http://tangent.org/586/Memcached_Functions_for_MySQL.html">MySQL UDF</a> usage for Memcached is growing.  <a href="http://code.google.com/soc/2008/">Google Summer of Code</a> is working on making <a href="http://forge.mysql.com/wiki/SummerOfCode2008Ideas">MySQL Query cache use Memcached</a>.   lighthttpd has mod_memcache for caching files from disk.  Apache also has mod_memcached but is still alpha.</p>
<p>2:42pm:  Memcached has a few limits that you should pay attention to:<br />
The max cache key is 250 bytes<br />
Max data size is 1MB<br />
Maxbytes limits the item cache, not everything<br />
Be careful because with 32bit machines, you can set too high of a maxbytes that in combination with other memcache memory elements (e.g., key storage) and it will segfault.</p>
<p>2:46pm:  <a href="http://en.wikipedia.org/wiki/Cache_algorithms">LRU</a> &#8211; Least recently accessed items are up for eviction and can be seen.  One LRU exists per &#8220;slab class.&#8221;  LRU evictions don&#8217;t need to be common.  That&#8217;s pretty nice because you won&#8217;t lose larger data sets because a small data element doesn&#8217;t have room in its slab (and vice versa).</p>
<p>2:50pm:  Threads &#8211; Great for large instances (16G+) and/or large multiget requests.  It scales okay now, but they are working on improving it.  Also means that you may not need to run multiple instances on the same box.  Only 1 thread can talk to the allocator and the hash table at one time.  This is so that you don&#8217;t have race conditions.</p>
<p>2:55pm:  Don&#8217;t run Memcached with swap enabled or at least set it really small.  Can seriously slow down performance and technically is contrary to purpose of memcache.  The smaller swap means that OS can still use if it really has to, but won&#8217;t let the writing to swap happen for Memcached.  The memory for Memcached is permanently allocated from the OS.  Shouldn&#8217;t be an issue with most modern servers.  The slab class are created by chunk size.  Tends to create 36-39 slab classes.  It does not reassign slab classes once the daemon loads.  They are working on a way to allow you to change the assignments on the fly.  e.g., if you find that you are evicting a lot of data from one slab, you can give that slab more pages while taking it from another slab.</p>
<p>3:10pm: There is normal hashing (usually crc or some modulus operation) and consistent hashing.  Each client could implement its own version, but usually use common methods so that multiple clients can use the same pool of memcache servers.</p>
<p>3:20pm:  PECL client (and most others) has option to not &#8220;remove&#8221; the server if it is not available.  It can have a &#8220;back-off&#8221; method where it won&#8217;t try to hit the server for 1 second, 5 seconds, then 15 seconds, etc.  It can also failover to a different server until the original is back online.</p>
<p>3:25pm: You should always try to use multi-get.  Memcached is optimized for handling multiple requests at once.  You&#8217;ll find a big improvement if you do this.  The trick is to write your code in a way that can utilize this to the fullest.</p>
<p>4:04pm: Back from break.  We&#8217;re now going over various coding examples of how to use Memcached.  I&#8217;m hoping this part will be helpful.  Most coding examples of how to use Memcached are generally fairly simple.  But with 90 minutes left, there aught to be some gems.</p>
<p>4:15pm: Going over locks.  Much like my previous post regarding <a href="http://www.grepmymind.com/2008/01/11/memcached-php-semaphore-cache-expiration-handling/">memcached cache locks</a>.</p>
<p>4:25pm: Just re-hashing the same examples in different languages.  <img src='http://www.grepmymind.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>4:35pm: <a href="http://tangent.org/552/libmemcached.html">libmemcached</a> is a C/C++ client.  Has replicated ability.  You can store flags associated with the data in the byte category.  Most clients don&#8217;t allow you direct access to this.</p>
<p>4:48pm: When doing a multi-get it hashes each key to determine the servers where the data would be stored.  Once it knows that, the requests are made in parallel and as single-combined request to each server needed.</p>
<p>4:50pm: MySQL &amp; Memcached.  The MySQL uses the UDF API and libmemcached.  You have to install it by CREATE FUNCTION.  Most common method is to use memc_delete to remove the memcached data when data is written to the db.  An example is &#8220;select id, url, memc_set(concat(&#8216;feeds&#8217;, md5(url), url) from feeds;&#8221;  or &#8220;select memc_get(concat(&#8216;feeds&#8217;, md5(url));&#8221;  This could be helpful for when you store the entire row, and only the row, in memcache.  But for the most part, I don&#8217;t see the benefit of using this.  Of course, I&#8217;ve been known to be wrong before.</p>
<p>5:00pm:  There is memcached-tool which may assist with some basic stats/display commands.  It will eventually be what does the slab re-allocation.  libmmcached has memslap which may be useful for performance testing.  MRTG gives you decent graphs about what is happening on the server.</p>
<p>5:05pm:  1.2.5 release supports multi-interface support, UDP all the time, noreply, &amp; IPV6.  Noreply is kind of neat as it allows you to set keys and not have have a response sent back to the client.  It makes it a fire &amp; forget save to memcache.  My experience is that most people don&#8217;t verify that the data is really set to memcache anyway.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.grepmymind.com/2008/04/14/mysql-conf-2008-memcached-day-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Conf 2008 &#8211; MySQL Replication (Day 1)</title>
		<link>http://www.grepmymind.com/2008/04/14/mysql-conf-2008-mysql-replication-day-1/</link>
		<comments>http://www.grepmymind.com/2008/04/14/mysql-conf-2008-mysql-replication-day-1/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 19:20:11 +0000</pubDate>
		<dc:creator>Michael Tougeron</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql08]]></category>
		<category><![CDATA[mysqlconf08]]></category>
		<category><![CDATA[replication.]]></category>

		<guid isPermaLink="false">http://www.grepmymind.com/2008/04/14/mysql-conf-2008-mysql-replication-day-1/</guid>
		<description><![CDATA[I started off the MySQL Conference 2008 with the replication tutorial. I&#8217;m hoping that there will be some good tidbits in the second half of the session. I&#8217;m almost positive the first part will be refresher and standard replication stuff. I really wanted to do the MySQL Proxy session, but that is an all-day thing [...]]]></description>
			<content:encoded><![CDATA[<p>I started off the <a href="http://www.mysqlconf.com/">MySQL Conference 2008</a> with the <a href="http://en.oreilly.com/mysql2008/public/schedule/detail/2145">replication tutorial</a>.  I&#8217;m hoping that there will be some good tidbits in the second half of the session.  I&#8217;m almost positive the first part will be refresher and standard replication stuff.</p>
<p>I really wanted to do the <a href="http://en.oreilly.com/mysql2008/public/schedule/detail/478">MySQL Proxy session</a>, but that is an all-day thing and I&#8217;d miss the <a href="http://en.oreilly.com/mysql2008/public/schedule/detail/1627">Memcached session</a>.  In hindsight, I&#8217;m probably going to regret that decision, but we&#8217;ll see.  I can always do Proxy next year.  <img src='http://www.grepmymind.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>10:00am: So far pretty much all refresher.  Some people have asked some good questions about the relay logs and replication lag.  Unfortunately, none of it is particularly helpful.  I don&#8217;t understand why MySQL doesn&#8217;t enable a way to do master-master replication reliably outside of NDB. In my opinion, NDB, is not an appropriate solution for most websites.  Having to take down the entire cluster to alter a table would not be acceptable.   <img src='http://www.grepmymind.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>10:45am: Not sure if it is my laptop or the wireless network, but my connection/authorization never seems to carry over from when I log in/out of the laptop.  I have to disconnect from the wireless auto-reconnect and connect again manually in order to get on the Internet.  I wonder if anyone else is having this problem?</p>
<p>10:45am: One of the recommend ways for doing <a href="http://en.wikipedia.org/wiki/High_availability">HA</a> <a href="http://en.wikipedia.org/wiki/Multi-master_replication">master/master</a> is to use a shared disk array.  The section would be to put a virtual IP in front of a heartbeat monitor in front of two MySQL servers configured the same.  If they shared the same disk array, then the bin-log will be the same for both servers.  The heartbeat monitor then sends the traffic to mas1 until it finds that it is no longer online.  Then the traffic goes to mas2 automatically.  When mas1 comes back online, the heartbeat monitor sends the traffic back automatically.  Since mas2 is no longer reading/writing to the db tables, there shouldn&#8217;t be any corruption.  Behind the mas1/mas2 is another virtual IP tied to the same heartbeat monitor.  That way the slaves will also stay online.  This sounds like it will handle many of the scenarios where you need HA master/master.  The only thing I still see missing is the ability to alter tables without bringing down the tier like you can with m/cluster.  [ m/cluster is a product by <a href="http://www.continuent.com/">Continuent</a> for HA synchronous replication.  Of course, that product is EOL and their new product doesn't allow this either.  <img src='http://www.grepmymind.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  ]</p>
<p>11:00am: Federated databases are good for joining two sets of data to another db server.  I guess I always misunderstood how that works.  This seems like it&#8217;d be a good way to hook up user information with community (forums) data.  I wonder what the performance costs are?</p>
<p>11:15am: Row-based replication in 5.1 paves the way for future replication enhancements such as conflict detection &amp; conflict resolution.  As well as multi-channel replication and horizontal partioning.  Multi-channel replication would be really cool.  It is such a pain when replication lags and this could go a long way to help fight that. You cannot do master filtering for individual tables with row-based.  I wonder why that is?</p>
<p>12:00pm: I don&#8217;t know why MySQL keeps pushing NDB as the end-all solution to replication problems.  Yes it can deal with a lot of the replication issues, but it has several other issues that make it a bad (or at least not optimal) solution.</p>
<p>12:05pm: eek, running out of battery power.  I have 18 minutes left&#8230;  Should be able to make it until lunch.  Maybe&#8230;</p>
<p>12:20: That&#8217;s about it.  Q&amp;A now, but I&#8217;m headed out to find a lunch table near power.  <img src='http://www.grepmymind.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.grepmymind.com/2008/04/14/mysql-conf-2008-mysql-replication-day-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

