mod_dbi_pool Documentation

Home » Projects » Apache » Mod_dbi_pool » Docs » mod_dbi_pool Documentation

Documentation

Compilation

mod_dbi_pool uses the "configure/make/make install" mechanism common to many Open Source programs. Most of the dirty work is handled by either configure or Apache's apxs utility. If you have built Apache modules before, there shouldn't be any surprises for you.

The interesting options you can pass to configure are:

  • --with-apxs=/path/to/apache/dir/bin/apxs

    This option is used to specify the location of the apxs utility that was installed as part of apache. Specify the location of the binary, not the directory it is located in.

  • --with-dbi=PREFIX

    Prefix where libdbi is installed.

  • --help

    Provides a list of available configure options.

./configure --with-apxs=/usr/sbin/apxs2
make
make install

Integration into Apache

To activate mod_dbi_pool Just add

LoadModule dbi_pool_module modules/mod_dbi_pool.so

to your httpd.conf and restart Apache.

mod_dbi_pool also provides two exported functions for other Apache Modules to use:

dbi_conn *dbipool_open (conn_id id);
void dbipool_close (conn_id id, dbi_conn* conn);

Configuring with Apache

A configuration set is all the parameters that describe one database pool. You can have an unlimited number of configuration sets, and each set can be used concurantly. mod_dbi_pool has the following directives:

Add the following to your httpd.conf for a simple pool:

PoolDbiDriver         Server1  mysql
PoolDbiHost           Server1  10.0.0.20
PoolDbiUsername       Server1  myuser
PoolDbiPassword       Server1  mypass
PoolDbiDBName         Server1  vhost_dbi
PoolDbiConnMin        Server1  1
PoolDbiConnSoftMax    Server1  1
PoolDbiConnHardMax    Server1  5
PoolDbiConnTTL        Server1  30

PoolDbiConnHardMax

Description: The Hard Maximum Number of Database Connections
Syntax: PoolDbiConnHardMax CONFIG_SET NUMBER
Default: 25
Context: server config

This is the absolute maximum number of connections that mod_dbi_pool will open for this configuration set.

PoolDbiConnMin

Description: The Minimum Number of Database Connections
Syntax: PoolDbiConnMin CONFIG_SET NUMBER
Default: 1
Context: server config

The minimum number of connections to the database server that mod_dbi_pool will maintain for this configuration set. This is also the number of connections that mod_dbi_pool will create on start-up for the given configuration set.

PoolDbiConnSoftMax

Description: The Soft Maximum Number of Database Connections
Syntax: PoolDbiConnSoftMax CONFIG_SET NUMBER
Default: 5
Context: server config

The soft maximum number of connections to the database server that mod_dbi_pool will maintain for this configuration set. Idle connections above this limit will be closed after the time set by AuthnDbiConnTTL has expired for them.

PoolDbiConnTTL

Description: The database pool time-to-live for each connection.
Syntax: PoolDbiConnTTL CONFIG_SET SECONDS
Default: 600
Context: server config

This gives the time in seconds after which idle connections above the soft limit will be closed.

PoolDbiDBName

Description: The name of the database containing the tables
Syntax: PoolDbiDBName CONFIG_SET DB_NAME
Default: mod_dbi
Context: server config

The name of the database that will be used.

PoolDbiDriver

Description: Sets the Driver that DBI Uses
Syntax: PoolDbiDriver CONFIG_SET DB_DRIVER_NAME
Default: mysql
Context: server config

The name of the driver that is passed to libdbi. The possible values depend on what libdbi drivers you have installed.

PoolDbiHost

Description: The host for the database connection
Syntax: PoolDbiHost CONFIG_SET HOSTNAME
Default: localhost
Context: server config

This is the hostname of the database host for this configuration. Specify a hostname or an IP address. Again, this string is just passed to libdbi.

PoolDbiPassword

Description: The password for the database connection
Syntax: PoolDbiPassword CONFIG_SET PASSWORD
Default: ""
Context: server config

The password that is used when logging in to the database.

PoolDbiUsername

Description: The username for the database connection
Syntax: PoolDbiUsername CONFIG_SET USERNAME
Default: root
Context: server config

The username that is used when logging-in to the database.