<?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>Simon J Mudd&#039;s Blog</title>
	<atom:link href="http://blog.wl0.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.wl0.org</link>
	<description>Random thoughts on different topics</description>
	<lastBuildDate>Tue, 24 Jan 2012 23:32:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Better Controlling MySQL Memory Usage</title>
		<link>http://blog.wl0.org/2012/01/better-controlling-mysql-memory-usage/</link>
		<comments>http://blog.wl0.org/2012/01/better-controlling-mysql-memory-usage/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 23:32:53 +0000</pubDate>
		<dc:creator>Simon J Mudd</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[5.1]]></category>
		<category><![CDATA[5.5]]></category>
		<category><![CDATA[5.6]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[memory allocation]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[resource control]]></category>
		<category><![CDATA[swapping]]></category>

		<guid isPermaLink="false">http://blog.wl0.org/?p=512</guid>
		<description><![CDATA[MySQL, like a lot of other software, has many knobs you can tweak. Most of these knobs may affect behaviour, but more importantly most affect the memory usage of the server, so getting these settings right is very important. Most of MySQL&#8217;s memory is really used just as a cache, in one form or another, [...]]]></description>
			<content:encoded><![CDATA[<p>MySQL, like a lot of other software, has many knobs you can tweak. Most of these knobs may affect behaviour, but more importantly most affect the memory usage of the server, so getting these settings right is very important.</p>
<p>Most of MySQL&#8217;s memory is really used just as a cache, in one form or another, information that otherwise is on disk. So ensuring you have as large a cache as possible is important. However, making these memory sizes too large will trigger the server to start swapping and possibly can cause it to crash or cause the kernel to kill the process when it runs out of memory.  So that&#8217;s something we want to avoid.</p>
<p>Certain settings affect memory allocation on a per connection/thread basis, being bounded by thread_cache_size and max_connections.  If you configure for the worst behaviour (max_connections) you may end up not actually using all the memory you have available, memory which normally could be used for other purposes.</p>
<p>Recently a server I managed was configured incorrectly with a large sort_buffer_size (4M to 256M) and larger read_buffer_size (4M to 20M).  The change in configuration on first glance looks quite innocent, and not noticing that these are per-connection settings this got rolled out. max_connections on this server was set to 1000, while normally there were ~40 connections of which only a few were active. The mysqld memory footprint on startup looked fine. In fact under normal usage it also worked fine. However spiky load suddenly changed this <em>nice behaviour</em>: as configured mysqld ramped up the thread count and hence memory usage, resulting in swapping and finally server death&#8230;</p>
<p>The fault of course was mine for not noticing, but this has been an issue with MySQL forever.  Most other RDBMSes manage memory slightly differently: you define how much memory you want to use (maximum), this is optinally locked into memory, and further requests for different <em>buffers</em> are taken from this <em>global pool</em>.  That is much safer, avoids unexpected swapping, or memory over-allocation, but does raise the question of what happens when a memory request can not be honoured.</p>
<p>Initially I would expect two different behaviours: either</p>
<ol>
<li>kill a thread whose memory can not be allocated, or</li>
<li>wait a certain time to allocate that memory, after which it gets killed anyway.</li>
</ol>
<p>Option (2) is probably saner, and possibly some sort of deadlock detection can kick if in all threads are waiting for memory, perhaps killing the <em>younger thread</em>, or thread which has done least work first. Possibly there are other better ways of doing this?</p>
<p>I can imagine that changing MySQL&#8217;s current behaviour to do something like this could be quite hard, especially as ideally the engines would also use the same memory management mechanisms, but I see this as being a good thing and would make MySQL more robust, especially under load, which is after all what counts.  Of course this will not happen in today&#8217;s 5.5 GA version, or tomorrow&#8217;s 5.6 version which is probably likely to appear some time this year. That&#8217;s a major change. It would be nice if Oracle look at this for 5.7 as a way of ensuring that when resource usage does come under pressure MySQL does not go heads up, but attempts to use the allocated resources as best as possible.</p>
<p>In the meantime what would help would be:</p>
<ul>
<li>better documentation so we can see clearly how all mysql memory is allocated. There are several web pages commenting ways to calculate this, but certainly no definitive guide.</li>
<li>The InnoDB engine&#8217;s documentation talks about memory usage and most people think that the innodb_buffer_pool_size is the main setting. yet read further and there&#8217;s talk of an overhead of perhaps 1/8th. I have recently been playing with innodb_buffer_pool_instances settings &gt; 1 (using values in the range of 20-40) and am inclined to think that this increases that overhead somewhat more, yet there&#8217;s no documentation on this and whether my guess is right or not. Please InnoDB developers improve your documentation, if only to prove me wrong.</li>
<li>Ideally some tools to tell you if you server is possibly misconfigured. Coming from a Sybase environment I&#8217;d be tempted to suggest a stored procedure in the mysql database which can tell you total memory usage and how it is broken down as doing this with a single SELECT is going to be tricky.</li>
</ul>
<p>Then once that is done consider adding some extra variable to enable total memory usage to be controlled. I made a feature request for this at <a title="Provide a global maximum_memory setting to limit unexpected memory usage" href="http://bugs.mysql.com/?id=64108" target="_blank">http://bugs.mysql.com/?id=64108</a>. If you think this feature might interest you please let Oracle know.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wl0.org/2012/01/better-controlling-mysql-memory-usage/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Why online disk storage is not the same as using tapes</title>
		<link>http://blog.wl0.org/2012/01/why-online-disk-storage-is-not-the-same-as-using-tapes/</link>
		<comments>http://blog.wl0.org/2012/01/why-online-disk-storage-is-not-the-same-as-using-tapes/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 08:49:06 +0000</pubDate>
		<dc:creator>Simon J Mudd</dc:creator>
				<category><![CDATA[Other Things]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[disk array]]></category>
		<category><![CDATA[disk failure]]></category>
		<category><![CDATA[drive failure]]></category>
		<category><![CDATA[n5200 pro]]></category>
		<category><![CDATA[RAID-5]]></category>
		<category><![CDATA[RAID-6]]></category>
		<category><![CDATA[tape]]></category>
		<category><![CDATA[tape drive]]></category>
		<category><![CDATA[Thecus]]></category>

		<guid isPermaLink="false">http://blog.wl0.org/?p=509</guid>
		<description><![CDATA[A couple of years ago I posted about an unlucky encounter with my Thecus N5200 Pro. On the 1st January at 06:15 I had a New Year&#8217;s present. A disk died on me. The Thecus duly notified me by starting to beep. I still have my RAID-6 setup so there was no real problem. I [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of years ago I <a title="Unlucky encounter with a Thecus N5200 PRO" href="http://blog.wl0.org/2009/11/unlucky-encounter-with-a-thecus-n5200-pro/" target="_blank">posted</a> about an <em>unlucky</em> encounter with my Thecus N5200 Pro. On the 1st January at 06:15 I had a New Year&#8217;s present. A disk died on me. The Thecus duly notified me by starting to beep.</p>
<p>I still have my RAID-6 setup so there was no real problem. I have 2 redundant disks. So I went and bought a replacement and fitted it and the Thecus duly started rebuilding the RAID array with an estimated time to finish of about 1 day (5x1TB disks, so ~3TB array).</p>
<p>Disk prices have increased significantly since I originally bought my array but buying a single disk was not a problem.  During the time that the array was rebuilding or shortly afterwards however a second disk failed just as it had 2 years ago when I ended up losing my array as the RAID-5 setup did not have any further disks. This time however there was no problem. RAID-6 saved me and the photos and backup information I had on my Thecus so I was happy and I ended up running out and buying another disk. This one triggered the array rebuild and completed successfully.</p>
<p>That lead me to think. A lot of people push the move to external disks as a backup alternative. Certainly this gives you online information and generally works well. I am using this device at home to keep my photos and other files and also to do a backup of my main machine to a separate location.  However, what strikes me as being clear: replacing disks is expensive. Had I been using tapes for backups throwing away the 2 tapes and buying new ones would have been much cheaper than buying 2 new hard disks for my array.  Of course a disk array does not provide you a site backup and also does not provide you a convenient way to store multiple backups over time. For that it is not yet cost effective.</p>
<p>So after this experience I am tempted to look and see if there are any small tape devices which I could attach to my PC and use that to give me these extra facilities. The hardware no doubt exists but from previous searches it is expensive and out of the price range of the average home user. That is a shame.  With a lot of people now dismissing tape devices as old fashioned failure of drives in a small array like my 5-disk array may turn out to be pretty expensive (in money) or pretty costly (lost data).  RAID-1 or RAID-5 sound great but can you afford for a second disk to fail while the array is <em>rebuilding</em> after the first disk has failed? If you can not then arrays of this type may not be for you and may lead you to a false sense of security.</p>
<p>The title of my original post was <em>Unlucky Encounter&#8230;</em> So have I just been unlucky (again) or is this sort of problem something which has happened to more people?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wl0.org/2012/01/why-online-disk-storage-is-not-the-same-as-using-tapes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Problems of Managing MySQL&#8217;s Configuration</title>
		<link>http://blog.wl0.org/2011/11/managing-mysqls-configuration/</link>
		<comments>http://blog.wl0.org/2011/11/managing-mysqls-configuration/#comments</comments>
		<pubDate>Fri, 11 Nov 2011 10:32:47 +0000</pubDate>
		<dc:creator>Simon J Mudd</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[5.5.16]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[configuration management]]></category>
		<category><![CDATA[defaults]]></category>
		<category><![CDATA[mysqld]]></category>
		<category><![CDATA[running_config]]></category>
		<category><![CDATA[startup_config]]></category>

		<guid isPermaLink="false">http://blog.wl0.org/?p=495</guid>
		<description><![CDATA[I want to keep a record of the configuration of the MySQL servers I manage. The configuration of some servers differs from others and over time the configuration may vary, partly as a result of upgrades in the mysql version or the use of the particular mysql instance, so tracking this is important. Configuration items in [...]]]></description>
			<content:encoded><![CDATA[<p>I want to keep a record of the configuration of the MySQL servers I manage. The configuration of some servers differs from others and over time the configuration may vary, partly as a result of upgrades in the mysql version or the use of the particular mysql instance, so tracking this is important.</p>
<p>Configuration items in MySQL can be thought of in 2 separate parts: the <em>static configuration files</em> which determine the behaviour of the server when it starts up (my.cnf) and the <em>running configuration</em> of the server in question. The latter information is usually obtained by running SHOW GLOBAL VARIABLES and SHOW SLAVE STATUS if the server is a slave.</p>
<p>I&#8217;d also like to compare the 2 sets of configuration so I can see if a <em>local</em> change has been made to the running server which is not reflected in its configuration file. I might want to correct this, or at least be aware of it.</p>
<p>However, collecting and comparing this configuration information is not as easy to do completely as one would really like. There are various inconsistencies which make this task troublesome.</p>
<ul>
<li>Getting the <strong>default</strong> configuration out of the system is hard: <tt>mysqld --help --verbose</tt> sort of shows you this information but you have to filter out the junk.</li>
<li>Use of dashes (<tt>'-'</tt>) in variable names in my.cnf or command line parameter names vs <tt>'_'</tt> in <tt>SHOW GLOBAL VARIABLES</tt>.</li>
<li>5.5.16 seems to try to &#8216;partially&#8217; startup when it shouldn&#8217;t.  See <a title="Bug#63187" href="http://bugs.mysql.com/bug.php?id=63187" target="_blank">bug#63187</a>.</li>
<li>You can not query the default configuration information from the running server.</li>
<li><tt>SHOW SLAVE STATUS</tt> uses mixed-case variable names vs <tt>SHOW GLOBAL VARIABLES</tt> which uses lower-case variable names.</li>
<li><tt>SHOW GLOBAL VARIABLES</tt> uses lower-case variable names vs <tt>SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES</tt> which shows them in upper-case.</li>
<li>Some variables get their multiple values sorted (others don&#8217;t)</li>
<li>Conversion of <tt>sql_mode</tt> special values is not consistent or clear.</li>
<li><tt>my.cnf</tt> may use <em>letter multipliers</em> to indicate size (K, M, G), show global variables uses actual numbers.</li>
<li><tt>my.cnf</tt> uses 0/1 vs <tt>SHOW GLOBAL VARIABLES</tt> using OFF/ON for certain switches. In some cases just having the variable defined implies &#8216;= 1&#8242;.</li>
<li>Some directory paths provided without a trailing &#8216;/&#8217; in my.cnf have the trailing &#8216;/&#8217; added in <tt>SHOW GLOBAL VARIABLES</tt>.</li>
<li>Some variables can take relative paths (relative to datadir) whereas <tt>SHOW GLOBAL VARIABLES</tt> shows the full path.</li>
<li>Some variable names differ in <tt>my.cnf</tt> compared to the equivalent setting in <tt>SHOW GLOBAL VARIABLES</tt>.</li>
<li>Some variable names have changed with newer versions of MySQL yet in many cases no warning is given that the new (correct?) variable name should be used and the old name is deprecated.</li>
<li>Not all my.cnf settings, DEFAULT SETTINGS (234 values) are shown in <tt>SHOW GLOBAL VARIABLES</tt> (312 values) in 5.5.16.</li>
<li>Some settings are incomplete (<tt>log_bin</tt> does not provide the full name of the binlog files set in my.cnf).</li>
<li>etc&#8230;</li>
</ul>
<p>So all of these issues means that if I want to look at the <tt>/etc/my.cnf</tt> files and compare that to the running configuration it&#8217;s pretty hard to do well.  That may not seem like such a big deal until you realise that many mysql servers may have an uptime over a year. In that time the configuration may have evolved and this may mean you need to bring down mysql to adjust its configuration or alternatively see the difference and accept it&#8217;s not such a big issue and can be corrected the next time the server is restarted.</p>
<p>I&#8217;ve brought this up with Oracle support but guess that many in the community are so used to this they think it&#8217;s normal. If you manage several servers then it really is helpful to be able to collect this information and also see if servers run with the expected settings. Not doing so may mean that performance is affected and no-one notices.</p>
<p>So I&#8217;d like to ask that Oracle consider addressing this issue and remove some of the aforementioned inconsistencies, and perhaps also providing something like a <tt>SHOW DEFAULT SETTINGS</tt> or <tt>INFORMATION_SCHEMA.DEFAULT_SETTINGS</tt> output.  If you are in a company which goes through a lot of change and that includes the servers that are being managed, it will be much easier to ensure the servers are configured properly and if they were to address that.</p>
<p>Note software from other places makes this really easy and that can be very handy. <a title="Postfix Mail Server" href="http://www.postfix.org" target="_blank">Postfix</a>&#8216;s <a title="Postfix configuration utility" href="http://www.postfix.org/postconf.1.html" target="_blank">postconf</a> shows the current configuration, but when called with -n will only show the non-default options and postconf -d shows all default settings.  So this certainly can be done.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wl0.org/2011/11/managing-mysqls-configuration/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Adding pre/post hooks into MySQL init scripts</title>
		<link>http://blog.wl0.org/2011/09/adding-prepost-hooks-into-mysql-init-scripts/</link>
		<comments>http://blog.wl0.org/2011/09/adding-prepost-hooks-into-mysql-init-scripts/#comments</comments>
		<pubDate>Sat, 24 Sep 2011 08:39:55 +0000</pubDate>
		<dc:creator>Simon J Mudd</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[init scripts]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql administration]]></category>
		<category><![CDATA[restart]]></category>
		<category><![CDATA[start]]></category>
		<category><![CDATA[stop]]></category>
		<category><![CDATA[tasks]]></category>

		<guid isPermaLink="false">http://blog.wl0.org/?p=483</guid>
		<description><![CDATA[On several occasions it may be necessary to do some tasks around the process of starting or stopping a MySQL server such as: Perform a warmup of the database using custom scripts and external information that the init_file configuration may not have access to. Change configuration settings such as innodb_log_file_size and adjust the on disk [...]]]></description>
			<content:encoded><![CDATA[<p>On several occasions it may be necessary to do some tasks around the process of starting or stopping a MySQL server such as:</p>
<ul>
<li>Perform a warmup of the database using custom scripts and external information that the <code>init_file</code> configuration may not have access to.</li>
<li>Change configuration settings such as <code>innodb_log_file_size</code> and adjust the on disk files that this needs.</li>
<li>Change configuration settings such as <code>log_bin</code> (I try to use a relative paths to ensure that different instances use a common setting even if <code>datadir</code> is different, and changing from an absolute to relative path often requires adjusting the binlog index file).</li>
<li>Shutting down MySQL may need to be delayed if the SQL thread has open temporary tables or open transactions are still being processed.</li>
<li>etc&#8230;</li>
</ul>
<p>You may have others and many of these are likely to be site specific. I could ask Oracle to add lots of configuration options to cover many of these special cases but that is likely to not work as my needs may not match others. However asking them to add hooks to allow me to put in the infrastructure that I need, especially if those hooks are normally disabled and require minimal changes to the current init scripts, might be acceptable. That&#8217;s why I&#8217;m curious as to what others think about this.</p>
<p>Some may be asking: <em>why do you need this at all?</em> I have certainly seen several issues such as those indicated above which I need to resolve. Also the DBA is not the only person who may have to restart a server. Sometimes this may be done by a system administrator, and on some servers a by developer. These people are not necessarily expected to know about the specifics of one MySQL server compared to another or to know the server&#8217;s current <em>state</em>. It is also true that often a server may go for a long time without needing to be restarted, so many configuration changes may be pending. They only need to be done when the server is restarted.</p>
<p>So I was considering the idea of some hooks which would work in a similar way to a system init script, probably composed of the following parts:</p>
<ul>
<li>An <code>/etc/mysql/init.d</code> directory containing any scripts that might need to be run. they can be placed there manually or by system configuration tools</li>
<li>An <code>/etc/mysql/rc-start</code> and <code>/etc/mysql/rc-stop</code> directory which would have files named: <code>PRE-nn-scriptname</code>, and <code>POST-nn-scriptname</code> linked to the <code>../init.d/scriptname</code> file. Again similar to the system init scripts. The <code>nn</code> would, like the number in the system init scripts, define the relative ordering of the execution of any scripts in that directory.</li>
<li>A modification to <code>/etc/init.d/mysql</code> so that these scripts would be run (if present) at 4 stages:
<ul>
<li><strong>pre-start</strong>: before starting <code>mysqld</code></li>
<li><strong>post-start</strong>: after starting <code>mysqld</code></li>
<li><strong>pre-stop</strong>: before stopping <code>msyqld</code></li>
<li><strong>post-stop</strong>: after stopping <code>mysqld</code></li>
</ul>
</li>
<li>Not absolutely necessary but for completeness a tool which would manage the linking / unlinking of these files.</li>
</ul>
<p>I can certainly see the use of something like this for my work, but do not see that someone like Oracle will take this unless they see a clear business sense to that, or technical advantage. It would also allow Oracle to provide some &#8220;standard&#8221; type of scripts if they have seen the need from their customers but also the community could equally share scripts which would be usable for their specific needs but may also be useful to others.</p>
<p>If you have a single mysql instance to manage this may seem like overkill. That&#8217;s fine: by default it would not be used. However, as MySQL is gradually being used in larger sites I believe this sort of functionality could be quite helpful as more people may be responsible for managing the servers, and some changes may need to be postponed to a later moment, and the change in the scripts I suggest would make management of the instances simpler.</p>
<p>Have you solved the problem already? If so how? If not does this seem like a reasonable idea?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wl0.org/2011/09/adding-prepost-hooks-into-mysql-init-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>About InnoDB&#8217;s: Shortened warm-up times with a preloaded InnoDB buffer pool</title>
		<link>http://blog.wl0.org/2011/07/about-innodbs-shortened-warm-up-times-with-a-preloaded-innodb-buffer-pool/</link>
		<comments>http://blog.wl0.org/2011/07/about-innodbs-shortened-warm-up-times-with-a-preloaded-innodb-buffer-pool/#comments</comments>
		<pubDate>Sat, 30 Jul 2011 07:10:32 +0000</pubDate>
		<dc:creator>Simon J Mudd</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[innodb]]></category>
		<category><![CDATA[innodb buffer pool]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[preload]]></category>
		<category><![CDATA[warmup]]></category>

		<guid isPermaLink="false">http://blog.wl0.org/?p=476</guid>
		<description><![CDATA[This comment is in regard to this InnoDB blog page. Trying to post a message says you need to be logged in, but there&#8217;s no register/login page I could see&#8230; Anyway the page talks about a new feature which allows you to save on shutdown an InnoDB buffer pool and to load this on startup, [...]]]></description>
			<content:encoded><![CDATA[<p>This comment is in regard to <a title="Shortened warm-up times with a preloaded InnoDB buffer pool" href="http://blogs.innodb.com/wp/2011/07/shortened-warm-up-times-with-a-preloaded-innodb-buffer-pool/" target="_blank">this</a> InnoDB blog page. Trying to post a message says you need to be logged in, but there&#8217;s no register/login page I could see&#8230;</p>
<p>Anyway the page talks about a new feature which allows you to save on shutdown an InnoDB buffer pool and to load this on startup, this ensuring that once loaded the database will perform with this &#8220;hot&#8221; cache.</p>
<p>That sounds interesting as I have seen on numerous occasions that if the buffer pool is not warm then performance can be a magnitude worse.</p>
<p>This looks like a very welcome feature. However, a couple of things are not clear to me.</p>
<ol>
<li>Having some example benchmark times of using this process and comparing it to trying to warm up the buffer pool by hand would be useful.  While this may heavily dependent on database content it would at least give us an idea of perhaps how much difference this may make.</li>
<li>On servers I have to <em>warm up</em> currently we find performance becomes acceptable when perhaps 20% of the buffer pool has been warmed up.  The implementation behind the new functionality isn&#8217;t explained but one option which might be useful would be to save and load only a configurable percentage of the most recently used pages, not 100% of the pages as this patch seems to do. This would save time on save and on load, and possibly be good enough for most people. Many servers I use have 40 GB or 90 GB pools.  So loading files of this size into memory is going to take time. Thus having some control over how much of the buffer pool is loaded / saved seems like a good idea if this is possible.</li>
<li>I assume the buffer pool is loaded and saved sequentially (in large blocks) giving the mysqld and the OS the chance to read/write the pages faster in larger chunks. Is this so?  Certainly currently when I see mysqld shutdown (in 5.1 and I believe 5.5 too) the shutdown times seem to be rather slow, and from what I can see the data does not appear to be written out quickly. Perhaps the shutdown generates a lot of random I/O. So moving to a faster linear read/write seems likely to be much more efficient.</li>
<li>There is no mention of how the content of the file is checked for &#8220;consistency&#8221; to make sure that invalid data won&#8217;t be loaded. I&#8217;m sure there is some checking but otherwise this feature may be a way to corrupt the database inadvertently if the buffer pool cache file gets corrupted.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.wl0.org/2011/07/about-innodbs-shortened-warm-up-times-with-a-preloaded-innodb-buffer-pool/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>CentOS 6 &#8211; Blocked by the installer not quite doing things as I want</title>
		<link>http://blog.wl0.org/2011/07/centos-6-blocked-by-the-installer-not-quite-doing-things-as-i-want/</link>
		<comments>http://blog.wl0.org/2011/07/centos-6-blocked-by-the-installer-not-quite-doing-things-as-i-want/#comments</comments>
		<pubDate>Sun, 24 Jul 2011 08:25:02 +0000</pubDate>
		<dc:creator>Simon J Mudd</dc:creator>
				<category><![CDATA[Other Things]]></category>
		<category><![CDATA[CentOS 6]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[LVM]]></category>
		<category><![CDATA[MBR]]></category>
		<category><![CDATA[show partitions]]></category>

		<guid isPermaLink="false">http://blog.wl0.org/?p=474</guid>
		<description><![CDATA[RHEL 6 has been out for some time and promises some nice new features. Finally CentOS 6 has been released so I was looking forward to getting it installed and upgrade my existing system. This is currently running CentOS 5.6 and has quite a few services on it.  The best way to upgrade is usually [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Red Hat Enterprise Linux 6" href="http://www.redhat.com/promo/Red_Hat_Enterprise_Linux6/" target="_blank">RHEL 6</a> has been out for some time and promises some nice new features. Finally <a title="CentOS 6" href="http://www.centos.org/" target="_blank">CentOS 6</a> has been released so I was looking forward to getting it installed and upgrade my existing system.</p>
<p>This is currently running CentOS 5.6 and has quite a few services on it.  The best way to upgrade is usually to do a fresh install and then migrate existing over existing services. That&#8217;s what I was planning to do.  I only have a single PC so was trying to figure out the best way to go about this and at the same time minimise downtime.</p>
<p>I use LVM quite a lot. It makes worrying about which disk is used and where the partitions are located much less of an issue. My current setup is quite simple: 2 disks with 2 partitions each. sda1 holds /boot, sdb1 is free. sda2/sdb2 are configured in RAID-1 and hold a single volume group.</p>
<p><strong>Plan A</strong></p>
<p>My first plan was to use a free USB disk drive and install CentOS 6 onto that, leave some space on the USB disk and migrate the CentOS 5 volume group to the USB disk. Then I could move the CentOS 6 installation to the hard disks and complete the migration. That should have left me with the option during this process of booting CentOS 5 or CentOS 6 and migrating data from one system to another.</p>
<p>Plan 1 worked in the sense I was able to complete the install of CentOS 6 on the USB disk but I couldn&#8217;t get the installer to install grub on /dev/sdc (MBR): it insisted on doing it on sdc1 which of course the BIOS just ignored.  So I couldn&#8217;t get CentOS 6 to boot. I could have spent some more time fiddling around with this but then came up with what I thought was a better plan B.</p>
<p><strong>Plan B</strong></p>
<p>Plan B was simpler: given my setup I had a free partition I could boot from (/dev/sdb1) and also an existing volume group where I could put the new partitions. There was plenty of free space in the existing Volume Group so this should be much easier.  However, this does not work. The CentOS 6 installer shows the disks correctly and it is possible to edit /dev/sdb1 to be /boot. It also shows you the previously created Volume Group. However, it does not show you the existing logical volumes inside that volume group. The list is empty. So I could not tell it to reuse my swap partition, or to use /home from my existing home partition, and I was also fearful of creating new partitions and have the installer perhaps recreate the VG and thus wipe out my existing system.  So I have reported the <a title="List existing LVM partitions in CentOS 6 installer " href="http://bugs.centos.org/view.php?id=4999" target="_blank">problem</a> to the CentOS team, though this looks like a bug with RHEL 6, and will play around further to see if I can get this to work.</p>
<p>This makes me wish I had a bigger environment at home.  In a work environment you can afford to install a new server, and set it up, migrating existing functionality from the current one, and then finally switch over. I don&#8217;t have the hardware to do that so upgrading is quite a bit more work, at least as I want to minimise downtime.</p>
<p>So I will continue to work out how to best to get the CentOS 6 install running and then migrate everything over.</p>
<p><strong>2011-07-30 Update</strong></p>
<p>After further investigation Plan A seemed to be a problem of my own making. The installer first shows you a list of disks and then asks which one you want to install the OS on, the others being called &#8220;data disks&#8221;.  There&#8217;s an option here to install boot loader. I missed this and if you do then later you are not offered the possibility of installing the bootloader on that disks MBR. So human error though I would prefer perhaps the install disks MBR to be an option, even if there&#8217;s a warning &#8220;You indicated you did not want to install the boot loader on the MBR of this disk&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wl0.org/2011/07/centos-6-blocked-by-the-installer-not-quite-doing-things-as-i-want/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Partitioning and its Confusing Syntax</title>
		<link>http://blog.wl0.org/2011/07/mysql-partitioning-and-its-confusing-syntax/</link>
		<comments>http://blog.wl0.org/2011/07/mysql-partitioning-and-its-confusing-syntax/#comments</comments>
		<pubDate>Mon, 18 Jul 2011 01:52:39 +0000</pubDate>
		<dc:creator>Simon J Mudd</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[hash]]></category>
		<category><![CDATA[key]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[partitioning]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://blog.wl0.org/?p=466</guid>
		<description><![CDATA[While looking at partitioning I recently made a mistake which I guess can happen to others. Often this is due to not fully reading the documentation or scanning it too quickly and misunderstanding what&#8217;s being said. So this post is to complain about the MySQL partitioning syntax and to warn others who may easily make [...]]]></description>
			<content:encoded><![CDATA[<p>While looking at partitioning I recently made a mistake which I guess can happen to others. Often this is due to not fully reading the documentation or scanning it too quickly and misunderstanding what&#8217;s being said.</p>
<p>So this post is to complain about the MySQL partitioning syntax and to warn others who may easily make the same mistake without realising.</p>
<p>First we probably need to ask why we are partitioning a table in the first place. The main reasons for this are I think:</p>
<ul>
<li>to improve query performance</li>
<li>to reduce individual .ibd file sizes for large tables (if using innodb_file_per_table)</li>
</ul>
<p>In my case I wanted to do both. I had a several tables which store a large number of rows (batches of data) based on an incremental batch number. One of these tables was around 40 GB and had about 500,000,000 rows in it.  When processing data in this table often all the data from a particular batch run would be aggregated with the resultant data being stored elsewhere.</p>
<p>So I knew I wanted to partition and performance of these aggregations would be improved as the time to <em>table scan</em> a batch would be reduced to the time to scan the partition rather than the whole table.</p>
<p>The primary key of these tables was already in the form ( batch_id, other_key ) so I really wanted to just partition by the batch_id key, using in my case 64 partitions. batch_id is defined as int unsigned NOT NULL.</p>
<p>This is where I made the mistake. There are various ways <a href="http://dev.mysql.com/doc/refman/5.1/en/partitioning-types.html" target="_blank">to partition tables in MySQL</a> and they are named: RANGE, LIST, HASH, KEY.  Given the batch_id was a gradually increasing value and I didn&#8217;t want to modify the partitioning once it was created RANGE and LIST seemed inappropriate. Of HASH and KEY, I incorrectly assumed that HASH would do some complex hash function of my integer batch_id, and since batch_id was part of the key that KEY would be the right way to partition.</p>
<p>So I incorrectly defined the table like this:</p>
<p>ALTER TABLE xxxxx PARTITION BY KEY ( batch_id ) PARTITIONS 64;</p>
<p>When you read the documentation you see that for HASH-type partitioning you provide a functional value which must be numeric and it actually determines the partition to use by doing MOD( your_functional_value, number_of_partitions ).</p>
<p>KEY-type partitioning works diferently and only allows you to provide column names and then it uses its own internal hashing function to generate the partition id.</p>
<p>So using PARTITION BY KEY ( numeric_column_name ) seems to correct but is likely to be more expensive to calculate. For large tables this is likely to cause additional performance issues.  It looks like I&#8217;m going to have to rebuild the tables I&#8217;ve just partitioned and that&#8217;ll be another weekend of work.</p>
<p>A suggestion to those at Oracle is that:</p>
<ul>
<li>PARTITION BY KEY ( numeric_column_name ) should be modified to behave like PARTITION BY HASH ( numeric_column_name ). However, as this is likely to cause on disk incompatibilities during a version change if it were implemented, I&#8217;m guessing it just won&#8217;t happen, unless there&#8217;s some easy way to distinguish the current behaviour and my proposed new behaviour.</li>
<li>The documentation is made a little clearer and mentions this obvious case. What I see with a lot of the MySQL documentation is that it documents technically how things are done rather than documenting the problem and then how to implement the solution. Since it&#8217;s likely that many people are going to partition on one of the columns especially if a multi-column primary key is used this use case should be made clearer.</li>
</ul>
<p>If I had time I&#8217;d look at how partitioning is implemented in Oracle database, Sybase, Postgres or DB2 and see whether it&#8217;s just MySQL which has chosen these unfortunate keywords for defining their partitioning methods.</p>
<p>However, I&#8217;m curious: am I the only one to fall in this trap?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wl0.org/2011/07/mysql-partitioning-and-its-confusing-syntax/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Getting Started with GuruPlug Plus (almost)</title>
		<link>http://blog.wl0.org/2011/06/getting-started-with-guruplug-plus-almost/</link>
		<comments>http://blog.wl0.org/2011/06/getting-started-with-guruplug-plus-almost/#comments</comments>
		<pubDate>Tue, 07 Jun 2011 19:31:15 +0000</pubDate>
		<dc:creator>Simon J Mudd</dc:creator>
				<category><![CDATA[Other Things]]></category>
		<category><![CDATA[arm]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[embedded]]></category>
		<category><![CDATA[guruplug]]></category>
		<category><![CDATA[squeeze]]></category>
		<category><![CDATA[uboot]]></category>
		<category><![CDATA[usb]]></category>

		<guid isPermaLink="false">http://blog.wl0.org/?p=459</guid>
		<description><![CDATA[A few months ago I came across the embedded platform SheevaPlug and its brother GuruPlug. I was basically looking to move my Asterisk setup from my main server to a separate box as I&#8217;ve been unable to avoid some of the latency issues I&#8217;ve reported in previous posts and think it is likely to be [...]]]></description>
			<content:encoded><![CDATA[<p>A few months ago I came across the embedded platform <a title="SheevaPlug" href="http://en.wikipedia.org/wiki/SheevaPlug" target="_blank">SheevaPlug</a> and its brother <a title="GuruPlug computer" href="http://www.globalscaletechnologies.com/t-guruplugdetails.aspx" target="_blank">GuruPlug</a>. I was basically looking to move my Asterisk setup from my main server to a separate box as I&#8217;ve been unable to avoid some of the latency issues I&#8217;ve reported in previous posts and think it is likely to be related to other software running on the server.</p>
<p>I was thus looking for a small size computer which I could tuck out of the way and hopefully have a nice simple working configuration. I also wanted to move over to FreeSwitch if I had time later.</p>
<p>So I bought myself a GuruPlug Plus. The hardware itself is very tiny and it comes with only 500MB of built-in storage but does have space for a MicroSD card and also external e-SATA/USB drives. It looked economical and a good option.</p>
<p>However, to get it working for my intended use I needed to install more than the sample version of Debian that&#8217;s provided with the box, so decided to try and install a larger Debian install on a 8GB MicroSD card. That&#8217;s enough for the single application I want to run.</p>
<p>The blog <a title="Installing Debian on the Guruplug Plus" href="http://bzed.de/posts/2010/05/installing_debian_on_the_guruplug_server_plus/" target="_blank">http://bzed.de/posts/2010/05/installing_debian_on_the_guruplug_server_plus/</a> seemed to have some good pointers as to how to install Debian and exactly on the hardware I was using.</p>
<p>So once I had uboot upgraded I followed the instructions. I checked I could see my MicoSD card:</p>
<p><code><br />
Marvell&gt;&gt; usb tree</code></p>
<p><code>Device Tree:<br />
1  Hub (480MBit/s, 0mA)<br />
|  Marvell EHCI<br />
|<br />
+-2  Hub (480MBit/s, 100mA)<br />
|   USB2.0 Hub<br />
|<br />
+-3  Mass Storage (480MBit/s, 500mA)<br />
USB Storage 000000009909          &lt;=====<br />
</code></p>
<p>I had decided to use the latest debian version (Squeeze). I also wanted to use LVM as this makes it easier to adjust partition sizes later and also it was an option provided by the installer. I followed the instructions on the website but failed to make the plug bootable. The reason after a bit of looking around is the uInitrd image was bigger than the 0&#215;600000 size given as an example. It would have been helpful if not only the commands but also the uboot output had been shown as this would have made it clearer. I took out the MicroSD card and on a normal Ubuntu server checked the device which was recognised fine:</p>
<p><code><br />
/dev/sdb1 is ext2  ( this is /boot )</code></p>
<p>LVM shows:</p>
<p><code>root@ubuntu:~# pvs<br />
PV         VG       Fmt  Attr PSize PFree<br />
/dev/sdb5  guruplug lvm2 a-   7.23g    0</code></p>
<p><code>root@ubuntu:~# lvs<br />
LV     VG       Attr   LSize   Origin Snap%  Move Log Copy%  Convert<br />
home   guruplug -wi---   2.54g<br />
root   guruplug -wi--- 264.00m<br />
swap_1 guruplug -wi--- 436.00m<br />
tmp    guruplug -wi--- 224.00m<br />
usr    guruplug -wi---   2.57g<br />
var    guruplug -wi---   1.22g</code></p>
<p><code> </code></p>
<p>&nbsp;</p>
<p><code>root@ubuntu:/mnt# ls -la<br />
total 16584<br />
drwxr-xr-x  3 root root    1024 2011-06-06 09:46 .<br />
drwxr-xr-x 22 root root    4096 2011-06-03 14:34 ..<br />
-rw-r--r--  1 root root   84094 2011-05-19 23:58 config-2.6.32-5-kirkwood<br />
lrwxrwxrwx  1 root root      28 2011-06-06 08:48 initrd.img -&gt; initrd.img-2.6.32-5-kirkwood<br />
-rw-r--r--  1 root root 6465845 2011-06-06 09:45 initrd.img-2.6.32-5-kirkwood<br />
drwxr-xr-x  2 root root   12288 2011-06-06 08:12 lost+found<br />
-rw-r--r--  1 root root 1003125 2011-05-19 23:58 System.map-2.6.32-5-kirkwood<br />
-rw-r--r--  1 root root 1433984 2011-06-06 09:46 uImage<br />
-rw-r--r--  1 root root 6465909 2011-06-06 09:46 uInitrd     &lt;&lt;============ larger than 0x600000 !<br />
lrwxrwxrwx  1 root root      25 2011-06-06 08:48 vmlinuz -&gt; vmlinuz-2.6.32-5-kirkwood<br />
-rw-r--r--  1 root root 1433920 2011-05-19 23:57 vmlinuz-2.6.32-5-kirkwood<br />
</code></p>
<p>So I modified the steps in the other blog and did the following:</p>
<p><code><br />
Marvell&gt;&gt; usb start<br />
(Re)start USB...<br />
USB:   scanning bus for devices... 3 USB Device(s) found<br />
Waiting for storage device(s) to settle before scanning...<br />
Device NOT ready<br />
Request Sense returned 02 3A 00<br />
1 Storage Device(s) found<br />
Marvell&gt;&gt; usb tree</code></p>
<p><code>Device Tree:<br />
1  Hub (480MBit/s, 0mA)<br />
|  Marvell EHCI<br />
|<br />
+-2  Hub (480MBit/s, 100mA)<br />
|   USB2.0 Hub<br />
|<br />
+-3  Mass Storage (480MBit/s, 500mA)<br />
USB Storage 000000009909</code></p>
<p><code>Marvell&gt;&gt; tftp 0x6400000 uImage<br />
Using egiga0 device<br />
TFTP from server 192.168.a.xx; our IP address is 192.168.a.yy<br />
Filename 'uImage'.<br />
Load address: 0x6400000<br />
Loading: #################################################################<br />
#################################################################<br />
#################################################################<br />
#################################################################<br />
#####################<br />
done<br />
Bytes transferred = 1433984 (15e180 hex)<br />
Marvell&gt;&gt; nand erase 0x100000 0x400000</code></p>
<p><code>NAND erase: device 0 offset 0x100000, size 0x400000<br />
Erasing at 0x4e0000 -- 100% complete.<br />
OK<br />
Marvell&gt;&gt; nand write.e 0x6400000 0x100000 0x400000</p>
<p>NAND write: device 0 offset 0x100000, size 0x400000</p>
<p>Writing data at 0x4ff800 -- 100% complete.<br />
4194304 bytes written: OK<br />
Marvell&gt;&gt; tftp 0x6400000 uInitrd<br />
Using egiga0 device<br />
TFTP from server 192.168.a.xx; our IP address is 192.168.a.yy<br />
Filename 'uInitrd'.<br />
Load address: 0x6400000<br />
Loading: #################################################################<br />
#################################################################<br />
#################################################################<br />
#################################################################<br />
#################################################################<br />
#################################################################<br />
#################################################################<br />
#################################################################<br />
#################################################################<br />
#################################################################<br />
#################################################################<br />
#################################################################<br />
#################################################################<br />
#################################################################<br />
#################################################################<br />
#################################################################<br />
#################################################################<br />
#################################################################<br />
#################################################################<br />
############################<br />
done<br />
Bytes transferred = 6465909 (62a975 hex)<br />
Marvell&gt;&gt; nand erase 0x500000 0x1fb00000</p>
<p>NAND erase: device 0 offset 0x500000, size 0x1fb00000<br />
Skipping bad block at  0x17920000<br />
Skipping bad block at  0x19e60000<br />
Erasing at 0x1ffe0000 -- 100% complete.<br />
OK<br />
Marvell&gt;&gt; nand write.e 0x6400000 0x500000 0x700000</p>
<p>NAND write: device 0 offset 0x500000, size 0x700000</p>
<p></code></p>
<p>&nbsp;</p>
<p><code>Writing data at 0xbff800 -- 100% complete.<br />
7340032 bytes written: OK<br />
Marvell&gt;&gt; setenv bootargs_debian 'console=ttyS0,115200 root=/dev/guruplug/root'<br />
Marvell&gt;&gt; setenv bootcmd_nand 'nand start; nand read.e 0x00800000 0x100000 0x400000; nand read.e 0x01100000 0x500000 0x700000'<br />
Marvell&gt;&gt; setenv bootcmd 'setenv bootargs $(bootargs_debian); run bootcmd_nand; bootm 0x00800000 0x01100000'<br />
Marvell&gt;&gt; saveenv<br />
Saving Environment to NAND...<br />
Erasing Nand...Writing to Nand... done<br />
Marvell&gt;&gt;<br />
</code></p>
<p>Now Debian does start the boot process but I see this:</p>
<p><code><br />
[    1.998201] hub 1-0:1.0: 1 port detected<br />
Begin: Loading essential drivers ... done.<br />
Begin: Running /scripts/init-premount ... done.<br />
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... [    2.077782] device-mapper: uevent: version 1.0.3<br />
[    2.084521] device-mapper: ioctl: 4.15.0-ioctl (2009-04-01) initialised: dm-devel@redhat.com<br />
Volume group "guruplug" not found<br />
Skipping volume group guruplug<br />
Unable to find LVM volume guruplug/swap_1<br />
done.<br />
Begin: Waiting for root file system ... [    2.316249] usb 1-1: new high speed USB device using orion-ehci and address 2<br />
[    2.467658] usb 1-1: New USB device found, idVendor=05e3, idProduct=0608<br />
[    2.474392] usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0<br />
[    2.481574] usb 1-1: Product: USB2.0 Hub<br />
[    2.486833] usb 1-1: configuration #1 chosen from 1 choice<br />
[    2.495535] hub 1-1:1.0: USB hub found<br />
[    2.499665] hub 1-1:1.0: 4 ports detected<br />
[    2.776575] usb 1-1.1: new high speed USB device using orion-ehci and address 3<br />
[    2.908157] usb 1-1.1: New USB device found, idVendor=05e3, idProduct=0726<br />
[    2.915067] usb 1-1.1: New USB device strings: Mfr=0, Product=1, SerialNumber=2<br />
[    2.922428] usb 1-1.1: Product: USB Storage<br />
[    2.926663] usb 1-1.1: SerialNumber: 000000009909<br />
[    2.932740] usb 1-1.1: configuration #1 chosen from 1 choice<br />
[    3.023159] SCSI subsystem initialized<br />
[    3.051611] Initializing USB Mass Storage driver...<br />
[    3.056811] scsi0 : SCSI emulation for USB Mass Storage devices<br />
[    3.063457] usbcore: registered new interface driver usb-storage<br />
[    3.070152] USB Mass Storage support registered.<br />
[    8.087371] scsi 0:0:0:0: Direct-Access     Generic  STORAGE DEVICE   9909 PQ: 0 ANSI: 0<br />
[    8.096094] scsi 0:0:0:1: Direct-Access     Generic  STORAGE DEVICE   9909 PQ: 0 ANSI: 0<br />
[    8.143441] sd 0:0:0:0: [sda] Attached SCSI removable disk<br />
[    8.149561] sd 0:0:0:1: [sdb] 15661056 512-byte logical blocks: (8.01 GB/7.46 GiB)<br />
[    8.157925] sd 0:0:0:1: [sdb] Write Protect is off<br />
[    8.162745] sd 0:0:0:1: [sdb] Assuming drive cache: write through<br />
[    8.171549] sd 0:0:0:1: [sdb] Assuming drive cache: write through<br />
[    8.177695]  sdb: sdb1 sdb2 &lt; sdb5 &gt;<br />
[    8.187177] sd 0:0:0:1: [sdb] Assuming drive cache: write through<br />
[    8.193308] sd 0:0:0:1: [sdb] Attached SCSI removable disk<br />
done.<br />
Gave up waiting for root device.  Common problems:<br />
- Boot args (cat /proc/cmdline)<br />
- Check rootdelay= (did the system wait long enough?)<br />
- Check root= (did the system wait for the right device?)<br />
- Missing modules (cat /proc/modules; ls /dev)<br />
ALERT!  /dev/guruplug/root does not exist.  Dropping to a shell!</code></p>
<p><code>BusyBox v1.17.1 (Debian 1:1.17.1-8) built-in shell (ash)<br />
Enter 'help' for a list of built-in commands.</code></p>
<p><code> </code></p>
<p><code>/bin/sh: can't access tty; job control turned off<br />
(initramfs)<br />
</code></p>
<p>It seems the device mapper is not being started at the right time, and hence the root partition can not be found.</p>
<p>I tried to extend the rootdelay. That changes the error slightly but it seems the real problem is the device mapper is started too early or the lvm commands are not used again to enable swap/root partitions to be seen.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><code>Marvell&gt; setenv bootargs_debian 'console=ttyS0,115200 root=/dev/guruplug/root rootdelay=10'<br />
Marvell&gt; saveenv<br />
Saving Environment to NAND...<br />
Erasing Nand...Writing to Nand... done<br />
Marvell&gt;&gt;<br />
</code><br />
However, that still doesn&#8217;t seem to help.</p>
<p><code><br />
...<br />
[   29.596839] sd 0:0:0:0: [sda] Attached SCSI removable disk<br />
[   29.602959] sd 0:0:0:1: [sdb] 15661056 512-byte logical blocks: (8.01 GB/7.46 GiB)<br />
[   29.611323] sd 0:0:0:1: [sdb] Write Protect is off<br />
[   29.616150] sd 0:0:0:1: [sdb] Assuming drive cache: write through<br />
[   29.624947] sd 0:0:0:1: [sdb] Assuming drive cache: write through<br />
[   29.631091]  sdb: sdb1 sdb2 &lt; sdb5 &gt;<br />
[   29.640449] sd 0:0:0:1: [sdb] Assuming drive cache: write through<br />
[   29.646601] sd 0:0:0:1: [sdb] Attached SCSI removable disk<br />
Begin: Loading essential drivers ... done.<br />
Begin: Running /scripts/init-premount ... done.<br />
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... [   33.555674] device-mapper: uevent: version 1.0.3<br />
[   33.562475] device-mapper: ioctl: 4.15.0-ioctl (2009-04-01) initialised: dm-devel@redhat.com<br />
done.<br />
Begin: Waiting for root file system ... done.<br />
Gave up waiting for root device.  Common problems:<br />
- Boot args (cat /proc/cmdline)<br />
- Check rootdelay= (did the system wait long enough?)<br />
- Check root= (did the system wait for the right device?)<br />
- Missing modules (cat /proc/modules; ls /dev)<br />
ALERT!  /dev/guruplug/root does not exist.  Dropping to a shell!</code></p>
<p><code>BusyBox v1.17.1 (Debian 1:1.17.1-8) built-in shell (ash)<br />
Enter 'help' for a list of built-in commands.</code></p>
<p><code> </code></p>
<p>&nbsp;</p>
<p><code>/bin/sh: can't access tty; job control turned off<br />
(initramfs)<br />
</code></p>
<p>So if anyone has any ideas, I&#8217;d be delighted to hear from you.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wl0.org/2011/06/getting-started-with-guruplug-plus-almost/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Thoughts about extlookup() in puppet</title>
		<link>http://blog.wl0.org/2011/05/thoughts-about-extlookup-in-puppet/</link>
		<comments>http://blog.wl0.org/2011/05/thoughts-about-extlookup-in-puppet/#comments</comments>
		<pubDate>Wed, 11 May 2011 22:10:46 +0000</pubDate>
		<dc:creator>Simon J Mudd</dc:creator>
				<category><![CDATA[Other Things]]></category>
		<category><![CDATA[2.6]]></category>
		<category><![CDATA[extending]]></category>
		<category><![CDATA[extlookup]]></category>
		<category><![CDATA[puppet]]></category>

		<guid isPermaLink="false">http://blog.wl0.org/?p=452</guid>
		<description><![CDATA[To manage some of the database servers I look after I use puppet. I&#8217;ve recently been trying to clean up quite an extensive set of puppet recipes I&#8217;d written. A suggestion that has been made was to remove the data from the recipes and a pointer was made to the new extlookup functionality. That is [...]]]></description>
			<content:encoded><![CDATA[<p>To manage some of the database servers I look after I use <a title="Puppet" href="http://www.puppetlabs.com/puppet/introduction/" target="_blank">puppet</a>.</p>
<p>I&#8217;ve recently been trying to clean up quite an extensive set of puppet recipes I&#8217;d written.  A suggestion that has been made was to remove the data from the recipes and a pointer was made to the new <a title="extlookup() function" href="http://docs.puppetlabs.com/references/2.6.8/function.html#extlookup" target="_blank">extlookup</a> functionality.  That is keep data and code separate and make it easier to modify the behaviour without having to modify the code itself.</p>
<p>In my case I manage a few sets of database servers. Similar groups of boxes are configured the same way. One specific function I was looking at to improve was this snippet.</p>
<p><code>case $domain {<br />
'dom1.example.com': { s_db::master_vif::check { 'master vif': interface =&gt; 'eth0:123', ip_address =&gt; '10.1.xxx.yyy' } }<br />
'dom2.example.com': { s_db::master_vif::check { 'master vif': interface =&gt; 'eth0:456', ip_address =&gt; '10.2.xxx.yyy' } }<br />
}</code></p>
<p>The intention here being that on the primary master the interface would be enabled and on the standby master the interface would NOT be enabled.</p>
<p>Note: this snippet applies to a pair of boxes but there are several other pairs to configure in the same way, each with their own specific settings.</p>
<p>The extlookup() functionality only allows a single &#8220;lookup value&#8221; to be searched and implicitly rather than explicitly where to look for this value. The snippet above has 2 &#8220;parameters&#8221; and if I have several pairs of boxes: MDB_A, MDB_B, MDB_C (the name is not part of the domain or the hostname) then using the extlookup() functionality I&#8217;m going to have to setup a lot of data files and this looks unwieldy, especially as I have other resources defined which take several parameters.</p>
<p>So I thought about how I would do this to make the lookup facility more generic and visible.</p>
<p>What seems better to me would be something which is a bit more generic and based on looking up a &lt; &#8220;config_item&#8221;, &#8220;lookup_value&#8221; &gt; pair in a single location to get a single value as now.  That would make the extlookup() prototype probably change to something like:</p>
<p>extlookup( &#8220;config_item&#8221;, [ list of variables to use ] , &#8220;default_value&#8221;, [ lookup "tables/csv files" ] )</p>
<p>parameters being:<br />
[1] config_item ( grouping of values to lookup )<br />
[2] array of values to apply the lookup on, done in order as now but more explicitly shown<br />
[3] default value<br />
[4] explict array of locations of the data files.</p>
<p>The .csv files would have 3 columns: config_item,lookup_value,result_value</p>
<p>Using something like this I can then simplify the snippet above to:</p>
<p><code>$interface_name = extlookup( 'MDB_A-vif-interface',  [ $hostname, $domain ], '', [ 'dba_config' ] )<br />
$ip_address =     extlookup( 'MDB_A-vif-ip-address', [ $hostname, $domain ], '', [ 'dba_config' ] )</code></p>
<p><code> </code></p>
<p><code>s_db::master_vif::check { 'master vif': interface  =&gt; $interface_name, ip_address =&gt; $ip_address } }</code></p>
<p>This is clearer as the configuration is more explicit then the current extlookup() definition.</p>
<p>If performance of having a large number of entries in a single file were a concern then talking to a DB backend and doing something like the following would work:</p>
<p><code>SELECT lookup_value FROM some_table WHERE config_item = ? AND lookup_key = ?<br />
</code></p>
<p>Also while in this example above I can use $hostname or $domain as a retrieval key in several other boxes I probably can&#8217;t but might need to lookup on another value such as server_type or db_name.<br />
Having the explicit [ .... ] list where I can add any string I want to be looked up give more flexibility and is clearer.</p>
<p>Using the current (puppet 2.6) mechanism would require me, if I understand it correctly, to configure different<br />
.csv files to be searched for each &#8220;configuration parameter&#8221;.  I may also need in several places to override the $extlookup_precedence. In any case this can&#8217;t be overridden several times within the same module which is what I would need if I want to lookup different variables.</p>
<p>That doesn&#8217;t strike me as being very useful.  It&#8217;s also unclear from the current extlookup() call itself where the data is being retrieved from. Using these external variables seems to me to make the calls behave like magic.</p>
<p>So my question was to ask how others who are using the extlookup() functionality how they cope with more complex settings than the system settings which depend on say $hostname or $domain etc. and whether my proposed extension makes any sense.</p>
<p>Thanks for your thoughts.</p>
<p>2011-05-12, update</p>
<p>Another snippet of something I&#8217;d like to do which seems easier to fulful using my proposed extlookup() setup.</p>
<p><code>$notifications_1 = 'address11@example.com'<br />
$notifications_2 = 'address2@example.com'<br />
$notifications_3 = 'address3@example.com'</code></p>
<p><code> </code></p>
<p><code>case $hostname {<br />
'host01':  { $email = $notifications_1 }<br />
'host02': { $email = $notifications_2 }<br />
default:   { $email = $notifications_3 }<br />
}<br />
</code></p>
<p>This would seem more naturally expressed as:</p>
<p><code>$email = extlookup( 'notification_email', [ $hostname ], $notifications_3 )<br />
</code></p>
<p>or perhaps the following if you want to only check for boxes in your domain.</p>
<p><code>$email = extlookup( 'notification_email', [ $hostname, $domain ] )<br />
</code></p>
<p>but most importantly with a <span style="text-decoration: underline;">single data file</span> containing:<br />
<code>notification_email,host01,address1@example.com<br />
notification_email,host02,address2@example.com<br />
notification_email,example.com,default_email@example.com</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wl0.org/2011/05/thoughts-about-extlookup-in-puppet/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to start mysqld using numactl</title>
		<link>http://blog.wl0.org/2011/03/how-to-start-mysqld-using-numactl/</link>
		<comments>http://blog.wl0.org/2011/03/how-to-start-mysqld-using-numactl/#comments</comments>
		<pubDate>Tue, 15 Mar 2011 08:30:17 +0000</pubDate>
		<dc:creator>Simon J Mudd</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[my.cnf]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[numactl]]></category>
		<category><![CDATA[swapping]]></category>

		<guid isPermaLink="false">http://blog.wl0.org/?p=440</guid>
		<description><![CDATA[Various people have complained about Linux swapping unexpectedly on boxes running mysqld, when apparently mysqld was not using all the memory and there was quite a bit of free memory available. There&#8217;s also an article by Jeremy Cole. However, his solution requires a one-line change to mysqld_safe which while it&#8217;s small does not work very [...]]]></description>
			<content:encoded><![CDATA[<p>Various people have complained about Linux swapping unexpectedly on boxes running mysqld, when apparently mysqld was not using all the memory and there was quite a bit of free memory available.</p>
<p>There&#8217;s also <a title="MySQL swap insanity and the NUMA architecture" href="http://jcole.us/blog/archives/2010/09/28/mysql-swap-insanity-and-the-numa-architecture/" target="_blank">an article</a> by Jeremy Cole. However, his solution requires a one-line change to mysqld_safe which while it&#8217;s small does not work very well if you have to maintain a large number of servers and are using packages asa package upgrade will overwrite the modified file mysqld_safe and then restart mysqld with the unmodified script. This leads to the need to repatch the script and then restart mysqld. Not very helpful.</p>
<p>So I was looking for another solution and came up with this option which basically requires a minor change to /etc/my.cnf and the use of a small shell wrapper script.  The change to my.cnf is simply to add the following to the [mysqld_safe] section:</p>
<pre>[mysqld_safe]

... other options you might be using ...

ledir=/directory/containing/mysqld_using_numactl
# wrapper around mysqld
mysqld=mysqld_using_numactl
</pre>
<p>The wrapper script is little more than:</p>
<pre>
#!/bin/sh
# work around to startup mysqld using numactl

numactl=/usr/bin/numactl        # Adjust the path as needed
mysqld=/usr/sbin/mysqld         # Adjust the path as needed

# use exec to avoid having an extra shell around.
exec $numactl --interleave all $mysqld "$@"
</pre>
<p>This minor change means that you can still use the standard mysql scripts and they will work even after an upgrade to a new rpm or other type of package.  So if you&#8217;ve seen your mysql server swapping when you think you have the memory settings correctly adjusted and have been trying to figure out how to easily adjust the configuration to try out numactl to see if this improves things this seems to be an easier way of doing it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wl0.org/2011/03/how-to-start-mysqld-using-numactl/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

