<?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>UNIXy &#187; CPU</title>
	<atom:link href="http://blog.unixy.net/tag/cpu/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.unixy.net</link>
	<description>Fully Managed Dedicated Servers</description>
	<lastBuildDate>Fri, 03 Feb 2012 17:37:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Not all CPU cores are showing up in Linux server /proc/cpuinfo</title>
		<link>http://blog.unixy.net/2011/10/not-all-cpu-cores-are-showing-up-in-linux-server-proccpuinfo/</link>
		<comments>http://blog.unixy.net/2011/10/not-all-cpu-cores-are-showing-up-in-linux-server-proccpuinfo/#comments</comments>
		<pubDate>Tue, 18 Oct 2011 07:53:44 +0000</pubDate>
		<dc:creator>UNIXy</dc:creator>
				<category><![CDATA[Crash Course]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[/proc/cpuinfo]]></category>
		<category><![CDATA[cores]]></category>
		<category><![CDATA[CPU]]></category>
		<category><![CDATA[cpuinfo]]></category>
		<category><![CDATA[hotplug]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://blog.unixy.net/?p=1423</guid>
		<description><![CDATA[The Linux kernel is very smart and can leverage CPU features and instruction sets to bring down power consumption. So one of the logical things to do when power savings are needed is to turn off CPU cores. To confirm that this is indeed what's happening on your system, you could hot-plug these cores and bring them online]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.unixy.net%2F2011%2F10%2Fnot-all-cpu-cores-are-showing-up-in-linux-server-proccpuinfo%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.unixy.net%2F2011%2F10%2Fnot-all-cpu-cores-are-showing-up-in-linux-server-proccpuinfo%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>The <a title="Linux" href="http://www.unixy.net">Linux</a> kernel is very <a title="smart server" href="http://www.unixy.net">smart</a> and can leverage CPU features and instruction sets to bring down power consumption especially on a <a title="server" href="http://www.unixy.net/dedicated-servers">server</a>. So one of the logical things to do when power savings are needed is to turn off CPU cores. To confirm that this is indeed what&#8217;s happening on your system, you could hot-plug these cores and bring them online in this fashion:</p>
<blockquote><p>echo 1 &gt; /sys/devices/system/cpu/cpu4/online<br />
echo 1 &gt; /sys/devices/system/cpu/cpu5/online</p></blockquote>
<p>You can then verify that additional CPU cores have been brought up. You can also take them offline if needed:</p>
<blockquote><p>echo 0 &gt; /sys/devices/system/cpu/cpu4/online<br />
echo 0 &gt; /sys/devices/system/cpu/cpu5/online</p></blockquote>
<p>The above will lead to this message being displayed in /var/log/messages (turned off core # 23):</p>
<blockquote><p>[1132050.457980] CPU 23 is now offline<br />
[1132065.819054] Booting Node 2 Processor 23 APIC 0x2b</p></blockquote>
<p>That&#8217;s all folks!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.unixy.net/2011/10/not-all-cpu-cores-are-showing-up-in-linux-server-proccpuinfo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Know when to upgrade memory, CPU, Disk, or bandwidth!</title>
		<link>http://blog.unixy.net/2009/03/know-when-to-upgrade-memory-cpu-disk-or-bandwidth/</link>
		<comments>http://blog.unixy.net/2009/03/know-when-to-upgrade-memory-cpu-disk-or-bandwidth/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 23:15:15 +0000</pubDate>
		<dc:creator>UNIXy</dc:creator>
				<category><![CDATA[Crash Course]]></category>
		<category><![CDATA[CPU]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[kSar]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[mpstat]]></category>
		<category><![CDATA[SAR]]></category>
		<category><![CDATA[swap]]></category>
		<category><![CDATA[sysstat]]></category>
		<category><![CDATA[top]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[vmstat]]></category>
		<category><![CDATA[VPS]]></category>

		<guid isPermaLink="false">http://blog.unixy.net/?p=5</guid>
		<description><![CDATA[Disclaimer: this post covers Linux only. The installation steps will also only work with Linux Redhat and Debian derivatives. They can be made to work with other Linux and Unix flavors as well. What Is This Post About There are times when one can&#8217;t tell what is it that&#8217;s causing their server (as in VPS [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.unixy.net%2F2009%2F03%2Fknow-when-to-upgrade-memory-cpu-disk-or-bandwidth%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.unixy.net%2F2009%2F03%2Fknow-when-to-upgrade-memory-cpu-disk-or-bandwidth%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><strong>Disclaimer</strong>: this post covers Linux only. The installation steps will also only work with Linux Redhat and Debian derivatives. They can be made to work with other Linux and Unix flavors as well.</p>
<p><strong><span style="text-decoration: underline;">What Is This Post About</span></strong></p>
<p>There are times when one can&#8217;t tell what is it that&#8217;s causing their server (as in VPS or dedicated server) to perform poorly. This post will hopefully help someone make an educated decision on whether to proceed with an upgrade or not. At least, it will help someone find the culprit and act accordingly.</p>
<p><strong><span style="text-decoration: underline;">The Basics First</span></strong></p>
<p>There are mainly four components that can make or break server responsiveness. Those are hard disk, memory, CPU, and bandwidth. It only takes one weak component to cause a server to be unresponsive. Linux provides tools that help visualize and pinpoint the lowest performing component(s). The tools are somewhat analogically similar to a car dashboard. You can tell whether the car is running out of gas or if the engine temperature is higher than usual. etcetera. Ultimately, one can correlate component weakness with server responsiveness.</p>
<p>So, what makes a server sluggish? Is it the lack of memory or the lack of CPU cycles? It could be either, neither, or both. It&#8217;s essential to realize that there are so many jobs a CPU can run before it&#8217;s pegged. Hard disks can only take so many requests before it saturates. As the components are fed more work than they can handle, the system starts queueing jobs. The queuing of jobs is one of the earliest signs of a server that has reached capacity.</p>
<p><strong><span style="text-decoration: underline;">Introducing The Dashboard</span></strong></p>
<p>How do we catch the early signs of a busy server? Unfortunately, and for a non-maintained server, user complaints is one of the earliest signs. There&#8217;s no doubt that we need to be proactive and on the lookout. There&#8217;s the great Top tool but it doesn&#8217;t provide a holistic view of what&#8217;s cooking on the srever. The good news is that there&#8217;s a tool that will do all the mundane work for us, all day long unattended. And from the comfort of your home once a day or once a week, you can go over the collected information.</p>
<p>My favorite tool is SAR, which stands for System Activity Reports. SAR is a collection of programs that run in the background on minimal resources and silently collect vital system data. It collects hard disk, CPU, memory, network information, and much more. While the SAR command line tools are all you need to display the data, there&#8217;s a bit of a learning curve to it. But don&#8217;t be discouraged; there are other ways, besides the command line, to display the data. We&#8217;ll go over an example later on.</p>
<p>So, let&#8217;s get SAR up and running. For those that have skipped the disclaimer, this tutorial deals with Linux Redhat and Debian compatible installs only. Therefore, it may or may not work with all Linux distributions. The following instructions require that you remote into the server. You should have a shell / command line open and ready for your input.</p>
<p><strong><span style="text-decoration: underline;">Installing SAR</span></strong></p>
<p><strong>ON DEBIAN</strong></p>
<p>As root, install the sysstat package by executing the following command as root:</p>
<div style="margin: 5px 20px 20px;">
<div class="smallfont" style="margin-bottom: 2px;">Quote:</div>
<table border="0" cellspacing="0" cellpadding="6" width="100%">
<tbody>
<tr>
<td class="alt2" style="border: 1px inset;">apt-get install sysstat</td>
</tr>
</tbody>
</table>
</div>
<p>Edit the file /etc/default/sysstat and change the line:</p>
<div style="margin: 5px 20px 20px;">
<div class="smallfont" style="margin-bottom: 2px;">Quote:</div>
<table border="0" cellspacing="0" cellpadding="6" width="100%">
<tbody>
<tr>
<td class="alt2" style="border: 1px inset;">ENABLED=&#8221;false&#8221;</td>
</tr>
</tbody>
</table>
</div>
<p>To:</p>
<div style="margin: 5px 20px 20px;">
<div class="smallfont" style="margin-bottom: 2px;">Quote:</div>
<table border="0" cellspacing="0" cellpadding="6" width="100%">
<tbody>
<tr>
<td class="alt2" style="border: 1px inset;">ENABLED=&#8221;true&#8221;</td>
</tr>
</tbody>
</table>
</div>
<p>No action is required on your part if it&#8217;s already set to true. Also, edit the file /etc/sysstat/sysstat and set the variable HISTORY to however many days you want SAR to keep historical data:</p>
<div style="margin: 5px 20px 20px;">
<div class="smallfont" style="margin-bottom: 2px;">Quote:</div>
<table border="0" cellspacing="0" cellpadding="6" width="100%">
<tbody>
<tr>
<td class="alt2" style="border: 1px inset;">HISTORY=7</td>
</tr>
</tbody>
</table>
</div>
<p>To</p>
<div style="margin: 5px 20px 20px;">
<div class="smallfont" style="margin-bottom: 2px;">Quote:</div>
<table border="0" cellspacing="0" cellpadding="6" width="100%">
<tbody>
<tr>
<td class="alt2" style="border: 1px inset;">HISTORY=31</td>
</tr>
</tbody>
</table>
</div>
<p>And last, kick off the process:</p>
<div style="margin: 5px 20px 20px;">
<div class="smallfont" style="margin-bottom: 2px;">Quote:</div>
<table border="0" cellspacing="0" cellpadding="6" width="100%">
<tbody>
<tr>
<td class="alt2" style="border: 1px inset;">/etc/init.d/sysstat restart</td>
</tr>
</tbody>
</table>
</div>
<p><strong>ON REDHAT</strong></p>
<p>Install the sysstat tools</p>
<div style="margin: 5px 20px 20px;">
<div class="smallfont" style="margin-bottom: 2px;">Quote:</div>
<table border="0" cellspacing="0" cellpadding="6" width="100%">
<tbody>
<tr>
<td class="alt2" style="border: 1px inset;">yum install sysstat</td>
</tr>
</tbody>
</table>
</div>
<p>Edit the /etc/sysconfig/sysstat file and change the variable HISTORY as such:</p>
<div style="margin: 5px 20px 20px;">
<div class="smallfont" style="margin-bottom: 2px;">Quote:</div>
<table border="0" cellspacing="0" cellpadding="6" width="100%">
<tbody>
<tr>
<td class="alt2" style="border: 1px inset;">HISTORY=7</td>
</tr>
</tbody>
</table>
</div>
<p>To</p>
<div style="margin: 5px 20px 20px;">
<div class="smallfont" style="margin-bottom: 2px;">Quote:</div>
<table border="0" cellspacing="0" cellpadding="6" width="100%">
<tbody>
<tr>
<td class="alt2" style="border: 1px inset;">History=31</td>
</tr>
</tbody>
</table>
</div>
<p>Then restart sysstat:</p>
<div style="margin: 5px 20px 20px;">
<div class="smallfont" style="margin-bottom: 2px;">Quote:</div>
<table border="0" cellspacing="0" cellpadding="6" width="100%">
<tbody>
<tr>
<td class="alt2" style="border: 1px inset;">service sysstat restart</td>
</tr>
</tbody>
</table>
</div>
<p>That&#8217;s all you have to do on the server side. We&#8217;ll have to let SAR run for a few hours and let it collect data.</p>
<p><strong><span style="text-decoration: underline;">The Fun Part</span></strong></p>
<p>This is the part where we get to see the data in pretty graphs and charts! A tool that goes with the name kSar, and that you can download for free, will itself remote into your server, download the SAR-generated files, and neatly graph them for you. This is the best tool I have found so far. Simply point your browser to <a href="http://sourceforge.net/project/showfiles.php?group_id=179805&amp;package_id=207768&amp;release_id=645912" target="_blank">http://sourceforge.net/project/showf&#8230;ease_id=645912</a> and hit the download link. Unzip the file, and double click on the JAR file. Once the application has launched, select the &#8220;Data&#8221; option in the menu, then &#8220;Launch SSH Command&#8221;. Input your server parameters (Ex: <a href="mailto:root@vpslux.com">root@vpslux.com</a>:22). Finally, select &#8220;Yes&#8221; when prompted for running the command &#8220;sar -A&#8221;. I&#8217;ve attached some screenshots of kSar in action. kSar has a shortcoming, however. It only displays one day worth of data at a time. But you can always save the daily reports as a PDF file and view them at a later date.</p>
<p><strong><span style="text-decoration: underline;">Back To Work!</span></strong></p>
<p>Let&#8217;s make some sense out of those graphs. Of interest are the following panel tabs: <em>CPU all</em>, <em>Swapping</em>, <em>Memory Usage</em>, <em>Load</em>, <em>Processes</em>, <em>Paging Activity</em>, <em>Sockets</em>, and finally <em>Interface traffic</em> under the Interface tab. We can group <em>Swapping</em>, <em>Memory Usage</em>, and <em>Paging Activity</em> together under the same category as they&#8217;re correlated to an extent. <em>CPU all</em>, <em>Sockets</em> and <em>Interface traffic</em> can be regarded as two independent indicators.</p>
<p>About 99% of the time, <em>Sockets</em> and <em>Interface traffic</em> are leading indicators in the sense that the number of open sockets and traffic increases as soon as the node in question sees more traffic as a result of user visits. <em>CPU all</em> shows the amount of CPU used over time. You can ignore short, occasional spikes. But sustained usage of 90% and above for periods of time is usually a sign of pegged CPUs. It&#8217;s most likely time to upgrade the CPUs or dig further into what&#8217;s hogging CPU. <em>Swapping</em> is the next most interesting indicator to look at. Any spikes here are usually a sign of lack of free memory. Let&#8217;s select <em>Memory Usage</em> to confirm. If <em>Memory Usage</em> is anywhere less than roughly 4MB over extended periods of time, then the box is begging for a memory upgrade (in conjunction with <em>Swapping</em> indicator). <em>Paging</em>, and in particular a spike in page faults, can further confirm the lack of memory.</p>
<p>To recap, and in general, interface traffic and therefore number of sockets increase, which leads to resources being consumed in order to serve data. The latter then causes either memory, CPU, or both to spike up, which then might cause swapping (disk I/O). One might suggest improving disk I/O but swapping is only a symptom of the issue. In this scenario, the lack of memory is definitely the root cause of the issue. But keep in mind that there are scenarios when disk I/O spikes up while memory is plenty available on the system. This is an easy case to resolve as most likely a rogue process is hitting the disks more than it should. One last scenario is when CPU, memory, and disk I/O are all almost flat but responsiveness is sluggish. In this case, pay close attention to the Interface traffic and Interface errors graphs for either saturation of your allocated port speed or errors.</p>
<p>That&#8217;s all folks. Feel free to reply back with questions, comments, corrections.<br />
<img class="aligncenter" src="http://www.webhostingtalk.com/attachment.php?attachmentid=14494&amp;d=1237959455" alt="CPU All" /></p>
<p><img class="aligncenter" src="http://www.webhostingtalk.com/attachment.php?attachmentid=14495&amp;d=1237959455I" alt="Disk Usage I/O" /></p>
<p><img class="aligncenter" src="http://www.webhostingtalk.com/attachment.php?attachmentid=14496&amp;d=1237959455" alt="Memory Usage" /></p>
<p><img class="aligncenter" src="http://www.webhostingtalk.com/attachment.php?attachmentid=14497&amp;d=1237959479" alt="Paging Activity" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.unixy.net/2009/03/know-when-to-upgrade-memory-cpu-disk-or-bandwidth/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

