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?

Thanks

--
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.

Search Discussions

  • Frederick Cheung at Feb 21, 2012 at 2:42 pm

    On Feb 21, 8:16 am, simpleton 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@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.
  • Simpleton at Feb 21, 2012 at 2:52 pm
    Certainly not using Thread.new yet.

    Thanks 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 at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedFeb 21, '12 at 2:36p
activeFeb 21, '12 at 2:52p
posts3
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Simpleton: 2 posts Frederick Cheung: 1 post

People

Translate

site design / logo © 2021 Grokbase