Indeed, MySQL natively supports replication which I think MS SQL Server supports too. Basically, setting up the master-slave replication is trivial by just following the instructions provided. However, in order to send write to master databases and read to slave databases, you need code that manually. It's not done automatically by the database server. I just don't know how NHibernate supports this scenario. I'm now considering implement my own IConnectionProvider in which I will try to pick connection dynamically based on some contextual information (NHibernate has little this information). This might work, however leads to a very careful design/code in the business layer.
Another possible solution might be using the MySQL proxy. But I'm not sure. On Apr 4, 12:24 am, Francois Ward <[email protected]> wrote: > I know that doesn't answer your question, but I was under the impression > MySQL supported replication natively. Replication and horizontal scaling of > DBMS is a crazy complex problem. Implementing that using an ORM will make > that problem even crazier, especially since database engines often support > it themselves so there's little point. > > So yes, better ways of achieving this: use the native database support =P > > -Francois > > > > -----Original Message----- > From: [email protected] [mailto:[email protected]] On Behalf > > Of Eric > Sent: Saturday, April 02, 2011 2:43 PM > To: nhusers > Subject: [nhusers] How to implement the MySQL master-slave replication w/ > NHibernate? > > Deal all, I'm a new fan of NHibernate and i'm going to use NH in my new > project for persisting. In this project, I planned to use MySQL as the > backend relational data store w/ master-slave replication setup aim to > improve the overall scalability and performance of the application by using > read-write segregation and probably load balancing in the data access > layer. After 3 days of research, I found that it's not trivial to implement > that w/ NHibernate. Do you guys have some suggestions on this case? Shoud I > implement my own IConnectionProvider to support that or are there some > better ways to achieve this? Thanks in advance. > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group > athttp://groups.google.com/group/nhusers?hl=en.- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
