I would like to use SQLRelay for database connection pooling and query- based routing with a Rails application that I am just about done with. It is my first Rails project, and I thought it might be wise to get some feedback on this before I get too far in coding it.>From what I can tell, I am going to have to write a connection adapterfor ActiveRecord if I want to use SQLRelay (http:// sqlrelay.sourceforge.net/) with Rails. While I think this could be a cool, fun and rewarding project, one that I will certainly be into doing, time is of essence here (when isn''t it?). I was hoping someone on this list could add their two cents. I need something like SQLRelay because the ops department, used to supporting weighty, slow PHP apps, is refusing to put this Rails website out on the Internet without support for DB pooling or at least read + write databases. I''d like the application to respond quickly too, as that will certainly play a large factor in whether or not the company continues with Rails development. I''ve implemented caching as best as I could, but I do still need to point at different databases, with masters and slaves. I am currently using acts_as_readonlyable, with some modifications, to support a read-only database for my main database server. Unfortunately, I had to use multiple database servers with this Rails application (a member of my team wrote a plugin to support this along the way), so the implementation of acts_as_readonlyable is less than straight-forward. Advice is greatly appreciated. Have you written a connection adapter for ActiveRecord? Or, better yet, have you implemented SQLRelay with ActiveRecord/Rails? Thanks!! Jacqui --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jacqui, I hope somebody would answer your question about SQLRelay. Meanwhile, I am not sure whether it helps in your situation, but as of 0.0.5, ActsAsReadonlyable supports multiple slaves (picked at random for every find). Just download the latest version from rubyforge and you can use it as: class Fruit < ActiveRecord::Base acts_as_readonlyable [:first_read_only, :second_read_only] end Regards, Val On Apr 28, 1:31 pm, jacqui <jacqui.ma...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I would like to use SQLRelay for database connection pooling and query- > based routing with a Rails application that I am just about done with. > It is my first Rails project, and I thought it might be wise to get > some feedback on this before I get too far in coding it. > > >From what I can tell, I am going to have to write a connection adapter > > for ActiveRecord if I want to use SQLRelay (http:// > sqlrelay.sourceforge.net/) with Rails. While I think this could be a > cool, fun and rewarding project, one that I will certainly be into > doing, time is of essence here (when isn''t it?). > > I was hoping someone on this list could add their two cents. I need > something like SQLRelay because the ops department, used to supporting > weighty, slow PHP apps, is refusing to put this Rails website out on > the Internet without support for DB pooling or at least read + write > databases. I''d like the application to respond quickly too, as that > will certainly play a large factor in whether or not the company > continues with Rails development. I''ve implemented caching as best as > I could, but I do still need to point at different databases, with > masters and slaves. > > I am currently using acts_as_readonlyable, with some modifications, to > support a read-only database for my main database server. > Unfortunately, I had to use multiple database servers with this Rails > application (a member of my team wrote a plugin to support this along > the way), so the implementation of acts_as_readonlyable is less than > straight-forward. > > Advice is greatly appreciated. Have you written a connection adapter > for ActiveRecord? Or, better yet, have you implemented SQLRelay with > ActiveRecord/Rails? > > Thanks!! > Jacqui--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks! That actually might help me. The problem I ran into with acts_as_readonlyable was telling it to use different read_only databases for different write databases. Like so: development: adapter: mysql database: my_development username: root password: host: encoding: utf8 read_only: adapter: mysql database: my_development_slave username: root password: host: encoding: utf8 cms_development: adapter: mysql database: my_cms_development username: root password: host: encoding: utf8 cms_read_only: adapter: mysql database: my_cms_development_slave username: root password: host: encoding: utf8 acts_as_readonlyable didn''t seem to work when some models had: acts_as_readonlyable :read_only and others had acts_as_readonlyable :cms_read_only The erroneous behavior I saw when I had two different read-only db servers defined with different names was that the read only db servers never got hit; all requests went to the write/master. I''ll try adding multiple read-only databases for the same master, though, in an array. That is useful and will make things better on my project - thanks! - jacqui On Apr 28, 1:03 pm, Val <v.alekse...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Jacqui, > > I hope somebody would answer your question aboutSQLRelay. Meanwhile, > I am not sure whether it helps in your situation, but as of 0.0.5, > ActsAsReadonlyable supports multiple slaves (picked at random for > every find). Just download the latest version from rubyforge and you > can use it as: > > class Fruit < ActiveRecord::Base > acts_as_readonlyable [:first_read_only, :second_read_only] > end > > Regards, > Val > > On Apr 28, 1:31 pm, jacqui <jacqui.ma...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I would like to useSQLRelayfor database connection pooling and query- > > based routing with a Rails application that I am just about done with. > > It is my first Rails project, and I thought it might be wise to get > > some feedback on this before I get too far in coding it. > > > >From what I can tell, I am going to have to write a connection adapter > > > for ActiveRecord if I want to useSQLRelay(http:// > >sqlrelay.sourceforge.net/) with Rails. While I think this could be a > > cool, fun and rewarding project, one that I will certainly be into > > doing, time is of essence here (when isn''t it?). > > > I was hoping someone on this list could add their two cents. I need > > something likeSQLRelaybecause the ops department, used to supporting > > weighty, slow PHP apps, is refusing to put this Rails website out on > > the Internet without support for DB pooling or at least read + write > > databases. I''d like the application to respond quickly too, as that > > will certainly play a large factor in whether or not the company > > continues with Rails development. I''ve implemented caching as best as > > I could, but I do still need to point at different databases, with > > masters and slaves. > > > I am currently using acts_as_readonlyable, with some modifications, to > > support a read-only database for my main database server. > > Unfortunately, I had to use multiple database servers with this Rails > > application (a member of my team wrote a plugin to support this along > > the way), so the implementation of acts_as_readonlyable is less than > > straight-forward. > > > Advice is greatly appreciated. Have you written a connection adapter > > for ActiveRecord? Or, better yet, have you implementedSQLRelaywith > > ActiveRecord/Rails? > > > Thanks!! > > Jacqui--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---