Skip Navigation

Sign up

If you sign up for an account on this web site you can customise elements of this site and subscribe to an email newsletter.

If you have an account on this web site you may login.

If you have an account on this site but have forgotten your user name and / or your password then you can request an account reminder email.

Server Tuning

Some notes on tuning a server for MKDoc.

mod_perl

See the Performance Tuning document from the mod_perl 1.0 User Guide.

Memory Usage

If you install the GTop module and add this code (based on the Calculating Real Memory Usage code) to the end of mkdoc.cgi (before 1;):

use GTop;
my $proc_mem = GTop->new->proc_mem($$);
my $diff     = $proc_mem->size - $proc_mem->share;
$diff = $diff/1024;
$diff = $diff/1024;
my $size = $proc_mem->size;
$size = $size/1024;
$size = $size/1024;
my $share = $proc_mem->share;
$share = $share/1024;
$share = $share/1024;
print STDERR "Difference is $diff MB, Size is $size MB and Share is $share MB\n";

Then you will get lines like this written to the error log:

Difference is 40.4765625 MB, Size is 45.234375 MB and Share is 4.7578125 MB
Difference is 40.73828125 MB, Size is 45.49609375 MB and Share is 4.7578125 MB
Difference is 42.01171875 MB, Size is 46.76953125 MB and Share is 4.7578125 MB
Difference is 40.9453125 MB, Size is 45.6875 MB and Share is 4.7421875 MB
Difference is 41.69921875 MB, Size is 46.44140625 MB and Share is 4.7421875 MB

This basically means that each Apache process uses around 40MB of RAM and in addition there is about 5MB of shared RAM.

.
              Total RAM Dedicated to the Webserver
 MaxClients = ------------------------------------
                    MAX child's process size

MySQL

Each apache process will use on MySQL process so the MySQL max_connections should not be set to be less than the Apache MaxClients.

See the Solving Memory Bottlenecks section of the High Performance MySQL book is worth looking at.

The MySQL you have probably came with sample config files for different situations, for example in /usr/share/mysql/*.cnf — it's probably best to pick the one best suited and use this as a basis for the MySQL main config file, /etc/my.cnf.

You can view the variables like this:

mysqladmin -uroot -pXXX variables

And you can see the number of processes like this:

mysqladmin -uroot -pXXX processlist

The mytop perl module is good for displaying mysql processes dynamically.

Up

This document was last modified by Chris Croome on 2005-04-20 08:15:59
MKDoc Ltd., 31 Psalter Lane, Sheffield, S11 8YL, UK.
Copyright © 2001-2005 MKDoc Ltd.