Hi, Just wondering if anyone has any suggestions as to the best way to provide access to the same data source for the (possible) creation of multiple web sites. I figure my options are: - Direct database access over tcp - ActionWebService - Wait for ActionResource I''ve done up some work with ActionWebService already, but I don''t think it''s going to work because it is so slow for me. All I''m doing is displaying a list of 12 product categories and it takes way too long. This is running under development mode and fastcgi. Direct database access would be the fastest in terms of performance I imagine? Are web services not really targeted for solving this sort of problem (creating multiple web sites using one data source)? -- Posted via http://www.ruby-forum.com/.
On 8/10/06, James Earl <james@icionline.ca> wrote:> Just wondering if anyone has any suggestions as to the best way to > provide access to the same data source for the (possible) creation of > multiple web sites.Direct DB access works well if all your app servers can see all the involved databases. Where I previously worked we ran three sites, each with their own database as well as a shared user database. It worked out very well. In doing that, though, you get a lot of speed but tie your apps pretty tightly together. Especially the parts sharing the same database. With a web service, you can of course keep the interface fairly consistent and are free to whimsically change implementation details. I think the answer is more of a "whatever suits your needs" type deal. That said, there''s some code at this link for connecting a model to an external database: http://www.pjhyett.com/articles/2006/01/25/rails-interacting-with-an-external-database Comment #3 is really concise. That might suit your needs. -- Chris Wanstrath http://errtheblog.com
You don''t have to wait for ActiveResourec... simply_restful is a plugin right now that you can use. That''s what I''d do if I was in your situation. Use WEBrick or Mongrel for development mode. There are known memory leaks using fastcgi in Development mode (production mode is fine... leaks are due to the constant reloading of models and controllers in dev mode). Your app will run considerably faster in production mode btw. On 8/10/06, James Earl <james@icionline.ca> wrote:> > Hi, > > Just wondering if anyone has any suggestions as to the best way to > provide access to the same data source for the (possible) creation of > multiple web sites. I figure my options are: > > - Direct database access over tcp > - ActionWebService > - Wait for ActionResource > > I''ve done up some work with ActionWebService already, but I don''t think > it''s going to work because it is so slow for me. All I''m doing is > displaying a list of 12 product categories and it takes way too long. > This is running under development mode and fastcgi. > > Direct database access would be the fastest in terms of performance I > imagine? > > Are web services not really targeted for solving this sort of problem > (creating multiple web sites using one data source)? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060810/c1cea282/attachment.html
Chris Wanstrath wrote:> On 8/10/06, James Earl <james@icionline.ca> wrote: > >> Just wondering if anyone has any suggestions as to the best way to >> provide access to the same data source for the (possible) creation of >> multiple web sites. > > Direct DB access works well if all your app servers can see all the > involved databases. Where I previously worked we ran three sites, > each with their own database as well as a shared user database. It > worked out very well. > > In doing that, though, you get a lot of speed but tie your apps pretty > tightly together. Especially the parts sharing the same database. > With a web service, you can of course keep the interface fairly > consistent and are free to whimsically change implementation details. > I think the answer is more of a "whatever suits your needs" type deal. > > That said, there''s some code at this link for connecting a model to an > external database: > > http://www.pjhyett.com/articles/2006/01/25/rails-interacting-with-an-external-database > > Comment #3 is really concise. That might suit your needs.Thanks! I think that may be exactly what I''ve been looking for. Developing a web service would be cool, but it may be overkill, and never get utilized in this case. It''s tempting though, to take the basic data that I''m finding I need to share, and spawn off it''s own internet service. -- Posted via http://www.ruby-forum.com/.
Brian Hogan wrote:> You don''t have to wait for ActiveResourec... simply_restful is a plugin > right now that you can use. That''s what I''d do if I was in your > situation. > > Use WEBrick or Mongrel for development mode. There are known memory > leaks > using fastcgi in Development mode (production mode is fine... leaks are > due > to the constant reloading of models and controllers in dev mode). > > Your app will run considerably faster in production mode btw.Isn''t ActiveResource different from the simply_restful plugin though? Correct me if I''m wrong, but ActiveResource is for developing XML based web services, and simply_restful is just for making controller actions more RESTful? -- Posted via http://www.ruby-forum.com/.
Sorry for the confusion... But what I meant was that you could use the SimplyRestful stuff right now to make your applications talk. App 1 calls app2''s controllers using restful actions. I''m doing some similar stuff right now that way but I''m actually not using SimplyRestful (Refactoring soon though) and it''s working so far. (proof of concept though) On 8/15/06, James Earl <james@icionline.ca> wrote:> > Brian Hogan wrote: > > You don''t have to wait for ActiveResourec... simply_restful is a plugin > > right now that you can use. That''s what I''d do if I was in your > > situation. > > > > Use WEBrick or Mongrel for development mode. There are known memory > > leaks > > using fastcgi in Development mode (production mode is fine... leaks are > > due > > to the constant reloading of models and controllers in dev mode). > > > > Your app will run considerably faster in production mode btw. > > Isn''t ActiveResource different from the simply_restful plugin though? > Correct me if I''m wrong, but ActiveResource is for developing XML based > web services, and simply_restful is just for making controller actions > more RESTful? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060815/bc873506/attachment.html
Brian Hogan wrote:> Sorry for the confusion... > But what I meant was that you could use the SimplyRestful stuff right > now to > make your applications talk. App 1 calls app2''s controllers using > restful > actions. > > I''m doing some similar stuff right now that way but I''m actually not > using > SimplyRestful (Refactoring soon though) and it''s working so far. (proof > of > concept though)How do have app2 call app1''s controller actions? Do you just use render_to_string or something, and then have app1 respond with xml? It appears I could probably start using ActiveResource now. It may have all the functionality I need (basically readonly right now). -- Posted via http://www.ruby-forum.com/.