Problems with pstore.rb under mod_ruby

I have a web application that runs under mod_ruby and uses a pstore
for persistant storage.

From time to time (apparently when the system is under heavy load),
the pstore database gets corrupted or left in a state where the pstore
db file (call it foo.pstore) is missing but the backup (foo.pstore~)
is still around.

I can generally exercise the problem by rapidly hitting reload so I’m
assuming that the ruby interpreter running the pstore code is getting
interrupted while performing an update and leaving things in an
indeterminate state.

What’s do folks here recommend as the right way to fix this problem?

A second, possibly related question is…is there a way to reduce the
overhead I’m incurring with each page request? Currently, each page
request separately opens the db, performs some action with it, then
closes the db. I would prefer to have it so that the first page access
opens the pstore db, which then stays around for use by subsequent
page requests.

Unfortunately, I’m still a bit confused as to the extent to which
information may be shared across requests. As I understand it,
mod_ruby (or apache) actually runs a pool of ruby interpreters each of
which has its own separate environment. A given request might end up
hitting any one of these. Is there away to have a single db
connection shared by all these ruby interpreters or must each one have
its own separate connection?

Thanks for any assistance you can offer.

					Bruce