Large Mysql Database (Multiple Databases?)


#1

Hey Everyone,

I’m looking for some advice. I am developing an application that will
have several million transaction records. I’ve heard of people scaling
Rails to connect to multiple databases. I have never done this, and
I’m wondering if rails can look at multiple databases and treat them
as one, or if I design some sort of overload feature that makes it
trickle from one database to the next. In essence I don’t want my
rails application to be limited by database capability or size. As I
said before I have never designed an app like this, and I want to get
it right before I get too far into the application. I have just
started the coding, and would like to be proactive on making the right
decision.

Thanks!

Chris


#2

You’ll probably want to look at replication [1] and/or sharding. There
are several gems out there that will help you do one, the other, or both
within Rails. I haven’t used any of them, but some quick googling seem
to indicate that data_fabric [2] or masochism [3] might be good places
to start.

While googling I also ran across MySQL’s HA/Scalability Guide which
looks useful if this is something new to you.

dwh

[1] http://dev.mysql.com/doc/refman/5.1/en/replication-solutions.html
[2] http://blog.fiveruns.com/2008/7/9/introducing-data_fabric
[3] http://github.com/technoweenie/masochism/tree/master [technoweenie
always chooses the best project names…]
[4] http://dev.mysql.com/doc/mysql-ha-scalability/en/index.html


#3

internetchris wrote:
[…]

In essence I don’t want my
rails application to be limited by database capability or size.

I would think that it would be better to have the DB take care of the
multi-DB splitting, and have it appear to the Rails app as one DB.

As I
said before I have never designed an app like this, and I want to get
it right before I get too far into the application. I have just
started the coding, and would like to be proactive on making the right
decision.

The right decision would almost certainly not be to use mySQL.
PostgreSQL is generally more capable and faster. It’s also more
extensible.

Thanks!

Chris

Best,

Marnen Laibow-Koser
http://www.marnen.org
removed_email_address@domain.invalid


#4

I appreciate your replys, I will look into PostgreSQL a little futher.
A post from yesterday indicated alot of success with PostgreSQL, so I
will probably go with it. One other thing…

I’m pretty new to rails, and this question may seem ridiculous, but I
must ask. If I keep my fields the same in my migration, and simply
change my database.yml file will my views and controllers still work
fine? I haven’t done alot of development on this app yet, but anytime
I can avoid rewriting code it’s nice.

Thanks!

Chris

On Apr 18, 12:52 pm, Marnen Laibow-Koser <rails-mailing-l…@andreas-