<?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>MrBrown blob &#187; memory</title>
	<atom:link href="http://charles.lescampeurs.org/tag/memory/feed" rel="self" type="application/rss+xml" />
	<link>http://charles.lescampeurs.org</link>
	<description>random bits.</description>
	<lastBuildDate>Sat, 10 Apr 2010 09:02:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Memory usage by group of processes</title>
		<link>http://charles.lescampeurs.org/2009/03/13/memory-usage-by-group-of-processes</link>
		<comments>http://charles.lescampeurs.org/2009/03/13/memory-usage-by-group-of-processes#comments</comments>
		<pubDate>Fri, 13 Mar 2009 14:14:26 +0000</pubDate>
		<dc:creator>CharlyBr</dc:creator>
				<category><![CDATA[Benchmarks]]></category>
		<category><![CDATA[Command line]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://charles.lescampeurs.org/?p=173</guid>
		<description><![CDATA[While monitoring a http/php server, I needed to do some statistics about php-cgi memory usage. Playing with memory_limit in PHP, we wanted to know the average memory usage per php-cgi process. This is easily calculated with our best friend awk. First, get the number of php running processes: # ps aux &#124; grep php-cgi &#124; [...]]]></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%2Fcharles.lescampeurs.org%2F2009%2F03%2F13%2Fmemory-usage-by-group-of-processes"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fcharles.lescampeurs.org%2F2009%2F03%2F13%2Fmemory-usage-by-group-of-processes&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>While monitoring a http/php server, I needed to do some statistics about php-cgi memory usage.</p>
<p>Playing with <em>memory_limit</em> in PHP, we wanted to know the average memory usage per php-cgi process. This is easily calculated with our best friend awk.</p>
<p>First, get the number of php running processes:</p>
<pre># ps aux | grep php-cgi | grep -v grep | wc -l
126</pre>
<p>Then, use awk to calculate the average memory usage for these processes:</p>
<pre># ps aux | grep --exclude=grep php-cgi | grep -v grep | awk 'BEGIN{s=0;}{s=s+$6;}END{print s/126;}'
33987.8</pre>
<p>The number used in the calculation is the field RSS given by ps. The ps manual page says:</p>
<blockquote><p>rss: resident set size, the non-swapped physical memory that a task has used (in kiloBytes)</p></blockquote>
<p>You can also calculate the total memory used by all php-cgi processes:</p>
<pre># ps aux | grep --exclude=grep php-cgi | grep -v grep | awk 'BEGIN{s=0;}{s=s+$6;}END{print s;}'
4302028</pre>
<p>If you need to watch the trend of this average memory usage, a little shell loop does the trick:</p>
<pre># while [ 1 ]; do ps aux | grep --exclude=grep php-cgi | grep -v grep | awk 'BEGIN{s=0;}{s=s+$6;}END{print s/126;}'; sleep 2; done
34401.3
34405.1
34408.4
34409.4
34414.2
34417</pre>
]]></content:encoded>
			<wfw:commentRss>http://charles.lescampeurs.org/2009/03/13/memory-usage-by-group-of-processes/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to know the maximum RAM supported by your server?</title>
		<link>http://charles.lescampeurs.org/2008/08/04/how-to-know-the-maximum-ram-supported-by-your-server</link>
		<comments>http://charles.lescampeurs.org/2008/08/04/how-to-know-the-maximum-ram-supported-by-your-server#comments</comments>
		<pubDate>Mon, 04 Aug 2008 06:42:09 +0000</pubDate>
		<dc:creator>CharlyBr</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dmidecode]]></category>
		<category><![CDATA[memory]]></category>

		<guid isPermaLink="false">http://charles.lescampeurs.org/?p=39</guid>
		<description><![CDATA[The dmidecode command gives you all informations available about your memory. With the special parameter &#8220;-t 16&#8243;, you can see the maximum (physical) memory that your server can have: $ dmidecode -t 16 # dmidecode 2.8 SMBIOS 2.4 present. Handle 0x1000, DMI type 16, 15 bytes Physical Memory Array Location: System Board Or Motherboard Use: [...]]]></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%2Fcharles.lescampeurs.org%2F2008%2F08%2F04%2Fhow-to-know-the-maximum-ram-supported-by-your-server"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fcharles.lescampeurs.org%2F2008%2F08%2F04%2Fhow-to-know-the-maximum-ram-supported-by-your-server&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>The dmidecode command gives you all informations available about your memory.</p>
<p>With the special parameter <em>&#8220;-t 16&#8243;</em>, you can see the maximum (physical) memory that your server can have:</p>
<pre>$ dmidecode -t 16
# dmidecode 2.8
SMBIOS 2.4 present.

Handle 0x1000, DMI type 16, 15 bytes
Physical Memory Array
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: Multi-bit ECC
<strong>Maximum Capacity: 32 GB</strong>
Error Information Handle: Not Provided
Number Of Devices: 8</pre>
<p>Here we can see that your server can handle up to 32Gb</p>
<h2>Check empty memory slots</h2>
<p>To know which slots are used or not use the <i>&#8220;-t 17&#8243;</i> flag.</p>
<pre>dmidecode -t 17 | grep Size
        Size: 2048 MB
        Size: 2048 MB
        Size: No Module Installed
        Size: No Module Installed
        Size: No Module Installed
        Size: No Module Installed
        Size: No Module Installed
        Size: No Module Installed</pre>
<h2>Links</h2>
<ul>
<li><a title="DMI specification" href="http://www.dmtf.org/standards/dmi/" target="_blank">DMI specification</a></li>
<li><a title="SMBIOS specification" href="http://www.dmtf.org/standards/smbios/" target="_blank">SMBIOS specification</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://charles.lescampeurs.org/2008/08/04/how-to-know-the-maximum-ram-supported-by-your-server/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
