<?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>domas mituzas &#187; mysql</title>
	<atom:link href="http://dom.as/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://dom.as</link>
	<description></description>
	<lastBuildDate>Thu, 02 Feb 2012 21:29:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='dom.as' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/6e344c6e0cd7462eb056f8b98eb2cbcd?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>domas mituzas &#187; mysql</title>
		<link>http://dom.as</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://dom.as/osd.xml" title="domas mituzas" />
	<atom:link rel='hub' href='http://dom.as/?pushpress=hub'/>
		<item>
		<title>On replication, some more</title>
		<link>http://dom.as/2009/12/13/on-replication-some-more/</link>
		<comments>http://dom.as/2009/12/13/on-replication-some-more/#comments</comments>
		<pubDate>Sun, 13 Dec 2009 19:24:24 +0000</pubDate>
		<dc:creator>Domas Mituzas</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[legacy]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://mituzas.lt/?p=679</guid>
		<description><![CDATA[Dear MySQL, I feel ashamed that I ever wanted you to support 4.0-&#62;5.1 replication, and apologize for that. I really understand that it was really egoistic of me even to consider you should be involved in this. I even understand &#8230; <a href="http://dom.as/2009/12/13/on-replication-some-more/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dom.as&amp;blog=190075&amp;post=679&amp;subd=domasmituzas&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Dear MySQL,</p>
<p>I feel ashamed that I ever <a href="http://bugs.mysql.com/bug.php?id=49474">wanted</a> you to<a href="http://bugs.mysql.com/bug.php?id=48369"> support 4.0-&gt;5.1 replication</a>, and apologize for <a href="http://mituzas.lt/2009/12/05/on-replication-compatibility/">that</a>. I really understand that it was really egoistic of me even to consider you should be involved in this.</p>
<p>I even understand that 5.0 is running out of <a href="http://www.mysql.com/about/legal/lifecycle/">active support</a> (I&#8217;m not questioning that you&#8217;ll stop supporting 4.1 entirely too), and you&#8217;ll stop doing pretty much anything to 5.0, except &#8220;critical security fixes&#8221; (w00t, I managed to <a href="http://bugs.mysql.com/bug.php?id=47320">get one</a> into 4.1, 8 year old MITM flaw :).</p>
<p>I really understand that supporting more than one release is very very very difficult, and people should do only adjacent version upgrade.</p>
<p>I&#8217;m not asking you much, but, maybe you could then support 5.1 to 5.1 replication? I don&#8217;t want much, just:</p>
<ul>
<li>Gracefully recover after slave crashes.</li>
<li>Don&#8217;t have single serial reading of pages for replication stream as a bottleneck &#8211; either read-ahead properly (you can do that with RBR!!!), or apply events in parallel (you can do that with RBR too!)</li>
<li>Allow to edit replication filters without restarting servers.</li>
<li>Allow to enable and disable binary logging of events received from master, as well as enabling and disabling binary logging without restarting the instance.</li>
</ul>
<p>I hope it isn&#8217;t too much too ask! It is just supported replication between two same version instances.</p>
<p>Thanks!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/domasmituzas.wordpress.com/679/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/domasmituzas.wordpress.com/679/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/domasmituzas.wordpress.com/679/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/domasmituzas.wordpress.com/679/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/domasmituzas.wordpress.com/679/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/domasmituzas.wordpress.com/679/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/domasmituzas.wordpress.com/679/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/domasmituzas.wordpress.com/679/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/domasmituzas.wordpress.com/679/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/domasmituzas.wordpress.com/679/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/domasmituzas.wordpress.com/679/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/domasmituzas.wordpress.com/679/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/domasmituzas.wordpress.com/679/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/domasmituzas.wordpress.com/679/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dom.as&amp;blog=190075&amp;post=679&amp;subd=domasmituzas&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dom.as/2009/12/13/on-replication-some-more/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c660a6eb3a4005232acb111303bef12c?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">domasmituzas</media:title>
		</media:content>
	</item>
		<item>
		<title>Profile guided optimization with gcc</title>
		<link>http://dom.as/2009/07/27/profile-guided-optimization-with-gcc/</link>
		<comments>http://dom.as/2009/07/27/profile-guided-optimization-with-gcc/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 15:27:38 +0000</pubDate>
		<dc:creator>Domas Mituzas</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[compiling]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[pgo]]></category>

		<guid isPermaLink="false">http://mituzas.lt/?p=554</guid>
		<description><![CDATA[Yesterday I wrote how certain build optimizations can have performance differences &#8211; and I decided to step a bit deeper into a quite interesting field &#8211; profile guided binary optimization. There&#8217;re quite a few interesting projects out there, like LLVM &#8230; <a href="http://dom.as/2009/07/27/profile-guided-optimization-with-gcc/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dom.as&amp;blog=190075&amp;post=554&amp;subd=domasmituzas&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Yesterday I wrote how certain build optimizations can have performance differences &#8211; and I decided to step a bit deeper into a quite interesting field &#8211; profile guided binary optimization. There&#8217;re quite a few interesting projects out there, like LLVM (I hear it is used extensively in iphone?) &#8211; which analyze run-time profile of compiled code and can do just in time adjustments of binary code. Apparently, you don&#8217;t need that fancy technology, and can use plain old gcc.</p>
<p>The whole plan is:</p>
<ol>
<li>Compile all code with -fprofile-generate in {C|CXX|LD}FLAGS</li>
<li>Run the binary</li>
<li>Run your application/benchmark against that binary</li>
<li>Recompile all code with -fprofile-use (above steps will place lots of .gcda files in source tree)</li>
<li>PROFIT!!! (note the omission of <a href='http://en.wikipedia.org/wiki/File:Gnomes_plan.png'>&#8220;???&#8221;</a> step)
</li>
</ol>
<p>How much profit? I measured <b>~7%</b> of sysbench performance increase (and probably would see much higher value in CPU-tight benchmarks). YMMV. Can such PGO be useful for every user out there? Maybe &#8211; but the best results are achieved once looking at actual use patterns &#8211; though of course, lots of them are similar everywhere around.</p>
<p>Also, I am showing the actual profiling process with too much of pink. Apparently gcc/gcov profiles tend to get corrupted in multithreaded applications, so I did multiple profile/build passes, until I managed to assemble final binary. :-)</p>
<p>Now I have to figure out how to use -combine flag in gcc, and treat whole MySQL codebase as one huge .c file (apparently compilers can make much much better decisions then).</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/domasmituzas.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/domasmituzas.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/domasmituzas.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/domasmituzas.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/domasmituzas.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/domasmituzas.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/domasmituzas.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/domasmituzas.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/domasmituzas.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/domasmituzas.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/domasmituzas.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/domasmituzas.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/domasmituzas.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/domasmituzas.wordpress.com/554/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dom.as&amp;blog=190075&amp;post=554&amp;subd=domasmituzas&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dom.as/2009/07/27/profile-guided-optimization-with-gcc/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c660a6eb3a4005232acb111303bef12c?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">domasmituzas</media:title>
		</media:content>
	</item>
		<item>
		<title>Notes from land of I/O</title>
		<link>http://dom.as/2008/08/11/notes-from-land-of-io/</link>
		<comments>http://dom.as/2008/08/11/notes-from-land-of-io/#comments</comments>
		<pubDate>Mon, 11 Aug 2008 12:52:00 +0000</pubDate>
		<dc:creator>Domas Mituzas</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[directio]]></category>
		<category><![CDATA[innodb]]></category>
		<category><![CDATA[io]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[xfs]]></category>

		<guid isPermaLink="false">http://dammit.lt/?p=184</guid>
		<description><![CDATA[A discussion on IRC sparkled some interest on how various I/O things work in Linux. I wrote small microbenchmarking program (where all configuration is in source file, and I/O modes can be changed by editing various places in code ;-), &#8230; <a href="http://dom.as/2008/08/11/notes-from-land-of-io/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dom.as&amp;blog=190075&amp;post=184&amp;subd=domasmituzas&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A discussion on IRC sparkled some interest on how various I/O things work in Linux. I wrote small microbenchmarking <a href='http://noc.wikimedia.org/~midom/raidbench.c.txt'>program</a> (where all configuration is in source file, and I/O modes can be changed by editing various places in code ;-), and started playing with performance.</p>
<p>The machine for this testing was RAID10 16disk box with 2.6.24 kernel, and I tried to understand how O_DIRECT works, and how fsync() works and ended up digging into some other stuff.</p>
<p>My notes for now are:</p>
<ul>
<li>O_DIRECT serializes writes to a file on ext2, ext3, jfs, so I got at most 200-250w/s.</li>
<li>xfs allows parallel (and out-of-order, if that matters) DIO, so I got 1500-2700w/s (depending on file size &#8211; seek time changes.. :) of random I/O without write-behind caching. There are few outstanding bugs that lock this down back to 250w/s (<i>#xfs@freenode: &#8220;yeah, we drop back to taking the i_mutex in teh case where we are writing beyond EOF or we have cached pages&#8221;</i>, so
<pre>posix_fadvise(fd, 0, filesize, POSIX_FADV_DONTNEED)</pre>
<p>helps).</li>
<li>fsync(),sync(),fdatasync() wait if there are any writes, bad part &#8211; it can wait forever. Filesystems people say thats a bug &#8211; it shouldn&#8217;t wait for I/O that happened after sync being called. I tend to believe, as it causes stuff like InnoDB semaphore waits and such. </li>
</ul>
<p>Of course, having write-behind caching at the controller (or disk, *shudder*) level allows filesystems to be lazy (and benchmarks are no longer that different), but having the upper layers work efficiently is quite important too, to avoid bottlenecks.</p>
<p>It is interesting, that write-behind caching isn&#8217;t needed that much anymore for random writes, once filesystem parallelizes I/O, even direct, nonbuffered one.</p>
<p>Anyway, now that I found some of I/O properties and issues, should probably start thinking how they apply to the upper layers like InnoDB.. :)</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/domasmituzas.wordpress.com/184/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/domasmituzas.wordpress.com/184/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/domasmituzas.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/domasmituzas.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/domasmituzas.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/domasmituzas.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/domasmituzas.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/domasmituzas.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/domasmituzas.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/domasmituzas.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/domasmituzas.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/domasmituzas.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/domasmituzas.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/domasmituzas.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/domasmituzas.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/domasmituzas.wordpress.com/184/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dom.as&amp;blog=190075&amp;post=184&amp;subd=domasmituzas&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dom.as/2008/08/11/notes-from-land-of-io/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c660a6eb3a4005232acb111303bef12c?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">domasmituzas</media:title>
		</media:content>
	</item>
		<item>
		<title>On blocking</title>
		<link>http://dom.as/2008/06/20/on-blocking/</link>
		<comments>http://dom.as/2008/06/20/on-blocking/#comments</comments>
		<pubDate>Fri, 20 Jun 2008 10:44:00 +0000</pubDate>
		<dc:creator>Domas Mituzas</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[io]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[rsync]]></category>
		<category><![CDATA[tcp]]></category>

		<guid isPermaLink="false">http://dammit.lt/?p=162</guid>
		<description><![CDATA[If a process has two blocking operations, each blocking other (like, I/O and networking), theoretical performance decrease will be 50%. Solution is very easy &#8211; convert one operation (quite often the one that blocks less, but I guess it doesn&#8217;t &#8230; <a href="http://dom.as/2008/06/20/on-blocking/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dom.as&amp;blog=190075&amp;post=162&amp;subd=domasmituzas&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If a process has two blocking operations, each blocking other (like, I/O and networking), theoretical performance decrease will be 50%. Solution is very easy &#8211; convert one operation (quite often the one that blocks less, but I guess it doesn&#8217;t matter that much) into a nonblocking one.</p>
<p>Though MySQL has network-write buffer, which provides some async network behavior, it still has to get context switch into a thread to write stuff.</p>
<p>rsync and other file transfer protocols are even worse in this regard. On a regular Linux machine rsync even on gigabit network will keep kernel&#8217;s send-queue saturated (it is 128K by default anyway).</p>
<p>How to make MySQL&#8217;s or rsync networking snappier? If in &#8216;netstat&#8217; sendq column is maxed out &#8211; just increase kernel buffers, instead of process buffers:</p>
<pre>
# increase TCP max buffer size
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
# increase Linux autotuning TCP buffer limits
# min, default, and max number of bytes to use
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
</pre>
<p>This can add additional 10-20% of file transfer throughput (and sendq goes up to 500k &#8211; so it seems to be really worth it).</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/domasmituzas.wordpress.com/162/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/domasmituzas.wordpress.com/162/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/domasmituzas.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/domasmituzas.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/domasmituzas.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/domasmituzas.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/domasmituzas.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/domasmituzas.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/domasmituzas.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/domasmituzas.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/domasmituzas.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/domasmituzas.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/domasmituzas.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/domasmituzas.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/domasmituzas.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/domasmituzas.wordpress.com/162/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dom.as&amp;blog=190075&amp;post=162&amp;subd=domasmituzas&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dom.as/2008/06/20/on-blocking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c660a6eb3a4005232acb111303bef12c?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">domasmituzas</media:title>
		</media:content>
	</item>
	</channel>
</rss>
