aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2012-02-25 21:48:38 +0530
committerVijay Dev <vijaydev.cse@gmail.com>2012-02-25 21:48:38 +0530
commit7940976dfd545f7691b63956b067533f9c769339 (patch)
treeb81043d9d5055700fb1a9196f510713146dbf1bb /railties/guides
parent0519567e3d3ad77e88866e8fb79ff2b24424d724 (diff)
downloadrails-7940976dfd545f7691b63956b067533f9c769339.tar.gz
rails-7940976dfd545f7691b63956b067533f9c769339.tar.bz2
rails-7940976dfd545f7691b63956b067533f9c769339.zip
copy-edits [ci skip]
Diffstat (limited to 'railties/guides')
-rw-r--r--railties/guides/source/configuring.textile18
1 files changed, 8 insertions, 10 deletions
diff --git a/railties/guides/source/configuring.textile b/railties/guides/source/configuring.textile
index cd36134e65..26292a85f5 100644
--- a/railties/guides/source/configuring.textile
+++ b/railties/guides/source/configuring.textile
@@ -651,20 +651,18 @@ The error occurred while evaluating nil.each
h3. Database pooling
-Active Record database connections are managed by a connection pool base class called +ActiveRecord::Base.connection+. The class ensures that a connection pool synchronizes the amount of thread access to a limited number of database connections. This limit defaults to 5 connections and is configured in +database.yml+.
-
-Below is an example of the pool limit being set to 25 for a development environment.
+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: 25
- timeout: 5000
+development:
+ adapter: sqlite3
+ database: db/development.sqlite3
+ pool: 5
+ timeout: 5000
</ruby>
-Since all 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.
+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.
+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.