Apache Directives

 Top

 Server Level Directives

Directive NameDescription
LogFormat mod_benchmark defines new variables that can be used to add information to the request log:

%{BenchmarkElapsed}n which gives the elapsed time to answer the request. The time format is "seconds.micro-seconds"

%{BenchmarkScoreBoard}n gives the count of ready and busy Apache instances at the request time.

%{BenchmarkProcStat}n gives the count of zombie, running, sleeping and waiting processes

%{BenchmarkMemStat}n gives the percentage of used memory and swap
BenchmarkWithLogInfo Value: on|off

Must be set to on to make mod_benchmark gives values to the new extra variables that can be used in LogFormat directive (see above).
BenchmarkTrace Value: debug

Sets the module in "debug" mode. Debug messages will be added to the Apache error log.
BenchmarkUseScoreBoard Value: on|off

Using the Apache scoreboard makes each request logged with the count of ready and busy Apache instances at the time it was required by the client. Logging this information can be useful if you want to correlate the response time with the system load.
BenchmarkStore Value: PathToDBInterface.so:dbserver:dbname:dbuser:dbpwd

Each request measured by mod_benchmark can be logged in the Apache log (using the LogFormat directive) and/or can be stored in a database.
To store the requests in a Database, you must specify the interface for this Database (MySQL, Sybase...), and then the four parameters that allow the module to connect and store data in the database tables.
Normally, the tables have been created from the benchmark-{database}.sql script.
BenchmarkWithSysInfo Value: on|off:statprogram:socketname:interval

For each measured request, the module can also store the current system load and memory usage. Logging this information can be useful if you want to correlate the response time with the system load.
If you specify the "on" value, mod_benchmark will start the specified "statprogram" (normally sysstat2) process at launch time. This process will then communicate with the module using the "socketname" Unix socket and will compute the system load at each "interval" seconds.

The "statprogram" will be automatically stopped when Apache stops.
BenchmarkWithStatProg Value: on|off:statprogram:dirname:username

If you specify the "on" value, mod_benchmark will start the specified "statprogram" (normally benchmark_rt) process at launch time. For each requested URI, mod_benchmark will send various counters to this program.
This program can then be perdiodically consulted to get the statistics. Big-Brother integration uses this mechanism.

"dirname" is the name of the directory where some temporary files will be created (usually /tmp).
"username" is the name of the user the "statprogram" must be run under. Since you must send signals to communicate with the benchmark_rt, it must be owned by the same user as the process sending these signals.

The "statprogram" will be automatically stopped when Apache stops
BenchmarkAlertAction Value: proc

Each time a request will overrun the threshold specified by the "BenchmarkAlertLimit" directive (see below), it will run the external "proc" program with the request and the response time (in milliseconds) as arguments.
See the "alerter.sh" script which is given as a sample of "proc" external program.

 Location Level Directives

Please note the directives of this section are only valid in a Location block and not in a Directory block.

Directive NameDescription
BenchmarkEngine Value: on|off

Activate or desactivate the module for the current Location block.
BenchmarkAccept Value: regexp

Regular expression that filters the URI to handle.
For example, if you want to measure PHP and PL scripts only, specify:

BenchmarkAccept \.php$|\.pl$
BenchmarkAlertLimit Value: threshold

If you insert a "BenchmarkAlertAction" direction (see above), you can specify the "threshold" (in milliseconds) for the generated alerts.

 Configuration Sample

...
LoadModule benchmark_module modules/mod_benchmark.so
AddModule mod_benchmark.c
...
LogFormat "%t %{BenchmarkElapsed}n %{BenchmarkScoreBoard}n \"%r\" %s %B" benchmark_log
CustomLog logs/benchmark.log benchmark_log
...
#BenchmarkTrace debug
BenchmarkUseScoreBoard on

# use the MySQL interface: BenchmarkStore /usr/lib/apache/benchmark-mysql.so:localhost:benchmark:wwwrun:wwwpwd

BenchmarkWithSysInfo on:/usr/local/apache/modules/sysstat2:/tmp/bench:5
BenchmarkWithStatProg on:/usr/local/apache/modules/benchmark_rt:/tmp:bb BenchmarkAlertAction /usr/local/apache/modules/alerter.sh
...
<Location /scripts>
    BenchmarkEngine on
    BenchmarkAccept \.html$|\.php$
    BenchmarkAlertLimit 200
</Location>


www.trickytools.com