Kang Peng
2008-Nov-16 04:11 UTC
does anyone know whether ActiveRecord has supported connection pool?
does anyone know whether ActiveRecord has supported connection pool? i can''t find articles talking about this, if so how to control it in Rails apps. thanks a lot. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Jeremy Kemper
2008-Nov-16 04:29 UTC
Re: does anyone know whether ActiveRecord has supported connection pool?
On Sat, Nov 15, 2008 at 8:11 PM, Kang Peng <okgoodsun-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> does anyone know whether ActiveRecord has supported connection pool? i > can''t find articles talking about this, if so how to control it in > Rails apps.In Rails 2.1 and earlier, Active Record uses a single persistent connection per thread. Beginning in Rails 2.2, Active Record uses a connection pool. Install the 2.2rc2 release and give it a spin. Best, jeremy --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
kang peng
2008-Nov-16 06:18 UTC
Re: does anyone know whether ActiveRecord has supported connection pool?
thanks. so before Rails2.2, each request will open new connection to database according to ''Active Record uses a single persistent connection per thread''? because as i know, each request will start a new thread, is it correct? On Sun, Nov 16, 2008 at 12:29 PM, Jeremy Kemper <jeremy-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org> wrote:> > On Sat, Nov 15, 2008 at 8:11 PM, Kang Peng <okgoodsun-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > does anyone know whether ActiveRecord has supported connection pool? i > > can''t find articles talking about this, if so how to control it in > > Rails apps. > > In Rails 2.1 and earlier, Active Record uses a single persistent > connection per thread. > > Beginning in Rails 2.2, Active Record uses a connection pool. Install > the 2.2rc2 release and give it a spin. > > Best, > jeremy > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Jeremy Kemper
2008-Nov-16 11:24 UTC
Re: does anyone know whether ActiveRecord has supported connection pool?
No, just one connection. On Sat, Nov 15, 2008 at 10:18 PM, kang peng <okgoodsun-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> thanks. so before Rails2.2, each request will open new connection to > database according to ''Active Record uses a single persistent > connection per thread''? because as i know, each request will start a new > thread, is it correct? > > On Sun, Nov 16, 2008 at 12:29 PM, Jeremy Kemper <jeremy-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org> wrote: >> >> On Sat, Nov 15, 2008 at 8:11 PM, Kang Peng <okgoodsun-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> > does anyone know whether ActiveRecord has supported connection pool? i >> > can''t find articles talking about this, if so how to control it in >> > Rails apps. >> >> In Rails 2.1 and earlier, Active Record uses a single persistent >> connection per thread. >> >> Beginning in Rails 2.2, Active Record uses a connection pool. Install >> the 2.2rc2 release and give it a spin. >> >> Best, >> jeremy >> >> > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
kang peng
2008-Nov-16 13:25 UTC
Re: does anyone know whether ActiveRecord has supported connection pool?
ok, so i think ActiveRecord is thread safe, right? if so, each request which call to database will be processed one by one, not concurrent, this seems RoR''s will be not good when faces big amont of requests in a short time. is it ture? On Sun, Nov 16, 2008 at 7:24 PM, Jeremy Kemper <jeremy-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org> wrote:> > No, just one connection. > > On Sat, Nov 15, 2008 at 10:18 PM, kang peng <okgoodsun-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > thanks. so before Rails2.2, each request will open new connection to > > database according to ''Active Record uses a single persistent > > connection per thread''? because as i know, each request will start a new > > thread, is it correct? > > > > On Sun, Nov 16, 2008 at 12:29 PM, Jeremy Kemper <jeremy-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org> > wrote: > >> > >> On Sat, Nov 15, 2008 at 8:11 PM, Kang Peng <okgoodsun-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> > does anyone know whether ActiveRecord has supported connection pool? i > >> > can''t find articles talking about this, if so how to control it in > >> > Rails apps. > >> > >> In Rails 2.1 and earlier, Active Record uses a single persistent > >> connection per thread. > >> > >> Beginning in Rails 2.2, Active Record uses a connection pool. Install > >> the 2.2rc2 release and give it a spin. > >> > >> Best, > >> jeremy > >> > >> > > > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Robert Walker
2008-Nov-16 23:37 UTC
Re: does anyone know whether ActiveRecord has supported conn
kang peng wrote:> ok, so i think ActiveRecord is thread safe, right? if so, each request > which > call to database will be processed one by one, not concurrent, this > seems > RoR''s will be not good when faces big amont of requests in a short time. > is > it ture?Do you have a scaling problem right now? If not then worry about this when you do.... http://gettingreal.37signals.com/ch04_Scale_Later.php -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
kang peng
2008-Nov-17 03:22 UTC
Re: does anyone know whether ActiveRecord has supported conn
thanks for great suggestion :) On Mon, Nov 17, 2008 at 7:37 AM, Robert Walker < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > kang peng wrote: > > ok, so i think ActiveRecord is thread safe, right? if so, each request > > which > > call to database will be processed one by one, not concurrent, this > > seems > > RoR''s will be not good when faces big amont of requests in a short time. > > is > > it ture? > > Do you have a scaling problem right now? If not then worry about this > when you do.... > > http://gettingreal.37signals.com/ch04_Scale_Later.php > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Jeremy Kemper
2008-Nov-17 06:14 UTC
Re: does anyone know whether ActiveRecord has supported connection pool?
Right. You need to use a nonblocking database driver to do concurrent requests. You can do this with neverblock''s database drivers and Active Record adapter (http://www.espace.com.eg/neverblock/benchmarks) or with jruby. Best, jeremy On Sun, Nov 16, 2008 at 5:25 AM, kang peng <okgoodsun-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> ok, so i think ActiveRecord is thread safe, right? if so, each request which > call to database will be processed one by one, not concurrent, this seems > RoR''s will be not good when faces big amont of requests in a short time. is > it ture? > > On Sun, Nov 16, 2008 at 7:24 PM, Jeremy Kemper <jeremy-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org> wrote: >> >> No, just one connection. >> >> On Sat, Nov 15, 2008 at 10:18 PM, kang peng <okgoodsun-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> > thanks. so before Rails2.2, each request will open new connection to >> > database according to ''Active Record uses a single persistent >> > connection per thread''? because as i know, each request will start a new >> > thread, is it correct? >> > >> > On Sun, Nov 16, 2008 at 12:29 PM, Jeremy Kemper <jeremy-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org> >> > wrote: >> >> >> >> On Sat, Nov 15, 2008 at 8:11 PM, Kang Peng <okgoodsun-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> > does anyone know whether ActiveRecord has supported connection pool? >> >> > i >> >> > can''t find articles talking about this, if so how to control it in >> >> > Rails apps. >> >> >> >> In Rails 2.1 and earlier, Active Record uses a single persistent >> >> connection per thread. >> >> >> >> Beginning in Rails 2.2, Active Record uses a connection pool. Install >> >> the 2.2rc2 release and give it a spin. >> >> >> >> Best, >> >> jeremy >> >> >> >> >> > >> > >> > > >> > >> >> > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
kang peng
2008-Nov-17 06:57 UTC
Re: does anyone know whether ActiveRecord has supported connection pool?
thank you very much. On Mon, Nov 17, 2008 at 2:14 PM, Jeremy Kemper <jeremy-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org> wrote:> > Right. You need to use a nonblocking database driver to do concurrent > requests. > > You can do this with neverblock''s database drivers and Active Record > adapter (http://www.espace.com.eg/neverblock/benchmarks) or with > jruby. > > Best, > jeremy > > On Sun, Nov 16, 2008 at 5:25 AM, kang peng <okgoodsun-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > ok, so i think ActiveRecord is thread safe, right? if so, each request > which > > call to database will be processed one by one, not concurrent, this seems > > RoR''s will be not good when faces big amont of requests in a short time. > is > > it ture? > > > > On Sun, Nov 16, 2008 at 7:24 PM, Jeremy Kemper <jeremy-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org> > wrote: > >> > >> No, just one connection. > >> > >> On Sat, Nov 15, 2008 at 10:18 PM, kang peng <okgoodsun-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > >> > thanks. so before Rails2.2, each request will open new connection to > >> > database according to ''Active Record uses a single persistent > >> > connection per thread''? because as i know, each request will start a > new > >> > thread, is it correct? > >> > > >> > On Sun, Nov 16, 2008 at 12:29 PM, Jeremy Kemper <jeremy-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org> > >> > wrote: > >> >> > >> >> On Sat, Nov 15, 2008 at 8:11 PM, Kang Peng <okgoodsun-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > >> >> > does anyone know whether ActiveRecord has supported connection > pool? > >> >> > i > >> >> > can''t find articles talking about this, if so how to control it in > >> >> > Rails apps. > >> >> > >> >> In Rails 2.1 and earlier, Active Record uses a single persistent > >> >> connection per thread. > >> >> > >> >> Beginning in Rails 2.2, Active Record uses a connection pool. Install > >> >> the 2.2rc2 release and give it a spin. > >> >> > >> >> Best, > >> >> jeremy > >> >> > >> >> > >> > > >> > > >> > > > >> > > >> > >> > > > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
boblu
2008-Nov-17 07:31 UTC
Re: does anyone know whether ActiveRecord has supported connection pool?
Can anybody tell me about this? Does this "connection pool" have something to do with multiple database connection? Or it is only for concurrent access with one database? On Nov 17, 3:14 pm, "Jeremy Kemper" <jer...-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org> wrote:> Right. You need to use a nonblocking database driver to do concurrent requests. > > You can do this with neverblock''s database drivers and Active Record > adapter (http://www.espace.com.eg/neverblock/benchmarks) or with > jruby. > > Best, > jeremy > > On Sun, Nov 16, 2008 at 5:25 AM, kang peng <okgood...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > ok, so i think ActiveRecord is thread safe, right? if so, each request which > > call to database will be processed one by one, not concurrent, this seems > > RoR''s will be not good when faces big amont of requests in a short time. is > > it ture? > > > On Sun, Nov 16, 2008 at 7:24 PM, Jeremy Kemper <jer...-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org> wrote: > > >> No, just one connection. > > >> On Sat, Nov 15, 2008 at 10:18 PM, kang peng <okgood...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> > thanks. so before Rails2.2, each request will open new connection to > >> > database according to ''Active Record uses a single persistent > >> > connection per thread''? because as i know, each request will start a new > >> > thread, is it correct? > > >> > On Sun, Nov 16, 2008 at 12:29 PM, Jeremy Kemper <jer...-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org> > >> > wrote: > > >> >> On Sat, Nov 15, 2008 at 8:11 PM, Kang Peng <okgood...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> >> > does anyone know whether ActiveRecord has supported connection pool? > >> >> > i > >> >> > can''t find articles talking about this, if so how to control it in > >> >> > Rails apps. > > >> >> In Rails 2.1 and earlier, Active Record uses a single persistent > >> >> connection per thread. > > >> >> Beginning in Rails 2.2, Active Record uses a connection pool. Install > >> >> the 2.2rc2 release and give it a spin. > > >> >> Best, > >> >> jeremy--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jonathan Rochkind
2008-Nov-24 21:56 UTC
Re: does anyone know whether ActiveRecord has supported connection pool?
It has to do with multiple connections to one database. It has, however, always been possible to have some models living in one database, and others living in others, if that''s what you want. Relationships accross databases don''t always work perfectly, if you''re trying to do fancy things. (Like, pre-loading a relationship accross databases). For using multiple databases in your app, see: http://wiki.rubyonrails.org/rails/pages/HowtoUseMultipleDatabases Incidentally, even pre Rails 2.2, I have had success using multiple connections to a single db in different threads, using the mysql gem adapter. Now I wonder if the mysql gem adapter is actually non-blocking though, or if my different threads were still blocking on db access. Jonathan boblu wrote:> Can anybody tell me about this? > Does this "connection pool" have something to do with multiple > database connection? > Or it is only for concurrent access with one database?-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---