[cgiapp] is my app caching db connection ?

silent silent2600 at gmail.com
Sun Jul 27 07:38:33 EDT 2008


Hi list,
I just write a small C::A script which used C::A::Plugin::DBH,
I just use $self->dbh_config(dsn, user, pass); in cgiapp_init(),
and the script runs as fastcgi on apache with C::A::Dispatch,

but when I use ab to benchmark the script,
the db connection seems not be cached:

mysql> show processlist;
+------+------+-----------+-----------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+------+------+-----------+-----------+---------+------+-------+------------------+
| 2119 | root | localhost | NULL | Query | 0 | NULL | show processlist |
| 2461 | root | localhost | joke | Sleep | 0 | | NULL |
+------+------+-----------+-----------+---------+------+-------+------------------+
2 rows in set (0.00 sec)

mysql> show processlist;
+------+------+-----------+-----------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+------+------+-----------+-----------+---------+------+-------+------------------+
| 2119 | root | localhost | NULL | Query | 0 | NULL | show processlist |
| 2780 | root | localhost | joke | Sleep | 0 | | NULL |
+------+------+-----------+-----------+---------+------+-------+------------------+
2 rows in set (0.00 sec)

the different process_id (2461, 2780) means they are two different
connections ?




and the same question on C::A::plugin::Config::Simple, I use it in
cgiapp_init() by
$self->config_file(file_name);

can this cache the config object ?


thanks!


More information about the cgiapp mailing list