
Eats and spits code by day
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 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 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
Related posts: