<?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>SupportSages &#187; Apache</title>
	<atom:link href="http://www.supportsages.com/blog/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.supportsages.com/blog</link>
	<description>Technical Support and Server Management : Musings in the fox hole.</description>
	<lastBuildDate>Thu, 05 Jan 2012 03:05:11 +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>Joomla in IIS 7 : SEO Friendly URLs not working</title>
		<link>http://www.supportsages.com/blog/2011/04/joomla-in-iis-7-seo-friendly-urls-not-working/</link>
		<comments>http://www.supportsages.com/blog/2011/04/joomla-in-iis-7-seo-friendly-urls-not-working/#comments</comments>
		<pubDate>Fri, 29 Apr 2011 18:34:44 +0000</pubDate>
		<dc:creator>vince</dc:creator>
				<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[fastcgi]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[joomla]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Plesk]]></category>
		<category><![CDATA[seo friendly urls]]></category>
		<category><![CDATA[url rewrite]]></category>

		<guid isPermaLink="false">http://www.supportsages.com/blog/?p=1796</guid>
		<description><![CDATA[This post is about how to configure Joomla in IIS]]></description>
			<content:encoded><![CDATA[<p><strong>Scenario</strong></p>
<p>A Joomla website hosted in Linux server is migrated to Windows. Several compatibility issues will be reported. The rules in .htaccess file will not work in Windows Servers which will cause malfunctioning of the website. Here are the steps on how to deal with these issues.</p>
<h3><strong>Solution</strong></h3>
<p>For this to work in IIS, a web.config file should be created and the corresponding rules in .htaccess should be imported to the same file. Here is a sample web.config file. Copy the entire content.</p>
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;configuration&gt;
 &lt;system.webServer&gt;
 &lt;rewrite&gt;
 &lt;rules&gt;
 &lt;rule name="Security Rule" stopProcessing="true"&gt;
 &lt;match url="^(.*)$" ignoreCase="false" /&gt;
 &lt;conditions logicalGrouping="MatchAny"&gt;
 &lt;add input="{QUERY_STRING}" pattern="mosConfig_[a-zA-Z_]{1,21}(=|\%3D)" ignoreCase="false" /&gt;
 &lt;add input="{QUERY_STRING}" pattern="base64_encode.*\(.*\)" ignoreCase="false" /&gt;
 &lt;add input="{QUERY_STRING}" pattern="(\&amp;lt;|%3C).*script.*(\&gt;|%3E)" /&gt;
 &lt;add input="{QUERY_STRING}" pattern="GLOBALS(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" /&gt;
 &lt;add input="{QUERY_STRING}" pattern="_REQUEST(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" /&gt;
 &lt;/conditions&gt;
 &lt;action type="CustomResponse" url="index.php" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" /&gt;
 &lt;/rule&gt;
 &lt;rule name="SEO Rule"&gt;
 &lt;match url="(.*)" ignoreCase="false" /&gt;
 &lt;conditions logicalGrouping="MatchAll"&gt;
 &lt;add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" /&gt;
 &lt;add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" pattern="" ignoreCase="false" /&gt;
 &lt;add input="{URL}" negate="true" pattern="^/index.php" ignoreCase="false" /&gt;
 &lt;add input="{URL}" pattern="(/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$" /&gt;
 &lt;/conditions&gt;
 &lt;action type="Rewrite" url="index.php" /&gt;
 &lt;/rule&gt;
 &lt;/rules&gt;
 &lt;/rewrite&gt;
 &lt;/system.webServer&gt;
&lt;/configuration&gt;</pre>
<p>So, the file web.config is ready. Now the rules in .htaccess has to be converted in accordance with IIS. In IIS6, you can make use of the ISAPI_REWRITE module. Go to http://www.isapirewrite.com/ for downloading it.</p>
<p>If you are having IIS7, here are the steps involved in converting those rules.</p>
<p>The x86 version of URL Rewrite module can be downloaded here : <a  title="x86 URL Rewrite Module" href="http://go.microsoft.com/?linkid=9722533" target="_blank">http://go.microsoft.com/?linkid=9722533</a></p>
<p>The x64 version of URL Rewrite module can be downloaded here : <a  title="x64 URL Rewrite Module" href="http://go.microsoft.com/?linkid=9722532." target="_blank">http://go.microsoft.com/?linkid=9722532</a></p>
<p>Install the module, restart the IIS manager. Choose the website in which you have to convert the rules (under Sites category). You will see the &#8216;URL Rewrite&#8217; module in IIS.</p>
<p><a  href="http://www.supportsages.com/blog/wp-content/uploads/2011/03/IIS_1.png" class="thickbox no_icon" rel="gallery-1796" title="IIS_1"><img class="alignnone size-full wp-image-1806" title="IIS_1" src="http://www.supportsages.com/blog/wp-content/uploads/2011/03/IIS_1.png" alt="" width="508" height="376" /></a></p>
<p>Open it. Since the web.config file is already created with some predefined rules, you will see it as Inbound rules (by the Names &#8211; Security Rule and SEO Rule).</p>
<p><a  href="http://www.supportsages.com/blog/wp-content/uploads/2011/03/IIS_2.png" class="thickbox no_icon" rel="gallery-1796" title="IIS_2"><img class="alignnone size-full wp-image-1811" title="IIS_2" src="http://www.supportsages.com/blog/wp-content/uploads/2011/03/IIS_2.png" alt="" width="575" height="335" /></a></p>
<p>You can convert the rules in .htaccess file by accessing the &#8216;Import Rules&#8217; under Inbound Rules category in the Actions pane.</p>
<p><a  href="http://www.supportsages.com/blog/wp-content/uploads/2011/03/IIS_3.png" class="thickbox no_icon" rel="gallery-1796" title="IIS_3"><img class="alignnone size-full wp-image-1813" title="IIS_3" src="http://www.supportsages.com/blog/wp-content/uploads/2011/03/IIS_3.png" alt="" width="191" height="352" /></a></p>
<p>Choose the .htaccess file and click Import. You will see the rules in &#8216;Rewrite Rules&#8217; section and the converted rules in &#8216;Converted Rules&#8217; option. Click Apply on the  Actions pane on the right hand side to save these rules to the web.config file (If a web.config file was not created as mentioned earlier, that file will be newly created). Make sure there are no conflicts in the conversion. Watch the Summary on the bottom end. There was a conflict when we did it, its shown here. In such cases, remove any unsupported rules and then click Apply.</p>
<p><a  href="http://www.supportsages.com/blog/wp-content/uploads/2011/03/IIS_4.png" class="thickbox no_icon" rel="gallery-1796" title="IIS_4"><img class="alignnone size-full wp-image-1816" title="IIS_4" src="http://www.supportsages.com/blog/wp-content/uploads/2011/03/IIS_4.png" alt="" width="705" height="528" /></a><strong> </strong></p>
<p><strong>Converting PHP to FastCGI</strong></p>
<p>We have do it from Plesk control panel. If you don&#8217;t have the administrator access, you may need to contact your Administrator. Others (Gods !) read on</p>
<p>Select the Domain, go to Web Hosting Settings.</p>
<p><a  href="http://www.supportsages.com/blog/wp-content/uploads/2011/03/Plesk_1.png" class="thickbox no_icon" rel="gallery-1796" title="Plesk_1"><img class="alignnone size-full wp-image-1820" title="Plesk_1" src="http://www.supportsages.com/blog/wp-content/uploads/2011/03/Plesk_1.png" alt="" width="668" height="123" /></a></p>
<p>Scroll down to Services. Choose PHP support to run as FastCGI application.</p>
<p><a  href="http://www.supportsages.com/blog/wp-content/uploads/2011/03/Plesk_2.png" class="thickbox no_icon" rel="gallery-1796" title="Plesk_2"><img class="alignnone size-full wp-image-1822" title="Plesk_2" src="http://www.supportsages.com/blog/wp-content/uploads/2011/03/Plesk_2.png" alt="" width="581" height="160" /></a></p>
<p><strong>Final Steps</strong></p>
<p>Go to Joomla Administrator interface. Access <strong>Global Configuration</strong> from the main menu. Under SEO Settings, make sure the following are set to Yes</p>
<p>Search Engine Friendly URLs : Yes</p>
<p>Use Apache mod_rewrite : Yes</p>
<p><a  href="http://www.supportsages.com/blog/wp-content/uploads/2011/03/SEO.png" class="thickbox no_icon" rel="gallery-1796" title="SEO"><img class="alignnone size-full wp-image-1821" title="SEO" src="http://www.supportsages.com/blog/wp-content/uploads/2011/03/SEO.png" alt="" width="310" height="147" /></a></p>
<p>Done, From now your Joomla website shoule work as smooth as it were in the Linux server. Sit back and Enjoy !</p>
<div class="tweetthis" style="text-align:left;"><p> <a  class="tt" href="http://twitter.com/home/?status=Joomla+in+IIS+7+%3A+SEO+Friendly+URLs+not+working+http%3A%2F%2Fwww.supportsages.com%2Fblog%2F1796" title="Post to Twitter"><img class="nothumb" src="http://www.supportsages.com/blog/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter3.png" alt="Post to Twitter" /></a> <a  class="tt" href="http://twitter.com/home/?status=Joomla+in+IIS+7+%3A+SEO+Friendly+URLs+not+working+http%3A%2F%2Fwww.supportsages.com%2Fblog%2F1796" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.supportsages.com/blog/2011/04/joomla-in-iis-7-seo-friendly-urls-not-working/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache Performance Tuning (Part III/III) &#8211; Measuring Apache&#8217;s Performance</title>
		<link>http://www.supportsages.com/blog/2011/01/apache-performance-tuning-part-iiiiii-measuring-apaches-performance/</link>
		<comments>http://www.supportsages.com/blog/2011/01/apache-performance-tuning-part-iiiiii-measuring-apaches-performance/#comments</comments>
		<pubDate>Tue, 04 Jan 2011 10:08:04 +0000</pubDate>
		<dc:creator>steve</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[ab]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[bennchmarking]]></category>
		<category><![CDATA[httperf]]></category>
		<category><![CDATA[measuring]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://www.supportsages.com/blog/?p=1646</guid>
		<description><![CDATA[<!-- p { margin-bottom: 0.21cm; }a:link {  } --><span style="font-size: small;">I will introduce two benchmarking tools here: <strong>ab</strong> &#38; <strong>httperf</strong> with some other utilities. </span>

<span style="font-size: small;"><strong>1. ab </strong>is shipped with most linux distributions. It is used to simulate load test on to your webserver and check how it behaves during such situations. It is run from the command line and the command is ab followed by the required options and the name of a website served by the server that you need to test. There are two ways to which you can run the test. One is to ...]]></description>
			<content:encoded><![CDATA[<p><!-- p { margin-bottom: 0.21cm; }a:link {  } --><span style="font-size: small;">I will introduce two benchmarking tools here: <strong>ab</strong> &amp; <strong>httperf</strong> with some other utilities. </span></p>
<p><span style="font-size: small;"><strong>1. ab </strong>is shipped with most linux distributions. It is used to simulate load test on to your webserver and check how it behaves during such situations. It is run from the command line and the command is ab followed by the required options and the name of a website served by the server that you need to test. There are two ways to which you can run the test. One is to run the ab tool in the same machine where Apache is installed. The sencond is the practical way which is to run the tool to a remote webserver which helps in taking into account the network related accessibility issues. Lets see how to use it.</span></p>
<p><span style="font-size: x-small;"><span style="font-size: small;">The most common options of ab  are -n and -c. A test to <a  href="http://www.google.com/">www.google.com</a> would be as below:</span></span></p>
<p><span style="font-size: small;">root@sage3-desktop:~# ab -n 100 -c 10 http://www.google.com/ </span></p>
<p><span style="font-size: small;">This is ApacheBench, Version 2.3 &lt;$Revision: 655654 $&gt;</span></p>
<p><span style="font-size: small;">Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ </span></p>
<p><span style="font-size: small;">Licensed to The Apache Software Foundation, http://www.apache.org/ </span></p>
<p><span style="font-size: small;">Benchmarking www.google.com (be patient)&#8230;..done </span></p>
<p><span style="font-size: small;">Server Software:        gws </span></p>
<p><span style="font-size: small;">Server Hostname:        www.google.com </span></p>
<p><span style="font-size: small;">Server Port:            80 </span></p>
<p><span style="font-size: small;">Document Path:          / </span></p>
<p><span style="font-size: small;">Document Length:        221 bytes </span></p>
<p><span style="font-size: small;">Concurrency Level:      10 </span></p>
<p><span style="font-size: small;">Time taken for tests:   1.455 seconds </span></p>
<p><span style="font-size: small;">Complete requests:      100 </span></p>
<p><span style="font-size: small;">Failed requests:        0 </span></p>
<p><span style="font-size: small;">Write errors:           0 </span></p>
<p><span style="font-size: small;">Non-2xx responses:      100 </span></p>
<p><span style="font-size: small;">Total transferred:      83000 bytes </span></p>
<p><span style="font-size: small;">HTML transferred:       22100 bytes </span></p>
<p><span style="font-size: small;">Requests per second:    68.72 [#/sec] (mean) </span></p>
<p><span style="font-size: small;">Time per request:       145.509 [ms] (mean) </span></p>
<p><span style="font-size: small;">Time per request:       14.551 [ms] (mean, across all concurrent requests) </span></p>
<p><span style="font-size: small;">Transfer rate:          55.70 [Kbytes/sec] received </span></p>
<p><span style="font-size: small;">Connection Times (ms) </span></p>
<p><span style="font-size: small;">min  mean[+/-sd] median   max </span></p>
<p><span style="font-size: small;">Connect:       45   49   3.2     48      62 </span></p>
<p><span style="font-size: small;">Processing:    89   94   3.3     94     108 </span></p>
<p><span style="font-size: small;">Waiting:       89   94   3.3     93     107 </span></p>
<p><span style="font-size: small;">Total:        136  143   5.5    142     170 </span></p>
<p><span style="font-size: small;">Percentage of the requests served within a certain time (ms) </span></p>
<p><span style="font-size: small;">50%    142 </span></p>
<p><span style="font-size: small;">66%    144 </span></p>
<p><span style="font-size: small;">75%    144 </span></p>
<p><span style="font-size: small;">80%    145 </span></p>
<p><span style="font-size: small;">90%    148 </span></p>
<p><span style="font-size: small;">95%    155 </span></p>
<p><span style="font-size: small;">98%    166 </span></p>
<p><span style="font-size: small;">99%    170 </span></p>
<p><span style="font-size: small;">100%    170 (longest request) </span></p>
<p><span style="font-size: small;">-n : Number of requests to perform for the benchmarking session. The default is to just perform a single request which   usually  leads to non-representative benchmarking results.</span></p>
<p><span style="font-size: small;">-c : Number of multiple requests to perform at a time. Default is one request at a time.</span></p>
<p><span style="font-size: small;">Let me explain the options. -n denotes the total number of requests to send to the webserver in the ab session. By specifying -c 10 we ensure that at any instant of the ab session we keep the webserver busy with 10 requests until the total limit of 100 requests is reached.  The requests may be sent through a single connection if the server permits KeepAlive and browser supports persistent connections. The main points in performace to note for are: Failed requests, Connection Times &amp; Transfer rate. </span></p>
<p><span style="font-size: small;"> </span></p>
<p><span style="font-size: small;"><strong>2.  httperf</strong> Usage :</span></p>
<p><!-- p { margin-bottom: 0.21cm; } --> <!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;"><span style="font-size: small;">httperf </span>&#8211;hog &#8211;server www.google.com &#8211;num-conn 50 &#8211;rate 10 &#8211;timeout 5</span></p>
<p><span style="font-size: small;">-hog : Use as many TCP ports as necessary to generate stats</span></p>
<p><span style="font-size: small;">&#8211;server: the host. IP or hostname can be specified</span></p>
<p><span style="font-size: small;">&#8211;num-conn : number of connections to create for the session</span></p>
<p><span style="font-size: small;">&#8211;rate : create connections at the rate of 10 per second</span></p>
<p><span style="font-size: small;">More simple and direct usage examples can be found at the man page for httperf. </span></p>
<p><span style="font-size: small;"><strong>3. </strong>Apart from command line tools, there are online websites for analysing webserver performance: </span></p>
<p><span style="font-size: x-small;"><strong><span style="font-size: small;"><a  href="http://www.webpagetest.org/">http://www.webpagetest.org/</a> </span></strong></span></p>
<p><span style="font-size: x-small;"><span style="font-size: small;"><strong><a  href="http://linuxbox.co.uk/website_performance_test.php">http://linuxbox.co.uk/website_performance_test.php</a> </strong></span></span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;"><strong>4. Page Speed</strong> by Google is an open-source project started at Google to help developers optimize their web pages by applying web performance best practices. Page Speed started as an open-source Firefox/Firebug add-on  and is now deployed in third-party products such as Webpagetest.org, Show Slow and Google Webmaster Tools. Please see:</span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: x-small;"><code><span style="font-family: Nimbus Roman No9 L,serif;"><span style="font-size: small;"><strong>http://code.google.com/speed/page-speed/</strong></span></span></code></span></p>
<div class="tweetthis" style="text-align:left;"><p> <a  class="tt" href="http://twitter.com/home/?status=Apache+Performance+Tuning+%28Part+III%2FIII%29+-+Measuring+Apache%27s+Performance+http%3A%2F%2Fwww.supportsages.com%2Fblog%2F1646" title="Post to Twitter"><img class="nothumb" src="http://www.supportsages.com/blog/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter3.png" alt="Post to Twitter" /></a> <a  class="tt" href="http://twitter.com/home/?status=Apache+Performance+Tuning+%28Part+III%2FIII%29+-+Measuring+Apache%27s+Performance+http%3A%2F%2Fwww.supportsages.com%2Fblog%2F1646" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.supportsages.com/blog/2011/01/apache-performance-tuning-part-iiiiii-measuring-apaches-performance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache Performance Tuning (Part II/III) &#8211; Editing Apache for Performance</title>
		<link>http://www.supportsages.com/blog/2011/01/apache-performance-tuning-part-iiiii-editing-apache-for-performance/</link>
		<comments>http://www.supportsages.com/blog/2011/01/apache-performance-tuning-part-iiiii-editing-apache-for-performance/#comments</comments>
		<pubDate>Tue, 04 Jan 2011 10:00:53 +0000</pubDate>
		<dc:creator>steve</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[apache performance]]></category>
		<category><![CDATA[tuning]]></category>
		<category><![CDATA[tuning apache]]></category>
		<category><![CDATA[tweaking]]></category>

		<guid isPermaLink="false">http://www.supportsages.com/blog/?p=1642</guid>
		<description><![CDATA[<!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">2. Editing Apache for Performance</span>

From hereon I will be writing for Linux platform configuration of Apache unless stated otherwise. Once the Hardware, OS selection and optimization are done, we have to implement Apache. Editing apache for performance can be 2 levels: Before Installation &#38; After Installation

<strong>2.1 Before Installation (Compile Time Tuning)</strong>

2.1.(a) Choosing the appropriate MPM

MPM stands for Multi Processing Module. It is just one of the modules of apache. Its features being:

- It modifies the basic functionality of the apache server related to multi-thread &#38; multi-processes style of working.
- It must be ...]]></description>
			<content:encoded><![CDATA[<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">2. Editing Apache for Performance</span></p>
<p>From hereon I will be writing for Linux platform configuration of Apache unless stated otherwise. Once the Hardware, OS selection and optimization are done, we have to implement Apache. Editing apache for performance can be 2 levels: Before Installation &amp; After Installation</p>
<p><strong>2.1 Before Installation (Compile Time Tuning)</strong></p>
<p>2.1.(a) Choosing the appropriate MPM</p>
<p>MPM stands for Multi Processing Module. It is just one of the modules of apache. Its features being:</p>
<p>- It modifies the basic functionality of the apache server related to multi-thread &amp; multi-processes style of working.<br />
- It must be built into apache at compilation like http_core and mod_so modules.<br />
- Only one MPM can be loaded into the server at any time.</p>
<p><!-- p { margin-bottom: 0.21cm; }h5 { margin-bottom: 0.21cm; }h5.western { font-family: "Liberation Serif",serif; }h5.cjk { font-family: "DejaVu LGC Sans"; }h5.ctl { font-family: "DejaVu LGC Sans"; } --><span style="font-size: small;"><strong>( Note: </strong>If you need to know more on differeences between Processes &amp; Threads, you may want to refer books on &#8216;Operating System Concepts&#8217; which has in-depth treatment of each.)</span></p>
<p><span style="font-size: small;">Its simple to understand. The MPM type you choose for apache is responsible for binding to network ports on the machine, accepting requests, handling requests etc. Choosing an MPM depends on various factors, such as whether the OS supports threads, how much memory is available, scalability versus stability, whether non-thread-safe third-party modules are used, etc. Linux systems can choose to use a hybridMPM (which means that it is multi-processed and multi-threaded implementation) like &#8216;worker&#8217; or a non-threaded MPM (only multi-process functionality)like &#8216;prefork&#8217;. Windows has only one choice which is &#8216;winnt&#8217; MPM (only multi-process functionality). Let me discuss some of the key features of these:</span></p>
<h5><span style="font-size: small;">prefork:</span></h5>
<ul>
<li><span style="font-size: small;">Apache 	1.3-based. </span></li>
<li><span style="font-size: small;">Multiple 	processes, 1 thread per process, processes handle requests. </span></li>
<li><span style="font-size: small;">Used 	for security and stability. </span></li>
<li><span style="font-size: small;">Has higher memory 	consumption and lower performance over the newer Apache 2.0-based 	threaded MPMs. </span></li>
</ul>
<h5><span style="font-size: small;">worker (Hybrid MPM):</span></h5>
<ul>
<li><span style="font-size: small;">Apache 	2.0-based. </span></li>
<li><span style="font-size: small;">Multiple 	processes, many threads per process, threads in a child handle 	requests. </span></li>
<li><span style="font-size: small;">Used 	for lower memory consumption and higher performance. </span></li>
<li><span style="font-size: small;">Does not provide the 	same level of isolation request-to-request, as a process-based MPM 	does. </span></li>
</ul>
<p><!-- p { margin-bottom: 0.21cm; }h5 { margin-bottom: 0.21cm; }h5.western { font-family: "Liberation Serif",serif; }h5.cjk { font-family: "DejaVu LGC Sans"; }h5.ctl { font-family: "DejaVu LGC Sans"; } --></p>
<h5><span style="font-size: small;">winnt:</span></h5>
<ul>
<li><span style="font-size: small;">The 	only MPM choice under Windows. </span></li>
<li><span style="font-size: small;">1 	parent process, exactly 1 child process with many threads, threads 	handle requests. </span></li>
<li><span style="font-size: small;">Best 	solution under Windows, as on this platform, threads are always 	&#8220;cheaper&#8221; to use over processes. </span></li>
</ul>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">Once the required module is loaded, we tweak them by the apache &#8216;Directives&#8217; that are dedicated for configuring MPMs like MaxClients, StartServers, MaxRequestsPerChild etc in the httpd.conf file. </span></p>
<p><span style="font-size: small;">2.1.(ii) Loading only the required modules</span></p>
<p><span style="font-size: small;">Before installation, only compile in the modules that are provide the basic functions of a web server. This is because as more modules are compiled in statically, the size of the running httpd binary will increase(neglecting the dynamic modules. Once dynamic modules are also loaded, the size will increase again). Normally, the statically  compiled modules are http_core, mod_so &amp; the required MPM module. </span></p>
<p><span style="font-size: small;">If you have built the modules as DSOs, eliminating modules is a simple matter of commenting out the associated LoadModule directive for that module.<span style="font-family: Nimbus Roman No9 L,serif;">If, on the other hand, you have modules statically linked into your Apache binary, you will need to recompile Apache in order to remove unwanted modules.</span></span></p>
<p><span style="font-size: x-small;"><span style="font-size: small;">2.1.(iii) </span><code><span style="font-family: Nimbus Roman No9 L,serif;"><span style="font-size: small;">DYNAMIC_MODULE_LIMIT</span></span></code></span></p>
<p><span style="font-size: x-small;"><span style="font-size: small;">This is one of the compile time flags you give in for apache. If you have no thoughts for DSO support for apache, then you will need to compile apache with </span><code><span style="font-family: Nimbus Roman No9 L,serif;"><span style="font-size: small;">DYNAMIC_MODULE_LIMIT=0. This will save the amount of RAM that is only dedicated for loading dynamically loading modules. The default value is 64 which will be usually sufficient.</span></span></code></span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;"><strong>2.2 After Installation (Once the server is installed and ready to run or running)</strong></span></p>
<p><span style="font-size: small;">This is where the bulk of apache tuning comes in. But first I will need to give you some intro about the 2 most common MPMs that are used with Apache in Linux environment. </span></p>
<p><span style="font-size: small;">The &#8216;prefork&#8217; MPM:</span></p>
<p><span style="font-size: small;">It was the only mode of operation available in Apache 1.3. In this configuration, the main Apache process also known as the &#8216;master server&#8217;(the apache process started by &#8216;root&#8217; user with full privileges) will at startup create (fork() ) multiple child servers(running under user with less privileges w.r.t those mentioned in User &amp; Group directive in the apache conf file). In the pool of child servers, these child servers can be considered to stand in a queue. The child at the front of the queue or standing 1<sup>st</sup> is known as the &#8216;Listener&#8217; and all the rest, counted from the 2<sup>nd</sup> child onwards are known as the &#8216;Idle Worker&#8217;. Only the listener child is allowed to listen for connection from sockets. When a request is received, this child makes a transition in its state from &#8216;Listener&#8217; to &#8216;Worker&#8217;. This particular child then goes on to process </span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">the received request. In the meantime  the child which was standing 2<sup>nd </sup>gets the &#8216;Listener&#8217; status. When the 1<sup>st</sup> child, which became the &#8216;worker&#8217;, is done processing the request, it will change its state back to &#8216;Idle Worker&#8217; and will then stand at the end of the same queue in which it was standing 1<sup>st</sup> previously. This cycle repeats as each request arrives. Each child server will only handle one request at a time. When it is detected that the number of available processes is running out, additional child servers will be created by the master server. But there is a limit for the maximum number of child servers and this is given in the conf file for apache. When the limit was reached and still sufficient requests arriving, the client may instead receive an error resulting from not being able to establish a connection with the web server. When the number of requests has subsequently dropped off, the excess child servers will be shutdown and killed. Child processes may also be shutdown and killed off after they have handled some set number of requests which depends upon the directives set in the conf file which I will discuss in the succeeding sections. </span></p>
<p><span style="font-size: small;">So the actual worker here is the child server and not the master server! The method imparts a lot of stability because each request is handled by a separate &#8216;process&#8217;. If a process dies/or is killed it will not affect other processes. Each process is an independent entity to which resources are allocated.</span></p>
<p><span style="font-size: small;">The &#8216;worker&#8217; MPM:</span></p>
<p><span style="font-size: small;">The &#8216;worker&#8217; MPM implemented from version 2.0,  is similar to &#8216;prefork&#8217; mode except that within each child process there will exist a number of worker threads according to ThreadsPerChild directive. A request will be handled by a &#8216;thread&#8217; within a child process rather than each request being handled by a separate child process in case of prefork MPM. If some of the threads in a process are already handling  requests, when a new request arrives, this is handed over to the thread which is ready and idle in the same process. If all worker threads within a child process were busy when a new request arrives the request would be processed by an idle worker thread in another child process. If all the threads in all the running child processses are engaged, Apache &#8216;master server&#8217; (server run with root privileges) may still create new child processes on demand if necessary. Apache master server may also still shutdown and kill off excess child processes, or child processes that have handled more than a set number of requests. </span></p>
<p><span style="font-size: small;">Overall, use of &#8216;worker&#8217; MPM will result in less child processes needing to be created, but resource usage of individual child processes will be greater. But where is the advantage then? It is in avoiding the delay and overhead incurred on creating a new child process for every request.</span></p>
<p><!-- p { margin-bottom: 0.21cm; }a:link {  } --><span style="font-size: x-small;"><span style="font-size: small;">Now lets discuss the Directives which are also known as apache&#8217;s Performance directives. Much of these I discuss can be found at: <a  href="http://httpd.apache.org/docs/2.0/misc/perf-tuning.html">http://httpd.apache.org/docs/2.0/misc/perf-tuning.html</a>. But may not be much comprehensive to a novice. So I shall try my best to break it down.</span></span></p>
<p><span style="font-size: small;">2.2(a) ThreadsPerChild</span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">This implies if apache is compiled to use &#8216;worker&#8217; MPM and mpm_winnt (windows) only. It denotes the number of threads that will be created in an individual child process at startup. This value multiplied by the &#8216;number of child&#8217; will give us the total number of threads in the server. Once a child has started, it will never change ThreadsPerChild value. The conf file needs to be edited and the apache master server must be restarted for the changes to take effect. Once this is done childs created from thereon will have the new value but the already existing child will have  old value. The default value in for worker is 25 and 64 for mpm_winnt. </span></p>
<p><span style="font-size: small;">2.2(b) ThreadLimit</span></p>
<p><span style="font-size: small;">However, there is a limit to which the ThreadsPerChild value can be increased. This limit is the ThreadLimit. While setting this directive:</span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">(i) If ThreadLimit is set to a value much higher than ThreadsPerChild, extra unused shared memory will be allocated.</span></p>
<p><span style="font-size: small;">(ii) If both ThreadLimit and ThreadsPerChild are set to values higher than the system can handle, Apache may not start or the system may become unstable.</span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">So how to set value of this directive?</span></p>
<p><span style="font-size: small;">Set the value of this directive equal to the greatest value of ThreadsPerChild that might be required for Apache during the most peak time. Consequently when apache is shipped, if 25 is the ThreadsPerChild value, ThreadLimit is defaluted to 64. However all this, will again depend upon how busy your apache will be and the hardware resources you have alloted for apache.</span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">2.2(c) MaxClients</span></p>
<p><span style="font-size: small;">The MaxClients indicates the limit on the maximum number of simultaneous requests that will be served. For preforking apache each request is handled by each child. Therefore MaxClients in this case can be interpreted as the maximum number of apache childs that will be launched in its single lifetime. The default value is 256 servers(in effect, in case of prefork, 256 simultaneous requests). Any connection attempts over this value will be queued according to ListenBackLog (default is in the range of 500). </span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">For worker, since each requests are handled by single threads, the MaxClients= ServerLimit x ThreadLimit = the maximum number of apache threads that can be possibly launched during the an apache lifetime. ServerLimit in short means the maximum number of apache servers(child process or child server) that can be launched in apache&#8217;s lifetime be it prefork or worker implementation. So for:</span></p>
<p><span style="font-size: small;">prefork, MaxClients= Total number of child servers in apache lifetime</span></p>
<p><span style="font-size: small;">worker,  MaxClients= Total number of threads in apache lifetime</span></p>
<p><span style="font-size: small;">Lets do some Math now. I have a apache running with the following specs: Apache/2.0.63, Prefork MPM and mulitple statically compiled in modules. </span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">By theory,</span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">MaxClients= RAM available to Apache/ Memory for each apache process </span></p>
<p><span style="font-size: small;">Let us assume if the concept of shared memory is implemented into IPC. Assume 250M as the system RAM. Setting MaxClients will always require the administrator to see for the memory usage of apache process during idle time and peak usage time. I shall give a very short method on how to do this here. </span></p>
<p><span style="font-size: small;">The best tool we are going to use here is the well known &#8216;ps&#8217; command. Lets see how.</span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">Do a  ps aux &#8211;sort -rss|grep httpd httpd from the commandline. Here is what I got for an apache server installed via EasyApche.</span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">#ps aux &#8211;sort -rss|grep httpd </span></p>
<p><span style="font-size: small;">USER       PID  %CPU %MEM    VSZ   RSS   TTY   STAT START  TIME     COMMAND</span></p>
<p><span style="font-size: small;">root          3902  	0.0  	0.0        9800  3312   ?        Ss       Nov25   0:00     /usr/local/apache/bin/httpd -k start -DSSL</span></p>
<p><span style="font-size: small;">nobody    1899  	0.0  	0.0        9936  2948   ?        S        Nov25   0:00     /usr/local/apache/bin/httpd -k start -DSSL </span></p>
<p><span style="font-size: small;">nobody    1903  	0.0  	0.0        9936  2948   ?        S        Nov25   0:00     /usr/local/apache/bin/httpd -k start -DSSL </span></p>
<p><span style="font-size: small;">nobody    3912  	0.0  	0.0        9936  2948   ?        S        Nov25   0:00     /usr/local/apache/bin/httpd -k start -DSSL </span></p>
<p><span style="font-size: small;">nobody    3913  	0.0  	0.0        9936  2948   ?        S        Nov25   0:00     /usr/local/apache/bin/httpd -k start -DSSL </span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">In this context we need to look for fields RSS &amp; VSZ. Lets see.</span></p>
<p><span style="font-size: small;">VSZ (Virtual memory SIZE) &#8211; This is the aggregate of memory the process is currently using  including the RAM and also the SWAP memory(if used).</span></p>
<p><span style="font-size: small;">RSS (Resident Set Size) &#8211;  It is the portion of the process that exists in “RAM only”. The rest if any, will be in swap.</span></p>
<p><span style="font-size: small;">If the process is using no swap space, then RSS will be = SZ.</span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">The above indicates that the process is being swapped by about 6-7M. This should not be the case as the process should not be allowed to swap and the required memory should be alloted or the conf should be edited so that the process is not swapped. Now lets get back to the math for MaxClients. </span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">So the actual apache process size here is 9.936M. If if there were enough memory, then RSS= VSZ= 9.936M and the whole 9.936M would have been in the RAM. Lets round it to 10M. We had assumed that our available system RAM for apache was 250M. </span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">So:</span></p>
<p><span style="font-size: small;">MaxClients=  250M/10M = 25 apache process. This means that 25 apache process is the maximum advisable range for setting the MaxClients to. Since we see that the process already swaps, we will need to allocate more memory and then set it to 25 or if not, lower the value. </span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">Now lets calculate the above case considering shared memory concepts in place(OS support required). Lets say we have a shared memory of 4M. So the available RAM to apache becomes 250-4 = 246M.</span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">So:</span></p>
<p><span style="font-size: small;">MaxClients = 250-4/10-4= 61 processes. Compare the result with the above. We see that the number has increased significantly. Optmizing shared memory concepts not only increases process number but also improves IPC so this is to be considered into while optimizing apache. </span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">The above calculated is still only accurate to the extent that we can implement this in the http.conf file. Try to set a MaxClients value a but lower than the result always. In the last calculation, 50-55 would be advisable.. I have said this becuase, the actual calculation taking into account of shared memory is a bit complex for any process. </span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">2.2(d) HostnameLookups</span></p>
<p><span style="font-size: small;">This directive is used for reverse lookup of the IP address of the accessing machine initiating the connection. This adds a great delay since this lookup is done for every new request generated by the established connection. There are 3 options for this: Off, On, Double. When Double is set, one forward and sucessively a backward lookup os also performed to ensure that domain name is not being spoofed. It is usually set to Off.</span></p>
<p><span style="font-size: small;">In addition to making this Off, while implementing ACLs, you should try to avoid Hostnames. Otherwise the server will perform Double DNS lookups. See the eg:</span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">&lt;Location /serverstat &gt;</span></p>
<p><span style="font-size: small;">Order deny, allow</span></p>
<p><span style="font-size: small;">Deny from all </span></p>
<p><span style="font-size: small;">Allow from www.example.com</span></p>
<p><span style="font-size: small;">&lt;/Location&gt; </span></p>
<p><span style="font-size: small;">Instead, try to use IP address in above. However accordig to our example, the lookup will only be performed for URLs starting with /serverstat. </span></p>
<p><!-- p { margin-bottom: 0.21cm; } --></p>
<p><span style="font-size: small;">2.2(e) FollowSymLinks and SymLinksIfOwnerMatch</span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">Lets talk in general. Actually FollowSymLinks enable the server to follow symbolic links to files to wherever they are if there are any in the directory it is enabled. Actually this is a security threat since blindly having this enabled can have a webcliet wander in filesystems into which it is actually not allowed. Say, the user has created a symlink to /etc/passwd in his DocumentRoot. This can reveal the file to him. So disable this option on the whole? No, this will not only disable the user from using safe and useful symbolic links within his permitted directory, but also induce extra overhead for apache. Extra overhead? Yes. When this option is disabled, when ever a resource is requested, apache will look whether the requested resource and its preceeding directories are a symlink or not from the server root &#8216;/&#8217;. Didn&#8217;t get it? See the below:</span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">DocumentRoot /www/htdocs </span></p>
<p><span style="font-size: small;">&lt;Directory /&gt; </span></p>
<p><span style="font-size: small;">Options -FollowSymLinks </span></p>
<p><span style="font-size: small;">&lt;/Directory&gt;</span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">When index.html is requested, apache will check whether: /www, /www/htdocs, /www/htdocs/index.html are symbolic links or not. Why does apache check this? Because we have told in &#8216;Options&#8217; directive that not to serve contents if they are symlinks. So if /www/htdocs/index.html or  www/htdocs or www was a symlink to something else, apache would have returned an error. This number of this check will increase if the requested resource is in deeper sub-directories and  the result of these checks are also not cached so check is made with every request even if the resource is in the same directory as the previous resource that was sought. The key point to note here is that if FollowSymLinks  was enabled, apache will not perform these checks, but will simply follow if a link is found.  This is highly derogatory to pertformace. So disabling FollowSymLinks on the whole is not at all advisable. </span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">Next, the SymLinksIfOwnerMatch directive. This was used as a workaround for the security leak created by FollowSymLinks of apache serving files outside user&#8217;s directories. This ensures that apache will follow the symbolic link iff the owner of the destination file is same as the owner of the link. This again, is an overhead since for each request, apache will have to do a check on the ownership of the destination files. </span></p>
<p><span style="font-size: small;">Now its really stuck. How do we do then? A practical case is to divide the directories in which these directives have the influence. We may deploy the following considering the Document root as: /var/www/htdocs.</span></p>
<p><span style="font-size: small;">&lt;Directory /&gt; </span></p>
<p><span style="font-size: small;">Options FollowSymLinks </span></p>
<p><span style="font-size: small;">&lt;/Directory&gt;</span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">&lt;Directory /var/www/htdocs&gt; </span></p>
<p><span style="font-size: small;">Options -FollowSymLinks +SymLinksIfOwnerMatch </span></p>
<p><span style="font-size: small;">&lt;/Directory&gt;</span></p>
<p><!-- p { margin-bottom: 0.21cm; } --> <!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">Now this is a good solution. Suppose a reques is made for index.html in /var/www/htdocs. We have enabled  FollowSymLinks for &#8216;/&#8217; and disabled it for /var/www/htdocs only. So this will eliminate the need for checking whether: /var, /var/www/, /var/www/htdocs are symbolic links or not. Apache will only need to check if /var/www/htdocs/ index.html is a symlink since FollowSymLinks  has been disabled under /var/www/htdocs and index.html is under it. +SymLinksIfOwnerMatch ensures that destination file of the link served only if its owned by the same user of the link. </span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">2.2.(f) MaxRequestsPerChild</span></p>
<p><span style="font-size: small;">This can be set to either 0 or &gt;0. When set to 0, the apache process will handle infinite number of requests and will not terminate by itself. When set to a value &gt;0, the apache process will terminate voluntarily after handling the specified number of requests in MaxRequestsPerChild directive.</span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">Setting this to zero has shown memory leakage issues. In simple words, the process after temination(will be done by the master process), will not release the meomry space that it had held so that it could be used by the upcoming or the in need apache processes. So if the process has run for a long time loading up more modules as it ran, it is possible to lock a hefty amount of memory after termination. The drawback need not be pointed to apache, but can be the underlying shortcoming of the platform or the poor programming of the loaded modules. One might need to monitor this carefully using pmap, ps and top. Check for the buggy modules etc, correct it out and then set this to 0 since this is more preferred if performance is sought.</span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><a name="htacess"></a><span style="font-size: small;">2.2.(g) AllowOverride</span></p>
<p><span style="font-size: small;">If this is enabled in a directory, whenever apache traverses this directory and its sub-directories, it will look for the file &#8216;.htaccess&#8217; and try to read its contents. If found, it will display contents in this directory only according to the options mentioned in this, overriding the global server settings. Like the case of 2.2(e), it is advisable to divide this setting into   two. One for the / partition and other for the DocumentRoot of the users. If /var/www/htdocs is the DocumentRoot it can be given like: </span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">&lt;Directory /&gt; </span></p>
<p><span style="font-size: small;">AllowOverride None </span></p>
<p><span style="font-size: small;">&lt;/Directory&gt;</span></p>
<p><span style="font-size: small;">&lt;Directory /var/www/htdocs&gt; </span></p>
<p><span style="font-size: small;">AllowOverride All </span></p>
<p><span style="font-size: small;">&lt;/Directory&gt;</span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">2.2.(h) </span><code><span style="font-family: Nimbus Roman No9 L,serif;"><span style="font-size: small;">EnableSendfile</span></span></code></p>
<p><code><span style="font-family: Nimbus Roman No9 L,serif;"><span style="font-size: small;">If your OS supports sendfile system call, you might need to consfier using this since it enables direct delivery of files to sockets. This can also be used on a per-directory basis. </span></span></code></p>
<p><!-- p { margin-bottom: 0.21cm; } --><code><span style="font-family: Nimbus Roman No9 L,serif;"><span style="font-size: small;">2.2.(i) StartServers, MinSpareServers, and MaxSpareServers</span></span></code></p>
<p><!-- p { margin-bottom: 0.21cm; } --><code><span style="font-family: Nimbus Roman No9 L,serif;"><span style="font-size: small;">This indicates the number of processes that apache is to create while starting, the minimum and maximum number of idle servers to maintain respectively. This should be set on account of the server load. The default values are given below:</span></span></code></p>
<p><code><span style="font-family: Nimbus Roman No9 L,serif;"><span style="font-size: small;">StartServers 		5</span></span></code></p>
<p><code><span style="font-family: Nimbus Roman No9 L,serif;"><span style="font-size: small;">MinSpareServers 	5</span></span></code></p>
<p><code><span style="font-family: Nimbus Roman No9 L,serif;"><span style="font-size: small;">MaxSpareServers  	10</span></span></code></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">2.2.(j) ListenBacklog </span></p>
<p><span style="font-size: small;">If all the apache servers are busy processing requests, then new requests will not be rejected but queued if this directive is enabled. What is defined by this is the length of this queue. By default, it is 511. There is no need to change this value in many cases. </span></p>
<p><span style="font-size: small;">2.2.(k) KeepAlive </span></p>
<p><span style="font-size: small;">This is a platform independent and http related apache performance directive. Persistent connections allow a client to send more than one request over the same connection . This is a very useful feature that must be enabled which is highly beneficial to the clients. The preferred chioce is to keep this On.</span></p>
<p><span style="font-size: small;">2.2.(l) KeepAliveTimeout </span></p>
<p><span style="font-size: small;">This specifies the time in seconds apache process(or thread) will wait for the next request from the client once the previous is processed and delivered. If the client does not make the next request within this time, apache closes the connection and the same client, for a new request, will have to open a new connection with apache server. This may or may not be delayed since it will depend on the available idle apache servers to accept new connections. The default value is about 15 seconds.</span></p>
<p><span style="font-size: small;">2.2.(m) MaxKeepAliveRequests </span></p>
<p><span style="font-size: small;">When the number of requests defined by this directive is reached, apache will automatically terminate the persistent connection even if  KeepAliveTimeout value hasn&#8217;t expired. The value should be high such as 100 which is the most used. </span></p>
<p><span style="font-size: small;">2.2.(n) I will now mention some HTTP  intensive directives that are not much looked upon and left to their default in most cases. </span></p>
<p><span style="font-size: small;">LimitRequestBody</span></p>
<p><span style="font-size: small;">This directive specifies the number of bytes from 0 (meaning unlimited) to 2GB that are allowed in a equest body . It can be given server, per-directory, per-file or per-location basis. If the client request exceeds that limit, the server will return an error response instead of servicing the request. It is usually defeulted to 0. </span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">LimitRequestFields</span></p>
<p><span style="font-size: small;">This directive allows the server administrator to modify the limit on the number of request header fields allowed in an HTTP request. A server needs this value to be larger than the number of fields that a normal client request might include. The number of request header fields used by a client rarely exceeds 20 . This directive gives the server administrator greater control over abnormal client request behavior, which may be useful for avoiding some forms of denial-of-service attacks. It is defeulted to 100. </span></p>
<p><span style="font-size: small;">LimitRequestFieldSize</span></p>
<p><span style="font-size: small;">This directive allows the server administrator to reduce the limit on the allowed size of an HTTP request header field and is mentioned in bytes. This is also useful in preventing DOS attacks. The default is 8190 bytes.</span></p>
<p><span style="font-size: small;">LimitRequestLine </span></p>
<p><span style="font-size: small;">This directive allows the server administrator to reduce the limit on the allowed size of a client’s HTTP request-line .                                                                              Since the request-line consists of the HTTP method, URI, and protocol version, the LimitRequestLine directive places a restriction on the length of a request-URI allowed for a request on the server. This also helps in preventing DOS attacks to an extent. The default is 8190 characters. </span></p>
<p><span style="font-size: small;">2.2.(o) If a proxy web server is used supplementing your main server, then we must consider in including the apache module mod_expires since directives supplied by this is very useful in reducing the hits to main server by implementing the method of caching. The cache is maintained by the proxy. It is the headers of the resource sent to the proxy that tells it to cache the page or not. The directiuves of concern are: </span></p>
<p><span style="font-size: small;">ExpiresActive: This directive enables or disables the generation of the Expires header for the document that apache servers to the proxy. If set to Off or On, this can be overriden in .htaccess file. </span></p>
<p><span style="font-size: small;">ExpiresByType: This directive defines the value of the Expires header generated for documents of the specified type (e.g., text/html). The second argument sets the number of seconds that will be added to a base time to construct the expiration date. The base time is either the last modification time of the file, or the time of the client’s access to the document.</span></p>
<p><span style="font-size: small;">ExpiresDefault: This directive sets the default algorithm for calculating the expiration time for all documents in the affected realm.</span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">I shall give an example:</span></p>
<p><span style="font-size: small;"># enable expirations </span></p>
<p><span style="font-size: small;">ExpiresActive On </span></p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;"># expire GIF images after a month in the client’s cache </span></p>
<p><span style="font-size: small;">ExpiresByType image/gif A604800</span></p>
<p><span style="font-size: small;"># HTML documents are good for a week from the time they were changed </span></p>
<p><span style="font-size: small;">ExpiresByType text/html M604800 </span></p>
<p><!-- p { margin-bottom: 0.21cm; } --></p>
<p><span style="font-size: small;">By the 2<sup>nd</sup> line, we have set this feature to On. By the 4<sup>th</sup> and 6<sup>th</sup> line, we specify the the type of data for which caching should be enabled. We have set caching for image files of the format gif to a week. The character A before the time stands for &#8216;Access&#8217;. This tells apache that to send a header which will make the cached file expire 1 week  after the file was &#8216;Accessed&#8217; by the client. We have set the caching of text documents of the type html to 1 week. This time we have mentioned &#8216;M&#8217; before the time in seconds. M stands for modification. This tells Apache to send an Expires header so that documents expire 604800 seconds after the date they were last modified. The options available are M &amp; A  only. </span></p>
<p><span style="font-size: small;">Thus caching brings down the hit to webserver tremendously.</span></p>
<p><!-- p { margin-bottom: 0.21cm; }h3 { margin-bottom: 0.21cm; }h3.western { font-family: "Nimbus Roman No9 L",serif; } --><span style="font-size: small;">2.2.(p) ExtendedStatus</span></p>
<p><span style="font-size: small;">When this directive is set to On, it makes apache to issue two system calls to the OS to get time: gettimeofday(2) and time(2). This is done so that the status report contains indications of time. Its better to set this to Off. </span></p>
<p><!-- p { margin-bottom: 0.21cm; } --></p>
<p><span style="font-size: small;">2.2.(q) Scoreboard File</span></p>
<p><span style="font-size: small;">Since apache master server and its children communicate using the scoreborad file, it is always better to implement it in the shared memory area. Usually this will be on the disk. This change is made in </span><code><span style="font-family: Nimbus Roman No9 L,serif;"><span style="font-size: small;">src/main/conf.h file.</span></span></code></p>
<p><!-- p { margin-bottom: 0.21cm; } --><code><span style="font-family: Nimbus Roman No9 L,serif;"><span style="font-size: small;"><em><strong>I would suggest the reader to go through the below link for some of the best suggestions from professionals at Google for overall optimization of website and the webserver. Its really worth it. </strong></em></span></span></code></p>
<p><code><span style="font-family: Nimbus Roman No9 L,serif;"><span style="font-size: small;"><strong>http://code.google.com/speed/page-speed/docs/rules_intro.html</strong></span></span></code></p>
<p><!-- p { margin-bottom: 0.21cm; } --><code><span style="font-family: Nimbus Roman No9 L,serif;"><span style="font-size: small;">So I guess this would be the some of the main areas of apache to look on while configuring the software. In the next section we will see a bit on testing or benchmarking the Apache server. </span></span></code></p>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/home/?status=Apache+Performance+Tuning+%28Part+II%2FIII%29+-+Editing+Apache+for+Performance+http%3A%2F%2Fwww.supportsages.com%2Fblog%2F1642" title="Post to Twitter"><img class="nothumb" src="http://www.supportsages.com/blog/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter3.png" alt="Post to Twitter" /></a> <a  class="tt" href="http://twitter.com/home/?status=Apache+Performance+Tuning+%28Part+II%2FIII%29+-+Editing+Apache+for+Performance+http%3A%2F%2Fwww.supportsages.com%2Fblog%2F1642" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.supportsages.com/blog/2011/01/apache-performance-tuning-part-iiiii-editing-apache-for-performance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache Performance Tuning (Part I/III) &#8211; Choosing the Best Platform for Apache</title>
		<link>http://www.supportsages.com/blog/2011/01/apache-performance-tuning-part-iiii-choosing-the-best-platform-for-apache/</link>
		<comments>http://www.supportsages.com/blog/2011/01/apache-performance-tuning-part-iiii-choosing-the-best-platform-for-apache/#comments</comments>
		<pubDate>Tue, 04 Jan 2011 09:31:14 +0000</pubDate>
		<dc:creator>steve</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[apache performance]]></category>
		<category><![CDATA[tuning]]></category>
		<category><![CDATA[tuning apache]]></category>
		<category><![CDATA[tweaking]]></category>

		<guid isPermaLink="false">http://www.supportsages.com/blog/?p=1635</guid>
		<description><![CDATA[<!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">Apache is a highly configurable software. Apache tuning can be learned effectively only by getting first hand experiences in live environments. But, all the knowledge in this world, before being put into practical usage, will need proper theoretical explanation and analysis. This is what this document intends to provide you with references from online articles and books on Apache.</span>

<span style="font-size: small;">Configuring Apache for maximum performance requires our interest in 2 areas:</span>

<span style="font-size: small;"><strong>i) Tuning Apache so that it exploits the maximum out of the system's available Hardware and Software.</strong> The term Hardware ...]]></description>
			<content:encoded><![CDATA[<p><!-- p { margin-bottom: 0.21cm; } --><span style="font-size: small;">Apache is a highly configurable software. Apache tuning can be learned effectively only by getting first hand experiences in live environments. But, all the knowledge in this world, before being put into practical usage, will need proper theoretical explanation and analysis. This is what this document intends to provide you with references from online articles and books on Apache.</span></p>
<p><span style="font-size: small;">Configuring Apache for maximum performance requires our interest in 2 areas:</span></p>
<p><span style="font-size: small;"><strong>i) Tuning Apache so that it exploits the maximum out of the system&#8217;s available Hardware and Software.</strong> The term Hardware signifies the system CPU, RAM and the disk I/O. Software signifies apache-modules and system OS. Be it software or hardware, I haveoverhead mentioned only those components which the apache software is in direct concern with.</span></p>
<p><span style="font-size: small;"><strong>ii)Tuning Apache so that it withstands attacks.</strong> Just imagine. All our above efforts in (i)would be in vain if the software is not properly configured to resist attacks such as DOS and even more undesirable, the DDOS. Web server administrators in trying to do so discovered that this itself was a vast area to study and explore and lead to a stream called as &#8216;Apache Security&#8217;. This is why I have placed apache tuning into 2 areas. </span></p>
<p><span style="font-size: small;">So we are now going to journey into the former part. Although, I will not be able to give you a comprehensive detail on each subject (which will require hundreds of pages!) I will try to throw light on some of the most important areas to cover. </span></p>
<p><span style="font-size: small;">The performance tuning of apache will be done in a few stages. These are:</span></p>
<p><span style="font-size: small;">1. Choosing the Best Platform for Apache</span></p>
<p><span style="font-size: small;">2. Editing the Apache Software for Performance</span></p>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } 		H3 { margin-bottom: 0.21cm } --><span style="font-size: small;">From Part I through Part III, I have references from:</span></p>
<p><span style="font-size: small;"><em>- FMC – The Apache Modelling Project</em></span></p>
<p><em><span style="font-size: small;">- Pro Apache by Peter Wainwright</span></em></p>
<p><em><span style="font-size: small;">- http://perl.apache.org/docs/1.0/guide/performance.html</span></em></p>
<p><span style="font-size: small;">Lets discuss the former part.</span></p>
<p><span style="font-size: small;">A fine performing and well tuned software is of no use unless it has a good foundation to work on. It must have the best suited combination of both the Hardware &amp; Software(primarily the OS). Below I attempt to discuss some points which should be kept in mind.</span></p>
<p><span style="font-size: small;"><strong>1.1 </strong><span style="text-decoration: underline;"><strong>Choosing the Right Operating System</strong></span> </span></p>
<p><span style="font-size: small;">This is one of the main key element required for proper functioning of the server software. The characteristics of this highly influences the Apache software. Search for the below points when choosing the OS for apache.</span></p>
<p><span style="font-size: small;">1.1.(i) mod_perl Support for the Operating System </span></p>
<p><span style="font-size: small;">This is to be considered seriously since the module mod_perl is a very handy tool which can help in extracting the maximum out Apache. I will be discussing its significance(not tuning with mod_perl) towards the end of this document.</span></p>
<p><span style="font-size: small;">1.1.(ii) Supports &#8216;sendfile&#8217; system call</span></p>
<p><span style="font-size: small;">This mainly benefits applications following the client-server arhitecture. A sendfile system call in general improves delivery of data from disk over to sockets. For retriveing a client requrested data, from disk, applications spends much time in transferring data from disk to many intermediate buffers and only then, to the socket. This induces much delay. With OS having kernel supporting sendfile, this can be achieved in a single operation.</span></p>
<p><span style="font-size: small;">1. 1.(iii) Good Memory Management </span></p>
<p><span style="font-size: small;">The reason why I mention this is because for the same script, some OS will tend to use the twice as much as memory used by another. Please consider from discarding such OS from your list immediately.</span></p>
<p><span style="font-size: small;">1.1.(iv) Avoiding Memory Leaks </span></p>
<p><span style="font-size: small;">A memory leak happens when some process occupies some blocks of memory and does not release it after it completes the execution of instructions which require those memory blocks. As a result, this part of the memory becomes unusable to other processes until the process that has occupied it has died. We certainly do not want that.</span></p>
<p><span style="font-size: small;">1.1.(iv) Memory-Sharing Capabilities </span></p>
<p><span style="font-size: small;">The new processes(children) that are spawned by apache should be able to share the features of the loaded modules of the parent apache process. This can save much memory and can be realized only if the OS supports memory sharing.</span></p>
<p><span style="font-size: small;">1.1.(v) The Support for OS</span></p>
<p><span style="font-size: small;">Good technical support must be available for the OS you implement and the support team remain vigilant about the holes and other aspects so that they do not give way for hackers. They should also be able to provide you personal support regarding the issues you have with your OS.</span></p>
<p><span style="font-size: small;">1.1.(vi) Discontinued Products</span></p>
<p><span style="font-size: small;">The company of your OS should not all of a sudden withdraw the release of new products and this can prove very bad in course of time even if you are satisfied with the functioning of the OS currently.</span></p>
<p><span style="font-size: small;">1.1.(vii) Regular OS releases</span></p>
<p><span style="font-size: small;">The OS needs to be kept up to date with the latest technology and kernel updates which are utmost necessary to keep the OS stable and free from security leaks.</span></p>
<p><span style="font-size: small;"><strong>1.2 <span style="text-decoration: underline;">Choosing the Right Hardware</span></strong></span></p>
<p><span style="font-size: small;">In concern with Hardware, there are no hard-set rules in calculating the appropriate number(the number specification of hardware. Eg: 128M RAM). This is because the number needed will be depend on the environment you place Apache in. A well functioning OS can be built on a good hardware and implementation such as:</span></p>
<p><span style="font-size: small;">1.2.(i) Random Access Memory (RAM)</span></p>
<p><span style="font-size: small;">Although you may see everywhere as the amount of installed RAM on the system, this is misleading. What actually counts is the RAM that is actually available to apache process. So we should actually calculate the amount of RAM usage on the system with all the process except apache started. This will be the available RAM for apache. The main goal while calculating the RAM for the server should be: the system never goes into a state to use the SWAP memory. When you need to write something into memory, and it is full, it swaps pages out of the memory that are less frequently used to the SWAP space. Only then you will be able to perform write operation to RAM memory. Thus delay is caused. </span></p>
<p><span style="font-size: small;">In the meantime if an other application supplementing the web server requests some pages and if it happens to be in one of the swapped pages, then the processor will have to load those pages again into main memory(RAM) swapping out some other data which might be needed in a short while. Let to repeat this, the state of the system can get worse. While configuring, you should also be aware that other essential system processes also need to be running smoothly. </span></p>
<p><span style="font-size: small;">1.2.(ii) CPU</span></p>
<p><span style="font-size: small;">This is the &#8216;Processor&#8217;. Using multicore processor with multi cache levels is a general and accepted implementation.</span></p>
<p><span style="font-size: small;">1.2.(iii) Disks with good I/O</span></p>
<p><span style="font-size: small;">Since apache is constant process of retrieval and writing data into disk, a good disk with high I/O capabilities is very much essential. This can also be achieved by implementing RAID.</span></p>
<p><span style="font-size: small;">1.2.(iv) Network Interface Card (NIC)</span></p>
<p><span style="font-size: small;">A hardware component that allows your machine to connect to the network. It sends and receives packets. NICs come in different speeds, varying from 10 MBps to 10 GBps and faster. The most widely used NIC type is the one that implements the Ethernet networking protocol.</span></p>
<p><span style="font-size: small;">1.2.(v) Cluster Implementation</span></p>
<p><span style="font-size: small;">As the name suggests, one or more interconnected machines working together to perform one big task is the core idea behind clustering. This is also implemented to provide backup during failure of one machine in the cluster. Similar to implementing RAID in disks to account for recovery from data loss due to disk failure.</span></p>
<p><span style="font-size: small;">1.2.(vi) Load balancing</span></p>
<p><span style="font-size: small;">This is a by product of clustering. If a web server is unable to handle load, it then dispatches the requests it receives to the web servers in it&#8217;s cluster to server the requests. In this mode of implementation, the http request will always reach first to the main server which is configured to hold the sites(or the as mentioned in the DNS). The server according to its load, will either server the request or dispatch the request to its&#8217;s load balancing server which handles the request from thereon.</span></p>
<div class="tweetthis" style="text-align:left;"><p> <a  class="tt" href="http://twitter.com/home/?status=Apache+Performance+Tuning+%28Part+I%2FIII%29+-+Choosing+the+Best+Platform+for+Apache++http%3A%2F%2Fwww.supportsages.com%2Fblog%2F1635" title="Post to Twitter"><img class="nothumb" src="http://www.supportsages.com/blog/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter3.png" alt="Post to Twitter" /></a> <a  class="tt" href="http://twitter.com/home/?status=Apache+Performance+Tuning+%28Part+I%2FIII%29+-+Choosing+the+Best+Platform+for+Apache++http%3A%2F%2Fwww.supportsages.com%2Fblog%2F1635" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.supportsages.com/blog/2011/01/apache-performance-tuning-part-iiii-choosing-the-best-platform-for-apache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Win32 style directory indexing in apache &#8211; Date and Size along with the name</title>
		<link>http://www.supportsages.com/blog/2009/07/win32-style-directory-indexing-in-apache-date-and-size-along-with-the-name/</link>
		<comments>http://www.supportsages.com/blog/2009/07/win32-style-directory-indexing-in-apache-date-and-size-along-with-the-name/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 14:03:34 +0000</pubDate>
		<dc:creator>George</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Specials]]></category>
		<category><![CDATA[dat and size in indexing]]></category>
		<category><![CDATA[directory index]]></category>
		<category><![CDATA[fancy indexing]]></category>

		<guid isPermaLink="false">http://www.supportsages.com/blog/?p=453</guid>
		<description><![CDATA[Inorder to have win32 styled directory indexing in apache, you need to make sure that mod_autoindex module is installed and active in the server. In cPanel 11 servers, it will have the modules enabled in, /usr/local/apache/conf/extra/httpd-autoindex.conf

So for the client who want to have the fancy directory indexing to be enabled, just add the below lines to his .htaccess
<blockquote>Options +Indexes
IndexOptions FancyIndexing VersionSort</blockquote>
I hope this snippet will help someone!]]></description>
			<content:encoded><![CDATA[<p>Inorder to have win32 styled directory indexing in apache, you need to make sure that mod_autoindex module is installed and active in the server. In cPanel 11 servers, it will have the modules enabled in, /usr/local/apache/conf/extra/httpd-autoindex.conf</p>
<p>So for the client who want to have the fancy directory indexing to be enabled, just add the below lines to his .htaccess</p>
<blockquote><p>Options +Indexes<br />
IndexOptions FancyIndexing VersionSort</p></blockquote>
<p>I hope this snippet will help someone!</p>
<div class="tweetthis" style="text-align:left;"><p> <a  class="tt" href="http://twitter.com/home/?status=Win32+style+directory+indexing+in+apache+-+Date+and+Size+along+with+the+name+http%3A%2F%2Fwww.supportsages.com%2Fblog%2F453" title="Post to Twitter"><img class="nothumb" src="http://www.supportsages.com/blog/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter3.png" alt="Post to Twitter" /></a> <a  class="tt" href="http://twitter.com/home/?status=Win32+style+directory+indexing+in+apache+-+Date+and+Size+along+with+the+name+http%3A%2F%2Fwww.supportsages.com%2Fblog%2F453" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.supportsages.com/blog/2009/07/win32-style-directory-indexing-in-apache-date-and-size-along-with-the-name/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How would I see the available versions of cPanel and Apache in a cPanel installed server ?</title>
		<link>http://www.supportsages.com/blog/2009/04/how-would-i-see-the-available-versions-of-cpanel-and-apache-in-a-cpanel-installed-server/</link>
		<comments>http://www.supportsages.com/blog/2009/04/how-would-i-see-the-available-versions-of-cpanel-and-apache-in-a-cpanel-installed-server/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 06:57:24 +0000</pubDate>
		<dc:creator>Fabian</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[cPanel]]></category>
		<category><![CDATA[changelog]]></category>
		<category><![CDATA[easyapache]]></category>

		<guid isPermaLink="false">http://www.supportsages.com/blog/?p=30</guid>
		<description><![CDATA[Solution #1 : Keep browsing http://changelog.cpanel.net/ every day :-)

Solution #2 :  /scripts/easyapache --latest-versions

Easy::Apache v3.2.0 Build 4660

[Apache]
1.3.41, 2.0.63, 2.2.11

[PHP 4]
4.4.6, 4.4.7, 4.4.8, 4.4.9

[PHP 5]
5.2.5, 5.2.6, 5.2.8, 5.2.9]]></description>
			<content:encoded><![CDATA[<p>Solution #1 : Keep browsing http://changelog.cpanel.net/ every day <img src='http://www.supportsages.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Solution #2 :  /scripts/easyapache &#8211;latest-versions</p>
<p>Easy::Apache v3.2.0 Build 4660</p>
<p>[Apache]<br />
1.3.41, 2.0.63, 2.2.11</p>
<p>[PHP 4]<br />
4.4.6, 4.4.7, 4.4.8, 4.4.9</p>
<p>[PHP 5]<br />
5.2.5, 5.2.6, 5.2.8, 5.2.9</p>
<div class="tweetthis" style="text-align:left;"><p> <a  class="tt" href="http://twitter.com/home/?status=How+would+I+see+the+available+versions+of+cPanel+and+Apache+in+a+cPanel+installed+server+%3F+http%3A%2F%2Fwww.supportsages.com%2Fblog%2F30" title="Post to Twitter"><img class="nothumb" src="http://www.supportsages.com/blog/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter3.png" alt="Post to Twitter" /></a> <a  class="tt" href="http://twitter.com/home/?status=How+would+I+see+the+available+versions+of+cPanel+and+Apache+in+a+cPanel+installed+server+%3F+http%3A%2F%2Fwww.supportsages.com%2Fblog%2F30" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.supportsages.com/blog/2009/04/how-would-i-see-the-available-versions-of-cpanel-and-apache-in-a-cpanel-installed-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

