# Multiple database: one vs multiple mongrel + rails processes?

**URL:** <https://www.ruby-forum.com/t/multiple-database-one-vs-multiple-mongrel-rails-processes/120058>\
**Category:** Rails\
**Created:** [November 13, 2007, 12:36pm UTC](https://www.ruby-forum.com/t/multiple-database-one-vs-multiple-mongrel-rails-processes/120058 "2007-11-13T12:36:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Canatella](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f17d59/32.png) [@Canatella](https://www.ruby-forum.com/u/Canatella)\
**Post date:** [November 13, 2007, 12:36pm UTC](https://www.ruby-forum.com/t/multiple-database-one-vs-multiple-mongrel-rails-processes/120058/1 "2007-11-13T12:36:06Z")

</div>

Hello everybody,

I’m creating an application where I would like every customer to have  
it’s own database, for privacy reason. Each customer will access the  
application using a wildcard virtual host like customer-  
name.domain.tld .

I’m wondering if I should

1. use multiple instance of mongrel, each running against one database  
or
2. use one instance of mongrel connecting agains multiple database.

At first glance, here are my thought:

solution 1., pros:

- least intrusive in regards to rails
- allows caching of queries

solution 1. cons:

- need one instance of mongrel + rails per customer, which means lots  
of memory.
- harder maintenance

solution 2., pros:

- 1 mongrel instance, easier maintenance
- smaller memory foot print

solution 2. cons:

- no caching of sql queries, or I need database connection pooling ?
- need to hack in the heart of rails/mongrel\_rails

What are you thought and advices on this matter ?

The access by each customer should be fairly low, maybe 100 hits a  
day.

Thank you very much,

–  
Damien M.  
[http://blog.cosinux.org/](http://blog.cosinux.org/)
