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

<channel>
	<title>MySQL Performance Blog &#187; operating systems</title>
	<atom:link href="http://www.mysqlperformanceblog.com/category/operating-systems/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysqlperformanceblog.com</link>
	<description>Everything about MySQL Performance</description>
	<lastBuildDate>Sat, 21 Nov 2009 03:11:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SystemTap &#8211; DTrace for Linux ?</title>
		<link>http://www.mysqlperformanceblog.com/2009/09/14/systemtap-dtrace-for-linux/</link>
		<comments>http://www.mysqlperformanceblog.com/2009/09/14/systemtap-dtrace-for-linux/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 04:24:30 +0000</pubDate>
		<dc:creator>Vadim</dc:creator>
				<category><![CDATA[operating systems]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=1115</guid>
		<description><![CDATA[Since DTrace was released for Solaris I am missing it on Linux systems... It can't be included in Linux by the same reason why ZFS can't be - it's licensing issue. Both ZFS and DTrace are under CDDL, which is incompatible with GPL. So you can see DTrace and ZFS on Solaris, FreeBSD, MacOS, but [...]]]></description>
			<content:encoded><![CDATA[<p>Since DTrace was released for Solaris I am missing it on Linux systems... It can't be included in Linux by the same reason why ZFS can't be - it's licensing issue. Both ZFS and DTrace are under CDDL, which is incompatible with GPL. So you can see DTrace and ZFS on Solaris, FreeBSD, MacOS, but not on Linux.</p>
<p>However I follow the project <a href="http://sourceware.org/systemtap/">SystemTap</a> for couple of years (it was started in 2005), which is supposed to provide similar to DTrace functionality.</p>
<p>Why I am interested in this tool, because there is no simple way under Linux to profile not CPU-bound load (for CPU-bound there is OProfile, see for example<br />
<a href="http://mysqlinsights.blogspot.com/2009/08/oprofile-for-io-bound-apps.html">http://mysqlinsights.blogspot.com/2009/08/oprofile-for-io-bound-apps.html</a>). I.e. for IO-bound or for mutex contention problems OProfile is not that useful.</p>
<p>SystemTap is included in RedHat 5 releases, but I was not able to get it running even in CentOS 5.3 (it crashed and hung every so often). Latest updated RedHat 5.4 promised some more fixes to SystemTap, so I decided to give it more try as soon as I got RedHat 5.4 on hands.</p>
<p>Surprising, but now it runs much more stable. I was able to get profiling of kernel and system calls.<br />
Here is simple script to <a href="http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html/SystemTap_Beginners_Guide/mainsect-disk.html#disktop">show IO activity per disk per process</a> (well, it is similar to iotop, but iotop is not available in RedHat / CentOS)</p>
<p>with output like this</p>
<div class="igBar"><span id="lcode-4"><a href="#" onclick="javascript:showPlainTxt('code-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-4">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Mon Sep <span style="color:#800000;color:#800000;">14</span> <span style="color:#800000;color:#800000;">05</span>:<span style="color:#800000;color:#800000;">22</span>:<span style="color:#800000;color:#800000;">14</span> <span style="color:#800000;color:#800000;">2009</span> , Average:20353Kb/sec, Read:&nbsp; &nbsp; 4337Kb, Write:&nbsp; 97428Kb</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;UID&nbsp; &nbsp; &nbsp; PID&nbsp; &nbsp; &nbsp;PPID&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CMD&nbsp; &nbsp;DEVICE&nbsp; &nbsp; T&nbsp; &nbsp; &nbsp; &nbsp; BYTES</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">27</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">3701</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">3651</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mysqld&nbsp; &nbsp; &nbsp;dm-<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; W&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">99766272</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">27</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">3701</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">3651</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mysqld&nbsp; &nbsp; &nbsp;dm-<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; R&nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">4440064</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">2324</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">2296</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;hald-addon-stor&nbsp; &nbsp; &nbsp;dm-<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; R&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">1242</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Mon Sep <span style="color:#800000;color:#800000;">14</span> <span style="color:#800000;color:#800000;">05</span>:<span style="color:#800000;color:#800000;">22</span>:<span style="color:#800000;color:#800000;">19</span> <span style="color:#800000;color:#800000;">2009</span> , Average:21756Kb/sec, Read:&nbsp; &nbsp; 4263Kb, Write: 104521Kb</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;UID&nbsp; &nbsp; &nbsp; PID&nbsp; &nbsp; &nbsp;PPID&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CMD&nbsp; &nbsp;DEVICE&nbsp; &nbsp; T&nbsp; &nbsp; &nbsp; &nbsp; BYTES</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">27</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">3701</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">3651</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mysqld&nbsp; &nbsp; &nbsp;dm-<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; W&nbsp; &nbsp; <span style="color:#800000;color:#800000;">107029504</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">27</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">3701</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">3651</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mysqld&nbsp; &nbsp; &nbsp;dm-<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; R&nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">4358144</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">2883</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">2879</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pam_timestamp_c&nbsp; &nbsp; &nbsp;dm-<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; R&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">6528</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">2324</span>&nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">2296</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;hald-addon-stor&nbsp; &nbsp; &nbsp;dm-<span style="color:#800000;color:#800000;">0</span>&nbsp; &nbsp; R&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#800000;color:#800000;">828</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This example maybe is simple, but the point is that there is rich scripting language with tons<br />
of probes you can intersect ( kernel functions,  FS drivers functions,  any other drives and modules)</p>
<p>What else I see very useful in SystemTap it can work in userspace. That is you can use it to profile your and any application that has -debuginfo packages ( all -debuginfo for standard RedHat RPMS you can download from RedHat FTP), but basically it is info you get compiling with <code>gcc -g</code>.</p>
<p>Well, there seems another war story going on. To profile userspace application with SystemTap your kernel should be patches with <code>uprobes</code> patch, which fortunately is included in RedHat based kernels, but not included in vanilla kernel yet. So I am not sure if you can get userspace profiling running in another distributives.</p>
<p>There is quite simple script that I tried to hack around MySQL &reg;</p>
<div class="igBar"><span id="lcode-5"><a href="#" onclick="javascript:showPlainTxt('code-5'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-5">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">probe process<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"/usr/libexec/mysqld"</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">function</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"*innobase*"</span><span style="color:#006600; font-weight:bold;">&#41;</span>.</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">printf<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"s(%s)<span style="color:#000099; font-weight:bold;">\n</span>"</span>, probefunc<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>, $$parms<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>with output which I get running simple SELECT against InnoDB table:</p>
<div class="igBar"><span id="lcode-6"><a href="#" onclick="javascript:showPlainTxt('code-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-6">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">stap -v lsprob.<span style="">stp</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Pass <span style="color:#800000;color:#800000;">1</span>: parsed user script and <span style="color:#800000;color:#800000;">52</span> library script<span style="color:#006600; font-weight:bold;">&#40;</span>s<span style="color:#006600; font-weight:bold;">&#41;</span> in 240usr/10sys/261real ms.</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="">Pass</span> <span style="color:#800000;color:#800000;">2</span>: analyzed script: <span style="color:#800000;color:#800000;">107</span> probe<span style="color:#006600; font-weight:bold;">&#40;</span>s<span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#800000;color:#800000;">22</span> function<span style="color:#006600; font-weight:bold;">&#40;</span>s<span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#800000;color:#800000;">1</span> embed<span style="color:#006600; font-weight:bold;">&#40;</span>s<span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#800000;color:#800000;">0</span> global<span style="color:#006600; font-weight:bold;">&#40;</span>s<span style="color:#006600; font-weight:bold;">&#41;</span> in 540usr/20sys/554real ms.</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="">Pass</span> <span style="color:#800000;color:#800000;">3</span>: using cached /root/.<span style="">systemtap</span>/cache/4f/stap_4f8b8738f58ff78e294c62765ac83d91_36925.<span style="">c</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Pass <span style="color:#800000;color:#800000;">4</span>: using cached /root/.<span style="">systemtap</span>/cache/4f/stap_4f8b8738f58ff78e294c62765ac83d91_36925.<span style="">ko</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Pass <span style="color:#800000;color:#800000;">5</span>: starting run.</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="">innobase_register_trx_and_stmt</span><span style="color:#006600; font-weight:bold;">&#40;</span>thd=? <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innobase_register_stmt<span style="color:#006600; font-weight:bold;">&#40;</span>thd=? <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innobase_map_isolation_level<span style="color:#006600; font-weight:bold;">&#40;</span>iso=? <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innobase_release_stat_resources<span style="color:#006600; font-weight:bold;">&#40;</span>trx=0x2aaaaaddb8b8 <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">convert_search_mode_to_innobase<span style="color:#006600; font-weight:bold;">&#40;</span>find_flag=? <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innodb_srv_conc_enter_innodb<span style="color:#006600; font-weight:bold;">&#40;</span>trx=? <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">srv_conc_enter_innodb<span style="color:#006600; font-weight:bold;">&#40;</span>trx=0x2aaaaaddb8b8 <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innodb_srv_conc_exit_innodb<span style="color:#006600; font-weight:bold;">&#40;</span>trx=? <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">srv_conc_exit_innodb<span style="color:#006600; font-weight:bold;">&#40;</span>trx=0x2aaaaaddb8b8 <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innobase_release_temporary_latches<span style="color:#006600; font-weight:bold;">&#40;</span>thd=0x1a6aced0 <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innobase_release_stat_resources<span style="color:#006600; font-weight:bold;">&#40;</span>trx=? <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">srv_conc_force_exit_innodb<span style="color:#006600; font-weight:bold;">&#40;</span>trx=0x2aaaaaddb8b8 <span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Again, this case is maybe too simple, but basically you can intersect internal MySQL function and script (measure time, count of call, statistics) what you what. I did not figure out yet how to intersect C++ style function (i.e. <code>ha_innobase::index_read</code>), so there is area to investigate.</p>
<p>So I am going to play with it more and do some useful scripting to get profiling of MySQL.</p>
<p>And it seems SystemTap can re-use DTrace probes available in application, as you may know DTrace-probes were added into MySQL 5.4, so interesting how it works.</p>
<p>I should mention that there is second alternative of DTrace... It's .... <a href="http://www.crisp.demon.co.uk/">DTrace port</a>.  Looking on <a href="http://www.crisp.demon.co.uk/blog/">blog</a> it seems one-man project and currently author is fighting with resolving userspace issues.  I gave to this a try, but on my current RedHat 5.4 after several runs I got "Kernel panic", so it's enough for now.</p>
    <hr noshade style="margin:0;height:1px" />
    <p>Entry posted by Vadim |
      <a href="http://www.mysqlperformanceblog.com/2009/09/14/systemtap-dtrace-for-linux/#comments">5 comments</a></p>
    <p>Add to: <a href="http://del.icio.us/post?url=http://www.mysqlperformanceblog.com/2009/09/14/systemtap-dtrace-for-linux/&amp;title=SystemTap &#8211; DTrace for Linux ?" title="Bookmark this post on del.icio.us"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/delicious.png" alt="delicious" /></a> | <a href="http://digg.com/submit?phase=2&amp;url=http://www.mysqlperformanceblog.com/2009/09/14/systemtap-dtrace-for-linux/&amp;title=SystemTap &#8211; DTrace for Linux ?" title="Digg this post on Digg.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/digg.png" alt="digg" /></a> | <a href="http://reddit.com/submit?url=http://www.mysqlperformanceblog.com/2009/09/14/systemtap-dtrace-for-linux/&amp;title=SystemTap &#8211; DTrace for Linux ?" title="Submit this post on reddit.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/reddit.png" alt="reddit" /></a> | <a href="http://www.netscape.com/submit/?U=http://www.mysqlperformanceblog.com/2009/09/14/systemtap-dtrace-for-linux/&amp;T=SystemTap &#8211; DTrace for Linux ?" title="Vote for this article on Netscape"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/netscape.gif" alt="netscape" /></a> | <a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.mysqlperformanceblog.com/2009/09/14/systemtap-dtrace-for-linux/&amp;title=SystemTap &#8211; DTrace for Linux ?" title="Add to Google Bookmarks"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/google.png" alt="Google Bookmarks" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlperformanceblog.com/2009/09/14/systemtap-dtrace-for-linux/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Linux schedulers in tpcc like benchmark</title>
		<link>http://www.mysqlperformanceblog.com/2009/01/30/linux-schedulers-in-tpcc-like-benchmark/</link>
		<comments>http://www.mysqlperformanceblog.com/2009/01/30/linux-schedulers-in-tpcc-like-benchmark/#comments</comments>
		<pubDate>Fri, 30 Jan 2009 07:13:42 +0000</pubDate>
		<dc:creator>Vadim</dc:creator>
				<category><![CDATA[benchmarks]]></category>
		<category><![CDATA[operating systems]]></category>

		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=601</guid>
		<description><![CDATA[I mentioned earlier that IO scheduler CFQ coming by default in RedHat / CentOS 5.x may be not so good for MySQL.  And yesterday one customer reported  that just changing cfq to noop solved their InnoDB IO problems. I ran  tpcc scripts against XtraDB on our Dell PowerEdge R900 server (16 cores, [...]]]></description>
			<content:encoded><![CDATA[<p>I mentioned earlier that IO scheduler <strong>CFQ</strong> coming by default in RedHat / CentOS 5.x may be not so good for MySQL.  And yesterday one customer reported  that just changing <strong>cfq</strong> to <strong>noop</strong> solved their InnoDB IO problems. I ran  tpcc scripts against XtraDB on our Dell PowerEdge R900 server (16 cores, 8 disks in RAID10, controller Perc/6i with BBU) to compare cfq, deadline, noop and anticipatory (last one just to get number, I did not expect a lot from anticipatory).</p>
<p>Here is result (in transactions per minute, more is better):</p>
<table>
<tr>
<td>cfq</td>
<td>2793.5</td>
</tr>
<tr>
<td>noop</td>
<td>6586.4</td>
</tr>
<tr>
<td>deadline</td>
<td>6513.7</td>
</tr>
<tr>
<td>anticipatory</td>
<td>1465</td>
</tr>
</table>
<p><a href='http://www.mysqlperformanceblog.com/wp-content/uploads/2009/01/tpcc-results.png'><img src="http://www.mysqlperformanceblog.com/wp-content/uploads/2009/01/tpcc-results.png" alt="" title="tpcc-results" width="450" height="320" class="alignnone size-full wp-image-602" /></a></p>
<p>Here is graph of disk writes (column bo in vmstat) during benchmark<br />
<a href='http://www.mysqlperformanceblog.com/wp-content/uploads/2009/01/disk_writes.png'><img src="http://www.mysqlperformanceblog.com/wp-content/uploads/2009/01/disk_writes.png" alt="" title="disk_writes"  class="alignnone size-full wp-image-603" /></a></p>
<p>As you see noop / deadline can utilize disks much better.</p>
<p>For reference I used tpcc scripts from https://launchpad.net/perconatools, generated 100W (about 9.5GB of data on disk), and used next XtraDB params:</p>
<div class="igBar"><span id="lcode-8"><a href="#" onclick="javascript:showPlainTxt('code-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-8">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>mysqld<span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#mysqld options in alphabetical order</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">user=root</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">default_table_type=MYISAM</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innodb_buffer_pool_size=3G</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innodb_data_file_path=ibdata1:10M:autoextend</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innodb_file_per_table=<span style="color:#800000;color:#800000;">1</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innodb_flush_log_at_trx_commit=<span style="color:#800000;color:#800000;">1</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innodb_log_buffer_size=8M</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innodb_log_files_in_group=<span style="color:#800000;color:#800000;">2</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innodb_log_file_size=128M</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innodb_thread_concurrency=<span style="color:#800000;color:#800000;">0</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innodb_flush_method&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= O_DIRECT</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innodb_write_io_threads=<span style="color:#800000;color:#800000;">4</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innodb_read_io_threads=<span style="color:#800000;color:#800000;">4</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innodb_io_capacity=<span style="color:#800000;color:#800000;">800</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">innodb_adaptive_checkpoint=<span style="color:#800000;color:#800000;">1</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">max_connections=<span style="color:#800000;color:#800000;">3000</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">query_cache_size=<span style="color:#800000;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">skip-name-resolve</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">table_cache=<span style="color:#800000;color:#800000;">2048</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
    <hr noshade style="margin:0;height:1px" />
    <p>Entry posted by Vadim |
      <a href="http://www.mysqlperformanceblog.com/2009/01/30/linux-schedulers-in-tpcc-like-benchmark/#comments">19 comments</a></p>
    <p>Add to: <a href="http://del.icio.us/post?url=http://www.mysqlperformanceblog.com/2009/01/30/linux-schedulers-in-tpcc-like-benchmark/&amp;title=Linux schedulers in tpcc like benchmark" title="Bookmark this post on del.icio.us"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/delicious.png" alt="delicious" /></a> | <a href="http://digg.com/submit?phase=2&amp;url=http://www.mysqlperformanceblog.com/2009/01/30/linux-schedulers-in-tpcc-like-benchmark/&amp;title=Linux schedulers in tpcc like benchmark" title="Digg this post on Digg.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/digg.png" alt="digg" /></a> | <a href="http://reddit.com/submit?url=http://www.mysqlperformanceblog.com/2009/01/30/linux-schedulers-in-tpcc-like-benchmark/&amp;title=Linux schedulers in tpcc like benchmark" title="Submit this post on reddit.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/reddit.png" alt="reddit" /></a> | <a href="http://www.netscape.com/submit/?U=http://www.mysqlperformanceblog.com/2009/01/30/linux-schedulers-in-tpcc-like-benchmark/&amp;T=Linux schedulers in tpcc like benchmark" title="Vote for this article on Netscape"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/netscape.gif" alt="netscape" /></a> | <a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.mysqlperformanceblog.com/2009/01/30/linux-schedulers-in-tpcc-like-benchmark/&amp;title=Linux schedulers in tpcc like benchmark" title="Add to Google Bookmarks"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/google.png" alt="Google Bookmarks" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlperformanceblog.com/2009/01/30/linux-schedulers-in-tpcc-like-benchmark/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Beware:  ext3 and sync-binlog do not play well together</title>
		<link>http://www.mysqlperformanceblog.com/2009/01/21/beware-ext3-and-sync-binlog-do-not-play-well-together/</link>
		<comments>http://www.mysqlperformanceblog.com/2009/01/21/beware-ext3-and-sync-binlog-do-not-play-well-together/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 00:42:28 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[hardware]]></category>
		<category><![CDATA[operating systems]]></category>

		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=594</guid>
		<description><![CDATA[One of our customers reported strange problem with MySQL having extremely poor performance when sync-binlog=1  is enabled, even though the system with RAID and BBU were expected to have much better performance. 
The problem could be repeated with SysBench as follows:
PLAIN TEXT
CODE:




./sysbench --num-threads=2 --test=oltp --oltp-test-mode=complex --oltp-table-size=100000 --oltp-distinct-ranges=0 --oltp-order-ranges=0 --oltp-sum-ranges=0 --oltp-simple-ranges=0 --oltp-point-selects=0 --oltp-range-size=0 --mysql-table-engine=innodb&#160; --mysql-user=root [...]]]></description>
			<content:encoded><![CDATA[<p>One of our customers reported strange problem with MySQL having extremely poor performance when <strong>sync-binlog=1</strong>  is enabled, even though the system with RAID and BBU were expected to have much better performance. </p>
<p>The problem could be repeated with SysBench as follows:</p>
<div class="igBar"><span id="lcode-10"><a href="#" onclick="javascript:showPlainTxt('code-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-10">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">./sysbench --num-threads=<span style="color:#800000;color:#800000;">2</span> --test=oltp --oltp-test-mode=complex --oltp-table-size=<span style="color:#800000;color:#800000;">100000</span> --oltp-distinct-ranges=<span style="color:#800000;color:#800000;">0</span> --oltp-order-ranges=<span style="color:#800000;color:#800000;">0</span> --oltp-sum-ranges=<span style="color:#800000;color:#800000;">0</span> --oltp-simple-ranges=<span style="color:#800000;color:#800000;">0</span> --oltp-point-selects=<span style="color:#800000;color:#800000;">0</span> --oltp-range-size=<span style="color:#800000;color:#800000;">0</span> --mysql-table-engine=innodb&nbsp; --mysql-user=root --max-requests=<span style="color:#800000;color:#800000;">0</span> --max-time=<span style="color:#800000;color:#800000;">60</span> --mysql-db=test run </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>On Dell R900 with  CentOS 5.2  and ext3 filesystem we get   <strong>1060 transactions/sec </strong> with single thread and sync_binlog=1  while with 2  threads it drops to  <strong>610 transactions/sec</strong>     Because of synchronous serialized writes to binlog we're not expecting significant improvements in transaction rate (as the load is binlog fsync bound) but   we surely do not expect it to drop ether. </p>
<p>To ensure this is not RAID controller related we repeated the run on the in memory block device and got very similar results -  <strong>2350 transactions/sec</strong> with 2 threads with sync-binlog=0  and just <strong>750 transactions/sec</strong> with sync-binlog=1   </p>
<p>We tried running <strong>data=writeback </strong> and <strong>data=journal</strong> just to make sure but  results were basically the same. </p>
<p>Using <strong>XFS </strong>  instead of EXT3 gives expected results - we get <strong>2350 transactions/sec</strong> with sync_binlog=1 and  <strong>2550 transactions/sec </strong>with sync-binlog=0 which is about 10% overhead.</p>
<p>EXT2 filesystem also behaves similar to XFS so it seems to be EXT3 specific performance issue.  We do not know if it is CentOS/RHEL specific and if it is fixed in the recent kernels.  If somebody can run the same test with different kernels it would be interesting to know results. </p>
<p>You also may wonder how could this problem be unnoticed for a while ?   First it only applies to the binary log.   Innodb transactional log does not have the same problem on EXT3.   I expect this is because Innodb log is pre-allocated so there is not need to modify meta data with each write while binary log is written as growing file.   Another possible reason is small sizes of writes which are being fsync'ed with binary log.  Though these are just my speculations - we did not investigate it in details. </p>
<p>Another reason is - it only happens with high transaction commit rate.  If you're just running couple of hundreds of durable commits a second you may not notice this problem.</p>
<p>Third -  <strong>sync-binlog=1</strong> is an option great for safety but it is surely not the most commonly used one.  The web applications which often have highest transaction rates typically do not have so strong durability requirements to run this option.</p>
<p>As the call for action - I would surely like someone to see if EXT3 can be fixed in this regard as it is by far the most common file system for Linux. It is also worth to investigate if something can be done on MySQL side  - may be opening binlog with O_DSYNC flag if sync_binlog=1 instead of using fsync will help ?  Or may be binlog pre-allocation  would be good solution. </p>
    <hr noshade style="margin:0;height:1px" />
    <p>Entry posted by peter |
      <a href="http://www.mysqlperformanceblog.com/2009/01/21/beware-ext3-and-sync-binlog-do-not-play-well-together/#comments">17 comments</a></p>
    <p>Add to: <a href="http://del.icio.us/post?url=http://www.mysqlperformanceblog.com/2009/01/21/beware-ext3-and-sync-binlog-do-not-play-well-together/&amp;title=Beware:  ext3 and sync-binlog do not play well together" title="Bookmark this post on del.icio.us"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/delicious.png" alt="delicious" /></a> | <a href="http://digg.com/submit?phase=2&amp;url=http://www.mysqlperformanceblog.com/2009/01/21/beware-ext3-and-sync-binlog-do-not-play-well-together/&amp;title=Beware:  ext3 and sync-binlog do not play well together" title="Digg this post on Digg.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/digg.png" alt="digg" /></a> | <a href="http://reddit.com/submit?url=http://www.mysqlperformanceblog.com/2009/01/21/beware-ext3-and-sync-binlog-do-not-play-well-together/&amp;title=Beware:  ext3 and sync-binlog do not play well together" title="Submit this post on reddit.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/reddit.png" alt="reddit" /></a> | <a href="http://www.netscape.com/submit/?U=http://www.mysqlperformanceblog.com/2009/01/21/beware-ext3-and-sync-binlog-do-not-play-well-together/&amp;T=Beware:  ext3 and sync-binlog do not play well together" title="Vote for this article on Netscape"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/netscape.gif" alt="netscape" /></a> | <a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.mysqlperformanceblog.com/2009/01/21/beware-ext3-and-sync-binlog-do-not-play-well-together/&amp;title=Beware:  ext3 and sync-binlog do not play well together" title="Add to Google Bookmarks"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/google.png" alt="Google Bookmarks" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlperformanceblog.com/2009/01/21/beware-ext3-and-sync-binlog-do-not-play-well-together/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>MySQL, AIX5L and malloc()</title>
		<link>http://www.mysqlperformanceblog.com/2008/11/03/mysql-aix5l-and-malloc/</link>
		<comments>http://www.mysqlperformanceblog.com/2008/11/03/mysql-aix5l-and-malloc/#comments</comments>
		<pubDate>Mon, 03 Nov 2008 22:52:47 +0000</pubDate>
		<dc:creator>Piotr Biel</dc:creator>
				<category><![CDATA[operating systems]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=478</guid>
		<description><![CDATA[Some time ago I get brand new IBM POWER6 server as the replacement for "old" P5 used to host Oracle database. Because we planed to use advanced virtualization with VIOS + LPAR/DLPAR I conceived the idea to use one spare partition for MySQL tests. Because I had no past experience with it and there is [...]]]></description>
			<content:encoded><![CDATA[<p>Some time ago I get brand new IBM POWER6 server as the replacement for "old" P5 used to host Oracle database. Because we planed to use advanced virtualization with VIOS + LPAR/DLPAR I conceived the idea to use one spare partition for MySQL tests. Because I had no past experience with it and there is not much documentation all around the web, I tried to set-up system and database traditional way. The first problem I hit was memory allocation and I think it is the best place share my remarks. Let's start from the beginning..</p>
<p>For any reason, you decided to run MySQL database on AIX 5L operating system. You compiled it successfully, configured and.. unluckily database didn't start due to memory allocation problem?</p>
<p>Basically, for some historical reasons AIX OS will allow your application to allocate maximum 256MB of memory per process by default. To use more, you have to use "<em>Large Address Space</em>" memory model so AIX will split memory into 256MB data segments, making possible to reserve more than one segment per single process.</p>
<p>You may set it up different ways:</p>
<ul>
<li> - using <strong>–bmaxdata=0xN000000</strong> option for linker</li>
<li> - setting <strong>MAXDATA</strong> value in <strong>LDR_CNTRL</strong> as run-time</li>
</ul>
<blockquote><p>[ LDR_CNTRL='MAXDATA=0xN000000' ] - <em>where N is the number of segments.</em></p></blockquote>
<p>So, to make your MySQL working fine:</p>
<p><strong><em>export LDR_CNTRL=’MAXDATA=0×80000000′</em></strong></p>
<p>It allows database to allocate 2GB of memory ( 8*256MB ) which is maximum value for 32-bit compiled applications.</p>
<p>But how to deal with 64-bit systems? It's quite easy, but you have to remember about setting OBJECT_MODE to 64 for both, self-compiled and binary distributed databases. After it, you will be able to set up bigger segments multiplier in MAXDATA variable at run-time.</p>
<p><strong><em>export LDR_CNTRL='MAXDATA=0xFFFFFFFFFFFFFFFFFF'</em></strong></p>
    <hr noshade style="margin:0;height:1px" />
    <p>Entry posted by Piotr Biel |
      <a href="http://www.mysqlperformanceblog.com/2008/11/03/mysql-aix5l-and-malloc/#comments">11 comments</a></p>
    <p>Add to: <a href="http://del.icio.us/post?url=http://www.mysqlperformanceblog.com/2008/11/03/mysql-aix5l-and-malloc/&amp;title=MySQL, AIX5L and malloc()" title="Bookmark this post on del.icio.us"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/delicious.png" alt="delicious" /></a> | <a href="http://digg.com/submit?phase=2&amp;url=http://www.mysqlperformanceblog.com/2008/11/03/mysql-aix5l-and-malloc/&amp;title=MySQL, AIX5L and malloc()" title="Digg this post on Digg.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/digg.png" alt="digg" /></a> | <a href="http://reddit.com/submit?url=http://www.mysqlperformanceblog.com/2008/11/03/mysql-aix5l-and-malloc/&amp;title=MySQL, AIX5L and malloc()" title="Submit this post on reddit.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/reddit.png" alt="reddit" /></a> | <a href="http://www.netscape.com/submit/?U=http://www.mysqlperformanceblog.com/2008/11/03/mysql-aix5l-and-malloc/&amp;T=MySQL, AIX5L and malloc()" title="Vote for this article on Netscape"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/netscape.gif" alt="netscape" /></a> | <a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.mysqlperformanceblog.com/2008/11/03/mysql-aix5l-and-malloc/&amp;title=MySQL, AIX5L and malloc()" title="Add to Google Bookmarks"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/google.png" alt="Google Bookmarks" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlperformanceblog.com/2008/11/03/mysql-aix5l-and-malloc/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Should you have your swap file enabled while running MySQL ?</title>
		<link>http://www.mysqlperformanceblog.com/2008/04/06/should-you-have-your-swap-file-enabled-while-running-mysql/</link>
		<comments>http://www.mysqlperformanceblog.com/2008/04/06/should-you-have-your-swap-file-enabled-while-running-mysql/#comments</comments>
		<pubDate>Mon, 07 Apr 2008 02:23:57 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[operating systems]]></category>
		<category><![CDATA[production]]></category>

		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2008/04/06/should-you-have-your-swap-file-enabled-while-running-mysql/</guid>
		<description><![CDATA[So you're running dedicated MySQL Linux box with plenty of memory, so the good question arises if you should have swap file enabled or disable it ?  I've seen production successfully running on boxes both with and without swap file so it is not the question of you must do it this or that [...]]]></description>
			<content:encoded><![CDATA[<p>So you're running dedicated MySQL Linux box with plenty of memory, so the good question arises if you should have swap file enabled or disable it ?  I've seen production successfully running on boxes both with and without swap file so it is not the question of you must do it this or that way but rather understanding advantages of both approaches.</p>
<p>I also would like to hear what you do yourself, and why <img src='http://www.mysqlperformanceblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The rationale behind <strong>disabling swap </strong> is what there is nothing you want to swap out on such box anyway and if you disable swap file kernel will not swap and possibly will be able to manage memory smarter knowing it does not need to look for pages to swap out or balance memory for reducing a cache or swapping something out. </p>
<p>And indeed if you run with swap disabled you would not have the issue of swapping happening on the box as there is just nowhere to swap. </p>
<p>So what is about <strong>enabled swap</strong> -  if we assume the kernel is smart (as we did for second case) we will be able to save a bit of memory as there are some programs which are started but never never really used.  These would be first valid candidates to swap out.   Second if you have swap file you get a bit more flexibility.  What happens if you miscounted something or there is a gotcha in your application and you ended up with a lots of connections creating large temporary tables and so MySQL running out of memory (and getting killed by kernel).  It could not even be MySQL but some script cron script or something similar with same affect. </p>
<p>In practice there are additional issues for both of the configurations - if you keep swap enabled you may have hard time keeping MySQL in memory because Kernel would love to swap it out.  Recent kernels become much better than few years ago but I still run in workloads which expose bad kernel behavior and swap buffer space out even with /proc/sys/vm/swappiness =0.  You can lock MySQL in memory by using <strong>--memlock</strong> option but it opens its own can of worms.  </p>
<p>If you keep swap disabled you can run into another problems.  A lot of code in the kernel assumes there is a swap space and I've seen kernel starting to behave crazy when there is memory pressure and there is nothing to swap out.  This may actually mean the buffer pool (or other caches) which you can safely use can be less if you have swap file disabled.     Though I must note again this can be workload and kernel version specific. </p>
<p>Besides general considerations there are many case specific ones. For example if you would rather spend more memory (allowing more reserve for spikes) than to have slowdown caused by swapping activities in case memory overcommit occurs you may be better off without swap file.  If on the contrary you want  to use as much memory as possible to get last bit of performance and do not mind slowdowns if you mixedup as well as have tools to resolve them quickly (ie killing runaway queries) keeping swap file enabled may be right for you.  </p>
<p>Myself I tend to keep swap enabled on MySQL server but of course ensure there is not swapping happening (si/so columns in VMSTAT are zero or close to zero).  </p>
<p>If you want to keep swap file disabled that also fine but you should make sure your workload is stable so there are no large spikes in memory requirements, as well as you have processes and discipline to make sure it is kept stable. </p>
    <hr noshade style="margin:0;height:1px" />
    <p>Entry posted by peter |
      <a href="http://www.mysqlperformanceblog.com/2008/04/06/should-you-have-your-swap-file-enabled-while-running-mysql/#comments">18 comments</a></p>
    <p>Add to: <a href="http://del.icio.us/post?url=http://www.mysqlperformanceblog.com/2008/04/06/should-you-have-your-swap-file-enabled-while-running-mysql/&amp;title=Should you have your swap file enabled while running MySQL ?" title="Bookmark this post on del.icio.us"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/delicious.png" alt="delicious" /></a> | <a href="http://digg.com/submit?phase=2&amp;url=http://www.mysqlperformanceblog.com/2008/04/06/should-you-have-your-swap-file-enabled-while-running-mysql/&amp;title=Should you have your swap file enabled while running MySQL ?" title="Digg this post on Digg.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/digg.png" alt="digg" /></a> | <a href="http://reddit.com/submit?url=http://www.mysqlperformanceblog.com/2008/04/06/should-you-have-your-swap-file-enabled-while-running-mysql/&amp;title=Should you have your swap file enabled while running MySQL ?" title="Submit this post on reddit.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/reddit.png" alt="reddit" /></a> | <a href="http://www.netscape.com/submit/?U=http://www.mysqlperformanceblog.com/2008/04/06/should-you-have-your-swap-file-enabled-while-running-mysql/&amp;T=Should you have your swap file enabled while running MySQL ?" title="Vote for this article on Netscape"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/netscape.gif" alt="netscape" /></a> | <a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.mysqlperformanceblog.com/2008/04/06/should-you-have-your-swap-file-enabled-while-running-mysql/&amp;title=Should you have your swap file enabled while running MySQL ?" title="Add to Google Bookmarks"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/google.png" alt="Google Bookmarks" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlperformanceblog.com/2008/04/06/should-you-have-your-swap-file-enabled-while-running-mysql/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>The tool I&#8217;ve been waiting for years</title>
		<link>http://www.mysqlperformanceblog.com/2008/03/18/the-tool-ive-been-waiting-for-years/</link>
		<comments>http://www.mysqlperformanceblog.com/2008/03/18/the-tool-ive-been-waiting-for-years/#comments</comments>
		<pubDate>Wed, 19 Mar 2008 04:54:20 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[operating systems]]></category>

		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2008/03/18/the-tool-ive-been-waiting-for-years/</guid>
		<description><![CDATA[I've just been pointed to the nice tool which I was waiting for years to see.  It is fincore - little perl script which allows you to see what pages of file are cached in OS memory.  This is really cool.
When it comes to MySQL it is very useful with MyISAM tables which [...]]]></description>
			<content:encoded><![CDATA[<p>I've just been pointed to the nice tool which I was waiting for years to see.  It is <a href="http://net.doit.wisc.edu/~plonka/fincore/">fincore</a> - little perl script which allows you to see what pages of file are cached in OS memory.  This is really cool.</p>
<p>When it comes to MySQL it is very useful with MyISAM tables which has their data file cached by OS cache only so you do not have any good information from MySQL side on what data is cached.  You can also use it with Innodb to see how much memory are you wasting with double buffering by not using of <strong>O_DIRECT</strong>.</p>
<p>Besides general clues such as 50% of my file is cached you should watch for dynamics - for example check it during backup process and compare it due to normal load - this can give you a clue if slow down happens because of extra IO pressure or just because pages were washed out.   You can also check how pages are cached.  For example every second page cached may be helpful for point queries but does not save a lot of IO for doing table scans. </p>
<p>One thing I'm still missing is looking it from another side - so I have say 10GB of OS cache used on the server but how can I tell what is using it ?  This look from another side would help me dramatically to find out what is causing cache pressure and what needs to be worked on.   Scanning all files on filesystem and checking which are cached obviously does not work.</p>
<p>The fincore looks more like proof of concept tool - it is a bit simplistic, however being written in Perl it is easily hackable - if you want to make it to print percentage of file cached or "graph" showing how cached pages are distributed among file is very easy.</p>
<p>The great thing about this tool it is very fast and it does not disturbs OS file cache by using <strong>mincore</strong> function to get pages which are currently in cache.  </p>
<p>This function is actually the real meat here - the tool is simplistic but it shows how to use the function so you can write real stuff.  For example using this tool MySQL can easily add amount of cached data per table for MyISAM and Archive tables to INFORMATION_SCHEMA (or other system tables) which would be really cool  Of course than one would need to implement cache content tracking for storage engines which cache everything in their own cache memory - Innodb, Falcon, Maria.  </p>
<p>Having information about how large portion of table is cached would allow optimizer to take much smarter decisions in many cases.</p>
<p>Lets now see some examples:</p>
<div class="igBar"><span id="lsql-14"><a href="#" onclick="javascript:showPlainTxt('sql-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-14">
<div class="sql">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@DB01 mysql<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color: #808080; font-style: italic;"># du -h ib_log*</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">257M&nbsp; &nbsp; ib_logfile0</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">257M&nbsp; &nbsp; ib_logfile1</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@DB01 mysql<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color: #808080; font-style: italic;"># perl /tmp/fincore --justsummarize ib_logfile0 ib_logfile1</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">page size: <span style="color: #cc66cc;color:#800000;">4096</span> bytes</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc66cc;color:#800000;">24141</span> pages, <span style="color: #cc66cc;color:#800000;">94</span>.<span style="color: #cc66cc;color:#800000;">3</span> Mbytes <span style="color: #993333; font-weight: bold;">IN</span> core <span style="color: #993333; font-weight: bold;">FOR</span> <span style="color: #cc66cc;color:#800000;">2</span> files; <span style="color: #cc66cc;color:#800000;">12070</span>.<span style="color: #cc66cc;color:#800000;">50</span> pages, <span style="color: #cc66cc;color:#800000;">47</span>.<span style="color: #cc66cc;color:#800000;">2</span> Mbytes per file.</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@DB01 mysql<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color: #808080; font-style: italic;"># perl /tmp/fincore --justsummarize ib_logfile0</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">page size: <span style="color: #cc66cc;color:#800000;">4096</span> bytes</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc66cc;color:#800000;">1</span> page, <span style="color: #cc66cc;color:#800000;">4</span>.<span style="color: #cc66cc;color:#800000;">0</span> kbytes <span style="color: #993333; font-weight: bold;">IN</span> core <span style="color: #993333; font-weight: bold;">FOR</span> <span style="color: #cc66cc;color:#800000;">1</span> file; <span style="color: #cc66cc;color:#800000;">1</span>.<span style="color: #cc66cc;color:#800000;">00</span> page, <span style="color: #cc66cc;color:#800000;">4</span>.<span style="color: #cc66cc;color:#800000;">0</span> kbytes per file.</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@DB01 mysql<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color: #808080; font-style: italic;"># perl /tmp/fincore --justsummarize ib_logfile1</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">page size: <span style="color: #cc66cc;color:#800000;">4096</span> bytes</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc66cc;color:#800000;">24169</span> pages, <span style="color: #cc66cc;color:#800000;">94</span>.<span style="color: #cc66cc;color:#800000;">4</span> Mbytes <span style="color: #993333; font-weight: bold;">IN</span> core <span style="color: #993333; font-weight: bold;">FOR</span> <span style="color: #cc66cc;color:#800000;">1</span> file; <span style="color: #cc66cc;color:#800000;">24169</span>.<span style="color: #cc66cc;color:#800000;">00</span> pages, <span style="color: #cc66cc;color:#800000;">94</span>.<span style="color: #cc66cc;color:#800000;">4</span> Mbytes per file. </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>So we can see one of Innodb log files is practically uncached while other has about 1/3rd cached - this makes sense, perhaps second log file is being written now and there is a "tail" of pages which just were not removed from the cache yet. As Innodb does not read logfile unless in recovery these are waste and Innodb could use fadvice to give instruction to kernel not to cache these as long as it can't perform direct IO to log files on Linux because it is not aligned.</p>
<div class="igBar"><span id="lsql-15"><a href="#" onclick="javascript:showPlainTxt('sql-15'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-15">
<div class="sql">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@DB01 mysql<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color: #808080; font-style: italic;"># du -h ibdata*</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">246G&nbsp; &nbsp; ibdata1</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@DB01 mysql<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color: #808080; font-style: italic;"># perl /tmp/fincore --justsummarize ibdata1</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">page size: <span style="color: #cc66cc;color:#800000;">4096</span> bytes</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc66cc;color:#800000;">0</span> pages, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">0</span>&nbsp; bytes <span style="color: #993333; font-weight: bold;">IN</span> core <span style="color: #993333; font-weight: bold;">FOR</span> <span style="color: #cc66cc;color:#800000;">1</span> file; <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">00</span> pages, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">0</span>&nbsp; bytes per file. </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Out of 250GB innodb data file none of pages are in cache - this is because this instance is using <strong>O_DIRECT</strong> flag to bypass data buffering and we can well see it works.</p>
<p>Lets now see stats for MyISAM tables:</p>
<div class="igBar"><span id="lsql-16"><a href="#" onclick="javascript:showPlainTxt('sql-16'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-16">
<div class="sql">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@DB01 logs<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color: #808080; font-style: italic;"># du -h performance_log_080318.MYD</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc66cc;color:#800000;">1</span>.1G&nbsp; &nbsp; performance_log_080318.MYD</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@DB01 logs<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color: #808080; font-style: italic;"># perl /tmp/fincore --justsummarize performance_log_080318.MYD</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">page size: <span style="color: #cc66cc;color:#800000;">4096</span> bytes</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc66cc;color:#800000;">497</span> pages, <span style="color: #cc66cc;color:#800000;">1</span>.<span style="color: #cc66cc;color:#800000;">9</span> Mbytes <span style="color: #993333; font-weight: bold;">IN</span> core <span style="color: #993333; font-weight: bold;">FOR</span> <span style="color: #cc66cc;color:#800000;">1</span> file; <span style="color: #cc66cc;color:#800000;">497</span>.<span style="color: #cc66cc;color:#800000;">00</span> pages, <span style="color: #cc66cc;color:#800000;">1</span>.<span style="color: #cc66cc;color:#800000;">9</span> Mbytes per file.</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@DB01 logs<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color: #808080; font-style: italic;"># du -h performance_log_080319.MYD</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">229M&nbsp; &nbsp; performance_log_080319.MYD</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@DB01 logs<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color: #808080; font-style: italic;"># perl /tmp/fincore --justsummarize performance_log_080319.MYD</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">page size: <span style="color: #cc66cc;color:#800000;">4096</span> bytes</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc66cc;color:#800000;">28415</span> pages, <span style="color: #cc66cc;color:#800000;">111</span>.<span style="color: #cc66cc;color:#800000;">0</span> Mbytes <span style="color: #993333; font-weight: bold;">IN</span> core <span style="color: #993333; font-weight: bold;">FOR</span> <span style="color: #cc66cc;color:#800000;">1</span> file; <span style="color: #cc66cc;color:#800000;">28415</span>.<span style="color: #cc66cc;color:#800000;">00</span> pages, <span style="color: #cc66cc;color:#800000;">111</span>.<span style="color: #cc66cc;color:#800000;">0</span> Mbytes per file.</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@DB01 logs<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color: #808080; font-style: italic;"># </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The performance log for yesterday is almost out of cache.  It is about 0:50 by server clock this is why we still can see some pages remaining.  Today log file is 50% in cache.     Knowing access pattern to the file you  can draw some conclusions about how much IO pressure we have on this server.</p>
<p><strong>P.S</strong> If you would hack this tool or know any similar tools please let me know.</p>
    <hr noshade style="margin:0;height:1px" />
    <p>Entry posted by peter |
      <a href="http://www.mysqlperformanceblog.com/2008/03/18/the-tool-ive-been-waiting-for-years/#comments">9 comments</a></p>
    <p>Add to: <a href="http://del.icio.us/post?url=http://www.mysqlperformanceblog.com/2008/03/18/the-tool-ive-been-waiting-for-years/&amp;title=The tool I&#8217;ve been waiting for years" title="Bookmark this post on del.icio.us"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/delicious.png" alt="delicious" /></a> | <a href="http://digg.com/submit?phase=2&amp;url=http://www.mysqlperformanceblog.com/2008/03/18/the-tool-ive-been-waiting-for-years/&amp;title=The tool I&#8217;ve been waiting for years" title="Digg this post on Digg.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/digg.png" alt="digg" /></a> | <a href="http://reddit.com/submit?url=http://www.mysqlperformanceblog.com/2008/03/18/the-tool-ive-been-waiting-for-years/&amp;title=The tool I&#8217;ve been waiting for years" title="Submit this post on reddit.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/reddit.png" alt="reddit" /></a> | <a href="http://www.netscape.com/submit/?U=http://www.mysqlperformanceblog.com/2008/03/18/the-tool-ive-been-waiting-for-years/&amp;T=The tool I&#8217;ve been waiting for years" title="Vote for this article on Netscape"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/netscape.gif" alt="netscape" /></a> | <a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.mysqlperformanceblog.com/2008/03/18/the-tool-ive-been-waiting-for-years/&amp;title=The tool I&#8217;ve been waiting for years" title="Add to Google Bookmarks"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/google.png" alt="Google Bookmarks" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlperformanceblog.com/2008/03/18/the-tool-ive-been-waiting-for-years/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Working with many files and file system fragmentation</title>
		<link>http://www.mysqlperformanceblog.com/2008/03/18/working-with-many-files-and-file-system-fragmentation/</link>
		<comments>http://www.mysqlperformanceblog.com/2008/03/18/working-with-many-files-and-file-system-fragmentation/#comments</comments>
		<pubDate>Tue, 18 Mar 2008 20:10:42 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[operating systems]]></category>

		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2008/03/18/working-with-many-files-and-file-system-fragmentation/</guid>
		<description><![CDATA[Working on performance optimization project (not directly MySQL related) we did a test - creating 100 files writing 4K in the random file for some time and when  checking the read speed on the files we end up with, compared to just writing the file sequentially and reading it back. 
The performance difference was [...]]]></description>
			<content:encoded><![CDATA[<p>Working on performance optimization project (not directly MySQL related) we did a test - creating 100 files writing 4K in the random file for some time and when  checking the read speed on the files we end up with, compared to just writing the file sequentially and reading it back. </p>
<p>The performance difference was huge - we could read single file at 80MB/sec while  fragmented files only deliver about 2MB/sec - this is a massive difference.</p>
<p>The test was done on EXT3 and it looks like it does not do very good job preventing file fragmentation for large amount of growing files.  </p>
<p>It would be interesting to see how other filesystems deal with this problem, for example XFS with delayed allocation may be doing better job. </p>
<p>I also would like to repeat the test with MySQL  MyISAM tables and see how bad the difference would be for MySQL but I would expect something along those lines.    </p>
<p>Interesting enough it should not be that hard to fix this issue - one could optionally preallocate MyISAM tables in some chunks (say 1MB) so its gets less fragmentation. Though it would be interesting to benchmark how much such approach would generally help. </p>
<p>Until we have this feature - reduced fragmentation is one more benefit we get with batching. For example instead of inserting rows one by one in large number of tables once can be buffered in memory (application or MyISAM memory table) and flushed to the actual tables in bulks.  </p>
    <hr noshade style="margin:0;height:1px" />
    <p>Entry posted by peter |
      <a href="http://www.mysqlperformanceblog.com/2008/03/18/working-with-many-files-and-file-system-fragmentation/#comments">10 comments</a></p>
    <p>Add to: <a href="http://del.icio.us/post?url=http://www.mysqlperformanceblog.com/2008/03/18/working-with-many-files-and-file-system-fragmentation/&amp;title=Working with many files and file system fragmentation" title="Bookmark this post on del.icio.us"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/delicious.png" alt="delicious" /></a> | <a href="http://digg.com/submit?phase=2&amp;url=http://www.mysqlperformanceblog.com/2008/03/18/working-with-many-files-and-file-system-fragmentation/&amp;title=Working with many files and file system fragmentation" title="Digg this post on Digg.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/digg.png" alt="digg" /></a> | <a href="http://reddit.com/submit?url=http://www.mysqlperformanceblog.com/2008/03/18/working-with-many-files-and-file-system-fragmentation/&amp;title=Working with many files and file system fragmentation" title="Submit this post on reddit.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/reddit.png" alt="reddit" /></a> | <a href="http://www.netscape.com/submit/?U=http://www.mysqlperformanceblog.com/2008/03/18/working-with-many-files-and-file-system-fragmentation/&amp;T=Working with many files and file system fragmentation" title="Vote for this article on Netscape"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/netscape.gif" alt="netscape" /></a> | <a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.mysqlperformanceblog.com/2008/03/18/working-with-many-files-and-file-system-fragmentation/&amp;title=Working with many files and file system fragmentation" title="Add to Google Bookmarks"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/google.png" alt="Google Bookmarks" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlperformanceblog.com/2008/03/18/working-with-many-files-and-file-system-fragmentation/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Linux IO Schedulers and MySQL</title>
		<link>http://www.mysqlperformanceblog.com/2007/01/30/linux-io-schedulers-and-mysql/</link>
		<comments>http://www.mysqlperformanceblog.com/2007/01/30/linux-io-schedulers-and-mysql/#comments</comments>
		<pubDate>Tue, 30 Jan 2007 14:07:26 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[operating systems]]></category>

		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/01/30/linux-io-schedulers-and-mysql/</guid>
		<description><![CDATA[Found a great article about Linux IO Schedulers  today which is quite interesting.  It goes in details about schedulers and explains in which of workloads which of schedulers is best. 
The interesting thing this article points out is - there are multiple versions of each of the schedulers,  while name remains the [...]]]></description>
			<content:encoded><![CDATA[<p>Found a great article about <a href="http://kerneltrap.org/node/7637">Linux IO Schedulers </a> today which is quite interesting.  It goes in details about schedulers and explains in which of workloads which of schedulers is best. </p>
<p>The interesting thing this article points out is - there are multiple versions of each of the schedulers,  while name remains the same. This means unless you really know mapping between kernel versions and scheduler versions it is very hard to evaluate benchmark results. </p>
<p>This could be noticed by benchmarks we've done over years. Long time ago  "AS" scheduler could be several times slower than deadline for MySQL workloads such as SysBench or DBT2 when it went down to 30% difference and in the last runs we've done difference was not really significant. </p>
<p>This article also points out benchmarking IO schedulers you should look at more numbers than aggregate bandwidth - you also better to measure per client bandwidth as well as max latency as this is what can be the problem.  Take a look at these <a href="http://lwn.net/Articles/113869/">old results</a> for example.   It also means you'd better to perform IO scheduler benchmarks on mixed load with different of task, for example mixing OLTP with some reporting queries if you really want to see the difference. </p>
<p>From the article it looks like CFQ should be good choice for databases and it is also found to work pretty well by some benchmarks we've done.  The only question if it is doing as good as it could -  In the docs it is mentioned it uses "per process" scheduling while MySQL is single process but single thread - does each thread gets its own queue in reality or is it shared ?  </p>
<p>We should look into this when we'll run more benchmarks for IO Schedulers. </p>
    <hr noshade style="margin:0;height:1px" />
    <p>Entry posted by peter |
      <a href="http://www.mysqlperformanceblog.com/2007/01/30/linux-io-schedulers-and-mysql/#comments">6 comments</a></p>
    <p>Add to: <a href="http://del.icio.us/post?url=http://www.mysqlperformanceblog.com/2007/01/30/linux-io-schedulers-and-mysql/&amp;title=Linux IO Schedulers and MySQL" title="Bookmark this post on del.icio.us"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/delicious.png" alt="delicious" /></a> | <a href="http://digg.com/submit?phase=2&amp;url=http://www.mysqlperformanceblog.com/2007/01/30/linux-io-schedulers-and-mysql/&amp;title=Linux IO Schedulers and MySQL" title="Digg this post on Digg.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/digg.png" alt="digg" /></a> | <a href="http://reddit.com/submit?url=http://www.mysqlperformanceblog.com/2007/01/30/linux-io-schedulers-and-mysql/&amp;title=Linux IO Schedulers and MySQL" title="Submit this post on reddit.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/reddit.png" alt="reddit" /></a> | <a href="http://www.netscape.com/submit/?U=http://www.mysqlperformanceblog.com/2007/01/30/linux-io-schedulers-and-mysql/&amp;T=Linux IO Schedulers and MySQL" title="Vote for this article on Netscape"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/netscape.gif" alt="netscape" /></a> | <a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.mysqlperformanceblog.com/2007/01/30/linux-io-schedulers-and-mysql/&amp;title=Linux IO Schedulers and MySQL" title="Add to Google Bookmarks"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/google.png" alt="Google Bookmarks" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlperformanceblog.com/2007/01/30/linux-io-schedulers-and-mysql/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>FreeBSD tests</title>
		<link>http://www.mysqlperformanceblog.com/2006/06/15/freebsd-tests/</link>
		<comments>http://www.mysqlperformanceblog.com/2006/06/15/freebsd-tests/#comments</comments>
		<pubDate>Thu, 15 Jun 2006 08:40:43 +0000</pubDate>
		<dc:creator>Vadim</dc:creator>
				<category><![CDATA[Innodb]]></category>
		<category><![CDATA[benchmarks]]></category>
		<category><![CDATA[myisam]]></category>
		<category><![CDATA[operating systems]]></category>

		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/06/15/freebsd-tests/</guid>
		<description><![CDATA[I'm continuing my experiments with different OS and today I tested FreeBSD 6.0 on my box.
(more details about box and benchmark see here http://www.mysqlperformanceblog.com/2006/06/13/quick-look-at-ubuntu-606/).
Initially I was very pessimistic about FreeBSD, as results were (in transactions/sec, more is better.
for comparison the results from Suse 10.0):


InnoDB





threads
FreeBSD 6
Suse 10.0
Suse/ FreeBSD ratio


1
436.97
536.91
1.23


4
322.08
816.27
2.53


16
519.94
639.05
1.23


64
crash
547.07



256

357.09





















MyISAM





threads
FreeBSD 6
Suse 10.0
Suse/ FreeBSD ratio


1
335.56
429.89
1.28


4
165.16
863.23
5.23


16
322.66
537.67
1.67


64
crash
516.00



256

346.65



The crash with many [...]]]></description>
			<content:encoded><![CDATA[<p>I'm continuing my experiments with different OS and today I tested FreeBSD 6.0 on my box.<br />
(more details about box and benchmark see here <a href="http://www.mysqlperformanceblog.com/2006/06/13/quick-look-at-ubuntu-606/">http://www.mysqlperformanceblog.com/2006/06/13/quick-look-at-ubuntu-606/</a>).<br />
Initially I was very pessimistic about FreeBSD, as results were (in transactions/sec, more is better.<br />
for comparison the results from Suse 10.0):</p>
<table border="1" cellpadding="0" cellspacing="0">
<tr>
<td width="64">InnoDB</td>
<td width="77"></td>
<td width="66"></td>
<td width="116"></td>
</tr>
<tr>
<td>threads</td>
<td>FreeBSD 6</td>
<td>Suse 10.0</td>
<td>Suse/ FreeBSD ratio</td>
</tr>
<tr>
<td align="right">1</td>
<td align="right">436.97</td>
<td align="right">536.91</td>
<td align="right">1.23</td>
</tr>
<tr>
<td align="right">4</td>
<td align="right">322.08</td>
<td align="right">816.27</td>
<td align="right">2.53</td>
</tr>
<tr>
<td align="right">16</td>
<td align="right">519.94</td>
<td align="right">639.05</td>
<td align="right">1.23</td>
</tr>
<tr>
<td align="right">64</td>
<td>crash</td>
<td align="right">547.07</td>
<td></td>
</tr>
<tr>
<td align="right">256</td>
<td></td>
<td align="right">357.09</td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>MyISAM</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>threads</td>
<td>FreeBSD 6</td>
<td>Suse 10.0</td>
<td>Suse/ FreeBSD ratio</td>
</tr>
<tr>
<td align="right">1</td>
<td align="right">335.56</td>
<td align="right">429.89</td>
<td align="right">1.28</td>
</tr>
<tr>
<td align="right">4</td>
<td align="right">165.16</td>
<td align="right">863.23</td>
<td align="right">5.23</td>
</tr>
<tr>
<td align="right">16</td>
<td align="right">322.66</td>
<td align="right">537.67</td>
<td align="right">1.67</td>
</tr>
<tr>
<td align="right">64</td>
<td>crash</td>
<td align="right">516.00</td>
<td></td>
</tr>
<tr>
<td align="right">256</td>
<td></td>
<td align="right">346.65</td>
<td></td>
</tr>
</table>
<p>The crash with many threads in FreeBSD is known <a href="http://bugs.mysql.com/bug.php?id=19496">problem</a> and is not MySQL fault. More info is available in FreeBSD <a href="http://www.freebsd.org/cgi/query-pr.cgi?pr=95127">bug report</a></p>
<p>I'm not big expert in FreeBSD and did not saw <a href="http://wikitest.freebsd.org/MySQL">http://wikitest.freebsd.org/MySQL</a> before. This page recommends to use libthr instead of libthreads.<br />
The results with libthr looks better:</p>
<table border="1" cellpadding="0" cellspacing="0">
<tr>
<td width="64">InnoDB</td>
<td width="77"></td>
<td width="66"></td>
<td width="116"></td>
</tr>
<tr>
<td>threads</td>
<td>FreeBSD 6</td>
<td>Suse 10.0</td>
<td>Suse/ FreeBSD ratio</td>
</tr>
<tr>
<td align="right">1</td>
<td align="right">483.22</td>
<td align="right">536.91</td>
<td align="right">1.11</td>
</tr>
<tr>
<td align="right">4</td>
<td align="right">852.21</td>
<td align="right">816.27</td>
<td align="right">0.96</td>
</tr>
<tr>
<td align="right">16</td>
<td align="right">748.89</td>
<td align="right">639.05</td>
<td align="right">0.85</td>
</tr>
<tr>
<td align="right">64</td>
<td align="right">644.45</td>
<td align="right">547.07</td>
<td align="right">0.85</td>
</tr>
<tr>
<td align="right">256</td>
<td align="right">273.99</td>
<td align="right">357.09</td>
<td align="right">1.30</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>MyISAM</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>threads</td>
<td>FreeBSD 6</td>
<td>Suse 10.0</td>
<td>Suse/ FreeBSD ratio</td>
</tr>
<tr>
<td align="right">1</td>
<td align="right">344.72</td>
<td align="right">429.89</td>
<td align="right">1.25</td>
</tr>
<tr>
<td align="right">4</td>
<td align="right">531.6</td>
<td align="right">863.23</td>
<td align="right">1.62</td>
</tr>
<tr>
<td align="right">16</td>
<td align="right">494.19</td>
<td align="right">537.67</td>
<td align="right">1.09</td>
</tr>
<tr>
<td align="right">64</td>
<td align="right">451.72</td>
<td align="right">516.00</td>
<td align="right">1.14</td>
</tr>
<tr>
<td align="right">256</td>
<td align="right">215.84</td>
<td align="right">346.65</td>
<td align="right">1.61</td>
</tr>
</table>
<p>Interesting thing with 4-64 threads FreeBSD is better than Suse in InnoDB benchmark. I think it is related to InnoDB's implementation of syncronious primitives. For MyISAM Suse is stable better.</p>
<p>Configuration params:<br />
Box: Dual Core Athlon 3800+, 1Gb of RAM, Motherboard ASUS A8N-E</p>
<p>MySQL 5.0.22</p>
<p>params for InnoDB:<br />
--innodb-buffer-pool-size=500M --max-connections=500</p>
<p>params for MyISAM:<br />
--key-buffer-size=500M --max-connections=500 --skip-innodb</p>
<p>Suse 10.0:<br />
kernel-smp-2.6.13-15.x86_64<br />
NTPL</p>
<p>Schedulers comparsion.<br />
By request I made tests with 4BSD scheduler:</p>
<table border="1" cellpadding="0" cellspacing="0">
<tr>
<td width="64">InnoDB</td>
<td width="101"></td>
<td width="110"></td>
<td width="116"></td>
</tr>
<tr>
<td>threads</td>
<td>FreeBSD 6 ULE</td>
<td>FreeBSD 6 4BSD</td>
<td>4BSD / ULE</td>
</tr>
<tr>
<td align="right">1</td>
<td align="right">483.22</td>
<td align="right">438.1</td>
<td align="right">0.91</td>
</tr>
<tr>
<td align="right">4</td>
<td align="right">852.21</td>
<td align="right">819.14</td>
<td align="right">0.96</td>
</tr>
<tr>
<td align="right">16</td>
<td align="right">748.89</td>
<td align="right">712.77</td>
<td align="right">0.95</td>
</tr>
<tr>
<td align="right">64</td>
<td align="right">644.45</td>
<td align="right">639.2</td>
<td align="right">0.99</td>
</tr>
<tr>
<td align="right">256</td>
<td align="right">273.99</td>
<td align="right">330.11</td>
<td align="right">1.20</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>MyISAM</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>threads</td>
<td>FreeBSD 6 ULE</td>
<td>FreeBSD 6 4BSD</td>
<td>4BSD / ULE</td>
</tr>
<tr>
<td align="right">1</td>
<td align="right">344.72</td>
<td align="right">324.9</td>
<td align="right">0.94</td>
</tr>
<tr>
<td align="right">4</td>
<td align="right">531.6</td>
<td align="right">518.96</td>
<td align="right">0.98</td>
</tr>
<tr>
<td align="right">16</td>
<td align="right">494.19</td>
<td align="right">476.57</td>
<td align="right">0.96</td>
</tr>
<tr>
<td align="right">64</td>
<td align="right">451.72</td>
<td align="right">444.77</td>
<td align="right">0.98</td>
</tr>
<tr>
<td align="right">256</td>
<td align="right">215.84</td>
<td align="right">258.42</td>
<td align="right">1.20</td>
</tr>
</table>
<p>Interesting with 256 threads BSD scheduler looks better.</p>
    <hr noshade style="margin:0;height:1px" />
    <p>Entry posted by Vadim |
      <a href="http://www.mysqlperformanceblog.com/2006/06/15/freebsd-tests/#comments">14 comments</a></p>
    <p>Add to: <a href="http://del.icio.us/post?url=http://www.mysqlperformanceblog.com/2006/06/15/freebsd-tests/&amp;title=FreeBSD tests" title="Bookmark this post on del.icio.us"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/delicious.png" alt="delicious" /></a> | <a href="http://digg.com/submit?phase=2&amp;url=http://www.mysqlperformanceblog.com/2006/06/15/freebsd-tests/&amp;title=FreeBSD tests" title="Digg this post on Digg.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/digg.png" alt="digg" /></a> | <a href="http://reddit.com/submit?url=http://www.mysqlperformanceblog.com/2006/06/15/freebsd-tests/&amp;title=FreeBSD tests" title="Submit this post on reddit.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/reddit.png" alt="reddit" /></a> | <a href="http://www.netscape.com/submit/?U=http://www.mysqlperformanceblog.com/2006/06/15/freebsd-tests/&amp;T=FreeBSD tests" title="Vote for this article on Netscape"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/netscape.gif" alt="netscape" /></a> | <a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.mysqlperformanceblog.com/2006/06/15/freebsd-tests/&amp;title=FreeBSD tests" title="Add to Google Bookmarks"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/google.png" alt="Google Bookmarks" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlperformanceblog.com/2006/06/15/freebsd-tests/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>MyISAM concurrent insert</title>
		<link>http://www.mysqlperformanceblog.com/2006/06/13/myisam-concurrent-insert/</link>
		<comments>http://www.mysqlperformanceblog.com/2006/06/13/myisam-concurrent-insert/#comments</comments>
		<pubDate>Tue, 13 Jun 2006 09:47:41 +0000</pubDate>
		<dc:creator>Vadim</dc:creator>
				<category><![CDATA[benchmarks]]></category>
		<category><![CDATA[myisam]]></category>
		<category><![CDATA[operating systems]]></category>

		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/06/13/myisam-concurrent-insert/</guid>
		<description><![CDATA[Arjen posted a good note about MyISAM concurrent-insert features, though I should mention concurrent-insert can be cause of
scalablity and peformance problems on SMP boxes, especially on queries processing range-queries. The reason of problems is POSIX read-write locks, which are used to protect key_buffer from concurrent changes and called for each processed row. More info you [...]]]></description>
			<content:encoded><![CDATA[<p>Arjen posted <a href="http://arjen-lentz.livejournal.com/74300.html ">a good note</a> about MyISAM <strong>concurrent-insert</strong> features, though I should mention <strong>concurrent-insert</strong> can be cause of<br />
scalablity and peformance problems on SMP boxes, especially on queries processing range-queries. The reason of problems is POSIX read-write locks, which are used to protect key_buffer from concurrent changes and called for each processed row. More info you can get from <a href="http://www.mysqlperformanceblog.com/files/presentations/UC2006-Optimizing-MySQL-on-Source-Code-Level.pdf">my UC2006 talk</a>, in short on main platforms (Linux, Solaris, Windows) rw-locks have a bad implementation and too many calls cause waste of CPU in user-space (Solaris) or kernel-space (Linux).</p>
<p>Some results for MyISAM table, query <code>SELECT id FROM sbtest WHERE id BETWEEN N AND N+20000</code>, id - primary key.<br />
Boxes: Sun V40z, Solaris 10, 4 x Dual Core Opteron @ 2.2GHz (8 logical cpu), 16GB of RAM, StorEdge 3310<br />
and Quadxeon, RedHat AS 3, 2.4.21-15.Elsmp, 4 x Intel(R) XEON(TM) MP CPU 2.00GHz, 4GB of RAM, SATA RAID 10<br />
The results in queries per sec (more is better)</p>
<table border="1" cellpadding="0" cellspacing="0">
<tr>
<td width="64">threads</td>
<td width="77">Quadxeon<br /> with enabled concurrent-insert</td>
<td width="66">Quadxeon<br /> --skip-concurrent-insert</td>
<td width="116">Sun V40z<br /> with enabled concurrent-insert</td>
<td width="64">Sun V40z<br /> --skip-concurrent-insert</td>
</tr>
<tr>
<td align="right">1</td>
<td align="right">44.08</td>
<td align="right">64.82</td>
<td align="right">61.06</td>
<td align="right">129.13</td>
</tr>
<tr>
<td align="right">2</td>
<td align="right">32.63</td>
<td align="right">123.33</td>
<td align="right">52.63</td>
<td align="right">244.03</td>
</tr>
<tr>
<td align="right">4</td>
<td align="right">24.95</td>
<td align="right">176.62</td>
<td align="right">20.03</td>
<td align="right">463.62</td>
</tr>
<tr>
<td align="right">8</td>
<td align="right">19.92</td>
<td align="right">206.81</td>
<td align="right">12.34</td>
<td align="right">483.47</td>
</tr>
<tr>
<td align="right">16</td>
<td align="right">19.73</td>
<td align="right">208.66</td>
<td align="right">12.3</td>
<td align="right">428.35</td>
</tr>
<tr>
<td align="right">32</td>
<td align="right">19.77</td>
<td align="right">212.83</td>
<td align="right">12.25</td>
<td align="right">445.66</td>
</tr>
</table>
<p>So if you are using range-queries and doing INSERT not often than disabling concurrent-insert with --skip-concurrent-insert can improve MyISAM performance.</p>
<p>As I said the reason of bad scalability is rw-locks and currently MySQL developers are working on CPU-depended rw-locks implementstation, this will be available in MySQL 5.1 - 5.2</p>
    <hr noshade style="margin:0;height:1px" />
    <p>Entry posted by Vadim |
      <a href="http://www.mysqlperformanceblog.com/2006/06/13/myisam-concurrent-insert/#comments">9 comments</a></p>
    <p>Add to: <a href="http://del.icio.us/post?url=http://www.mysqlperformanceblog.com/2006/06/13/myisam-concurrent-insert/&amp;title=MyISAM concurrent insert" title="Bookmark this post on del.icio.us"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/delicious.png" alt="delicious" /></a> | <a href="http://digg.com/submit?phase=2&amp;url=http://www.mysqlperformanceblog.com/2006/06/13/myisam-concurrent-insert/&amp;title=MyISAM concurrent insert" title="Digg this post on Digg.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/digg.png" alt="digg" /></a> | <a href="http://reddit.com/submit?url=http://www.mysqlperformanceblog.com/2006/06/13/myisam-concurrent-insert/&amp;title=MyISAM concurrent insert" title="Submit this post on reddit.com"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/reddit.png" alt="reddit" /></a> | <a href="http://www.netscape.com/submit/?U=http://www.mysqlperformanceblog.com/2006/06/13/myisam-concurrent-insert/&amp;T=MyISAM concurrent insert" title="Vote for this article on Netscape"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/netscape.gif" alt="netscape" /></a> | <a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.mysqlperformanceblog.com/2006/06/13/myisam-concurrent-insert/&amp;title=MyISAM concurrent insert" title="Add to Google Bookmarks"><img src="http://www.mysqlperformanceblog.com/wp-content/themes/boxy-but-gold/images/google.png" alt="Google Bookmarks" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mysqlperformanceblog.com/2006/06/13/myisam-concurrent-insert/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
