Ruby on Rails Saturday, May 1, 2010

On Apr 30, 6:52 pm, "Joe Smith" <unknown_kev_...@hotmail.com> wrote:
> Frederick Cheung wrote:
> >On Apr 29, 1:57 am, Joshua Partogi
> ><joshua.part...->Re5JQEeQqe8AvxtiuMw...@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@googlegroups.com.
> 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@googlegroups.com.
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.

No comments:

Post a Comment