<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Saving you from MySQL quicksand!</title>
	<atom:link href="http://mysqlquicksand.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://mysqlquicksand.wordpress.com</link>
	<description>Small disruptions can cause great disaster</description>
	<lastBuildDate>Sat, 16 Feb 2013 18:58:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='mysqlquicksand.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/3cca31534fa10c77ff0416c34a3ae994?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Saving you from MySQL quicksand!</title>
		<link>http://mysqlquicksand.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://mysqlquicksand.wordpress.com/osd.xml" title="Saving you from MySQL quicksand!" />
	<atom:link rel='hub' href='http://mysqlquicksand.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Organizing the MySQL UG NL on 22nd of February</title>
		<link>http://mysqlquicksand.wordpress.com/2013/02/15/organizing-the-mysql-ug-nl-on-22nd-of-february/</link>
		<comments>http://mysqlquicksand.wordpress.com/2013/02/15/organizing-the-mysql-ug-nl-on-22nd-of-february/#comments</comments>
		<pubDate>Fri, 15 Feb 2013 16:26:59 +0000</pubDate>
		<dc:creator>Art van Scheppingen</dc:creator>
				<category><![CDATA[mysqlquicksand]]></category>
		<category><![CDATA[mysql ug nl]]></category>
		<category><![CDATA[mysql user group]]></category>
		<category><![CDATA[percona live]]></category>
		<category><![CDATA[spil games]]></category>

		<guid isPermaLink="false">http://mysqlquicksand.wordpress.com/?p=133</guid>
		<description><![CDATA[It has been a bit of a rollercoaster ride for us since the Percona Live London posting. The team has expanded with two new DBAs, I was invided to give a talk on selected the Percona Live Conference &#38; Expo 2013 in April and at the same time Spil Games is organizing the second MySQL &#8230; <a href="http://mysqlquicksand.wordpress.com/2013/02/15/organizing-the-mysql-ug-nl-on-22nd-of-february/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mysqlquicksand.wordpress.com&#038;blog=25013563&#038;post=133&#038;subd=mysqlquicksand&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>It has been a bit of a rollercoaster ride for us since the Percona Live London posting. The team has expanded with two new DBAs, I was invided to give a talk on <a href="http://www.percona.com/live/mysql-conference-2013/sessions/mysql-performance-monitoring-using-statsd-and-graphite" target="_blank">selected the Percona Live Conference &amp; Expo 2013 in April</a> and at the same time Spil Games is organizing the <a href="http://www.meetup.com/MySQL-User-Group-NL/events/97461352/" target="_blank">second MySQL User Group NL meeting</a> on Friday February 22nd of February. I did not realize it is next week and never posted about it, so there it is!</p>
<p>The meeting schedule is as following:<br />
17:00 Spil Games Pub Open<br />
18:00 Introduction<br />
18:15 &#8220;MySQL User Defined Functions&#8221; by Roland Bouman<br />
19:00 Pizza<br />
20:00 &#8220;Total cost of ownership&#8221; by Zsolt Fabian (Spil Games)</p>
<p>Before and after the meeting drinks and snacks will be served in our pub. You can chat up with others, mingle with the Spil Games employees or if you are very shy play some pool/foosball/pinball.</p>
<p>I&#8217;m happy we are presenting the TCO on this User Group. Zsolt will show his findings on several things you need to keep in mind if you wish to calculate your TCO, so it will be more a general guidance on how to do it yourself. Of course we will share some of our own WTFs/facepalms and other interesting facts we found during our own investigation. <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  </p>
<p>In case you are attending, there are several ways to get to the Spil Games HQ:<br />
If you travel by car, just punch in our address in your navigation:<br />
Arendstraat 23<br />
1223 RE Hilversum<br />
Do take notice our entrance has moved to the <a href="http://maps.google.com/maps?q=52.220728,5.198132&amp;ll=52.220741,5.198035&amp;spn=0.002369,0.004823&amp;num=1&amp;t=h&amp;z=18&amp;iwloc=near" target="_blank">new building on our campus</a> behind these nicely graffiti painted doors:<br />
<a href="http://mysqlquicksand.files.wordpress.com/2013/02/spilgames-gates.jpg"><img src="http://mysqlquicksand.files.wordpress.com/2013/02/spilgames-gates.jpg?w=300&#038;h=300" alt="spilgames-gates" width="300" height="300" class="alignnone size-medium wp-image-141" /></a></p>
<p>Second option would be coming by public transport.<br />
Coming from the direction of Amsterdam/Amerfoort:<br />
Take the train to Hilversum (central) and either walk to <a href="http://maps.google.com/maps?q=52.220728,5.198132&amp;ll=52.220741,5.198035&amp;spn=0.002369,0.004823&amp;num=1&amp;t=h&amp;z=18&amp;iwloc=near" target="_blank">our new office</a> using Google Maps (about 15 minutes walk). Otherwise you can take <a href="http://9292.nl/reisadvies/station-hilversum/hilversum_arendstraat-23/aankomst/2013-02-22T1654" target="_blank">bus #2 (to Snelliuslaan) and hop off on the Minckelersstraat</a> (ask the driver) and walk the remaining few hundred meters.</p>
<p>Coming from the direction of Utrecht:<br />
Take the train to Hilversum Sportpark and walk to <a href="http://maps.google.com/maps?q=52.220728,5.198132&amp;ll=52.220741,5.198035&amp;spn=0.002369,0.004823&amp;num=1&amp;t=h&amp;z=18&amp;iwloc=near" target="_blank">our new office</a> using Google Maps (about 8 to 10 minutes walk).</p>
<p>Hope to see you all next Friday at the Spil HQ! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br /> Tagged: <a href='http://mysqlquicksand.wordpress.com/tag/mysql-ug-nl/'>mysql ug nl</a>, <a href='http://mysqlquicksand.wordpress.com/tag/mysql-user-group/'>mysql user group</a>, <a href='http://mysqlquicksand.wordpress.com/tag/percona-live/'>percona live</a>, <a href='http://mysqlquicksand.wordpress.com/tag/spil-games/'>spil games</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mysqlquicksand.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mysqlquicksand.wordpress.com/133/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mysqlquicksand.wordpress.com&#038;blog=25013563&#038;post=133&#038;subd=mysqlquicksand&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mysqlquicksand.wordpress.com/2013/02/15/organizing-the-mysql-ug-nl-on-22nd-of-february/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ad9c0a32166ce6e1dd6cbe51ff720b7e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">artvanscheppingen</media:title>
		</media:content>

		<media:content url="http://mysqlquicksand.files.wordpress.com/2013/02/spilgames-gates.jpg?w=300" medium="image">
			<media:title type="html">spilgames-gates</media:title>
		</media:content>
	</item>
		<item>
		<title>Percona Live London 2012 slides available</title>
		<link>http://mysqlquicksand.wordpress.com/2012/12/06/percona-live-london-2012-slides-available/</link>
		<comments>http://mysqlquicksand.wordpress.com/2012/12/06/percona-live-london-2012-slides-available/#comments</comments>
		<pubDate>Thu, 06 Dec 2012 16:09:43 +0000</pubDate>
		<dc:creator>Art van Scheppingen</dc:creator>
				<category><![CDATA[mysql conference]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[datacenters]]></category>
		<category><![CDATA[enormous scale]]></category>
		<category><![CDATA[erlang]]></category>
		<category><![CDATA[master dc]]></category>
		<category><![CDATA[MySQL Conference & Expo]]></category>
		<category><![CDATA[percona live]]></category>
		<category><![CDATA[percona live london]]></category>
		<category><![CDATA[satellite dc]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[virtualized]]></category>
		<category><![CDATA[virtuals]]></category>

		<guid isPermaLink="false">http://mysqlquicksand.wordpress.com/?p=128</guid>
		<description><![CDATA[Many thanks to all those who attended my talk at the Percona Live London 2012 conference! I did put the location in the last slide, but just in case you missed the last slide (or missed my talk) you can find them here: http://spil.com/perconalondon2012 I did receive a couple of questions afterwards (in the hallways &#8230; <a href="http://mysqlquicksand.wordpress.com/2012/12/06/percona-live-london-2012-slides-available/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mysqlquicksand.wordpress.com&#038;blog=25013563&#038;post=128&#038;subd=mysqlquicksand&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Many thanks to all those who attended my talk at the Percona Live London 2012 conference!<br />
I did put the location in the last slide, but just in case you missed the last slide (or missed my talk) you can find them here:<br />
<a href="http://spil.com/perconalondon2012" target="_blank">http://spil.com/perconalondon2012</a></p>
<p>I did receive a couple of questions afterwards (in the hallways of the conference) that made me realize that I forgot to clear up a couple of things.</p>
<p>First of all the essence of shifting the data ownership of a specific GID towards a specific datacenter and ensuring data consistency also means one Erlang process within that very same datacenter is the owner of that data. This does also mean this Erlang process is the only that can write to the data of this GID. Don&#8217;t worry: for every GID there should be a process that is the data owner and Erlang should be able to cope with the enormous scale here.</p>
<p>Second of all the whole purpose of the satellite datacenter (all virtualized) is to have a <em>disposable</em> datacenter while the master datacenter (mostly virtualized, except for storage) is permanent. Imagine that next to the existing presence (master or satellite DC) in one country we also expect big growth due to the launch of a new game we could easily create a new satellite datacenter by getting a couple of machines in the cloud. This way our <em>hybrid</em> cloud can easily be expanded either by virtuals or by datacenters. I thought this was a bit too offtopic but apparently it raised some questions.</p>
<p>If you have any questions, don&#8217;t hesitate to ask! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br /> Tagged: <a href='http://mysqlquicksand.wordpress.com/tag/cloud/'>cloud</a>, <a href='http://mysqlquicksand.wordpress.com/tag/datacenters/'>datacenters</a>, <a href='http://mysqlquicksand.wordpress.com/tag/enormous-scale/'>enormous scale</a>, <a href='http://mysqlquicksand.wordpress.com/tag/erlang/'>erlang</a>, <a href='http://mysqlquicksand.wordpress.com/tag/master-dc/'>master dc</a>, <a href='http://mysqlquicksand.wordpress.com/tag/mysql-conference-expo/'>MySQL Conference &amp; Expo</a>, <a href='http://mysqlquicksand.wordpress.com/tag/percona-live/'>percona live</a>, <a href='http://mysqlquicksand.wordpress.com/tag/percona-live-london/'>percona live london</a>, <a href='http://mysqlquicksand.wordpress.com/tag/satellite-dc/'>satellite dc</a>, <a href='http://mysqlquicksand.wordpress.com/tag/technology/'>technology</a>, <a href='http://mysqlquicksand.wordpress.com/tag/virtualized/'>virtualized</a>, <a href='http://mysqlquicksand.wordpress.com/tag/virtuals/'>virtuals</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mysqlquicksand.wordpress.com/128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mysqlquicksand.wordpress.com/128/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mysqlquicksand.wordpress.com&#038;blog=25013563&#038;post=128&#038;subd=mysqlquicksand&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mysqlquicksand.wordpress.com/2012/12/06/percona-live-london-2012-slides-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ad9c0a32166ce6e1dd6cbe51ff720b7e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">artvanscheppingen</media:title>
		</media:content>
	</item>
		<item>
		<title>Runaway history list</title>
		<link>http://mysqlquicksand.wordpress.com/2012/11/15/runaway-history-list/</link>
		<comments>http://mysqlquicksand.wordpress.com/2012/11/15/runaway-history-list/#comments</comments>
		<pubDate>Thu, 15 Nov 2012 21:19:15 +0000</pubDate>
		<dc:creator>Art van Scheppingen</dc:creator>
				<category><![CDATA[mysql tuning]]></category>
		<category><![CDATA[history list]]></category>
		<category><![CDATA[purge lag]]></category>
		<category><![CDATA[read committed]]></category>
		<category><![CDATA[repeatable read]]></category>
		<category><![CDATA[runaway history list]]></category>
		<category><![CDATA[transaction isolation]]></category>

		<guid isPermaLink="false">http://mysqlquicksand.wordpress.com/?p=120</guid>
		<description><![CDATA[On one of the clusters at Spil we noticed a sudden increase in the length of the history list and a steep increase in the ibdata file in the MySQL directory. I did post a bit about this topic earlier regarding MySQL 5.5 but this cluster is still running 5.1 and unfortunately 5.1 does not &#8230; <a href="http://mysqlquicksand.wordpress.com/2012/11/15/runaway-history-list/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mysqlquicksand.wordpress.com&#038;blog=25013563&#038;post=120&#038;subd=mysqlquicksand&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>On one of the clusters at Spil we noticed a sudden increase in the length of the history list and a steep increase in the ibdata file in the MySQL directory.<br />
I did post a bit about this <a href="https://mysqlquicksand.wordpress.com/2012/01/13/mysql-5-5-upgrade-blues-part-one/" target="_blank">topic earlier regarding MySQL 5.5</a> but this cluster is still running 5.1 and unfortunately 5.1 does not have the same configurable options to influence the purging of the undo log&#8230;</p>
<p><a href="http://mysqlquicksand.files.wordpress.com/2012/11/history-color.gif"><img src="http://mysqlquicksand.files.wordpress.com/2012/11/history-color.gif?w=281&#038;h=300" alt="History list" title="History list" width="281" height="300" class="alignleft size-medium wp-image-121" /></a></p>
<p>Now I did find a couple of great resources that explain the purge lag problem into detail: <a href="http://www.pythian.com/news/32571/some-fun-around-mysql-history-list/" target="_blank">Pythian</a>, <a href="http://dimitrik.free.fr/blog/archives/2009/08/entry_76.html" target="_blank">DimitriK</a> and <a href="http://www.tusacentral.net/joomla/index.php/mysql-blogs/135-some-fun-around-history-list" target="_blank">Marco Tusa</a>.</p>
<p>What it boils down to is that the purge lag is largely influenced by the length of the history list and the purge lag:<br />
<code>((purge_lag/innodb_max_purge_lag)×10)–5 milliseconds.</code><br />
On 5.5 it is also influenced by the number of purge threads and purge batch size. I toyed around with these settings in my earlier post and tuning them helped. However the only setting I could change on 5.1 is the purge lag in milliseconds that was already set to 0. In other words: I could not fiddle around with this. This time it wasn&#8217;t an upgrade to 5.5 either so I could not blame that again. <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>So what was different on this server then? Well the only difference was that it did have &#8220;a bit&#8221; of disk utilization: around 80% during peak hours. Since it is not used as a front end server it does not affect the end users, but only the (background) job processes that process and store data on this server. However it could be the case that due to the IO utilization it started to lag behind and created a too large history list to catch up with its current configuration.</p>
<p>How did we resolve it then? After I read this quote of Peter Zaitsev on <a href="http://www.tusacentral.net/joomla/index.php/mysql-blogs/135-some-fun-around-history-list" target="_blank">Marco Tusa</a>&#8216;s posting the solution became clear:<br />
<em><br />
Running Very Long Transaction If you’re running very long transaction, be it even SELECT, Innodb will be unable to purge records for changes which are done after this transaction has started, in default REPEATABLE-READ isolation mode. This means very long transactions are very bad causing a lot of garbage to be accommodated in the database. It is not limited to undo slots. When we’re speaking about Long Transactions the time is a bad measure. Having transaction in read only database open for weeks does no harm, however if database has very high update rate, say 10K+ rows are modified every second even 5 minute transaction may be considered long as it will be enough to accumulate about 3 million of row changes.<br />
</em><br />
The transaction isolation is default set to REPEATABLE-READ and we favor it on many of our systems, especially because it performs better than READ-COMMITTED. However a background job running storage server does not need this transaction isolation, especially not if it is was blocking the purge to be performed!</p>
<p>So in the end changing the transaction isolation to READ-COMMITTED did fix the job for us.</p>
<p>Some other things: tomorrow my team is attending <a href="http://www.meetup.com/MySQL-User-Group-NL/" target="_blank">the MySQL User Group NL</a> and in three weeks time I&#8217;ll be speaking at Percona London:<br />
<a href="http://www.percona.com/live/london-2012/"><img src="http://s0.percona.com/percona-live/london2012/badges/123x123-London-Speaking.png" width="123" height="123" alt="Percona Live London, December 3-4, 2012" title="Discover the Power of MySQL" /></a><br />
So see you there!</p>
<br /> Tagged: <a href='http://mysqlquicksand.wordpress.com/tag/history-list/'>history list</a>, <a href='http://mysqlquicksand.wordpress.com/tag/mysql-tuning/'>mysql tuning</a>, <a href='http://mysqlquicksand.wordpress.com/tag/purge-lag/'>purge lag</a>, <a href='http://mysqlquicksand.wordpress.com/tag/read-committed/'>read committed</a>, <a href='http://mysqlquicksand.wordpress.com/tag/repeatable-read/'>repeatable read</a>, <a href='http://mysqlquicksand.wordpress.com/tag/runaway-history-list/'>runaway history list</a>, <a href='http://mysqlquicksand.wordpress.com/tag/transaction-isolation/'>transaction isolation</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mysqlquicksand.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mysqlquicksand.wordpress.com/120/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mysqlquicksand.wordpress.com&#038;blog=25013563&#038;post=120&#038;subd=mysqlquicksand&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mysqlquicksand.wordpress.com/2012/11/15/runaway-history-list/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ad9c0a32166ce6e1dd6cbe51ff720b7e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">artvanscheppingen</media:title>
		</media:content>

		<media:content url="http://mysqlquicksand.files.wordpress.com/2012/11/history-color.gif?w=281" medium="image">
			<media:title type="html">History list</media:title>
		</media:content>

		<media:content url="http://s0.percona.com/percona-live/london2012/badges/123x123-London-Speaking.png" medium="image">
			<media:title type="html">Discover the Power of MySQL</media:title>
		</media:content>
	</item>
		<item>
		<title>Using CURDATE() the wrong way</title>
		<link>http://mysqlquicksand.wordpress.com/2012/10/29/using-curtime-the-wrong-way/</link>
		<comments>http://mysqlquicksand.wordpress.com/2012/10/29/using-curtime-the-wrong-way/#comments</comments>
		<pubDate>Mon, 29 Oct 2012 13:54:34 +0000</pubDate>
		<dc:creator>Art van Scheppingen</dc:creator>
				<category><![CDATA[MySQL syntax]]></category>
		<category><![CDATA[CURDATE]]></category>
		<category><![CDATA[developer]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[syntax]]></category>
		<category><![CDATA[WTF]]></category>

		<guid isPermaLink="false">http://mysqlquicksand.wordpress.com/?p=114</guid>
		<description><![CDATA[It has been a while since I wrote on this blog. Basically I had too much on my mind (expanding my department, holidays, etc) to actually write here and I&#8217;ll promise to post more regularly from now onwards. Anyway, as the title already suggests: I found out how you can use CURDATE() in a wrong &#8230; <a href="http://mysqlquicksand.wordpress.com/2012/10/29/using-curtime-the-wrong-way/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mysqlquicksand.wordpress.com&#038;blog=25013563&#038;post=114&#038;subd=mysqlquicksand&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>It has been a while since I wrote on this blog. Basically I had too much on my mind (expanding my department, holidays, etc) to actually write here and I&#8217;ll promise to post more regularly from now onwards. <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><a href="http://mysqlquicksand.files.wordpress.com/2012/10/syntax.jpeg"><img src="http://mysqlquicksand.files.wordpress.com/2012/10/syntax.jpeg?w=300&#038;h=201" alt="Syntax error!" title="Syntax error!" width="300" height="201" class="alignleft size-medium wp-image-115" /></a></p>
<p>Anyway, as the title already suggests: I found out how you can use CURDATE() in a wrong way. One of the developers in my company asked me to help him out as his code all of a sudden did not work properly anymore. Or even better: it used to process several thousands of rows and all of a sudden it processed none.</p>
<p>I looked at his code snippet and it was quite a long query with a lot of brackets:<br />
<code><br />
SELECT SUM(some_count_col), logdate, loghour FROM logs<br />
WHERE (logdate = CURDATE() AND loghour = HOUR(NOW())<br />
GROUP BY logdate, loghour;<br />
</code><br />
Column wise logdate is of the type DATE and loghour of the type TINYINT.<br />
<em>note that this is, obviously, not the original query, but it is similar</em></p>
<p>Apart from the fact that his usage of brackets makes the query quite unreadable I was quickly able to simplify the query to this:<span id="more-114"></span><br />
<code><br />
SELECT SUM(some_count_col), logdate, loghour FROM logs<br />
WHERE (logdate BETWEEN CURDATE() AND (CURDATE()-2)<br />
OR (logdate = CURDATE()-3 AND loghour &gt;= HOUR(NOW())<br />
GROUP BY logdate, loghour;<br />
</code><br />
There is no such thing as storing logs in the future, right? But yet still I wasn&#8217;t able to help him out properly as it still did not return any rows.</p>
<p>Then it struck me: he wasn&#8217;t using either the DATE_SUB() function or &#8220;INTERVAL 3 day&#8221; to calculate the date, he was actually substracting a number from the CURDATE() function. So I looked up the <a href="http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_curdate" target="_blank">CURDATE() function in the MySQL documentation</a>:</p>
<blockquote><p>
CURDATE()<br />
  Returns the current date as a value in &#8216;YYYY-MM-DD&#8217; or YYYYMMDD format, depending on whether the function is used in a string or numeric context.</p>
<p>mysql&gt; SELECT CURDATE();<br />
        -&gt; &#8217;2008-06-13&#8242;<br />
mysql&gt; SELECT CURDATE() + 0;<br />
        -&gt; 20080613
</p></blockquote>
<p>That&#8217;s weird: you actually can use CURDATE() in numeric context and adding or substracting is valid&#8230;</p>
<p>So let&#8217;s see what happens if you make calculations with it:<br />
<code><br />
[(none)]&gt; SELECT CURDATE()-4;<br />
+-------------+<br />
| CURDATE()-4 |<br />
+-------------+<br />
|    20121025 |<br />
+-------------+<br />
1 row in set (0.00 sec)<br />
</code><br />
Makes perfectly sense for todays date, right?</p>
<p>Well actually on that particular day I helped out the developer it was the first of October and the output was the following:<br />
<code><br />
[(none)]&gt; SELECT CURDATE()-4;<br />
+-------------+<br />
| CURDATE()-4 |<br />
+-------------+<br />
|    20120997 |<br />
+-------------+<br />
1 row in set (0.00 sec)<br />
</code><br />
Doing it for today with +4 would also give a similar behavior with the date 20121033.</p>
<p>I can imagine there is a need for CURDATE() to output both string and numeric context. However given that the MySQL documentation contains an example where a calculation is performed on CURDATE() to output it in numeric context makes it only more confusing for users. </p>
<p>Obviously this statement works correctly if you change it to this:<br />
<code><br />
[(none)]&gt; SELECT CURDATE() - INTERVAL 4 DAY;<br />
+----------------------------+<br />
| CURDATE() - INTERVAL 4 DAY |<br />
+----------------------------+<br />
| 2012-10-25                 |<br />
+----------------------------+<br />
1 row in set (0.00 sec)<br />
</code><br />
I am aware that developers should always check their SQL syntax and see if it actually outputs warnings/errors, but this particular case does work for 24/26/27 days each month.  It would be great to see a warning in the documentation to only perform date calculations in the proper way.</p>
<br /> Tagged: <a href='http://mysqlquicksand.wordpress.com/tag/curdate/'>CURDATE</a>, <a href='http://mysqlquicksand.wordpress.com/tag/developer/'>developer</a>, <a href='http://mysqlquicksand.wordpress.com/tag/sql/'>SQL</a>, <a href='http://mysqlquicksand.wordpress.com/tag/syntax/'>syntax</a>, <a href='http://mysqlquicksand.wordpress.com/tag/wtf/'>WTF</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mysqlquicksand.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mysqlquicksand.wordpress.com/114/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mysqlquicksand.wordpress.com&#038;blog=25013563&#038;post=114&#038;subd=mysqlquicksand&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mysqlquicksand.wordpress.com/2012/10/29/using-curtime-the-wrong-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://mysqlquicksand.files.wordpress.com/2012/10/syntax.jpeg?w=150" />
		<media:content url="http://mysqlquicksand.files.wordpress.com/2012/10/syntax.jpeg?w=150" medium="image">
			<media:title type="html">Syntax error!</media:title>
		</media:content>

		<media:content url="http://1.gravatar.com/avatar/ad9c0a32166ce6e1dd6cbe51ff720b7e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">artvanscheppingen</media:title>
		</media:content>

		<media:content url="http://mysqlquicksand.files.wordpress.com/2012/10/syntax.jpeg?w=300" medium="image">
			<media:title type="html">Syntax error!</media:title>
		</media:content>
	</item>
		<item>
		<title>The Percona Live MySQL Conference 2012</title>
		<link>http://mysqlquicksand.wordpress.com/2012/04/16/the-percona-live-mysql-conference-2012/</link>
		<comments>http://mysqlquicksand.wordpress.com/2012/04/16/the-percona-live-mysql-conference-2012/#comments</comments>
		<pubDate>Mon, 16 Apr 2012 14:05:55 +0000</pubDate>
		<dc:creator>Art van Scheppingen</dc:creator>
				<category><![CDATA[mysql conference]]></category>
		<category><![CDATA[london]]></category>
		<category><![CDATA[MySQL Conference & Expo]]></category>
		<category><![CDATA[percona live]]></category>

		<guid isPermaLink="false">http://mysqlquicksand.wordpress.com/?p=108</guid>
		<description><![CDATA[Thank you very much if you attended my session at the Percona Live MySQL Conference! I promised some people to share my slides, so I posted them on the page at Percona: Spil Games: Outgrowing an internet startup (Percona Live MySQL Conference 2012) on SlideShare Click here if you need a direct link My opinion &#8230; <a href="http://mysqlquicksand.wordpress.com/2012/04/16/the-percona-live-mysql-conference-2012/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mysqlquicksand.wordpress.com&#038;blog=25013563&#038;post=108&#038;subd=mysqlquicksand&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Thank you very much if you attended my session at the Percona Live MySQL Conference!<br />
I promised some people to share my slides, so I posted them on the page at Percona:<br />
<a href="http://www.percona.com/live/mysql-conference-2012/sessions/spil-games-outgrowing-internet-startup">Spil Games: Outgrowing an internet startup (Percona Live MySQL Conference 2012) on SlideShare</a><br />
Click <a href="http://www.slideshare.net/art-spilgames/spil-games-outgrowing-an-internet-startup">here</a> if you need a direct link</p>
<p>My opinion of the conference is that it was amazing! The conference was very well organized, the atmosphere was great and I met so many great people that I had a tough time remembering all their names and companies. The contents of all talks were really well balanced and most of the ones I attended were very interesting.</p>
<p>The most interesting talk of the conference was the <a href="http://www.percona.com/live/mysql-conference-2012/sessions/scripting-mysql-lua-and-libdrizzle-inside-nginx">Scripting MySQL with Lua and libdrizzle inside Nginx</a>. It was a shame only a few people attended the talk and that they ran out of time before they could complete the presentation. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>Apart from that I had a really great time and hope to see you all next year! (or later this year in London)</p>
<br /> Tagged: <a href='http://mysqlquicksand.wordpress.com/tag/london/'>london</a>, <a href='http://mysqlquicksand.wordpress.com/tag/mysql-conference-expo/'>MySQL Conference &amp; Expo</a>, <a href='http://mysqlquicksand.wordpress.com/tag/percona-live/'>percona live</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mysqlquicksand.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mysqlquicksand.wordpress.com/108/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mysqlquicksand.wordpress.com&#038;blog=25013563&#038;post=108&#038;subd=mysqlquicksand&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mysqlquicksand.wordpress.com/2012/04/16/the-percona-live-mysql-conference-2012/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:thumbnail url="http://mysqlquicksand.files.wordpress.com/2012/04/pl_badge_large_speaker.jpg?w=74" />
		<media:content url="http://mysqlquicksand.files.wordpress.com/2012/04/pl_badge_large_speaker.jpg?w=74" medium="image">
			<media:title type="html">PL_Badge_Large_Speaker</media:title>
		</media:content>

		<media:content url="http://1.gravatar.com/avatar/ad9c0a32166ce6e1dd6cbe51ff720b7e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">artvanscheppingen</media:title>
		</media:content>
	</item>
		<item>
		<title>Speaking at Percona Live MySQL conference</title>
		<link>http://mysqlquicksand.wordpress.com/2012/04/08/speaking-at-percona-live-mysql-conference/</link>
		<comments>http://mysqlquicksand.wordpress.com/2012/04/08/speaking-at-percona-live-mysql-conference/#comments</comments>
		<pubDate>Sun, 08 Apr 2012 12:37:25 +0000</pubDate>
		<dc:creator>Art van Scheppingen</dc:creator>
				<category><![CDATA[mysql conference]]></category>
		<category><![CDATA[MySQL Conference & Expo]]></category>

		<guid isPermaLink="false">http://mysqlquicksand.wordpress.com/?p=101</guid>
		<description><![CDATA[Suitcase packed? Check! Laptop? Check! Presentation? Check! I&#8217;m ready for my departure to San Francisco tomorrow morning! I already mentioned before that I will be a speaker at the MySQL conference, but I think the session has moved since. It is now scheduled Thursday between 1:00 and 1:50 in ballrooom E. Be there if you &#8230; <a href="http://mysqlquicksand.wordpress.com/2012/04/08/speaking-at-percona-live-mysql-conference/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mysqlquicksand.wordpress.com&#038;blog=25013563&#038;post=101&#038;subd=mysqlquicksand&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Suitcase packed? Check!<br />
Laptop? Check!<br />
Presentation? Check!<br />
I&#8217;m ready for my departure to San Francisco tomorrow morning!</p>
<p>I already mentioned before that I will be a speaker at the MySQL conference, but I think the session has moved since. It is now <a href="http://www.percona.com/live/mysql-conference-2012/sessions/spil-games-outgrowing-internet-startup" target="_blank">scheduled Thursday between 1:00 and 1:50 in ballrooom E</a>. Be there if you want to know more about what Spil Games is doing!</p>
<p>I also determined what the most interesting talks are going to be for me and here are some of the highlights:<br />
<a href="http://www.percona.com/live/mysql-conference-2012/sessions/one-many-story-sharding-box" target="_blank">One to Many: The Story of Sharding at Box (Wed 1:00 &#8211; 1:50pm)</a><br />
Sounds very interesting to see how different their story is from the one at Spil Games.</p>
<p><a href="http://www.percona.com/live/mysql-conference-2012/sessions/etsy-shard-architecture-starts-s-and-ends-hard" target="_blank">The Etsy Shard Architecture: Starts with S and Ends With Hard (Wed 2:00 &#8211; 2:50)</a><br />
Same as above but then with the difference that, from the description, it seems they are implementing almost the same solution as we are. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p><a href="http://www.percona.com/live/mysql-conference-2012/sessions/scripting-mysql-lua-and-libdrizzle-inside-nginx" target="_blank">Scripting MySQL with Lua and libdrizzle inside Nginx (Wed 3:30 &#8211; 16:20)</a><br />
Very interesting thought of combining Nginx with Lua and a database connection through Libdrizzle. It seems you can easily implement lightweight services this way. So definitely a reccomended session!</p>
<p><a href="http://www.percona.com/live/mysql-conference-2012/sessions/percona-xtradb-cluster-new-ha-solution" target="_blank">Percona XtraDB Cluster: New HA solution (Thu 11:00 &#8211; 11:50)</a><br />
Percona XtraDB Cluster came to me as a complete surprise earlier this year. I&#8217;ve been playing around with it a little bit and now that it has gone GA last week I&#8217;m even more anxious to attend this session. I think it could be a good candidate to become one of the building blocks for Spil Games in the future.</p>
<p><a href="http://www.percona.com/live/mysql-conference-2012/sessions/common-schema-framework-mysql-server-administration" target="_blank">Common Schema: a framework for MySQL server administration (Thu 2:00 &#8211; 2:50)</a><br />
I haven&#8217;t done much with Common Schema so far and it is already available on our platform so I think it would be a good idea to attend this session and get more practical insights.</p>
<p>So I&#8217;m off to SF in about 19 hours. If you are also attending the conference: see you there!</p>
<br /> Tagged: <a href='http://mysqlquicksand.wordpress.com/tag/mysql-conference-expo/'>MySQL Conference &amp; Expo</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mysqlquicksand.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mysqlquicksand.wordpress.com/101/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mysqlquicksand.wordpress.com&#038;blog=25013563&#038;post=101&#038;subd=mysqlquicksand&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mysqlquicksand.wordpress.com/2012/04/08/speaking-at-percona-live-mysql-conference/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:thumbnail url="http://mysqlquicksand.files.wordpress.com/2012/04/pl_badge_large_speaker.jpg?w=74" />
		<media:content url="http://mysqlquicksand.files.wordpress.com/2012/04/pl_badge_large_speaker.jpg?w=74" medium="image">
			<media:title type="html">PL_Badge_Large_Speaker</media:title>
		</media:content>

		<media:content url="http://1.gravatar.com/avatar/ad9c0a32166ce6e1dd6cbe51ff720b7e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">artvanscheppingen</media:title>
		</media:content>
	</item>
		<item>
		<title>Relearn about your battery</title>
		<link>http://mysqlquicksand.wordpress.com/2012/03/15/relearn-about-your-battery/</link>
		<comments>http://mysqlquicksand.wordpress.com/2012/03/15/relearn-about-your-battery/#comments</comments>
		<pubDate>Thu, 15 Mar 2012 18:42:07 +0000</pubDate>
		<dc:creator>banpei</dc:creator>
				<category><![CDATA[hardware]]></category>
		<category><![CDATA[battery relearn]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[omconfig]]></category>
		<category><![CDATA[omreport]]></category>
		<category><![CDATA[poweredge r710]]></category>
		<category><![CDATA[replication]]></category>

		<guid isPermaLink="false">http://mysqlquicksand.wordpress.com/?p=94</guid>
		<description><![CDATA[Some days ago I got a call from our support engineer on duty that MySQL on one of our database servers was lagging more than 1000 seconds behind in replication and the server got kicked out of the pool because of the delay. He was unable to find out why and there was absolutely nothing &#8230; <a href="http://mysqlquicksand.wordpress.com/2012/03/15/relearn-about-your-battery/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mysqlquicksand.wordpress.com&#038;blog=25013563&#038;post=94&#038;subd=mysqlquicksand&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Some days ago I got a call from our support engineer on duty that MySQL on one of our database servers was lagging more than 1000 seconds behind in replication and the server got kicked out of the pool because of the delay. He was unable to find out why and there was absolutely nothing in the mysql log files. When I got the call it was still lagging behind but the lag was slowly decreasing again.</p>
<p>After a quick peek in all our monitoring systems I isolated it to this message:<br />
<em>Cache Battery 0 in controller 0 is Charging (Ready) [probably harmless]</em><br />
Apparently not that harmless! <img src='http://s2.wp.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>Obviously we did encountered this situation a couple of times before but apparently there was no detection on this machine. </p>
<p>The relearn cycle happens every 90 days and gets first scheduled when the machine gets powered on. Now imagine this happening in a master-master setup where both machines were powered on at the same time. Lucky enough you can use omconfig to reschedule the cycle up to 7 days, but then you obviously need to have detection in place.</p>
<p>Why did nobody come up with the idea to have a dual battery backed up cache with alternating relearn cycles? That way you can have your battery relearn without the controller going back into write-through mode. <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<br /> Tagged: <a href='http://mysqlquicksand.wordpress.com/tag/battery-relearn/'>battery relearn</a>, <a href='http://mysqlquicksand.wordpress.com/tag/hardware/'>hardware</a>, <a href='http://mysqlquicksand.wordpress.com/tag/mysql/'>mysql</a>, <a href='http://mysqlquicksand.wordpress.com/tag/omconfig/'>omconfig</a>, <a href='http://mysqlquicksand.wordpress.com/tag/omreport/'>omreport</a>, <a href='http://mysqlquicksand.wordpress.com/tag/poweredge-r710/'>poweredge r710</a>, <a href='http://mysqlquicksand.wordpress.com/tag/replication/'>replication</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mysqlquicksand.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mysqlquicksand.wordpress.com/94/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mysqlquicksand.wordpress.com&#038;blog=25013563&#038;post=94&#038;subd=mysqlquicksand&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mysqlquicksand.wordpress.com/2012/03/15/relearn-about-your-battery/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:thumbnail url="https://mysqlquicksand.files.wordpress.com/2012/03/battery-perc6i.jpg?w=150" />
		<media:content url="https://mysqlquicksand.files.wordpress.com/2012/03/battery-perc6i.jpg?w=150" medium="image">
			<media:title type="html">battery-perc6i</media:title>
		</media:content>

		<media:content url="http://2.gravatar.com/avatar/29f2af625e8fb5fae0b8016a17553db7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">banpei</media:title>
		</media:content>
	</item>
		<item>
		<title>Percona Monitoring Plugins fix: Query Response Time</title>
		<link>http://mysqlquicksand.wordpress.com/2012/03/13/percona-monitoring-plugins-fix-query-response-time/</link>
		<comments>http://mysqlquicksand.wordpress.com/2012/03/13/percona-monitoring-plugins-fix-query-response-time/#comments</comments>
		<pubDate>Tue, 13 Mar 2012 16:17:04 +0000</pubDate>
		<dc:creator>Art van Scheppingen</dc:creator>
				<category><![CDATA[percona]]></category>
		<category><![CDATA[cacti]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[percona monitoring plugins]]></category>
		<category><![CDATA[query response time]]></category>
		<category><![CDATA[query time histogram]]></category>

		<guid isPermaLink="false">http://mysqlquicksand.wordpress.com/?p=92</guid>
		<description><![CDATA[After switching from the Better Cacti Templates to the Percona Monitoring Plugins we suffered from the Query Response Time and the Query Time Histogram not graphing at all. It took me a while to figure out why our new instance wasn&#8217;t graphing: the response time query was performing and the script was picking up its &#8230; <a href="http://mysqlquicksand.wordpress.com/2012/03/13/percona-monitoring-plugins-fix-query-response-time/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mysqlquicksand.wordpress.com&#038;blog=25013563&#038;post=92&#038;subd=mysqlquicksand&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>After switching from the <a href="http://code.google.com/p/mysql-cacti-templates/" target="_blank">Better Cacti Templates</a> to the <a href="http://www.percona.com/software/percona-monitoring-plugins/" target="_blank">Percona Monitoring Plugins</a> we suffered from the Query Response Time and the Query Time Histogram not graphing at all.</p>
<p>It took me a while to figure out why our new instance wasn&#8217;t graphing: the response time query was performing and the script was picking up its values. Also the rrd files were created but for some bizarre reason all values were set to &#8220;NaN&#8221;, in rrd/cacti terms: <em>Not a Number</em>. If you search on that subject you will come across a lot of (forum) postings stating you need to change your graph type to &#8220;GAUGE&#8221; or change the MIN/MAX values for your data templates. Strange as this was already set to a minimum of 0 and a maximum of an unsigned 64 bit integer.</p>
<p>After running the ss_get_mysql_stats.php script manually for these graphs I got the error stating that a -1 value was not allowed. Indeed the output of the script contained a -1 value for the last measurement and I quickly found the culprit: an uninitialized array key inside the script will cause it to return a -1 value. Now why was this array key not initialized? Simply because the query filling the array was capped to 13 rows instead of the expected 14 rows.</p>
<p>This left me with three options:<br />
<strong>1.</strong> Change cacti templates to allow -1 value<br />
<strong>2.</strong> Change cacti templates to only contain 13 data points instead of 14<br />
<strong>3.</strong> Change the query in the ss_get_mysql_stats.php script<br />
Naturally I patched the script and after 10 minutes the graphs started to get colorful again! <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>So if you have the same problem as we do, you can find the patch attached to my bugreport:<br />
<a href="https://bugs.launchpad.net/percona-monitoring-plugins/+bug/954118" target="_blank">Query reponse time and Query time histogram not graphing</a></p>
<br /> Tagged: <a href='http://mysqlquicksand.wordpress.com/tag/cacti/'>cacti</a>, <a href='http://mysqlquicksand.wordpress.com/tag/monitoring/'>monitoring</a>, <a href='http://mysqlquicksand.wordpress.com/tag/mysql/'>mysql</a>, <a href='http://mysqlquicksand.wordpress.com/tag/percona-monitoring-plugins/'>percona monitoring plugins</a>, <a href='http://mysqlquicksand.wordpress.com/tag/query-response-time/'>query response time</a>, <a href='http://mysqlquicksand.wordpress.com/tag/query-time-histogram/'>query time histogram</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mysqlquicksand.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mysqlquicksand.wordpress.com/92/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mysqlquicksand.wordpress.com&#038;blog=25013563&#038;post=92&#038;subd=mysqlquicksand&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mysqlquicksand.wordpress.com/2012/03/13/percona-monitoring-plugins-fix-query-response-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ad9c0a32166ce6e1dd6cbe51ff720b7e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">artvanscheppingen</media:title>
		</media:content>
	</item>
		<item>
		<title>Running multiple MySQL instances in parallel</title>
		<link>http://mysqlquicksand.wordpress.com/2012/03/08/running-multiple-mysql-instances-in-parallel/</link>
		<comments>http://mysqlquicksand.wordpress.com/2012/03/08/running-multiple-mysql-instances-in-parallel/#comments</comments>
		<pubDate>Thu, 08 Mar 2012 20:34:01 +0000</pubDate>
		<dc:creator>Art van Scheppingen</dc:creator>
				<category><![CDATA[multple mysql instances]]></category>
		<category><![CDATA[HA]]></category>
		<category><![CDATA[MMM]]></category>
		<category><![CDATA[multiple mysql instances]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[MySQL 5.5]]></category>
		<category><![CDATA[percona live]]></category>
		<category><![CDATA[Percona Server]]></category>
		<category><![CDATA[xtrabackup]]></category>

		<guid isPermaLink="false">http://mysqlquicksand.wordpress.com/?p=84</guid>
		<description><![CDATA[I know, I haven&#8217;t been posting much lately. 5.5 upgrades got postponed due to the new storage platform needing my immediate attention and being a speaker at the Percona Live conference in April also needs a lot of attention. One of the things I want to try out is running multiple MySQL instances on the &#8230; <a href="http://mysqlquicksand.wordpress.com/2012/03/08/running-multiple-mysql-instances-in-parallel/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mysqlquicksand.wordpress.com&#038;blog=25013563&#038;post=84&#038;subd=mysqlquicksand&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I know, I haven&#8217;t been posting much lately. 5.5 upgrades got postponed due to the new storage platform needing my immediate attention and being a <a href="http://www.percona.com/live/mysql-conference-2012/program/speakers" target="_blank">speaker at the Percona Live conference in April</a> also needs a lot of attention.</p>
<p>One of the things I want to try out is running multiple MySQL instances on the same machine. The concept remained in the back of my mind ever since I attended <a href="http://www.slideshare.net/ryanthiessen/mysql-conference-2011-the-secret-sauce-of-sharding-ryan-thiessen" target="_blank">Ryan Thiessen&#8217;s presentation</a> on the MySQL conference 2011 but we never actually got a proper usecase for it. Well, with the new storage platform it would be really beneficial so an excellent use case to try it out! So what have I been busy with in the past week? That&#8217;s right: running multiple instances MySQL on one single server. <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Even though it is not well documented and nobody describes the process in depth it is not that complicated to get multiple instances running next to each other. However it does involve a lot of changes in the surrounding tools, scripts and monitoring. For example, this is what I changed so far:</p>
<p><strong>1. MySQL startup script</strong><br />
Yes, you really want this baby to support multiple instances. I&#8217;ve learned my lesson with the wildgrowth of copies of the various MMM init scripts.</p>
<p><strong>2. Templating of configs</strong><br />
If you want to maintain the instances well you should definitely start using a fixed template which includes a defaults file. In our case I created one defaults file for all instances and each and every instance will override the settings of the defaults file. Also some tuning parts are now separated from the main config.</p>
<p><strong>3. Automation of adding new instances to a host</strong><br />
Apart from a bunch of config files, data directory you really want to have some intelligence when adding another instance. For example only the innodb_buffer_pool_size needs to be adjusted for each new instance you add.</p>
<p><strong>4. Automation of removing instances from a host</strong><br />
Part of the step above: if you can add instances, they you need to be able to remove an instance. This should be done with care as it will be destructive. <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>After this there is still a long extensive list of things to be taken care of:<br />
<strong>1. Automation of replication setup</strong><br />
The plan is to keep things simple and have two hosts replicate all instances to each other. So the instance 3307 on host 1 will replicate to instance 3307 on host 2 (and back), instance 3308 on host 1 will replicate to instance 3308 on host 2 (and back), etc.</p>
<p><strong>2. HA Monitoring needs thinking/replacement</strong><br />
I haven&#8217;t found a HA Monitoring tool that can handle multiple instances on one host.<br />
Why is this a problem?<br />
If only one of the MySQL instances needs maintenance you can&#8217;t use the current tools unless you are willing to make all other instances unavailable as well. Also what will you do when the connection pool of one instance gets exhausted? Or if one instance on both servers die?</p>
<p><strong>3. Backup scripts needs some changes</strong><br />
Obviously our backup tools (wrapper scripts around xtrabackup) need some alteration. We are now running multiple instances, so we need to backup more than one database.</p>
<p><strong>4. Cloning scripts need some changes</strong><br />
We have a script that can clone a live database (utilizing xtrabackup) to a new host. Apart from the fact that it assumes it needs to clone only one single database we might also go for full cloning of all instances</p>
<p><strong>5. Monitoring needs to understand multiple instances</strong><br />
Our current (performance) monitoring tools, like Nagios/Cacti/etc, only assume one MySQL instance per host. At best I can implement the templates multiple times, but that also increases the number of other checks with the same factor.</p>
<p>And there obviously a lot more things I haven&#8217;t thought of yet. As you can see I&#8217;ll be quite occupied in the upcoming period&#8230;</p>
<br /> Tagged: <a href='http://mysqlquicksand.wordpress.com/tag/ha/'>HA</a>, <a href='http://mysqlquicksand.wordpress.com/tag/mmm/'>MMM</a>, <a href='http://mysqlquicksand.wordpress.com/tag/multiple-mysql-instances/'>multiple mysql instances</a>, <a href='http://mysqlquicksand.wordpress.com/tag/mysql/'>mysql</a>, <a href='http://mysqlquicksand.wordpress.com/tag/mysql-5-5/'>MySQL 5.5</a>, <a href='http://mysqlquicksand.wordpress.com/tag/percona-live/'>percona live</a>, <a href='http://mysqlquicksand.wordpress.com/tag/percona-server/'>Percona Server</a>, <a href='http://mysqlquicksand.wordpress.com/tag/xtrabackup/'>xtrabackup</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mysqlquicksand.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mysqlquicksand.wordpress.com/84/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mysqlquicksand.wordpress.com&#038;blog=25013563&#038;post=84&#038;subd=mysqlquicksand&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mysqlquicksand.wordpress.com/2012/03/08/running-multiple-mysql-instances-in-parallel/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:thumbnail url="http://mysqlquicksand.files.wordpress.com/2012/03/parallel.jpg?w=150" />
		<media:content url="http://mysqlquicksand.files.wordpress.com/2012/03/parallel.jpg?w=150" medium="image">
			<media:title type="html">Parallel</media:title>
		</media:content>

		<media:content url="http://1.gravatar.com/avatar/ad9c0a32166ce6e1dd6cbe51ff720b7e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">artvanscheppingen</media:title>
		</media:content>
	</item>
		<item>
		<title>MySQL 5.5 upgrade blues (part two)</title>
		<link>http://mysqlquicksand.wordpress.com/2012/01/24/mysql-5-5-upgrade-blues-part-two/</link>
		<comments>http://mysqlquicksand.wordpress.com/2012/01/24/mysql-5-5-upgrade-blues-part-two/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 21:24:50 +0000</pubDate>
		<dc:creator>Art van Scheppingen</dc:creator>
				<category><![CDATA[upgrades]]></category>
		<category><![CDATA[disk utilization]]></category>
		<category><![CDATA[innodb bufferpool]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[MySQL 5.5]]></category>
		<category><![CDATA[MySQL Conference & Expo]]></category>
		<category><![CDATA[percona live]]></category>

		<guid isPermaLink="false">http://mysqlquicksand.wordpress.com/?p=80</guid>
		<description><![CDATA[Shortly after the MySQL 5.5 upgrade the whole cluster was upgraded with extra ram. This was a nice test to see how differently 5.1 and 5.5 behave when they A) innodb bufferpool is too small and B) when the innodb bufferpool has enough room to fit everything in memory. The MySQL 5.5 had just the &#8230; <a href="http://mysqlquicksand.wordpress.com/2012/01/24/mysql-5-5-upgrade-blues-part-two/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mysqlquicksand.wordpress.com&#038;blog=25013563&#038;post=80&#038;subd=mysqlquicksand&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Shortly after the MySQL 5.5 upgrade the whole cluster was upgraded with extra ram. This was a nice test to see how differently 5.1 and 5.5 behave when they A) innodb bufferpool is too small and B) when the innodb bufferpool has enough room to fit everything in memory.</p>
<p>The MySQL 5.5 had just the same pattern in terms of disk utilization as the other nodes before (around 30% to 40%) and after the upgrade (4% to 5%), so not much difference at all. However the number of free pages within the bufferpool is significantly lower (about 10%) than on the other nodes. This definitely needs some further investigation.</p>
<p>Apart from that the machine is stable and it seems we will proceed with the upgrade on the whole cluster soon.</p>
<p>A sidenote: I&#8217;m happy to announce that I was selected as a speaker at the Percona Live MySQL Conference &amp; Expo in San Francisco, April 2012. I&#8217;ll be talking about Spil Games (the company I work for) and how our new architecture will solve or ease up the majority of our database issues.<br />
<a href="http://www.percona.com/live/mysqluc-2012/"><img src="http://www.percona.com/static/images/percona-live/mysqluc2012/promote/PL_Badge_Large_Speaker.jpg" width="118" height="239" alt="Percona Live MySQL User's Conference, San Francisco, April 10-12th, 2012" title="Discover the Power of MySQL" /></a></p>
<br /> Tagged: <a href='http://mysqlquicksand.wordpress.com/tag/disk-utilization/'>disk utilization</a>, <a href='http://mysqlquicksand.wordpress.com/tag/innodb-bufferpool/'>innodb bufferpool</a>, <a href='http://mysqlquicksand.wordpress.com/tag/mysql/'>mysql</a>, <a href='http://mysqlquicksand.wordpress.com/tag/mysql-5-5/'>MySQL 5.5</a>, <a href='http://mysqlquicksand.wordpress.com/tag/mysql-conference-expo/'>MySQL Conference &amp; Expo</a>, <a href='http://mysqlquicksand.wordpress.com/tag/percona-live/'>percona live</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mysqlquicksand.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mysqlquicksand.wordpress.com/80/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mysqlquicksand.wordpress.com&#038;blog=25013563&#038;post=80&#038;subd=mysqlquicksand&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mysqlquicksand.wordpress.com/2012/01/24/mysql-5-5-upgrade-blues-part-two/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ad9c0a32166ce6e1dd6cbe51ff720b7e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">artvanscheppingen</media:title>
		</media:content>

		<media:content url="http://www.percona.com/static/images/percona-live/mysqluc2012/promote/PL_Badge_Large_Speaker.jpg" medium="image">
			<media:title type="html">Discover the Power of MySQL</media:title>
		</media:content>
	</item>
	</channel>
</rss>
