views:

53

answers:

2

i understand that a master/slave setup is redundant, in that data is mirrored to all slaves from a central master. how does this vary from a distributed architecture?

+3  A: 

A master/slave relationship implies either a backup solution, or a failover solution. When the master becomes unavailable, the slave takes over, and functions as the new master until the master comes back up.

In a distributed architecture, the servers are basically equals. Any request can be served by any server, so long as the request is atomic.

jonfhancock
in a distributed architecture, how are queries distributed to the servers?
Carson
@matt: That depends on the architecture. :P
Aaronaught
@matt that might merit a separate question. I'm afraid I don't know the answer. There are numerous methods of distributing queries. Round robin for one, but user names might be fragmented alphabetically among different servers, which is how MongoDB sharding works.
jonfhancock
thats a very good point - i think round-robin dns is a simple answer. i love mongo, but haven't played with sharding yet. thanks!
Carson
+2  A: 

A master slave relationship in the context of databases says that all slaves will replicate data from the master... However, in the end, every server is doing an equal number of writes (the master receives writes from the application, and the slaves receive the same writes from the master).

In a distributed system that implements horizontal scaling, you have multiple servers containing the same table schema, but each responsible for a portion of the overall data... No one machine needs to contain all the data.

For example, let's say you are storing user bookmarks. You could store each user's list in one table in a replicated setup, and every machine would receive all the data. Or you can store the list for users with uid%100<50's data on server1 and the rest on server2. As long as you don't need to do analytical queries over the full userbase, you're fine! Of course, you still need backups for each half anyway, considering server1 won't have server2's data.

Mike Sherov