About: multi database performance on Substruct

Hello,
I forked the sweet Substruct and applied Advanced Recipe 83: I associate
a
different shop (separate database) to each ‘installation’ according to
the
subdomain the application is accessed from. Do you think it makes sense?
Basically AR queries main database once to fetch ‘installation’ object
and
connects to installation.database if the subdomain is configured or
loads
the demo database/shop instead. It seems a good idea (to me) to keep
every
(admin) account clearly separated and it’s by far easier not to
completely
re-write Substruct logic to manage more than one admin. Passenger on
dreamhost.


Emanuele T.
+1 (619) 549 3230
4955 Narragansett Ave Apt #9
San Diego Ca 92107-3157

the demo database/shop instead. It seems a good idea (to me) to keep
every
(admin) account clearly separated and it’s by far easier not to
completely
re-write Substruct logic to manage more than one admin. Passenger on
dreamhost.

Sounds good to me if you can manage it :slight_smile:
-=R

So where’s the fork?


seth - subimage llc

http://sublog.subimage.com

Cashboard - Estimates, invoices, and time tracking software - for free!
http://www.getcashboard.com

Substruct - Open source RoR e-commerce software.
http://code.google.com/p/substruct/

Why you need to go for the isolated database for each tenant (shop)?
What are all the advantages and disadvantages of this? How you will
achieve this technically in ROR application? How the active records will
know what connection to use?

Just curious to know since we are also analyzing deep in what are all
the pros and cons in using the isolated database for each tenant. We
have some thought on this design. Just curious to know what others are
thinking on this.

On Wed, Sep 17, 2008 at 10:38 PM, Ayyanar Aswathaman <
[email protected]> wrote:

Why you need to go for the isolated database for each tenant (shop)?

I’m trying to add multi admin/shop support to the application and, seen
the
original database structure, it seems easier just to use one database
for
each shop.

What are all the advantages and disadvantages of this?

This is what I’m trying to find out. So far, so good but I didn’t see
any
other application dealing with multiple database and when you’re the
only
one you’re usually on the wrong path!

how you will achieve this technically in ROR application? How the active
records will know what connection to use?

This is quite easy: using subdomains for shops I just ask AcriveRecord
to
connect to the ‘current’ database, basically every database is a copy of
the
original one, I wrote some
new rake code (and found out later that I’m not allowed to script-create
database, but this is another story!)
There is only one model, ‘Installation’ that always connects to the main
database and it’s used to switch between shops. I’m trying to find out
if
shop switch can create a mess, but
everything is okay by far…

@installation = Installation.for(request.host, request.subdomains)

ActiveRecord::Base.establish_connection(:adapter => “mysql”,
:host => “localhost”,
:username => “root”,
:password => “”,
:database => @installation.database)

see http://mek.venicebuy.eu/ and http://usul.venicebuy.eu/ are running
online

Just curious to know since we are also analyzing deep in what are all
the pros and cons in using the isolated database for each tenant. We
have some thought on this design. Just curious to know what others are
thinking on this.

I wish I could see this application with heavy load and we could
understand!
:slight_smile:


Posted via http://www.ruby-forum.com/.


Emanuele T.
+1 (619) 549 3230
4955 Narragansett Ave Apt #9
San Diego Ca 92107-3157

How you do the authentication and authorization in your multi-tenant
application? Are you using any authentication and authorization
plug-ins?

Thanks Emanuele.

I’m using the normal Substruct authorization methods: each subdomain not
only load the appropriate database (and every admin has his own password
for
his db), but alsocreate a different session and things stay clean and
work
(so far)!

On Mon, Sep 22, 2008 at 11:38 PM, Ayyanar Aswathaman <
[email protected]> wrote:

How you do the authentication and authorization in your multi-tenant
application? Are you using any authentication and authorization
plug-ins?

Posted via http://www.ruby-forum.com/.


Emanuele T.
+1 (619) 549 3230
4955 Narragansett Ave Apt #9
San Diego Ca 92107-3157

I’m trying to add multi admin/shop support to the application and, seen
the
original database structure, it seems easier just to use one database
for
each shop.

Also checkout http://tomayko.com/writings/rails-multiple-connections and
Dr. nic’s magic multi connections :slight_smile:
-=R