Great! 10x! It's working!
DBIx creates connection at every query?
Or it uses sheared dbhandle?
May be you read it before me ) | [reply] |
DBIx::Class re-uses existing connections. It checks if connections are still open: if so they are re-used otherwise it reconnects.Please note DBIx::Class is not sharing connections: every my $schema = My::DB->connect('dbi:mysql:DB', 'user', 'secret_password'); will remain separate from every other connection, but every query within an individual $schema will re-use the same connection as long as it is still open. Connections only get closed when the script finishes or when explicitly closed ($schema->disconnect;) or when timed-out server-side.
CountZero A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
| [reply] [d/l] [select] |
I am using DBIx::Class and when I look at the processlist (mysql) all the connections are in state of sleep. I am using mod_perl so the scripts should be staying alive. Is it recommended to call disconnect each time or to try and re-use the existing connection?
| [reply] |
Sorry, thought I was logged in. This applies to the post above.
I also tried using Apache::DBI and it didn't seem to work and I have since read this is not recommended either. Is that not a good solution?
| [reply] |