I would breakdown the concept of "talking to multiple databases"
into two categories, based on the motivation for doing it :
1) One has to interact with data that lives in different schemas and/or applications.
2) The need for higher throughput, two common ways of doing this are :
i) Master Slave replication
This has been discussed here :
http://groups.google.com/group/squeryl/browse_thread/thread/6fff74ab17f598f9/fce0a977564bbb7f?lnk=gst&q=master#fce0a977564bbb7f
Pros: simple to implement
Cons: won't buy you much if you need a high write throughput
ii) Sharding
In my opinion, sharding is the only way to get a relational database to attain "web scale" throughput,
but it requires that the data model be intrinsincally "shardable", by this I mean that cross shard
queries are rare, or preferably non existent. The more "cross shard" queries you have, the less benefit
one will gain from sharding.
I am currently implementing a system that will eventually need to be sharded, so I have been
reflecting for a while about how Squeryl could provide facilities for it.
Any decent sharding mechanism needs to adress the following :
a) redundancy (a shard must have at least one replica that lives on a different dababase on a different machine)
b) ideally the function that maps an object to its shard must be decentralized (i.e. to be replicatable while not not
relying on shared state).
c) if the host of a shard goes down, no rehashing is needed.
To my knowledge, there is only one known algorythm that has all those properties, Consistent Hashing :
http://en.wikipedia.org/wiki/Consistent_hashing http://www.tomkleinpeter.com/2008/03/17/programmers-toolbox-part-3-consistent-hashing/
Like I wrote earlyer, I don't think that sharding is a generalized solution for scaling any data model,
some can easily benefit from it, some can't, depending on the inherent characteristics of the data.
However, the cases where it can applies form an interesting niche, because one can scale like some NoSql database will,
without sacrificing the mathematical model of the relational paradigm.
I've just scratched the surface of the sharding question, I've not discussed about the "how" a sharding mechanism should
be implemented in Squeryl, I leave that for a future post.
Cheers