<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=Apache_workers</id>
	<title>Apache workers - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=Apache_workers"/>
	<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=Apache_workers&amp;action=history"/>
	<updated>2026-05-13T09:43:28Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://training-course-material.com/index.php?title=Apache_workers&amp;diff=23957&amp;oldid=prev</id>
		<title>Cesar Chew at 17:47, 24 November 2014</title>
		<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=Apache_workers&amp;diff=23957&amp;oldid=prev"/>
		<updated>2014-11-24T17:47:01Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Cat|Apache|02}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;slideshow style=&amp;quot;nobleprog&amp;quot; headingmark=&amp;quot;⌘&amp;quot; incmark=&amp;quot;…&amp;quot; scaled=&amp;quot;true&amp;quot; font=&amp;quot;Trebuchet MS&amp;quot; &amp;gt;&lt;br /&gt;
;title: Apache workers&lt;br /&gt;
;author: Sam Bashton (NobleProg Ltd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/slideshow&amp;gt;&lt;br /&gt;
=== Apache worker model ⌘===&lt;br /&gt;
* Apache can function using different models&lt;br /&gt;
* Most common - prefork&lt;br /&gt;
=== Apache prefork ⌘===&lt;br /&gt;
* One central Apache process to accept incoming connections, read configuration etc&lt;br /&gt;
* Multiple child processes to serve requests&lt;br /&gt;
* Each child can serve only one request at a time&lt;br /&gt;
=== Apache prefork settings ⌘===&lt;br /&gt;
 ```&lt;br /&gt;
 StartServers       8&lt;br /&gt;
 MinSpareServers    5&lt;br /&gt;
 MaxSpareServers   20&lt;br /&gt;
 ServerLimit      256&lt;br /&gt;
 MaxClients       256&lt;br /&gt;
 MaxRequestsPerChild  4000&lt;br /&gt;
 ```&lt;br /&gt;
=== Tuning Apache prefork ⌘===&lt;br /&gt;
* StartServers&lt;br /&gt;
:* Number of Apache processes to create on first start&lt;br /&gt;
* MinSpareServers&lt;br /&gt;
:* Minimum number of spare Apache processes that should be available at any time.  If less spare workers than this are available, Apache will start more&lt;br /&gt;
* MaxSpareServers&lt;br /&gt;
:* Maximum number of spare workers.If more than this are available, Apache will kill them off at a rate of 1/second to bring it below this.&lt;br /&gt;
=== Tuning Apache prefork ⌘===&lt;br /&gt;
* Default EL5 config has a maximum of 256 child processes&lt;br /&gt;
* This means maximum 256 concurrent requests&lt;br /&gt;
* In reality, 256 may well be too high&lt;br /&gt;
* When using PHP, Apache processes are often 30MB+&lt;br /&gt;
* 30 * 256 = 7680MB of RAM required, just for workers&lt;br /&gt;
* Under these conditions, 256 MaxClients suitable only for machines with at 8GB RAM&lt;br /&gt;
=== Sizing MaxClients ⌘===&lt;br /&gt;
* Tool ps_mem.py can be used&lt;br /&gt;
:* http://www.pixelbeat.org/scripts/ps_mem.py&lt;br /&gt;
:* Shows actual RAM in use by each process&lt;br /&gt;
:* Should be used on a server with a representative workload&lt;br /&gt;
* Set MaxClients too high, and you&amp;#039;ll start swapping&lt;br /&gt;
=== What are the workers doing? ⌘===&lt;br /&gt;
* Apache module `mod_status` shows this data&lt;br /&gt;
* Module is loaded by default but not enabled&lt;br /&gt;
* Uncomment the section in /etc/httpd/conf/httpd.conf to enable&lt;br /&gt;
:* Change `.example.com` to `127.0.0.1`&lt;br /&gt;
* Once enabled, run `service httpd fullstatus` to see data&lt;br /&gt;
=== Exercise ⌘===&lt;br /&gt;
* Enable mod_status and find the status of each worker&lt;br /&gt;
* How much memory is each httpd process using on your VM?&lt;br /&gt;
* What is a suitable value for MaxClients on this VM based on the above?&lt;/div&gt;</summary>
		<author><name>Cesar Chew</name></author>
	</entry>
</feed>