Tom Sawyer <transami / transami.net> writes:

> but my web app is dog slow. one of the reasons is that i connect to the
> database on every request. is there a way to persist a database
> connection between requests?

Switching to mod_ruby would help a lot, both removing the interpreter
start-up time and giving you a persistent database connection.

For the connection, something as simple as

  db ||= DBI.connect(...)

at the start of the script will work fine until you want to get
sophisticated and do things like reconnect after database shutdowns
and the like.


Cheers


Dave