Multiple database: one vs multiple mongrel + rails processes?

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/