Ruby on Rails on managed hosting environment

Hi all,
My app is deployed on a managed hositng server. So there are many
applicaion servers running my app. The maximum no. of database
connections that can be used is 50. The problem is that due to fastcgi
caching the database connections Few application servers don’t get the
database connections. Can some one guide me how I can handle this