<?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>RedHatVN Network &#187; memory</title>
	<atom:link href="http://redhatvn.net/tag/memory/feed" rel="self" type="application/rss+xml" />
	<link>http://redhatvn.net</link>
	<description>Shared Linux problems</description>
	<lastBuildDate>Tue, 07 Sep 2010 08:08:35 +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>Unable to fork: Cannot allocate memory</title>
		<link>http://redhatvn.net/unable-to-fork-cannot-allocate-memory</link>
		<comments>http://redhatvn.net/unable-to-fork-cannot-allocate-memory#comments</comments>
		<pubDate>Fri, 25 Dec 2009 06:19:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[vps]]></category>
		<category><![CDATA[memory]]></category>

		<guid isPermaLink="false">http://redhatvn.net/?p=992</guid>
		<description><![CDATA[You see a message “Unable to fork: Cannot allocate memory” while logging to a VPS from the host server. The reason is the VPS is running out of resources especially RAM. To temporary solve the issue, you may restart the VPS by executing vzctl restart VEID OR increase RAM for the VPS by increasing privvmpages [...]]]></description>
			<content:encoded><![CDATA[<p>You see a message “<strong>Unable to fork: Cannot allocate memory” </strong>while logging to a VPS from the host server. The reason is the VPS is running out of resources especially RAM. To temporary solve the issue, you may restart the VPS by executing</p>
<p><code>vzctl restart VEID</code></p>
<p>OR increase RAM for the VPS by increasing <span style="color: #ff6600;"><strong>privvmpages and kmemsize</strong></span> for the VPS.</p>
<p>Edit the configuration file of the VPS</p>
<p><code>vi /etc/sysconfig/vz-scripts/veid.conf</code></p>
<p>increase the value of the above two parameters and restart the VPS.</p>
]]></content:encoded>
			<wfw:commentRss>http://redhatvn.net/unable-to-fork-cannot-allocate-memory/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tuning the Apache MaxClients parameter</title>
		<link>http://redhatvn.net/tuning-the-apache-maxclients-parameter</link>
		<comments>http://redhatvn.net/tuning-the-apache-maxclients-parameter#comments</comments>
		<pubDate>Thu, 17 Dec 2009 02:06:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Cpanel]]></category>
		<category><![CDATA[Directadmin]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[vps]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[memory]]></category>

		<guid isPermaLink="false">http://redhatvn.net/?p=888</guid>
		<description><![CDATA[This parameter defines how many simultaneous request can be served. Any connection request from browsers that come in after that will be queued. Apache prefork, StartServers, MaxSpareServers and MinSpareServers In the most common case, you will be using Apache in the prefork mode, meaning one process per connection, with a pool of processes pre-forked to [...]]]></description>
			<content:encoded><![CDATA[<p>This parameter defines how many simultaneous request can be served. Any connection request from browsers that come in after that will be queued.<br />
<span id="more-888"></span></p>
<h2>Apache prefork, StartServers, MaxSpareServers and MinSpareServers</h2>
<p>In the most common case, you will be using Apache in the prefork mode, meaning one process per connection, with a pool of processes pre-forked to standby for connections. The number of spare processes is defined by the values <a href="http://httpd.apache.org/docs/2.0/mod/prefork.html#maxspareservers" target="_blank">MaxSpareServers</a>, <a href="http://httpd.apache.org/docs/2.0/mod/prefork.html#minspareservers" target="_blank">MinSpareServers</a>, while the number to start is defined by <a href="http://httpd.apache.org/docs/2.0/mod/mpm_common.html#startservers" target="_blank">StartServers</a>.</p>
<h2>Maxclients default</h2>
<p>By default, the MaxClients parameter has a compiled in hard limit of 256. This can be changed by recompiling Apache however. Some distributions, or hosting companies raise this limit to a very high value, such as 512 or even 1024 in order to cope with large loads.</p>
<p>While this makes sense when the web server is serving static content (plain HTML, images, &#8230;etc.), it can be detrimental to a dynamic web application like Drupal. So often, we have clients calling because their web server has grind to a halt, and the reason would be a too high MaxClients value.</p>
<h2>A web site&#8217;s nemesis: Excessive Thrashing</h2>
<p>The reason is that if your web site experiences a traffic spike, or if there is a bottleneck in the database, incoming requests cause new processes to be forked at a rate higher than old processes can service the older connections. This causes a condition where the system keeps creating new processes that overflow the available memory and starts to use the swap space. This almost always causes <a href="http://en.wikipedia.org/wiki/Thrash_%28computer_science%29" target="_blank">thrashing</a>, where the system is just swapping pages from physical memory to virtual memory (on disk), and vice versa, without doing any real work. You can detect if thrashing has occurred by using the vmstat command.</p>
<p>A simple calculation for MaxClients on a system that does only Drupal would be:</p>
<blockquote><p>(Total Memory  &#8211; Operating System Memory &#8211; MySQL memory) / Size Per Apache process.</p></blockquote>
<p>If your hosting company configured your server with all sorts of bells and whistles (like mod_perl, mod_python, in addition to mod_php), then Apache can easily be 21 MB per process. If your server has 512MB, then you can fit some 20 Apache processes. If you tune Apache well, and remove all the unneeded modules, and install a <span style="color: #99ccff;">PHP op-code cache/accelerator</span>, then you can make each Apache process take as little as 12 MB. These figures depend on how many modules you have loaded, how big they are, so there is no hard and fast rule. Even if one has 1GB of memory, and leaves 250 MB for the system and MySQL, with an Apache process of 15MB, this means 50 Apache processes can fit in the remaining 750MB.</p>
<p>Remember that you need memory for the operating system, as well as for MySQL. The more you give the system and MySQL memory, the more caching of the file system they do for you and avoid hitting disk, so do not use the very last available memory for MaxClients.</p>
<h2>Tuning the ServerLimit</h2>
<p>On some systems, there is another parameter that  sets an upper limit if MySQL. So for example, if ServerLimit is set by default to 256, and you want to increase MaxClients to 300, you will not be able to do so, until you set ServerLimit to 300 as well. Normally, you would see a warning message from Apache when you restart it to tell you that this needs to be done.</p>
<h2>Conclusion</h2>
<p>If you cannot do a proper calculation, then it is safest to start with a conservative number, e.g. 60 to 150 on a 2GB system, and then increase it as you monitor the usage of the system over a few weeks. By all means, do not keep it at the 512 value that came with your server/distribution until you know how much load you can handle.</p>
]]></content:encoded>
			<wfw:commentRss>http://redhatvn.net/tuning-the-apache-maxclients-parameter/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Choosing MaxClients</title>
		<link>http://redhatvn.net/choosing-maxclients</link>
		<comments>http://redhatvn.net/choosing-maxclients#comments</comments>
		<pubDate>Fri, 04 Dec 2009 01:51:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Cpanel]]></category>
		<category><![CDATA[Directadmin]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[vps]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[memory]]></category>

		<guid isPermaLink="false">http://redhatvn.net/?p=764</guid>
		<description><![CDATA[The MaxClients directive sets the limit on the number of simultaneous requests that can be supported. No more than this number of child server processes will be created. To configure more than 256 clients, you must edit the HARD_SERVER_LIMIT entry in httpd.h and recompile. In our case we want this variable to be as small [...]]]></description>
			<content:encoded><![CDATA[<p>The <code>MaxClients</code> directive sets the limit on the number of simultaneous requests that can be supported.  No more than this number of child server processes will be created.  To configure more than 256 clients, you must edit the <code>HARD_SERVER_LIMIT</code> entry in <code>httpd.h</code> and recompile.  In our case we want this variable to be as small as possible, because in this way we can limit the resources used by the server children.  Since we can restrict each child&#8217;s process size (see <a href="http://perl.apache.org/docs/1.0/guide/performance.html#Preventing_Your_Processes_from_Growing">Preventing Your Processes from Growing</a>), the calculation of <code>MaxClients</code> is pretty straightforward:</p>
<p><span id="more-764"></span></p>
<pre>               Total RAM Dedicated to the Webserver
  MaxClients = ------------------------------------
                     MAX child's process size</pre>
<p>So if I have 400Mb left for the webserver to run with, I can set <code>MaxClients</code> to be of 40 if I know that each child is limited to 10Mb of memory (e.g. with <a href="http://perl.apache.org/docs/1.0/guide/performance.html#Preventing_Your_Processes_from_Growing"><code>Apache::SizeLimit</code></a>).</p>
<p>You will be wondering what will happen to your server if there are more concurrent users than <code>MaxClients</code> at any time.  This situation is signified by the following warning message in the <code>error_log</code>:</p>
<pre>  [Sun Jan 24 12:05:32 1999] [error] server reached MaxClients setting,
  consider raising the MaxClients setting</pre>
<p>There is no problem &#8212; any connection attempts over the <code>MaxClients</code> limit will normally be queued, up to a number based on the <code>ListenBacklog</code> directive.  When a child process is freed at the end of a different request, the connection will be served.</p>
<p>It <strong>is an error</strong> because clients are being put in the queue rather than getting served immediately, despite the fact that they do not get an error response.  The error can be allowed to persist to balance available system resources and response time, but sooner or later you will need to get more RAM so you can start more child processes.  The best approach is to try not to have this condition reached at all, and if you reach it often you should start to worry about it.</p>
<p>It&#8217;s important to understand how much real memory a child occupies. Your children can share memory between them when the OS supports that. You must take action to allow the sharing to happen &#8211; See <a href="http://perl.apache.org/docs/1.0/guide/performance.html#Preloading_Perl_Modules_at_Server_Startup">Preload Perl modules at server startup</a>. If you do this, the chances are that your <code>MaxClients</code> can be even higher.  But it seems that it&#8217;s not so simple to calculate the absolute number.  If you come up with a solution please let us know! If the shared memory was of the same size throughout the child&#8217;s life, we could derive a much better formula:</p>
<pre>               Total_RAM + Shared_RAM_per_Child * (MaxClients - 1)
  MaxClients = ---------------------------------------------------
                              Max_Process_Size</pre>
<p>which is:</p>
<pre>                    Total_RAM - Shared_RAM_per_Child
  MaxClients = ---------------------------------------
               Max_Process_Size - Shared_RAM_per_Child</pre>
<p>Let&#8217;s roll some calculations:</p>
<pre>  Total_RAM            = 500Mb
  Max_Process_Size     =  10Mb
  Shared_RAM_per_Child =   4Mb

              500 - 4
 MaxClients = --------- = 82
               10 - 4</pre>
<p>With no sharing in place</p>
<pre>                 500
  MaxClients = --------- = 50
                 10</pre>
<p>With sharing in place you can have 64% more servers without buying more RAM.</p>
<p>If you improve sharing and keep the sharing level, let&#8217;s say:</p>
<pre>  Total_RAM            = 500Mb
  Max_Process_Size     =  10Mb
  Shared_RAM_per_Child =   8Mb

               500 - 8
  MaxClients = --------- = 246
                10 - 8</pre>
<p>392% more servers! Now you can feel the importance of having as much shared memory as possible.</p>
]]></content:encoded>
			<wfw:commentRss>http://redhatvn.net/choosing-maxclients/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Identify Server ECC Memory Modules</title>
		<link>http://redhatvn.net/how-to-identify-server-ecc-memory-modules</link>
		<comments>http://redhatvn.net/how-to-identify-server-ecc-memory-modules#comments</comments>
		<pubDate>Thu, 27 Aug 2009 09:07:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[memory]]></category>

		<guid isPermaLink="false">http://redhatvn.net/?p=260</guid>
		<description><![CDATA[Q. How do I identify Linux server ECC memory modules from a shell prompt? A. You need to count the chips on the module. If memory module has 9 chips per sides, it is ECC memory (EDAC protected memory). It may or may not be registered. If the memory module has 8 chips per side, [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;">Q.</span> How do I identify Linux server ECC memory modules from a shell prompt?</p>
<p><span style="color: #009900;">A. </span>You need to count the chips on the module. If memory module has 9 chips per sides, it is ECC memory (EDAC protected memory). It may or may not be registered. If the memory module has 8 chips per side, it is not ECC memory modules.</p>
<p><span id="more-260"></span>You can get this information by visiting your BIOS setup menu. Another option is to use <a href="http://www.cyberciti.biz/tips/querying-dumping-bios-from-linux-command-prompt.html">dmidecode command to dump bios memory information</a> from a shell prompt:<br />
<code># dmidecode --type memory</code></p>
]]></content:encoded>
			<wfw:commentRss>http://redhatvn.net/how-to-identify-server-ecc-memory-modules/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->