Joshua Partogi
2010-Apr-29 00:57 UTC
How many connection pool should we have for internet facing apps?
Hi all, This is a rather basic question about connection pooling in ruby on rails. In rails we can define the connection pool in database.yml. I assume it is quite safe to hardcode this value for intranet application since we would know how many users that will be using the apps. But for an internet facing apps where we don''t know how many users that will be accessing the app, how many connection pool should we provide ? Can anyone share their experience on this to enlighten me? Thank you very much in advance for the insights. Kind regards, Joshua -- http://twitter.com/scrum8 -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung
2010-Apr-29 08:16 UTC
Re: How many connection pool should we have for internet facing apps?
On Apr 29, 1:57 am, Joshua Partogi <joshua.part...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi all, > > This is a rather basic question about connection pooling in ruby on > rails. In rails we can define the connection pool in database.yml. I > assume it is quite safe to hardcode this value for intranet > application since we would know how many users that will be using the > apps. But for an internet facing apps where we don''t know how many > users that will be accessing the app, how many connection pool should > we provide ? Can anyone share their experience on this to enlighten > me?Connection pool size isn''t really related to number of users. It doesn''t really make much difference without a multithreaded setup (and your default ''normal'' ruby + passenger or mongrel isn''t one of those) Fred> > Thank you very much in advance for the insights. > > Kind regards, > Joshua > > --http://twitter.com/scrum8 > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Joe Smith
2010-Apr-30 17:52 UTC
Re: How many connection pool should we have for internet facing apps?
Frederick Cheung wrote:>On Apr 29, 1:57 am, Joshua Partogi ><joshua.part...->Re5JQEeQqe8AvxtiuMwx3w-XMD5yJDbdMReXY1tMh2IBg@public.gmane.org> wrote: >> Hi all, >> >> This is a rather basic question about connection pooling in ruby on >> rails. In rails we can define the connection pool in database.yml. I >> assume it is quite safe to hardcode this value for intranet >> application since we would know how many users that will be using the >> apps. But for an internet facing apps where we don''t know how many >> users that will be accessing the app, how many connection pool should >> we provide ? Can anyone share their experience on this to enlighten >> me? > >Connection pool size isn''t really related to number of users. It >doesn''t really make much difference without a multithreaded setup (and >your default ''normal'' ruby + passenger or mongrel isn''t one of those)Fair enough, in the default state with passenger, you have a multi-process setup, and since each process is independent, they don''t know of each other, and thus the value for connection in the database.yml file is more or less meaningless. (It is good to be explicit in explainging why this is the case). Nevertheless, the database itself may have a limited connection pool, rather than using the standard UNIX model of fork a new process on connection, or othewrwise put a user-configurable constraint on number of active connections. (I undertsand that MySQL often has such a limit.) Any guidance for the original poster on how best to deal with that? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung
2010-May-01 11:07 UTC
Re: How many connection pool should we have for internet facing apps?
On Apr 30, 6:52 pm, "Joe Smith" <unknown_kev_...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote:> Frederick Cheung wrote: > >On Apr 29, 1:57 am, Joshua Partogi > ><joshua.part...->Re5JQEeQqe8AvxtiuMw...-XMD5yJDbdMReXY1tMh2IBg@public.gmane.org> wrote: > >> Hi all, > > >> This is a rather basic question about connection pooling in ruby on > >> rails. In rails we can define the connection pool in database.yml. I > >> assume it is quite safe to hardcode this value for intranet > >> application since we would know how many users that will be using the > >> apps. But for an internet facing apps where we don''t know how many > >> users that will be accessing the app, how many connection pool should > >> we provide ? Can anyone share their experience on this to enlighten > >> me? > > >Connection pool size isn''t really related to number of users. It > >doesn''t really make much difference without a multithreaded setup (and > >your default ''normal'' ruby + passenger or mongrel isn''t one of those) > > Fair enough, in the default state with passenger, you have a multi-process > setup, and since each process is independent, they don''t know of each other, > and thus the value for connection in the database.yml file is more or less > meaningless. (It is good to be explicit in explainging why this is the > case). > > Nevertheless, the database itself may have a limited connection pool, rather > than using the standard UNIX model of fork a new process on connection, or > othewrwise put a user-configurable constraint on number of active > connections. (I undertsand that MySQL often has such a limit.) Any guidance > for the original poster on how best to deal with that?Well if your database has a limit on the number of connections, ensure that it''s greater than the number of mongrels/passenger instances (and if you''re going to actually be using the connection pooling stuff i suppose you''d want to make it greater than the sum of the size of the connection pool across application instances). I seem to remember the default limit on mysql is 100, but it can go way higher than that (and if you are going to have several hundred mongrels you can probably afford a big beefy database server too) 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.