1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Connection Pooling


This is related to the thread safety feature. Rails can now manage a pool of thread-safe database connections to certain databases (MySQL included). Threads can grab any one of these already open connections, make queries and return them to the pool. This is an effort to make large numbers of concurrent database queries possible and fast.

This feature is enabled by default, managing a small pool of database connections. Even if you're not using the threaded features, this should make requests a little bit faster. If you want to control the size of the connection pool, add a pool key to the appropriate sections of your database.yml file. For example, your production database configuration might look something like this.

  adapter: mysql
  username: some_user
  password: some_password
  database: my_app
  pool: 20
  1. About.com
  2. Technology
  3. Ruby
  4. Ruby on Rails
  5. Connection Pooling

©2014 About.com. All rights reserved.