On Feb 21, 8:16 am, simpleton
<brand.magn...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> After load testing my app, it started getting errors at 6 concurrent
> users on a not-at-all heavy SQL operation page and I want to know how
> to reduce these. I''ve read up about Connection Pooling but the
> information out there is scarce. I''d like to increase my pool
limit to
> about 25-40 but what are the possible negative repercussions?
>
> The API docs say I must also return the connections to the pool after
> they''re done being used with:
>
> ActiveRecord::Base.clear_active_connections!
>
> However, where does this line of code go? And what line of code goes
> into database.yml to increase the pool size?
Add
pool: 10
for example amongst the settings for each environment. In a
''normal''
rails app where you aren''t creating threads yourself connections
should be returned to the pool for you. If you are creating threads,
then you should close the connection at the end of the thread''s
execution e.g.
Thread.new do
begin
....
ensure
ActiveRecord::Base.connection.close
end
end
In terms of the downsides i think it''s just that the database has
potentially more connections to handle.
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 at
http://groups.google.com/group/rubyonrails-talk?hl=en.