<?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>h3x.no &#187; Software</title>
	<atom:link href="http://h3x.no/category/software/feed" rel="self" type="application/rss+xml" />
	<link>http://h3x.no</link>
	<description>Tor Henning Ueland`s thoughts about technology and other stuff</description>
	<lastBuildDate>Sun, 05 Feb 2012 20:24:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Yum on Red Hat 5 hangs when using proxy</title>
		<link>http://h3x.no/2012/02/05/yum-on-red-hat-5-hangs-when-using-proxy</link>
		<comments>http://h3x.no/2012/02/05/yum-on-red-hat-5-hangs-when-using-proxy#comments</comments>
		<pubDate>Sun, 05 Feb 2012 20:24:43 +0000</pubDate>
		<dc:creator>Tor Henning Ueland</dc:creator>
				<category><![CDATA[Red Hat]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[Yum]]></category>

		<guid isPermaLink="false">http://h3x.no/?p=1098</guid>
		<description><![CDATA[I had a machine that started hanging when running yum update on it. And the only way to actually stop yum then was to kill the process from another shell, pretty strange. I noticed that it was trying to look &#8230; <a href="http://h3x.no/2012/02/05/yum-on-red-hat-5-hangs-when-using-proxy">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I had a machine that started hanging when running yum update on it. And the only way to actually stop yum then was to kill the process from another shell, pretty strange.</p>
<p>I noticed that it was trying to look up and old proxy server which was not in use anymore, the machine itself got online without issues on other services but then i realised that the file &#8220;<strong>/etc/sysconfig/rhn/up2date&#8221;</strong> had a entry for yum proxy settings.</p>
<p>It is also worth checking all files in your <strong>&#8220;/etc/yum&#8221;</strong> folder and make sure that none of your repo files have dedicated proxy settings defined since that will override anything from up2date.</p>
<p>When commenting out that proxy setting, yum started behaving again.</p>
]]></content:encoded>
			<wfw:commentRss>http://h3x.no/2012/02/05/yum-on-red-hat-5-hangs-when-using-proxy/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wrong charset for cron</title>
		<link>http://h3x.no/2012/01/28/wrong-charset-for-cron</link>
		<comments>http://h3x.no/2012/01/28/wrong-charset-for-cron#comments</comments>
		<pubDate>Sat, 28 Jan 2012 14:02:41 +0000</pubDate>
		<dc:creator>Tor Henning Ueland</dc:creator>
				<category><![CDATA[Everything else]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[charset]]></category>
		<category><![CDATA[cron]]></category>

		<guid isPermaLink="false">http://h3x.no/?p=1088</guid>
		<description><![CDATA[I got a issue on a export job i had that was running daily on which the charset of the data exported wer wrong, and this did not happen when i ran the job manually. I noticed that Cron used &#8230; <a href="http://h3x.no/2012/01/28/wrong-charset-for-cron">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I got a issue on a export job i had that was running daily on which the charset of the data exported wer wrong, and this did not happen when i ran the job manually. I noticed that Cron used the charset &#8220;POSIX&#8221; instead of en_US.UTF-8 which i used. I fixed this by adding &#8220;<strong>LANG=en_US.UTF-8</strong>&#8221; to the file <strong>/etc/default/locale</strong>.</p>
<p>It appears that when the LANG variable is not set in that file, Cron will fall back to using the POSIX charset.</p>
]]></content:encoded>
			<wfw:commentRss>http://h3x.no/2012/01/28/wrong-charset-for-cron/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Windows 2008 server uptime via the command line</title>
		<link>http://h3x.no/2011/09/12/getting-windows-2008-server-uptime-via-the-command-line</link>
		<comments>http://h3x.no/2011/09/12/getting-windows-2008-server-uptime-via-the-command-line#comments</comments>
		<pubDate>Mon, 12 Sep 2011 14:10:49 +0000</pubDate>
		<dc:creator>Tor Henning Ueland</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[uptime]]></category>

		<guid isPermaLink="false">http://h3x.no/?p=1084</guid>
		<description><![CDATA[A simple one liner to get hold of Windows 2008 server uptime: systeminfo &#124; find &#34;System Boot Time&#34;]]></description>
			<content:encoded><![CDATA[<p>A simple one liner to get hold of Windows 2008 server uptime:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">systeminfo <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #ff0000;">&quot;System Boot Time&quot;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://h3x.no/2011/09/12/getting-windows-2008-server-uptime-via-the-command-line/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The effects of old NIC drivers on Data Protector</title>
		<link>http://h3x.no/2011/09/06/the-effects-of-old-nic-drivers-on-data-protector</link>
		<comments>http://h3x.no/2011/09/06/the-effects-of-old-nic-drivers-on-data-protector#comments</comments>
		<pubDate>Tue, 06 Sep 2011 19:09:19 +0000</pubDate>
		<dc:creator>Tor Henning Ueland</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[data protector]]></category>
		<category><![CDATA[drivers]]></category>
		<category><![CDATA[NIC]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://h3x.no/?p=1074</guid>
		<description><![CDATA[During the Data Protector migration we noticed that the performance on the new Data Protector Cell Manager was a lot lower than the performance on the old solution. Speeds of around 100Mbit was the best we ever could get from &#8230; <a href="http://h3x.no/2011/09/06/the-effects-of-old-nic-drivers-on-data-protector">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>During the Data Protector migration we noticed that the performance on the new Data Protector Cell Manager was a lot lower than the performance on the old solution. Speeds of around 100Mbit was the best we ever could get from it, although the machine is running on a gigabit network.</p>
<p>To make the case even more strange, performance on other network tasks was quite normal where the gigabit  connection was maxed ASAP.</p>
<p>After some digging, the problem turned out to be that the server was running the old default drivers for the NIC (Broadcom BCM5708S netXtreme II GigE). Windows update has in the latest Windows versions become better on delivering driver updates but that was not the case this time.</p>
<p>After installing the newest drivers from Broadcom`s website the performance jumped straight to gigabit even on Data Protector.</p>
]]></content:encoded>
			<wfw:commentRss>http://h3x.no/2011/09/06/the-effects-of-old-nic-drivers-on-data-protector/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dataprotector: System error: HOST_NOT_FOUND</title>
		<link>http://h3x.no/2011/09/05/dataprotector-system-error-host_not_found</link>
		<comments>http://h3x.no/2011/09/05/dataprotector-system-error-host_not_found#comments</comments>
		<pubDate>Mon, 05 Sep 2011 18:55:16 +0000</pubDate>
		<dc:creator>Tor Henning Ueland</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[data protector]]></category>

		<guid isPermaLink="false">http://h3x.no/?p=1076</guid>
		<description><![CDATA[I have been working a bit with migrating a Data Protector cell manager, when moving a client i recieved the following error: &#91;Critical&#93; From: BDA-NET@ &#34; &#91;/boot&#93;&#34; Time: 02.09.2011 09:08:03 Cannot connect to Media Agent on system , port 49708 &#8230; <a href="http://h3x.no/2011/09/05/dataprotector-system-error-host_not_found">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have been working a bit with migrating a Data Protector cell manager, when moving a client i recieved the following error:</p>

<div class="wp_syntax"><div class="code"><pre class="" style="font-family:monospace;"><span class="br0">&#91;</span>Critical<span class="br0">&#93;</span> From: BDA-NET@ &quot; <span class="br0">&#91;</span>/boot<span class="br0">&#93;</span>&quot;  Time: 02.09.2011 09:08:03
Cannot connect to Media Agent on system , port <span style="">49708</span> <span class="br0">&#40;</span>IPC Invalid Hostname or IP Address
System error: HOST_NOT_FOUND<span class="br0">&#41;</span> =&gt;
aborting.</pre></div></div>

<p>The cause for this was that the client could not look up the cell manager. I solved this by simply adding the cell manager in the hosts file of the client. You can verify this problem by simply doing a ping or nslookup against the cell manager, from the client itself.</p>
]]></content:encoded>
			<wfw:commentRss>http://h3x.no/2011/09/05/dataprotector-system-error-host_not_found/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Expanding a kVM disk image</title>
		<link>http://h3x.no/2011/08/14/expanding-a-kvm-disk-image</link>
		<comments>http://h3x.no/2011/08/14/expanding-a-kvm-disk-image#comments</comments>
		<pubDate>Sun, 14 Aug 2011 19:24:31 +0000</pubDate>
		<dc:creator>Tor Henning Ueland</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[disk]]></category>
		<category><![CDATA[kvm]]></category>
		<category><![CDATA[qemu]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://h3x.no/?p=1055</guid>
		<description><![CDATA[Had to expand a KVM virtual machine today. Luckily, that`s pretty straight forward. You simply create a new disk image with the extra size needed, merge it into the original disk and voila. Then you just need to partition in &#8230; <a href="http://h3x.no/2011/08/14/expanding-a-kvm-disk-image">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Had to expand a KVM virtual machine today. Luckily, that`s pretty straight forward. You simply create a new disk image with the extra size needed, merge it into the original disk and voila. Then you just need to partition in the extra space and you are good to go.</p>
<p><strong>How-to:</strong></p>
<p><strong>1: Halt your virtual machine.</strong></p>
<p>You need to stop your virtual machine before going wild with the drive. Virsh stop &lt;vm name&gt;, or virsh destroy &lt;vm name&gt; if it somehow wont stop.</p>
<p><strong>2: Create a disk with the extra space needed:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">qemu-img create <span style="color: #660033;">-f</span> raw 5gig.img 5G</pre></div></div>

<p><strong>3: Merge it into the disk you are working with</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> 5gig.img <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> yourdisk.img</pre></div></div>

<p><strong>4: Boot up and and partition your drive.</strong></p>
<p>Then start up your virtual machine again with virsh start &lt;vm name&gt;. If you use Windows server, all you need to do is to visit disk managent, right click your drive with little free space and choose &#8220;extend partition&#8221;. The job takes seconds and does not require any reboot.</p>
]]></content:encoded>
			<wfw:commentRss>http://h3x.no/2011/08/14/expanding-a-kvm-disk-image/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tuning Ubuntu mdadm RAID5/6</title>
		<link>http://h3x.no/2011/07/09/tuning-ubuntu-mdadm-raid56</link>
		<comments>http://h3x.no/2011/07/09/tuning-ubuntu-mdadm-raid56#comments</comments>
		<pubDate>Sat, 09 Jul 2011 19:59:58 +0000</pubDate>
		<dc:creator>Tor Henning Ueland</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[mdadm]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[raid]]></category>
		<category><![CDATA[raid5]]></category>
		<category><![CDATA[raid6]]></category>
		<category><![CDATA[tuning]]></category>

		<guid isPermaLink="false">http://h3x.no/?p=1038</guid>
		<description><![CDATA[If you are using mdadm RAID 5 or 6 with Ubuntu, you might notice that the performance is not all uber all the time. Reason for this is that the default tuning settings for Ubuntu is set to rather motdest &#8230; <a href="http://h3x.no/2011/07/09/tuning-ubuntu-mdadm-raid56">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you are using mdadm RAID 5 or 6 with Ubuntu, you might notice that the performance is not all uber all the time. Reason for this is that the default tuning settings for Ubuntu is set to rather motdest values. These can lucikly easily be tuned. I will in this article increase some settings until my read and write performance against my RAID 6 has been improved a lot.</p>
<p><strong>My setup:</strong><br />
CPU: Intel(R) Core(TM)2 Quad  CPU   Q9300<br />
RAM: 16G<br />
Drives: 11 drives in one RAID6 with drives split over two cheap PCI-E x4 controllers and the motherboard`s internal controller.</p>
<p>I will test my system between each tuning by using dd for read and write testing. Since i have a nice amount of RAM available, i will use a test file of 36G. (bs=16k) Between each test (both read and write), i clear the OS disk cache with the command:</p>

<div class="wp_syntax"><div class="code"><pre class="" style="font-family:monospace;">sync;echo <span style="">3</span> &gt; /proc/sys/vm/drop_caches</pre></div></div>

<h2><strong>Tuning stripe_cache_size </strong></h2>
<p><strong></strong>stripe_cache_size affects RAM used by mdadm to <strong>writing of data</strong>. Ubuntu`s default value is 256, you can verify your value by doing:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>block<span style="color: #000000; font-weight: bold;">/</span>md0<span style="color: #000000; font-weight: bold;">/</span>md<span style="color: #000000; font-weight: bold;">/</span>stripe_cache_size</pre></div></div>

<p>And changing it with:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #000000; font-weight: bold;">*</span>number<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>block<span style="color: #000000; font-weight: bold;">/</span>md0<span style="color: #000000; font-weight: bold;">/</span>md<span style="color: #000000; font-weight: bold;">/</span>stripe_cache_size</pre></div></div>

<p><strong>Test results with stripe_cache_size=256</strong><br />
- Write performance: 174 MB/s</p>
<p>Not to good, i therefore increased it some levels, each level with result is described below:</p>
<p><strong>Test results with stripe_cache_size=512</strong><br />
- Write performance: 212 MB/s</p>
<p><strong>Test results with stripe_cache_size=1024</strong><br />
- Write performance: 237 MB/s</p>
<p><strong>Test results with stripe_cache_size=2048</strong><br />
- Write performance: 254 MB/s</p>
<p><strong>Test results with stripe_cache_size=4096</strong><br />
- Write performance: 295 MB/s</p>
<p><strong>Test results with stripe_cache_size=8192</strong><br />
- Write performance: 362 MB/s</p>
<p><strong>Test results with stripe_cache_size=16384</strong><br />
- Write performance: 293 MB/s</p>
<p><strong>Test results with stripe_cache_size=32768</strong><br />
- Write performance: 326 MB/s</p>
<p>So, going from 256 to 32K ~doubled my write performance, not bad! <img src='http://h3x.no/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>Tuning Read Ahead</h2>
<p>Time to change a bit on read ahead, which should impact <strong>read performance</strong>. Default read ahead value is &#8220;1536&#8243;, and you can change it with the command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">blockdev <span style="color: #660033;">--setra</span> <span style="color: #000000; font-weight: bold;">*</span>number<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>md0</pre></div></div>

<p><strong>Test results with Read Ahead @ 1536</strong><br />
- Read performance: 717 MB/s</p>
<p><strong>Test results with Read Ahead @ 4096</strong><br />
- Read performance: 746 MB/s</p>
<p><strong>Test results with Read Ahead @ 32768</strong><br />
- Read performance: 731 MB/s</p>
<p><strong>Test results with Read Ahead @ 262144</strong><br />
- Read performance: 697 MB/s</p>
<p><strong>Test results with Read Ahead @ 524288</strong><br />
- Read performance: 630 MB/s</p>
<p>So oposite of the write performance tuning, this actually became worse for most of the settings. So 4096 is the best for my system.</p>
<h1>In conclution</h1>
<p>This is just an example on how different settings can have rather large impact on a system, both for the better and for the worse. If you are going to tune your system you have to test different setting for yourself and see what works best for your setup.  Higher values does not automaticly mean better results. I ended up with &#8220;stripe_cache_size=8192&#8243; and &#8220;Read Ahead @ 4096&#8243; for my system.</p>
<p>If you want to make sure that your changes is saved when rebooting the system, remember to add these commands (with your values) in /etc/rc.local.</p>
]]></content:encoded>
			<wfw:commentRss>http://h3x.no/2011/07/09/tuning-ubuntu-mdadm-raid56/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>WordPress giving maintenance error message</title>
		<link>http://h3x.no/2011/06/04/wordpress-giving-maintenance-error-message</link>
		<comments>http://h3x.no/2011/06/04/wordpress-giving-maintenance-error-message#comments</comments>
		<pubDate>Sat, 04 Jun 2011 21:25:05 +0000</pubDate>
		<dc:creator>Tor Henning Ueland</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://h3x.no/?p=1022</guid>
		<description><![CDATA[If you have tried to upgrade a WordPress plugin or WordPress itself, and failed. You might have ended up with your blog only returning &#8220;Briefly unavailable for scheduled maintenance. Check back in a minute.&#8221; error message. The reason for this &#8230; <a href="http://h3x.no/2011/06/04/wordpress-giving-maintenance-error-message">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you have tried to upgrade a WordPress plugin or WordPress itself, and failed. You might have ended up with your blog only returning &#8220;Briefly unavailable for scheduled maintenance. Check back in a minute.&#8221; error message. The reason for this is that WordPress takes the blog down before running any upgrades, so the users wont get any nasty error messages. But in some rare cases, WordPress cant seem to turn itself back on afterwards.</p>
<p>The solution is to delete the file &#8220;.maintenance&#8221; in your WWW-folder/website root folder. Your blog will then again begin to work as it should.</p>
]]></content:encoded>
			<wfw:commentRss>http://h3x.no/2011/06/04/wordpress-giving-maintenance-error-message/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change hostname on Linode VPS</title>
		<link>http://h3x.no/2011/05/14/change-hostname-on-linode-vps</link>
		<comments>http://h3x.no/2011/05/14/change-hostname-on-linode-vps#comments</comments>
		<pubDate>Sat, 14 May 2011 20:35:19 +0000</pubDate>
		<dc:creator>Tor Henning Ueland</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[dhcp]]></category>
		<category><![CDATA[hostname]]></category>
		<category><![CDATA[linode]]></category>

		<guid isPermaLink="false">http://h3x.no/?p=1017</guid>
		<description><![CDATA[Linode explains pretty well how to change the hostname of your VPS. But they do not mention that in the latest Ubuntu it is set via Linode`s own DHCP server. So even if you set it via /etc/hostname and in &#8230; <a href="http://h3x.no/2011/05/14/change-hostname-on-linode-vps">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Linode explains pretty well <a href="http://library.linode.com/using-linux/administration-basics#sph_set-the-hostname">how to change the hostname</a> of your VPS. But they do not mention that in the latest Ubuntu it is set via Linode`s own DHCP server. So even if you set it via /etc/hostname and in hosts, it will still be overwritten by Linode`s own hostname given to your server.</p>
<p>The solution is to kindly thell DHCPCD to *not* override the hostname you have set, open /etc/default/dhcpcd and alter the following:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">SET_HOSTNAME</span>=<span style="color: #ff0000;">'yes'</span></pre></td></tr></table></div>

<p>to</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">SET_HOSTNAME</span>=<span style="color: #ff0000;">'no'</span></pre></td></tr></table></div>

<p>Reboot and voila! <img src='http://h3x.no/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://h3x.no/2011/05/14/change-hostname-on-linode-vps/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Guide: Solr performance tuning</title>
		<link>http://h3x.no/2011/05/10/guide-solr-performance-tuning</link>
		<comments>http://h3x.no/2011/05/10/guide-solr-performance-tuning#comments</comments>
		<pubDate>Tue, 10 May 2011 18:48:16 +0000</pubDate>
		<dc:creator>Tor Henning Ueland</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[Solr]]></category>
		<category><![CDATA[tuning]]></category>

		<guid isPermaLink="false">http://h3x.no/?p=966</guid>
		<description><![CDATA[Introduction I have for the last year been working a lot with the Solr search engine, and figuring out how to get the best performance from a Solr instance.  And it is almost funny how much impact the little things &#8230; <a href="http://h3x.no/2011/05/10/guide-solr-performance-tuning">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>I have for the last year been working a lot with the Solr search engine, and figuring out how to get the best performance from a Solr instance.  And it is almost funny how much impact the little things have on search performance. I have in this article described the points i have noticed myself that can be worked with in order to get just a little more juice out of Solr. (If you are working on tuning Solr yourself, remember to also <a href="http://wiki.apache.org/solr/SolrPerformanceFactors">look at the Solr Wiki</a> for some extra hints)</p>
<p>&nbsp;</p>
<h2>Test data</h2>
<p>For this article, i will be using the Wikipedia database as test content. I have downloaded a version from Wikimedia that only contain the current version of all english articles. ( <a href="http://download.wikimedia.org/enwiki/20100130/enwiki-20100130-pages-articles.xml.bz2 ">download link</a>)</p>
<p>I have generated XML-documents out of 633654 pages, to get a descent amount of test data. (This has given me a Solr index of 6.7 GB)  And then collected 25000 random words from those pages which i will use to run tests on. I will run the searches 5 times each, reaching to a total of 125 000 search queries against Solr. Solr will be restarted before each test to ensure correct cache levels (etc) for each test. When tests are performed on the same disk device, the OS disk cache is cleared from RAM in order to get a correct test each time. (sync;echo 3 &gt; /proc/sys/vm/drop_caches)</p>
<p>The search queries will be simple search terms without any wildcards etc, since i will discuss this and usage of ngrams in Solr more in detail in a later article.</p>
<h2>My test server</h2>
<p>My test server is a Ubuntu Linux machine running with a single SATA drive for OS, and a RAID6 spanning over 11 SATA disks. The server started out with a single dual core FX-62 AMD processor with 8 GB of RAM, this was later replaced with a quad core Q9300 CPU with 16 GB of RAM.  Changes in the hardware is described in the hardware chapter, to give you a focus on how solr actually responds on relative small hardware changes.</p>
<h2>My schema.xml</h2>
<p>The test schema uses all the default field types, and had the following data fields.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;">             <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fields<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>   
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;field</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;id&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;string&quot;</span> <span style="color: #000066;">indexed</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">stored</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">required</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;field</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;title&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">indexed</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">stored</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">multiValued</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;field</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">indexed</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">stored</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">multiValued</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;field</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;text_rev&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text_rev&quot;</span> <span style="color: #000066;">indexed</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">stored</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000066;">multiValued</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
             <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fields<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<h2>Tuning part one: Hardware</h2>
<p><strong>Starting out</strong><br />
I started solr on a single drive at first, without tweaking anything. The time taken to run all the queries was 168m43.705s. A quick calculation gives 12 queries per second for that.  I suspect that it is possible to speed up that a lot. So lets try to move our solr instance over to our RAID setup.</p>
<p><strong>RAID performance</strong><br />
I moved the Solr instance over to the RAID set and performed the same test again. And this actually caused a performance gain of just over 100%.  The whole test now did not take more than 82m51.199s, which equals no less than 25 queries per second. But no need to stop here, time to try some hardware upgrade before turning to software tweaking.</p>
<p><strong>Time for more juice!</strong><br />
Time to try a last change in the hardware. I replaced the dual core AMD CPU and its 8GB of RAM with a quad core Intel CPU with 16GB of RAM.  This time the test did not take more than 20m41.202s, a massive improvement from the first 168 minutes.  And we have actually now reached 100 queries per second, and that is even before tuning Solr itself.</p>
<h2>Tuning part two: Tuning the solr cache (in solrconfig.xml)</h2>
<p>I have now tuned as much as i have the posibility to do with the hardware i have available, so the next step is to look to our solrconfig.xml, which has not been touched yet. I will focus on the caches that you can track via the statistics page of solr admin (http://solrserver:8983/solr/admin/stats.jsp#cache).  The different cache elements there will have information about its size, elements inserted and elements removed in order to make room for new elements. If you have many evictions you should look into increasing that cache module so all elements can fit (but dont overdo it, adjust it and see what fits for your setup). It is likewise also a idea to decrease the size of some of them if they have a lot of unused slots.  A goal should be to get the hit rate as close to 1.00 as possible (1.00 beeing 100% hit ratio)</p>
<p>For my setup with simple search queries and no usage of filters, i only have two cache modules that i need to adjust, that is queryResultCache and documentCache.</p>
<p><strong>queryResultCache<br />
</strong>The queryResultCache is used to store ordered sets of document IDs. After running the test suite it noticed that the number of evictions already reached several thousands. So i start by adjusting it to 122880 (both size and initalSize), quite an increase from the default 512.  This cache does not have many lookups compared to inserts, but it still caused the test suite to go down to 17m17.550s. (120 queries per second)</p>
<p><strong>documentCache</strong><br />
The document cache has had over 2800000 cache inserts, with a default of only 512 slots, that wont do for long. So i increased this from 512 to 2900000. This caused the test suite to go down a bit more to 16m15.414s (128 queries per second)</p>
<p><strong>Other</strong><br />
Solr does have a couple of other cache settings too you can tweak, but these are dependet on your setup and solr usage. See <a href="http://wiki.apache.org/solr/SolrCaching#">http://wiki.apache.org/solr/SolrCaching#</a> for more information.</p>
<p><span style="color: #000000; font-size: 23px; line-height: 35px;">Tuning part three: Java parameters</span><br />
There is a lot of settings which you can tune for optimizing java, i will not go in dept on them here. But i would like to point out that one of the most important parameters to tweak is how much memory Java can use. If you use to little then Java have to work hard making sure it has enoug memory to use, while too much again causes Java to hog memory that could rather be used for disk caching.</p>
<p>I have done a couple of tests to display how different memory settings will affect the search suite i have:</p>
<p><strong>&#8220;-Xmx14336m -Xms4096m&#8221; (14G/4G)</strong><br />
My test suite was down to 16 minutes, after giving Java too much memory the test went up to 26m50.914s. I suspect the reason for this beeing that Java hogged so much memory that the OS could no longer keep the index data in cache, causing more disk access.</p>
<p><strong>&#8220;-Xmx2048m -Xms512m&#8221;(2G/512M)</strong><br />
I aborted the test after running for a staggering 1331m33.322s. I suspect that after the test had ran for a while, java/Solr had to use soo much resources on keeping enough memory available that it eventually died/hanged.</p>
<p><strong>Skipping memory settings</strong><br />
I then tried to let Solr run without any limitation to memory (aka let Java decide for itself at startup, based on memory available on the machine)<br />
This caused it to use around 4G of RAM after running for a while, quite a bit more than it had to spend in the previous test. This did of course do wonders for the response from Solr, sending it back to 16m26.850s.</p>
<p>In order to keep a bit control over your server, i suggest running without a limit first, then set a limit when you have had Solr running for a while and can see for yourself how much Solr wants to use.</p>
<h2>Tuning part four: Tuning the search queries</h2>
<p>If you have a schema with multiple fields which you can filter when doing queries, then use them! (With the help of the filterquery(fq) parameter) If solr has the possibility to remove X % of the documents before searching the remaining documents, you can risk a pretty good performance boost for those queries.</p>
<h2>In conclution:</h2>
<p><strong>The numbers</strong><br />
Running test suite against default solr instance on single drive with 8G RAM and 2 cores: <strong>168m43.705s</strong><br />
Running test suite against default solr instance on RAID6 with 8G RAM and 2 cores:  <strong>82m51.199s</strong><br />
Running test suite against default solr instance on RAID6 with 16G RAM and 4 cores: <strong>20m41.202s</strong><br />
Running test suite with tuned solr cache on the same hardware:<strong> 16m15.414s</strong></p>
<p><strong>And finally<br />
</strong>As you can see it is rather easy to get either a very bad performance or a very good performance from Solr, it all depends on your setup and what your needs are. You have to analyze and test to see what setup is the best for your needs, since there are no simple answers that fits every need.</p>
<p>Hardware will give you a lot of the needed performance, but if you have reconfigured something wrong, all the hardware in the world wont help. (It wont help with 32G of RAM on a 4GB index and when Solr only can use 512MB&#8230;)</p>
]]></content:encoded>
			<wfw:commentRss>http://h3x.no/2011/05/10/guide-solr-performance-tuning/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

