aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source/configuring.textile
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2012-02-25 21:52:59 +0530
committerVijay Dev <vijaydev.cse@gmail.com>2012-02-25 21:52:59 +0530
commit1e25d6217cfac78e0ca1c1e97c539b05dc472dd6 (patch)
treeb3959eaf6df01645d1f84472a40cbe18586d807a /railties/guides/source/configuring.textile
parent29054ba173c16d675545b719f018b28c6f8eef7e (diff)
parent7940976dfd545f7691b63956b067533f9c769339 (diff)
downloadrails-1e25d6217cfac78e0ca1c1e97c539b05dc472dd6.tar.gz
rails-1e25d6217cfac78e0ca1c1e97c539b05dc472dd6.tar.bz2
rails-1e25d6217cfac78e0ca1c1e97c539b05dc472dd6.zip
Merge branch 'master' of github.com:lifo/docrails
Conflicts: actionmailer/CHANGELOG.md
Diffstat (limited to 'railties/guides/source/configuring.textile')
-rw-r--r--railties/guides/source/configuring.textile18
1 files changed, 18 insertions, 0 deletions
diff --git a/railties/guides/source/configuring.textile b/railties/guides/source/configuring.textile
index 316a7e2bb6..2f465b37ed 100644
--- a/railties/guides/source/configuring.textile
+++ b/railties/guides/source/configuring.textile
@@ -649,3 +649,21 @@ The error occurred while evaluating nil.each
*+set_routes_reloader+* Configures Action Dispatch to reload the routes file using +ActionDispatch::Callbacks.to_prepare+.
*+disable_dependency_loading+* Disables the automatic dependency loading if the +config.cache_classes+ is set to true and +config.dependency_loading+ is set to false.
+
+h3. Database pooling
+
+Active Record database connections are managed by +ActiveRecord::ConnectionAdapters::ConnectionPool+ which ensures that a connection pool synchronizes the amount of thread access to a limited number of database connections. This limit defaults to 5 and can be configured in +database.yml+.
+
+<ruby>
+development:
+ adapter: sqlite3
+ database: db/development.sqlite3
+ pool: 5
+ timeout: 5000
+</ruby>
+
+Since the connection pooling is handled inside of ActiveRecord by default, all application servers (Thin, mongrel, Unicorn etc.) should behave the same. Initially, the database connection pool is empty and it will create additional connections as the demand for them increases, until it reaches the connection pool limit.
+
+Any one request will check out a connection the first time it requires access to the database, after which it will check the connection back in, at the end of the request, meaning that the additional connection slot will be available again for the next request in the queue.
+
+NOTE. If you have enabled +Rails.threadsafe!+ mode then there could be a chance that several threads may be accessing multiple connections simultaneously. So depending on your current request load, you could very well have multiple threads contending for a limited amount of connections.