<?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"
	>

<channel>
	<title>Proven Scaling Blog</title>
	<atom:link href="http://provenscaling.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://provenscaling.com/blog</link>
	<description>High performance MySQL consulting</description>
	<pubDate>Thu, 01 Jan 2009 17:24:17 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<item>
		<title>MySQL Enterprise 5.0.74 Released</title>
		<link>http://provenscaling.com/blog/2009/01/01/mysql-enterprise-5074-released/</link>
		<comments>http://provenscaling.com/blog/2009/01/01/mysql-enterprise-5074-released/#comments</comments>
		<pubDate>Thu, 01 Jan 2009 17:24:17 +0000</pubDate>
		<dc:creator>Eric Bergen</dc:creator>
		
		<category><![CDATA[Announcements]]></category>

		<category><![CDATA[Enterprise]]></category>

		<category><![CDATA[Mirror]]></category>

		<guid isPermaLink="false">http://provenscaling.com/blog/?p=193</guid>
		<description><![CDATA[Sun has released MySQL Enterprise 5.0.74.  The source and binaries are now available from the Proven Scaling mirror.
This release is a MRU release and is recommended if you are being affected by bugs which are fixed in this release.  A number of server crashes have been addressed.  Details for changes in this [...]]]></description>
			<content:encoded><![CDATA[<p>Sun has released MySQL Enterprise 5.0.74.  The <a href="http://mirror.provenscaling.com/mysql/enterprise/source/5.0/mysql-5.0.74.tar.gz">source</a> and <a href="http://mirror.provenscaling.com/mysql/enterprise/binaries/5.0/5.0.74/">binaries</a> are now available from the <a href="http://mirror.provenscaling.com/">Proven Scaling mirror</a>.</p>
<p>This release is a MRU release and is recommended if you are being affected by bugs which are fixed in this release.  A number of server crashes have been addressed.  Details for changes in this release can be found in the <a href="http://dev.mysql.com/doc/refman/5.0/en/releasenotes-es-5-0-74.html">MySQL Enterprise 5.0.74 release notes</a>.</p>
<p>For more information about the different MySQL release version numbers, see our previous post on <a href="http://provenscaling.com/blog/2008/07/31/understanding-mysql-version-numbers/">version numbers</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://provenscaling.com/blog/2009/01/01/mysql-enterprise-5074-released/feed/</wfw:commentRss>
		</item>
		<item>
		<title>MySQL Enterprise 5.0.72 Released</title>
		<link>http://provenscaling.com/blog/2008/12/04/mysql-enterprise-5072-released/</link>
		<comments>http://provenscaling.com/blog/2008/12/04/mysql-enterprise-5072-released/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 15:45:19 +0000</pubDate>
		<dc:creator>Eric Bergen</dc:creator>
		
		<category><![CDATA[Announcements]]></category>

		<category><![CDATA[Enterprise]]></category>

		<category><![CDATA[Mirror]]></category>

		<guid isPermaLink="false">http://provenscaling.com/blog/?p=186</guid>
		<description><![CDATA[Sun has released MySQL Enterprise 5.0.72.  The source and binaries are now available from the Proven Scaling mirror.
This release is a MRU release and is recommended if you are being affected by bugs which are fixed in this release.  A number of server crashes have been addressed.  Details for changes in this [...]]]></description>
			<content:encoded><![CDATA[<p>Sun has released MySQL Enterprise 5.0.72.  The <a href="http://mirror.provenscaling.com/mysql/enterprise/source/5.0/mysql-5.0.72.tar.gz">source</a> and <a href="http://mirror.provenscaling.com/mysql/enterprise/binaries/5.0/5.0.72/">binaries</a> are now available from the <a href="http://mirror.provenscaling.com/">Proven Scaling mirror</a>.</p>
<p>This release is a MRU release and is recommended if you are being affected by bugs which are fixed in this release.  A number of server crashes have been addressed.  Details for changes in this release can be found in the <a href="http://dev.mysql.com/doc/refman/5.0/en/releasenotes-es-5-0-72.html">MySQL Enterprise 5.0.72 release notes</a>.</p>
<p>For more information about the different MySQL release version numbers, see our previous post on <a href="http://provenscaling.com/blog/2008/07/31/understanding-mysql-version-numbers/">version numbers</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://provenscaling.com/blog/2008/12/04/mysql-enterprise-5072-released/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Proven Scaling at Make It Scale in London tonight</title>
		<link>http://provenscaling.com/blog/2008/11/27/make-it-scale-london/</link>
		<comments>http://provenscaling.com/blog/2008/11/27/make-it-scale-london/#comments</comments>
		<pubDate>Thu, 27 Nov 2008 09:59:34 +0000</pubDate>
		<dc:creator>Mike Griffiths</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://provenscaling.com/blog/?p=180</guid>
		<description><![CDATA[I will be at Sun&#8217;s Make It Scale event in London this evening, delivering a presentation on Scaling MySQL.
The event has been organised by Sun&#8217;s Startup Essentials team, and is aimed at young companies looking to tackle their growing pains head on.  I will be alongside speakers from Last.fm, Sun and Fav.or.it.
Lots of people [...]]]></description>
			<content:encoded><![CDATA[<p>I will be at Sun&#8217;s <a href="http://www.makeitscale.co.uk/">Make It Scale</a> event in London this evening, delivering a presentation on Scaling MySQL.</p>
<p>The event has been organised by Sun&#8217;s Startup Essentials team, and is aimed at young companies looking to tackle their growing pains head on.  I will be alongside speakers from Last.fm, Sun and Fav.or.it.</p>
<p>Lots of people have registered for the event, but as far as I know there are some places still available - <a href="http://www.makeitscale.co.uk/register.php">you can sign up at the Make It Scale site</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://provenscaling.com/blog/2008/11/27/make-it-scale-london/feed/</wfw:commentRss>
		</item>
		<item>
		<title>MySQL Enterprise 5.0.70 released</title>
		<link>http://provenscaling.com/blog/2008/10/21/mysql-enterprise-5070-released/</link>
		<comments>http://provenscaling.com/blog/2008/10/21/mysql-enterprise-5070-released/#comments</comments>
		<pubDate>Tue, 21 Oct 2008 22:35:06 +0000</pubDate>
		<dc:creator>Mike Griffiths</dc:creator>
		
		<category><![CDATA[Announcements]]></category>

		<category><![CDATA[Enterprise]]></category>

		<category><![CDATA[Mirror]]></category>

		<guid isPermaLink="false">http://provenscaling.com/blog/?p=167</guid>
		<description><![CDATA[Sun has released MySQL Enterprise 5.0.70.  The source and binaries are now available from the Proven Scaling mirror.
This release is a MRU release and is recommended if you are being affected by bugs which are fixed in this release.  A number of server crashes have been addressed.  Details for changes in this [...]]]></description>
			<content:encoded><![CDATA[<p>Sun has released MySQL Enterprise 5.0.70.  The <a href="http://mirror.provenscaling.com/mysql/enterprise/source/5.0/mysql-5.0.70.tar.gz">source</a> and <a href="http://mirror.provenscaling.com/mysql/enterprise/binaries/5.0/5.0.70/">binaries</a> are now available from the <a href="http://mirror.provenscaling.com/">Proven Scaling mirror</a>.</p>
<p>This release is a MRU release and is recommended if you are being affected by bugs which are fixed in this release.  A number of server crashes have been addressed.  Details for changes in this release can be found in the <a href="http://dev.mysql.com/doc/refman/5.0/en/releasenotes-es-5-0-70.html">MySQL Enterprise 5.0.70 release notes</a>.</p>
<p>For more information about the different MySQL release version numbers, see our previous post on <a href="http://provenscaling.com/blog/2008/07/31/understanding-mysql-version-numbers/">version numbers</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://provenscaling.com/blog/2008/10/21/mysql-enterprise-5070-released/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How mysqldump locks tables with different options</title>
		<link>http://provenscaling.com/blog/2008/10/19/how-mysqldump-locks-tables-with-different-options/</link>
		<comments>http://provenscaling.com/blog/2008/10/19/how-mysqldump-locks-tables-with-different-options/#comments</comments>
		<pubDate>Mon, 20 Oct 2008 05:18:34 +0000</pubDate>
		<dc:creator>Eric Bergen</dc:creator>
		
		<category><![CDATA[InnoDB]]></category>

		<category><![CDATA[Maatkit]]></category>

		<category><![CDATA[Replication]]></category>

		<category><![CDATA[mysqldump]]></category>

		<guid isPermaLink="false">http://provenscaling.com/blog/?p=124</guid>
		<description><![CDATA[The mysqldump program, which ships with MySQL, takes data from existing tables and turns it into SQL statements which can then be used to re-create the data later.  It has several different options which dictate its behavior for collecting data.  Some of the most important change its locking behaviour; depending on the options [...]]]></description>
			<content:encoded><![CDATA[<p>The <tt>mysqldump</tt> program, which ships with MySQL, takes data from existing tables and turns it into SQL statements which can then be used to re-create the data later.  It has several different options which dictate its behavior for collecting data.  Some of the most important change its locking behaviour; depending on the options passed to the <tt>mysqldump</tt> command, it may need to lock tables for the entire duration of the dumping process, briefly at the beginning, or not at all.</p>
<p>When using <tt>mysqldump</tt> for backups with a MySQL replication slave, the <tt>master-data</tt> option is often required in order to save the slave replication log file name and position in the backup.  By default, the <tt>master-data</tt> option will execute a <tt>FLUSH TABLES WITH READ LOCK</tt> command&mdash;which disallows writes to any table&mdash;and will keep the read lock for the entire duration of the dump to ensure that the replication position won&#8217;t change during the dump.  This can be problematic, because any clients trying to write to tables during the dump process are locked out.  With MyISAM, this is necessary, but with InnoDB it isn&#8217;t.</p>
<p>With a little help from InnoDB&#8217;s transaction and multi-versioning support, it&#8217;s possible to keep the read lock for a very short period of time&mdash;just long enough to quiesce the system and check the replication status.  InnoDB guarantees that a transaction will see a consistent view of the database after a transaction has started.  If all of the tables being dumped are InnoDB, using the <tt>single-transaction</tt> flag to <tt>mysqldump</tt> will instruct it to only keep a read lock long enough to gather the replication state and start a transaction.  After the transaction has been started, the read lock is released so that the dump and other clients can continue without locking each other out.</p>
<p>On the topic of consistency for a dump, there is an important distinction between the <tt>lock-all-tables</tt> and <tt>lock-tables</tt> options:  With the <tt>lock-all-tables</tt> option, <tt>mysqldump</tt> will use the same type of global read lock it uses when gathering the replication position.  This can be used to ensure a consistent dump when not using replication.  The <tt>lock-tables</tt> option, however, issues a <tt>LOCK TABLES</tt> query for each database it&#8217;s dumping.  If you choose multiple databases to dump, each database will be locked and unlocked in turn. This introduces a race condition: modifications can be made to database A while database B is locked and being dumped.  If you&#8217;re using InnoDB, <tt>single-transaction</tt> is a much better option.</p>
<p>Most people worry about the total time it takes to perform a backup, but the most important timing aspect of any backup is not the time it takes to create the backup, but the time it takes to restore it. Nonetheless, Maatkit includes <tt><a href="http://www.maatkit.org/doc/mk-parallel-dump.html">mk-parallel-dump</a></tt> and <tt><a href="http://www.maatkit.org/doc/mk-parallel-restore.html">mk-parallel-restore</a></tt> which offer a nice speed boost over the traditional MySQL tools. </p>
]]></content:encoded>
			<wfw:commentRss>http://provenscaling.com/blog/2008/10/19/how-mysqldump-locks-tables-with-different-options/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Introducing Flipper for managing MySQL master pairs</title>
		<link>http://provenscaling.com/blog/2008/10/09/introducing-flipper-for-managing-mysql-master-pairs/</link>
		<comments>http://provenscaling.com/blog/2008/10/09/introducing-flipper-for-managing-mysql-master-pairs/#comments</comments>
		<pubDate>Fri, 10 Oct 2008 00:22:17 +0000</pubDate>
		<dc:creator>Mike Griffiths</dc:creator>
		
		<category><![CDATA[Announcements]]></category>

		<category><![CDATA[Availability]]></category>

		<category><![CDATA[Flipper]]></category>

		<category><![CDATA[Master-Master]]></category>

		<guid isPermaLink="false">http://provenscaling.com/blog/?p=117</guid>
		<description><![CDATA[At Proven Scaling, we&#8217;re great fans of using pairs of MySQL servers replicating to each other (commonly known as master-master replication or dual-master replication) as a way of ensuring high availability for MySQL databases.
Deploying servers in this way enables one half of the pair to be taken offline for maintenance work while the other half [...]]]></description>
			<content:encoded><![CDATA[<p>At Proven Scaling, we&#8217;re great fans of using pairs of MySQL servers replicating to each other (commonly known as master-master replication or dual-master replication) as a way of ensuring high availability for MySQL databases.</p>
<p>Deploying servers in this way enables one half of the pair to be taken offline for maintenance work while the other half carries on dealing with queries from clients &mdash; meaning that, for instance, lengthy <tt>ALTER TABLE</tt> operations can be done with no impact on service.  This strategy has been in use at many sites for years, and has been very successful at minimizing downtime.</p>
<p>The usual way of implementing this model is to have IP addresses floating between the two MySQL servers.  Rather than having the clients use the actual IP addresses or hostnames of the servers themselves, these &#8220;floating IPs&#8221; (or &#8220;virtual IPs&#8221;, &#8220;VIPs&#8221;, &#8220;IP aliases&#8221;) are used by clients to access MySQL based on a role (typically &#8220;writable&#8221; and &#8220;read-only&#8221;).  The floating IP addresses can be moved between the servers as required to ensure that each role is always available.</p>
<p>There are some tools already available to manage pairs of MySQL servers, most notably <a href="http://code.google.com/p/mysql-master-master/">mysql-master-master</a> (MMM) and the <a href="http://www.linux-ha.org/">High Availability Linux</a> project.  </p>
<p>Today, we&#8217;re announcing the release of Flipper, a tool for managing access to MySQL servers using master-master replication.</p>
<h3>Reinventing the wheel?</h3>
<p>Although the existing tools have worked well for some people in some situations, we (and our customers) have been frustrated by the number of situations where they&#8217;re not suitable.</p>
<p>Most of the existing tools are specific to Linux, and therefore no good to users of Solaris, FreeBSD and other operating systems.  Most are heavy-weight implementations, with monitoring daemons running all the time.  Configuration is rarely simple, sometimes because some of the available solutions try to be all things to all men, doing things that would be better handled elsewhere.</p>
<p>A lot of the effort that&#8217;s been put into other tools has been aimed at implementing <em>automatic</em> failover.  Sometimes this can be very useful (for instance in stateless applications, restartable services, etc.), but very often this is implemented with little consideration for the possible consequences in a stateful, database environment.</p>
<p>Bringing failed servers back into service prematurely (as often happens with hardware load-balancing solutions) can be disastrous, with bad data being returned to clients, or data received from clients and theoretically committed being lost.  Likewise, servers may be incorrectly diagnosed as having failed, causing a painful, lengthy, and potentially irreversible failover process to take place for what should have been a barely noticeable event.  In some cases, an automatic failover system may change its mind back and forth, causing repeated failover events (known as &#8220;flapping&#8221;).  All in all, we&#8217;re not convinced that completely automatic failover is always a good idea<sup>1</sup>.</p>
<h3>Automated, but manually triggered</h3>
<p>Flipper&#8217;s design comes from a very pragmatic perspective.  It&#8217;s a standalone tool that doesn&#8217;t require constantly running monitoring daemons &mdash; it evaluates the current situation at the moment that it&#8217;s executed, and does only what it&#8217;s told.  It doesn&#8217;t attempt to do anything fancy right now; it just manages moving IP addresses between MySQL nodes and reconfiguring a typical master-master setup, in a safe, controlled manner.  If one of the MySQL masters fails, it will allow you to move services away from the failed master, enabling you to fix the failure.</p>
<p>Flipper has been designed to be as portable as possible.  It&#8217;s capable of running on almost any UNIX-like operating system, as it&#8217;s written in Perl and uses DBD::mysql to communicate with MySQL servers.  Flipper itself doesn&#8217;t necessarily require any special privileges, user accounts, or daemons; it uses <tt>ssh</tt> and <tt>sudo</tt> to run system commands (and you&#8217;d typically want to set up SSH keys, and use <tt>ssh-agent</tt> to avoid typing your passphrase so many times).</p>
<p>We will add additional features in the future, but the system will always remain modular &mdash; you&#8217;ll be able to use whichever parts of it you want.</p>
<h3>Where can I find out more?</h3>
<p>We&#8217;ve set up a new (and currently rather minimal) micro-site for Flipper at <a href="http://provenscaling.com/software/flipper/">provenscaling.com/software/flipper</a> with <a href="http://provenscaling.com/software/flipper/docs/">documentation</a> and links to various resources.</p>
<p>We will also post <a href="http://provenscaling.com/blog/category/software/flipper/">on this blog</a> when there&#8217;s a new release, or some other important Flipper-related news.</p>
<p><sup>1</sup> Of course, we&#8217;d be delighted to hear from anyone who wants to try and convince us that any of the current MySQL automatic failover/HA strategies are error-proof, or anyone who&#8217;s got new ideas about how this can be achieved.</p>
]]></content:encoded>
			<wfw:commentRss>http://provenscaling.com/blog/2008/10/09/introducing-flipper-for-managing-mysql-master-pairs/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Making MySQL more usable: Stored Procedure call stack on error</title>
		<link>http://provenscaling.com/blog/2008/10/07/making-mysql-more-usable-stored-procedure-call-stack-on-error/</link>
		<comments>http://provenscaling.com/blog/2008/10/07/making-mysql-more-usable-stored-procedure-call-stack-on-error/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 19:10:43 +0000</pubDate>
		<dc:creator>Jeremy Cole</dc:creator>
		
		<category><![CDATA[Patches]]></category>

		<category><![CDATA[Stored Procedures]]></category>

		<category><![CDATA[Usability]]></category>

		<guid isPermaLink="false">http://provenscaling.com/blog/?p=47</guid>
		<description><![CDATA[MySQL&#8217;s Stored Procedure implementation is far from perfect.  One of the major problems has been in debugging tools and information available while writing and using the procedures you&#8217;ve written.  In particular there is no real way to return customized error messages, e.g. RAISE or SIGNAL, and no way to find out what error [...]]]></description>
			<content:encoded><![CDATA[<p>MySQL&#8217;s Stored Procedure implementation is far from perfect.  One of the major problems has been in debugging tools and information available while writing and using the procedures you&#8217;ve written.  In particular there is <a href="http://bugs.mysql.com/bug.php?id=11661">no real way to return customized error messages</a>, e.g. <tt>RAISE</tt> or <tt>SIGNAL</tt>, and <a href="http://bugs.mysql.com/bug.php?id=11660">no way to find out what error actually occurred</a>, e.g. accessing <tt>SQLSTATE</tt>.  However, even with the standard error messages that MySQL already produces, there is another major problem: as a caller of the stored procedure, you can&#8217;t tell where the error actually came from.</p>
<p>In order to demonstrate this, let&#8217;s first create a few stored procedures that call each other in order to make things interesting:</p>
<blockquote><pre>
use test;

delimiter ;;
drop procedure if exists s_test;;
create procedure s_test ()
begin
  call s_test_foo();
end;;

drop procedure if exists s_test_foo;;
create procedure s_test_foo ()
begin
  call s_test_bar();
end;;

drop procedure if exists s_test_bar;;
create procedure s_test_bar ()
begin
  select 1 from blarbo;
end;;

delimiter ;
</pre>
</blockquote>
<p>Notice that the final stored procedure tries to select from a table that we haven&#8217;t mentioned yet; that&#8217;s because that table doesn&#8217;t exist.  This should generate an error for us reliably.  Here&#8217;s what happens when we call the stored procedure:</p>
<blockquote><pre>
call test.s_test();

ERROR 1146 (42S02): Table 'test.blarbo' doesn't exist
</pre>
</blockquote>
<p>Now that&#8217;s not very helpful: the user didn&#8217;t try to do anything with <tt>test.blarbo</tt> so he has no idea what has just happened!  Technically it would be much better if the <tt>s_test_bar</tt> procedure could have generated a custom error message&#8230; I&#8217;ll leave that for a future post.</p>
<p>In the past I&#8217;ve discussed a <a href="http://jcole.us/blog/archives/2006/10/01/on-triggers-stored-procedures-and-call-stacks/">patch to add a <tt>CALLER()</tt> function</a>, and this patch is a natural evolution of that code.  We&#8217;ve written a <a href="http://jcole.us/patches/mysql/5.0/draft/show_error_stack_trace.patch">proof of concept patch</a> to add a <tt>SHOW ERROR STACK TRACE</tt> command.  This works by saving the call stack, which is tracked using the code from the old <tt>CALLER()</tt> patch, whenever an error occurs.  Let&#8217;s try it out, after receiving any error from a SQL statement, you may run <tt>SHOW ERROR STACK TRACE</tt> as follows:</p>
<blockquote><pre>
SHOW ERROR STACK TRACE;

+-------+----------------------+
| Depth | Query                |
+-------+----------------------+
|     0 | select 1 from blarbo |
|     1 | call s_test_bar()    |
|     2 | call s_test_foo()    |
|     3 | call test.s_test()   |
+-------+----------------------+
4 rows in set (0.00 sec)
</pre>
</blockquote>
<p>That&#8217;s certainly more useful!  I&#8217;ve still got a few ideas on how to improve it even more:</p>
<ul>
<li>Add something like e.g. <tt>SHOW ERROR VARIABLES FOR 1</tt> which could return the contents of all local variables from a particular stack level from the stack trace.</li>
<li>Add something like e.g. <tt>SHOW ERROR CONTEXT FOR 1</tt> which could return the few lines of code before and after the error from a particular stack level from the stack trace.</li>
</ul>
<p>Essentially, it would be great if you could do most of what <tt>gdb</tt> is capable of when debugging C code.  I hope you like it!</p>
]]></content:encoded>
			<wfw:commentRss>http://provenscaling.com/blog/2008/10/07/making-mysql-more-usable-stored-procedure-call-stack-on-error/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Max allowed packet and connection pooling</title>
		<link>http://provenscaling.com/blog/2008/10/07/max-allowed-packet-and-connection-pooling/</link>
		<comments>http://provenscaling.com/blog/2008/10/07/max-allowed-packet-and-connection-pooling/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 18:03:20 +0000</pubDate>
		<dc:creator>Eric Bergen</dc:creator>
		
		<category><![CDATA[Connection Pooling]]></category>

		<category><![CDATA[Usability]]></category>

		<guid isPermaLink="false">http://provenscaling.com/blog/?p=129</guid>
		<description><![CDATA[The MySQL configuration variable max_allowed_packet controls how large a single MySQL protocol packet (not a network/TCP packet) can be. This variable can be changed to solve &#8220;Packet too large&#8221; errors typically caused by excessively long query strings, such as large multi-row INSERT statements.  It&#8217;s both a session and global variable meaning that different sessions [...]]]></description>
			<content:encoded><![CDATA[<p>The MySQL configuration variable <tt>max_allowed_packet</tt> controls how large a single MySQL protocol packet (not a network/TCP packet) can be. This variable can be changed to solve &#8220;<a href="http://dev.mysql.com/doc/refman/5.0/en/packet-too-large.html">Packet too large</a>&#8221; errors typically caused by excessively long query strings, such as large multi-row <tt>INSERT</tt> statements.  It&#8217;s both a session and global variable meaning that different sessions can set their own limits for for <tt>max_allowed_packet</tt>.</p>
<p>It&#8217;s often assumed that changing global variables in MySQL means that the value changes for each connection.  However, in the case of <tt>max_allowed_packet</tt> and many others, the local setting of the variable is inherited from the global variable when a connection is first established.  This has special implications when using connection pooling. </p>
<p>In a connection pooling environment, connections are pooled on the application server.  When the application needs a connection to the MySQL server, it borrows it from the pool, and returns it when finished.  Typically when a connection is borrowed from the pool, the connection pool library automatically calls its API&#8217;s variant of the &#8220;change user&#8221; API function (which uses the <tt>COM_CHANGE_USER</tt> protocol command) to reset some connection specific parameters. </p>
<p>The session-level <tt>max_allowed_packet</tt> setting for a connection is normally inherited from the global setting when a client first connects, but it isn&#8217;t copied when the user is changed.  This means that even though the global <tt>max_allowed_packet</tt> may have been changed, the applications which are using those connections may not pick up the change until the <em>connection pool&#8217;s</em> connections are forced to reconnect, usually by restarting the application server.</p>
]]></content:encoded>
			<wfw:commentRss>http://provenscaling.com/blog/2008/10/07/max-allowed-packet-and-connection-pooling/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Making MySQL more usable: InnoDB save/restore buffer pool patch</title>
		<link>http://provenscaling.com/blog/2008/10/06/making-mysql-more-usable-innodb-saverestore-buffer-pool-patch/</link>
		<comments>http://provenscaling.com/blog/2008/10/06/making-mysql-more-usable-innodb-saverestore-buffer-pool-patch/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 00:38:18 +0000</pubDate>
		<dc:creator>Jeremy Cole</dc:creator>
		
		<category><![CDATA[InnoDB]]></category>

		<category><![CDATA[Patches]]></category>

		<category><![CDATA[Usability]]></category>

		<guid isPermaLink="false">http://provenscaling.com/blog/?p=62</guid>
		<description><![CDATA[A feature that I and many others have wanted for years is to be able to save the contents of InnoDB&#8217;s buffer pool on shutdown, and restore it on startup.  Why?  After the system has been running for some time, it has spent a lot of effort perfecting the contents of the buffer [...]]]></description>
			<content:encoded><![CDATA[<p>A feature that I and many others have wanted for <strong>years</strong> is to be able to save the contents of InnoDB&#8217;s buffer pool on shutdown, and restore it on startup.  Why?  After the system has been running for some time, it has spent a lot of effort perfecting the contents of the buffer pool, and exactly the right pages are now cached.  When you shut down, that cache is lost, and on restart, InnoDB will have to start over from scratch.  This process is often referred to as &#8220;warming up&#8221; the caches.  This can cause a simple and quick server restart to have an effect on your production system for hours, or in the worst case <em>days</em>.</p>
<p>A good analogy to this cold startup process is that of starting from a dead stop in manual transmission car: While 5th gear is great for cruising at highway speeds, it&#8217;s not really suited for getting you up to speed; that&#8217;s what 1st through 4th gear are for.  In most cars that aren&#8217;t too underpowered, with enough finessing and cajoling you can start from a dead stop in any gear&#8230; revving the engine up high to keep it from stalling, and gently easing the clutch in to get rolling&#8230; but it&#8217;s not pleasant.  Besides the unpleasantness, it also takes <em>much</em> longer to get up to highway speeds compared to progressing through the gears in the normal way.  Additionally, you may start off rolling just fine, but some time before you&#8217;ve gotten up to speed, you hit a small hill&mdash;which in the correct gear would be no problem.  In the wrong gear, the car slows down, starts chugging, and eventually the engine stalls.</p>
<p>Most database systems behave much like cars with only 5th gear.  When tuned properly and appropriately sized, they cruise along perfectly well at &#8220;highway speeds&#8221;; when the caches are &#8220;hot&#8221; and finely tuned.  They are, in the end, largely designed to operate from an in-memory cache; cache misses, and thus disk reads, <em>should</em> be a relative rarity.  If you have too many cache misses, performance is terrible, and the system gets backed up and potentially overloaded.  We&#8217;ve seen all too many times the situation that occurs when a server (say, a read slave from a pool of many) is rebooted with cold caches, and then immediately put into service in a busy environment.  All hell breaks loose.</p>
<p>I have written a <a href="http://provenscaling.com/patches/innodb_plugin/1.0/draft/buffer_pool_save_restore.patch">proof of concept patch</a> (for InnoDB plugin for MySQL 5.1) which adds a facility (admittedly quite hacky in this draft) to save the list of cached pages to a text file on shutdown.  Then, on startup, it restores those pages back into the cache.  Since it saves the pages by page number, rather than by saving the contents of the pages, it is perfectly safe<sup>1</sup> and fairly efficient<sup>2</sup>.  Note that you should probably also use the <a href="http://provenscaling.com/blog/2008/07/29/making-mysql-more-usable-innodb-information-schema-patches/"><tt>information_schema</tt> patch</a> to be able to see that this patch is actually working.</p>
<p>While this feature isn&#8217;t nearly as sexy to show demos of in a static blog, it has a lot of potential in a production environment.  I intend to do a lot more development on it, to provide at least:</p>
<ul>
<li>A facility for changing the file name/path for the save file</li>
<li>The ability to skip the restore step, optionally</li>
<li>The ability to restore only part of the cache before accepting user connections, deferring the remainder of the cache to a background thread which continues running after startup</li>
</ul>
<p>Some other ideas I&#8217;ve had:</p>
<ul>
<li>Use multiple threads to read the pages, which should make much better use of RAIDs</li>
<li>Add runtime commands to save/restore the buffer pool state from a running server, without shutting down</li>
<li>Add an option to save some of the statistics about the pages so that they can be restored &#8220;smarter&#8221; rather than just have all pages stuffed back in the cache with equal priority</li>
</ul>
<p>Does this sound like a useful feature?  What other features should it have?  Do you have problems with cold startup in production?</p>
<p><sup>1</sup> In the worst case, if the file is complete gibberish, the requested pages either won&#8217;t exist, or will contain irrelevant data.  Either case should do no harm.  It wouldn&#8217;t be a bad idea to do some more niceties around the file format: a checksum, magic at the beginning of the file, etc.  The current file format especially is very much a proof of concept.</p>
<p><sup>2</sup> There&#8217;s still a lot of work to do to make things more efficient: ordering pages, using multiple threads to read from different tablespaces, subdividing reads for a tablespace into multiple threads, the possibilities are endless.</p>
]]></content:encoded>
			<wfw:commentRss>http://provenscaling.com/blog/2008/10/06/making-mysql-more-usable-innodb-saverestore-buffer-pool-patch/feed/</wfw:commentRss>
		</item>
		<item>
		<title>MySQL Enterprise 5.0.68 available</title>
		<link>http://provenscaling.com/blog/2008/09/08/mysql-enterprise-5068-available/</link>
		<comments>http://provenscaling.com/blog/2008/09/08/mysql-enterprise-5068-available/#comments</comments>
		<pubDate>Mon, 08 Sep 2008 20:49:37 +0000</pubDate>
		<dc:creator>Eric Bergen</dc:creator>
		
		<category><![CDATA[Announcements]]></category>

		<category><![CDATA[Enterprise]]></category>

		<category><![CDATA[Mirror]]></category>

		<guid isPermaLink="false">http://provenscaling.com/blog/?p=96</guid>
		<description><![CDATA[Sun has released MySQL Enterprise 5.0.68, and the source and binaries are now available from the Proven Scaling mirror. This release is a MRU release and is only recommended if you&#8217;re looking for fixes to specific bugs which are available in this release. For more information about the different MySQL release version numbers, see our [...]]]></description>
			<content:encoded><![CDATA[<p>Sun has released MySQL Enterprise 5.0.68, and the <a href="http://mirror.provenscaling.com/mysql/enterprise/source/5.0/mysql-5.0.68.tar.gz">source</a> and <a href="http://mirror.provenscaling.com/mysql/enterprise/binaries/5.0/5.0.68/">binaries</a> are now available from the <a href="http://mirror.provenscaling.com/">Proven Scaling mirror</a>. This release is a MRU release and is only recommended if you&#8217;re looking for fixes to specific bugs which are available in this release. For more information about the different MySQL release version numbers, see our previous post on <a href="http://provenscaling.com/blog/2008/07/31/understanding-mysql-version-numbers/">version numbers</a>. Details for changes in this release can be found in the <a href="http://dev.mysql.com/doc/refman/5.0/en/releasenotes-es-5-0-68.html">MySQL Enterprise 5.0.68 release notes</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://provenscaling.com/blog/2008/09/08/mysql-enterprise-5068-available/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
