If I have an application that makes numerous calls to a database for CRUD stuff over a period, does another user on a different PC when accessing the same database and same user make use of that existing connection. Or is another new connection opened, for the second user. When is the connection closed? When is it re-used? Is it any different if using multiple Mongrels and Proxy Load Balancer with Apache? Thanks Andrew -- 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 -~----------~----~----~----~------~----~------~--~---
No, none of them are shared. Each one is a separate connection. It would be the same with multiple instances of mongrel. -Bill Andrew Cleland wrote:> If I have an application that makes numerous calls to a database for > CRUD stuff over a period, does another user on a different PC when > accessing the same database and same user make use of that existing > connection. Or is another new connection opened, for the second user. > > When is the connection closed? When is it re-used? Is it any different > if using multiple Mongrels and Proxy Load Balancer with Apache? > > Thanks > > Andrew >-- Sincerely, William Pratt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 8 Oct 2007, at 14:47, Andrew Cleland wrote:> > If I have an application that makes numerous calls to a database for > CRUD stuff over a period, does another user on a different PC when > accessing the same database and same user make use of that existing > connection. Or is another new connection opened, for the second user. > > When is the connection closed? When is it re-used? Is it any different > if using multiple Mongrels and Proxy Load Balancer with Apache? >Unless you start establishing connections by hand, each instance of mongrel has one database connection, which it will reuse until it dies. If you only had one mongrel then there would only ever be 1 connection. Fred --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
You will get multiple connections regardless of whether you create them by hand, even if it''s using a named pipe. I fired up 2 connections by hand to illustrate the point: netstat -an | grep mysql.sock unix 2 [ ACC ] STREAM LISTENING 7235 /var/lib/mysql/mysql.sock unix 3 [ ] STREAM CONNECTED 2373005 /var/lib/mysql/mysql.sock unix 3 [ ] STREAM CONNECTED 2372935 /var/lib/mysql/mysql.sock -Bill Frederick Cheung wrote:> On 8 Oct 2007, at 14:47, Andrew Cleland wrote: > > >> If I have an application that makes numerous calls to a database for >> CRUD stuff over a period, does another user on a different PC when >> accessing the same database and same user make use of that existing >> connection. Or is another new connection opened, for the second user. >> >> When is the connection closed? When is it re-used? Is it any different >> if using multiple Mongrels and Proxy Load Balancer with Apache? >> >> > > Unless you start establishing connections by hand, each instance of > mongrel has one database connection, which it will reuse until it > dies. If you only had one mongrel then there would only ever be 1 > connection. > > Fred > > > >-- Sincerely, William Pratt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 8 Oct 2007, at 16:30, William Pratt wrote:> You will get multiple connections regardless of whether you create > them by hand, even if it''s using a named pipe. I fired up 2 > connections by hand to illustrate the point:What do you mean by "fire up 2 connections". I always see one connection per mongrel (+ instances of query browser etc... obviously)> > > netstat -an | grep mysql.sock > unix 2 [ ACC ] STREAM LISTENING 7235 /var/lib/ > mysql/mysql.sock > unix 3 [ ] STREAM CONNECTED 2373005 /var/lib/ > mysql/mysql.sock > unix 3 [ ] STREAM CONNECTED 2372935 /var/lib/ > mysql/mysql.sock > > -Bill > > Frederick Cheung wrote: >> On 8 Oct 2007, at 14:47, Andrew Cleland wrote: >>> If I have an application that makes numerous calls to a database >>> for CRUD stuff over a period, does another user on a different PC >>> when accessing the same database and same user make use of that >>> existing connection. Or is another new connection opened, for the >>> second user. When is the connection closed? When is it re-used? >>> Is it any different if using multiple Mongrels and Proxy Load >>> Balancer with Apache? >> Unless you start establishing connections by hand, each instance >> of mongrel has one database connection, which it will reuse until >> it dies. If you only had one mongrel then there would only ever be >> 1 connection. Fred > > -- Sincerely, William Pratt > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
You said "by hand", which I assumed to mean running mysql from the command line. How are you creating a connection by hand with Mongrel? Frederick Cheung wrote:> On 8 Oct 2007, at 16:30, William Pratt wrote: > > >> You will get multiple connections regardless of whether you create >> them by hand, even if it''s using a named pipe. I fired up 2 >> connections by hand to illustrate the point: >> > > What do you mean by "fire up 2 connections". I always see one > connection per mongrel (+ instances of query browser etc... obviously) > >> netstat -an | grep mysql.sock >> unix 2 [ ACC ] STREAM LISTENING 7235 /var/lib/ >> mysql/mysql.sock >> unix 3 [ ] STREAM CONNECTED 2373005 /var/lib/ >> mysql/mysql.sock >> unix 3 [ ] STREAM CONNECTED 2372935 /var/lib/ >> mysql/mysql.sock >> >> -Bill >> >> Frederick Cheung wrote: >> >>> On 8 Oct 2007, at 14:47, Andrew Cleland wrote: >>> >>>> If I have an application that makes numerous calls to a database >>>> for CRUD stuff over a period, does another user on a different PC >>>> when accessing the same database and same user make use of that >>>> existing connection. Or is another new connection opened, for the >>>> second user. When is the connection closed? When is it re-used? >>>> Is it any different if using multiple Mongrels and Proxy Load >>>> Balancer with Apache? >>>> >>> Unless you start establishing connections by hand, each instance >>> of mongrel has one database connection, which it will reuse until >>> it dies. If you only had one mongrel then there would only ever be >>> 1 connection. Fred >>> >> -- Sincerely, William Pratt >> > > > > >-- Sincerely, William Pratt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I read your post again. I misinterpreted it to read that if you create connections by hand, those connections would be shared. Just a misinterpretation. -Bill William Pratt wrote:> You will get multiple connections regardless of whether you create > them by hand, even if it''s using a named pipe. I fired up 2 > connections by hand to illustrate the point: > > netstat -an | grep mysql.sock > unix 2 [ ACC ] STREAM LISTENING 7235 > /var/lib/mysql/mysql.sock > unix 3 [ ] STREAM CONNECTED 2373005 > /var/lib/mysql/mysql.sock > unix 3 [ ] STREAM CONNECTED 2372935 > /var/lib/mysql/mysql.sock > > -Bill > > Frederick Cheung wrote: >> On 8 Oct 2007, at 14:47, Andrew Cleland wrote: >> >> >>> If I have an application that makes numerous calls to a database for >>> CRUD stuff over a period, does another user on a different PC when >>> accessing the same database and same user make use of that existing >>> connection. Or is another new connection opened, for the second user. >>> >>> When is the connection closed? When is it re-used? Is it any different >>> if using multiple Mongrels and Proxy Load Balancer with Apache? >>> >>> >> >> Unless you start establishing connections by hand, each instance of >> mongrel has one database connection, which it will reuse until it >> dies. If you only had one mongrel then there would only ever be 1 >> connection. >> >> Fred >> >> >> > > -- > Sincerely, > > William Pratt > > > >-- Sincerely, William Pratt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 8 Oct 2007, at 16:37, William Pratt wrote:> You said "by hand", which I assumed to mean running mysql from the > command line. How are you creating a connection by hand with Mongrel?Well obviously that creates extra connections. By ''by hand'' I mean calling ActiveRecord::Base.establish_connection. My point was that unless you go out of your way, your rails app will use one connection per instance of mongrel. Fred> > > Frederick Cheung wrote: >> On 8 Oct 2007, at 16:30, William Pratt wrote: >>> You will get multiple connections regardless of whether you >>> create them by hand, even if it''s using a named pipe. I fired up >>> 2 connections by hand to illustrate the point: >> What do you mean by "fire up 2 connections". I always see one >> connection per mongrel (+ instances of query browser etc... >> obviously) >>> netstat -an | grep mysql.sock unix 2 [ ACC ] STREAM LISTENING >>> 7235 /var/lib/ mysql/mysql.sock unix 3 [ ] STREAM CONNECTED >>> 2373005 /var/lib/ mysql/mysql.sock unix 3 [ ] STREAM CONNECTED >>> 2372935 /var/lib/ mysql/mysql.sock -Bill Frederick Cheung wrote: >>>> On 8 Oct 2007, at 14:47, Andrew Cleland wrote: >>>>> If I have an application that makes numerous calls to a >>>>> database for CRUD stuff over a period, does another user on a >>>>> different PC when accessing the same database and same user >>>>> make use of that existing connection. Or is another new >>>>> connection opened, for the second user. When is the connection >>>>> closed? When is it re-used? Is it any different if using >>>>> multiple Mongrels and Proxy Load Balancer with Apache? >>>> Unless you start establishing connections by hand, each instance >>>> of mongrel has one database connection, which it will reuse >>>> until it dies. If you only had one mongrel then there would only >>>> ever be 1 connection. Fred >>> -- Sincerely, William Pratt > > -- Sincerely, William Pratt > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---