Apache Tuning

Thread Manager

The modular nature of Apache has the ability to switch and replace modules interchangeably. In Apache 2 there is a new thread processing manager. Whilst it brings true multi threading to Apache, it increased the overhead and complexity of the web server.

To decrease the resources used and troubleshooting Apache errors such as

Cannot allocate memory: apr_thread_create: unable to create worker thread

use the old style module similar in Apache 1.3 which is safe for non thread safe modules.

To install this module in Ubuntu 8.04 use the command:
apt-get install apache2-mpm-prefork

Apache Connection Settings

Apache can control the number of clients connected to a website as well as how many processes it spawns for each site ready to handle a web request. These are all controlled in the apache2.conf file which, under Ubuntu 8.04 is located in
/etc/apache/
The main entries can toggle the different settings threads are:

A guide for the “MaxClients” directive is the amount of RAM dedicated to Apache. The formula is

amount of RAM (MB) / 5

It’s divisable by 5 because it’s estimated to that each web request takes about 5MB of RAM.

Apache Benchmark

Apache has a benchmarking utility which are usually included in Linux distributions called Apache Benchmark or AB for short. It allows people to simulate web access by sending requests to the server as if some one was visiting a site. A useful example of this utility is:
ab -kc 10 -t 30 http://localhost/
where:

Mac Geekery on Apache Benchmark

Shabuz Lamp website

About Danny

I.T software professional always studying and applying the knowledge gained and one way of doing this is to blog. Danny also has participates in a part time project called Energy@Home [http://code.google.com/p/energyathome/] for monitoring energy usage on a premise. Dedicated to I.T since studying pure Information Technology since the age of 16, Danny Tsang working in the field that he has aimed for since leaving school. View all posts by Danny → This entry was posted in Linux and tagged , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *.

All comments must go through an approval and anti-spam process before appearing on the website. Please be patience and do not re-submit your comment if it does not appear.

This site uses Akismet to reduce spam. Learn how your comment data is processed.